From 4fd7c36b3d0cda16fb68baa378169ad8094ba62e Mon Sep 17 00:00:00 2001 From: igel-kun Date: Sun, 5 Oct 2014 17:32:38 +0200 Subject: [MegasharesCom] Update patterns --- module/plugins/hoster/MegasharesCom.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'module/plugins/hoster') diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index c12897ed0..3b6f29536 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -10,21 +10,23 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MegasharesCom(SimpleHoster): __name__ = "MegasharesCom" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" - __pattern__ = r'http://(?:www\.)?megashares.com/.*' + __pattern__ = r'http://(?:www\.)?(d\d{2}\.)?megashares\.com/((index.php)?\?d\d{2}=|dl/)\w+' __description__ = """Megashares.com hoster plugin""" __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" + FILE_NAME_PATTERN = r'

]*title="(?P[^"]+)">' - FILE_SIZE_PATTERN = r'Filesize: (?P[0-9.]+) (?P[kKMG])i?B
' - OFFLINE_PATTERN = r'
(Invalid Link Request|Link has been deleted)' + FILE_SIZE_PATTERN = r'Filesize: (?P[\d.]+) (?P\w+)' + OFFLINE_PATTERN = r'
(Invalid Link Request|Link has been deleted|Invalid link)' LINK_PATTERN = r'
]*>\s*' - PASSPORT_LEFT_PATTERN = r'Your Download Passport is: <[^>]*>(\w+).*\s*You have\s*<[^>]*>\s*([0-9.]+) ([kKMG]i?B)' - PASSPORT_RENEW_PATTERN = r'Your download passport will renew in\s*(\d+):(\d+):(\d+)' + + PASSPORT_LEFT_PATTERN = r'Your Download Passport is: <[^>]*>(\w+).*?You have.*?<[^>]*>.*?([\d.]+) (\w+)' + PASSPORT_RENEW_PATTERN = r'Your download passport will renew(?:.|\n)*?(\d+).*?(\d+).*?(\d+)' REACTIVATE_NUM_PATTERN = r']*id="random_num" value="(\d+)" />' REACTIVATE_PASSPORT_PATTERN = r']*id="passport_num" value="(\w+)" />' REQUEST_URI_PATTERN = r'var request_uri = "([^"]+)";' @@ -35,9 +37,11 @@ class MegasharesCom(SimpleHoster): self.resumeDownload = True self.multiDL = self.premium + def handlePremium(self): self.handleDownload(True) + def handleFree(self): self.html = self.load(self.pyfile.url, decode=True) @@ -45,10 +49,7 @@ class MegasharesCom(SimpleHoster): self.retry(wait_time=5 * 60) self.getFileInfo() - # if self.pyfile.size > 576716800: - # self.fail("This file is too large for free download") - # Reactivate passport if needed m = re.search(self.REACTIVATE_PASSPORT_PATTERN, self.html) if m: passport_num = m.group(1) @@ -76,20 +77,22 @@ class MegasharesCom(SimpleHoster): self.fail("Failed to reactivate passport") # Check traffic left on passport - m = re.search(self.PASSPORT_LEFT_PATTERN, self.html) + m = re.search(self.PASSPORT_LEFT_PATTERN, self.html, re.M | re.S) if m is None: self.fail('Passport not found') self.logInfo("Download passport: %s" % m.group(1)) - data_left = float(m.group(2)) * 1024 ** {'KB': 1, 'MB': 2, 'GB': 3}[m.group(3)] + data_left = float(m.group(2)) * 1024 ** {'B': 0, 'KB': 1, 'MB': 2, 'GB': 3}[m.group(3)] self.logInfo("Data left: %s %s (%d MB needed)" % (m.group(2), m.group(3), self.pyfile.size / 1048576)) if not data_left: m = re.search(self.PASSPORT_RENEW_PATTERN, self.html) - renew = m.group(1) + m.group(2) + m.group(3) * 60 * 60 if m else 10 * 60 - self.retry(max_tries=15, wait_time=renew, reason="Unable to get passport") + renew = int(m.group(1) + 60 * (m.group(2) + 60 * m.group(3))) if found else 600 + self.logDebug('Waiting %d seconds for a new passport' % renew) + self.retry(wait_time=renew, reason="Passport renewal") self.handleDownload(False) + def handleDownload(self, premium=False): # Find download link; m = re.search(self.LINK_PATTERN % (1 if premium else 2), self.html) -- cgit v1.2.3 From 55233a0e25d6034c9b80568fdda24041a00b2eb9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 5 Oct 2014 22:08:34 +0200 Subject: New hoster plugin FilepupNet --- module/plugins/hoster/FilepupNet.py | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 module/plugins/hoster/FilepupNet.py (limited to 'module/plugins/hoster') diff --git a/module/plugins/hoster/FilepupNet.py b/module/plugins/hoster/FilepupNet.py new file mode 100644 index 000000000..69065565f --- /dev/null +++ b/module/plugins/hoster/FilepupNet.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# +# Test links: +# http://www.filepup.net/files/k5w4ZVoF1410184283.html +# http://www.filepup.net/files/R4GBq9XH1410186553.html + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class FilepupNet(SimpleHoster): + __name__ = "FilepupNet" + __type__ = "hoster" + __version__ = "0.01" + + __pattern__ = r"http://(?:www\.)?filepup\.net/files/\w+" + + __description__ = """Filepup.net hoster plugin""" + __author_name__ = ("zapp-brannigan", "Walter Purcaro") + __author_mail__ = ("fuerst.reinje@web.de", "vuolter@gmail.com") + + + FILE_NAME_PATTERN = r'>(?P.+?)

' + FILE_SIZE_PATTERN = r'class="fa fa-archive"> \((?P[\d.]+) (?P\w+)' + + OFFLINE_PATTERN = r'>This file has been deleted' + + LINK_PATTERN = r'(http://www\.filepup\.net/get/.+?)\'' + + + def setup(self): + self.multiDL = False + self.chunkLimit = 1 + + + def handleFree(self): + m = re.search(self.LINK_PATTERN, self.html) + if m is None: + self.parseError("Download link not found") + + dl_link = m.group(1) + self.download(dl_link, post={'task': "download"}) + + check = self.checkDownload({'html': re.compile("html")}) + if check == "html": + self.parseError("Downloaded file is an html file") + + +getInfo = create_getInfo(FilepupNet) -- cgit v1.2.3 From ff91b58bf9ee65aaeb048426295af6ad122b119e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 5 Oct 2014 22:14:53 +0200 Subject: Spare code cosmetics --- module/plugins/hoster/AlldebridCom.py | 4 ++-- module/plugins/hoster/CzshareCom.py | 4 ++-- module/plugins/hoster/DevhostSt.py | 4 ++-- module/plugins/hoster/DropboxCom.py | 4 ++-- module/plugins/hoster/FastshareCz.py | 5 ++--- module/plugins/hoster/FilepupNet.py | 2 +- module/plugins/hoster/KingfilesNet.py | 4 ++-- module/plugins/hoster/SpeedyshareCom.py | 4 ++-- 8 files changed, 15 insertions(+), 16 deletions(-) (limited to 'module/plugins/hoster') diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py index b1513bbac..44d709b1d 100644 --- a/module/plugins/hoster/AlldebridCom.py +++ b/module/plugins/hoster/AlldebridCom.py @@ -78,8 +78,8 @@ class AlldebridCom(Hoster): self.download(new_url, disposition=True) - check = self.checkDownload({"error": "An error occured while processing your request", - "empty": re.compile(r"^$")}) + check = self.checkDownload({'error': "An error occured while processing your request", + 'empty': re.compile(r"^$")}) if check == "error": self.retry(wait_time=60, reason="An error occured while generating link.") diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index df8cfea9e..f7fb119ac 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -128,13 +128,13 @@ class CzshareCom(SimpleHoster): def checkDownloadedFile(self): # check download check = self.checkDownload({ - "tempoffline": re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), + "temp_offline": re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), "credit": re.compile(r"^Nem.*te dostate.*n.* kredit.$"), "multi_dl": re.compile(self.MULTIDL_PATTERN), "captcha_err": "
  • Zadaný ověřovací kód nesouhlasí!
  • " }) - if check == "tempoffline": + if check == "temp_offline": self.fail("File not available - try later") if check == "credit": self.resetAccount() diff --git a/module/plugins/hoster/DevhostSt.py b/module/plugins/hoster/DevhostSt.py index 088ace93a..b50257238 100644 --- a/module/plugins/hoster/DevhostSt.py +++ b/module/plugins/hoster/DevhostSt.py @@ -41,8 +41,8 @@ class DevhostSt(SimpleHoster): self.logDebug("Download URL = " + dl_url) self.download(dl_url, disposition=True) - check = self.checkDownload({'is_html': re.compile("html")}) - if check == "is_html": + check = self.checkDownload({'html': re.compile("html")}) + if check == "html": self.parseError("Downloaded file is an html file") diff --git a/module/plugins/hoster/DropboxCom.py b/module/plugins/hoster/DropboxCom.py index 07e251946..e5de6823d 100644 --- a/module/plugins/hoster/DropboxCom.py +++ b/module/plugins/hoster/DropboxCom.py @@ -34,8 +34,8 @@ class DropboxCom(SimpleHoster): def handleFree(self): self.download(self.pyfile.url, get={'dl': "1"}) - check = self.checkDownload({'is_html': re.compile("html")}) - if check == "is_html": + check = self.checkDownload({'html': re.compile("html")}) + if check == "html": self.parseError("Downloaded file is an html file") diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index 5a6773af6..7a70baf93 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -48,9 +48,8 @@ class FastshareCz(SimpleHoster): self.download(urljoin(baseurl, action), post={"code": captcha, "btn.x": 77, "btn.y": 18}) check = self.checkDownload({ - "paralell_dl": - "FastShare.cz|