diff options
author | Stefano <l.stickell@yahoo.it> | 2014-01-11 14:44:13 +0100 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2014-04-21 16:54:35 +0200 |
commit | 8665629b466f90207c2fe8b9b0b315aa585d7f60 (patch) | |
tree | 0d7acf66b4c01b3086d7a6c30bbead5d43f55118 | |
parent | Keep2share: fixed #450 (diff) | |
download | pyload-8665629b466f90207c2fe8b9b0b315aa585d7f60.tar.xz |
TurbobitNetFolder: fixed #471
Merged with fixes #472
(cherry picked from commit 22fe027409eb639d7a3494dd7d1ab7d4ea4a14e9)
-rw-r--r-- | pyload/plugins/crypter/TurbobitNetFolder.py | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/pyload/plugins/crypter/TurbobitNetFolder.py b/pyload/plugins/crypter/TurbobitNetFolder.py index e172f8037..bec5a4480 100644 --- a/pyload/plugins/crypter/TurbobitNetFolder.py +++ b/pyload/plugins/crypter/TurbobitNetFolder.py @@ -15,7 +15,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################ -import math +from math import ceil import re from module.plugins.internal.SimpleCrypter import SimpleCrypter @@ -29,32 +29,27 @@ def format_links(fid): class TurbobitNetFolder(SimpleCrypter): __name__ = "TurbobitNetFolder" __type__ = "crypter" - __pattern__ = r"http://(?:w{3}.)?turbobit\.net/download/folder/(?P<id>\w+)" - __version__ = "0.01" + __pattern__ = r"http://(?:www\.)?turbobit\.net/download/folder/(?P<ID>\w+)" + __version__ = "0.02" __description__ = """Turbobit.net Folder Plugin""" - __author_name__ = ("stickell") - __author_mail__ = ("l.stickell@yahoo.it") + __author_name__ = ("stickell", "Walter Purcaro") + __author_mail__ = ("l.stickell@yahoo.it", "vuolter@gmail.com") - TITLE_PATTERN = r"<img src='/js/lib/grid/icon/folder.png'>(?P<title>.+)</div>" + TITLE_PATTERN = r"src='/js/lib/grid/icon/folder.png'> <span>(?P<title>.+?)</span>" - def getLinks(self): - folder_id = re.search(self.__pattern__, self.pyfile.url).group('id') - grid = self.load('http://turbobit.net/downloadfolder/gridFile', - get={'id_folder': folder_id, 'rows': 200}, decode=True) - grid = json_loads(grid) + def _getLinks(self, id, page=1): + gridFile = self.load('http://turbobit.net/downloadfolder/gridFile', + get={'rootId': id, 'rows': 200, 'page': page}, decode=True) + grid = json_loads(gridFile) - links_count = grid["records"] - pages = int(math.ceil(links_count / 200.0)) + pages = int(ceil(grid["records"] / 200.0)) - ids = list() for i in grid['rows']: - ids.append(i['id']) + yield i['id'] - for p in range(2, pages + 1): - grid = self.load('http://turbobit.net/downloadfolder/gridFile', - get={'id_folder': folder_id, 'rows': 200, 'page': p}, decode=True) - grid = json_loads(grid) - for i in grid['rows']: - ids.append(i['id']) + if page < pages: + self._getLinks(id, page + 1) - return map(format_links, ids) + def getLinks(self): + folder_id = re.match(self.__pattern__, self.pyfile.url).group('ID') + return map(format_links, self._getLinks(folder_id)) |