From 93592862b520a862c01f80c019e5c4bc43746c19 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 5 Jul 2014 16:54:20 +0200 Subject: [SimpleHoster] Better inline docs + changed "FILE_OFFLINE_PATTERN" to "OFFLINE_PATTERN" --- module/plugins/hoster/ShareRapidCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/ShareRapidCom.py') diff --git a/module/plugins/hoster/ShareRapidCom.py b/module/plugins/hoster/ShareRapidCom.py index b82a142ea..aca7e995b 100644 --- a/module/plugins/hoster/ShareRapidCom.py +++ b/module/plugins/hoster/ShareRapidCom.py @@ -30,7 +30,7 @@ class ShareRapidCom(SimpleHoster): FILE_NAME_PATTERN = r']*>]*>(?:]*>)?(?P[^<]+)' FILE_SIZE_PATTERN = r'Velikost:\s*\s*(?P[0-9.]+) (?P[kKMG])i?B' - FILE_OFFLINE_PATTERN = ur'Nastala chyba 404|Soubor byl smazán' + OFFLINE_PATTERN = ur'Nastala chyba 404|Soubor byl smazán' DOWNLOAD_URL_PATTERN = r'([^<]+)' ERR_LOGIN_PATTERN = ur'
Stahování je přístupné pouze přihlášeným uživatelům' -- cgit v1.2.3 From 04038a2cf0c4c2d9cc9a0c8e8bf9beb6426afae8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 10 Jul 2014 03:02:26 +0200 Subject: Use parseError instead PluginParseError + unified all download pattern attributes as LINK_PATTERN + removed some old patterns (not used anymore) + other code cosmetics --- module/plugins/hoster/ShareRapidCom.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/ShareRapidCom.py') diff --git a/module/plugins/hoster/ShareRapidCom.py b/module/plugins/hoster/ShareRapidCom.py index aca7e995b..dad75ae74 100644 --- a/module/plugins/hoster/ShareRapidCom.py +++ b/module/plugins/hoster/ShareRapidCom.py @@ -32,11 +32,12 @@ class ShareRapidCom(SimpleHoster): FILE_SIZE_PATTERN = r'Velikost:\s*\s*(?P[0-9.]+) (?P[kKMG])i?B' OFFLINE_PATTERN = ur'Nastala chyba 404|Soubor byl smazán' - DOWNLOAD_URL_PATTERN = r'([^<]+)' + FILE_URL_REPLACEMENTS = [(__pattern__, r'http://share-rapid.com/stahuj/\g')] + + LINK_PATTERN = r'([^<]+)' ERR_LOGIN_PATTERN = ur'
Stahování je přístupné pouze přihlášeným uživatelům' ERR_CREDIT_PATTERN = ur'
Stahování zdarma je možné jen přes náš' - FILE_URL_REPLACEMENTS = [(__pattern__, r'http://share-rapid.com/stahuj/\g')] def setup(self): self.chunkLimit = 1 @@ -54,7 +55,7 @@ class ShareRapidCom(SimpleHoster): self.getFileInfo() - found = re.search(self.DOWNLOAD_URL_PATTERN, self.html) + found = re.search(self.LINK_PATTERN, self.html) if found: link = found.group(1) self.logDebug("Premium link: %s" % link) -- cgit v1.2.3 From da308a71c77296793eb5801ceb68298c91a4da7f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 20 Jul 2014 03:23:40 +0200 Subject: [ShareRapidCom] Fix https://github.com/pyload/pyload/issues/694 --- module/plugins/hoster/ShareRapidCom.py | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) (limited to 'module/plugins/hoster/ShareRapidCom.py') diff --git a/module/plugins/hoster/ShareRapidCom.py b/module/plugins/hoster/ShareRapidCom.py index dad75ae74..bda893a17 100644 --- a/module/plugins/hoster/ShareRapidCom.py +++ b/module/plugins/hoster/ShareRapidCom.py @@ -3,9 +3,9 @@ import re from pycurl import HTTPHEADER -from module.network.HTTPRequest import BadHeader + from module.network.RequestFactory import getRequest -from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo, replace_patterns +from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo def getInfo(urls): @@ -15,24 +15,26 @@ def getInfo(urls): "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0"]) for url in urls: html = h.load(url, decode=True) - file_info = parseFileInfo(ShareRapidCom, replace_patterns(url, ShareRapidCom.FILE_URL_REPLACEMENTS), html) + file_info = parseFileInfo(ShareRapidCom, url, html) yield file_info class ShareRapidCom(SimpleHoster): __name__ = "ShareRapidCom" + __version__ = "0.54" __type__ = "hoster" - __pattern__ = r'http://(?:www\.)?((share(-?rapid\.(biz|com|cz|info|eu|net|org|pl|sk)|-(central|credit|free|net)\.cz|-ms\.net)|(s-?rapid|rapids)\.(cz|sk))|(e-stahuj|mediatack|premium-rapidshare|rapidshare-premium|qiuck)\.cz|kadzet\.com|stahuj-zdarma\.eu|strelci\.net|universal-share\.com)/stahuj/(?P\w+)' - __version__ = "0.53" - __description__ = """Share-rapid.com hoster plugin""" - __author_name__ = ("MikyWoW", "zoidberg", "stickell") - __author_mail__ = ("mikywow@seznam.cz", "zoidberg@mujmail.cz", "l.stickell@yahoo.it") + + __pattern__ = r'http://(?:www\.)?(share|mega)rapid\.cz/soubor/\d+/.+' + + __description__ = """MegaRapid.cz hoster plugin""" + __author_name__ = ("MikyWoW", "zoidberg", "stickell", "Walter Purcaro") + __author_mail__ = ("mikywow@seznam.cz", "zoidberg@mujmail.cz", "l.stickell@yahoo.it", "vuolter@gmail.com") FILE_NAME_PATTERN = r']*>]*>(?:]*>)?(?P[^<]+)' FILE_SIZE_PATTERN = r'Velikost:\s*\s*(?P[0-9.]+) (?P[kKMG])i?B' OFFLINE_PATTERN = ur'Nastala chyba 404|Soubor byl smazán' - FILE_URL_REPLACEMENTS = [(__pattern__, r'http://share-rapid.com/stahuj/\g')] + SH_CHECK_TRAFFIC = True LINK_PATTERN = r'([^<]+)' ERR_LOGIN_PATTERN = ur'
Stahování je přístupné pouze přihlášeným uživatelům' @@ -41,25 +43,18 @@ class ShareRapidCom(SimpleHoster): def setup(self): self.chunkLimit = 1 - self.resumeDownload = True - - def process(self, pyfile): - if not self.account: - self.fail("User not logged in") + def handlePremium(self): try: - self.html = self.load(pyfile.url, decode=True) + self.html = self.load(self.pyfile.url, decode=True) except BadHeader, e: self.account.relogin(self.user) self.retry(max_tries=3, reason=str(e)) - self.getFileInfo() - found = re.search(self.LINK_PATTERN, self.html) if found: link = found.group(1) self.logDebug("Premium link: %s" % link) - self.download(link, disposition=True) else: if re.search(self.ERR_LOGIN_PATTERN, self.html): -- cgit v1.2.3 From 9395182da7afed55a29bde1c7cbefe4204e783f0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 20 Jul 2014 03:02:09 +0200 Subject: Store all re.search/match object as "m" instead "found" --- module/plugins/hoster/ShareRapidCom.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/ShareRapidCom.py') diff --git a/module/plugins/hoster/ShareRapidCom.py b/module/plugins/hoster/ShareRapidCom.py index bda893a17..5f17a2f62 100644 --- a/module/plugins/hoster/ShareRapidCom.py +++ b/module/plugins/hoster/ShareRapidCom.py @@ -51,9 +51,9 @@ class ShareRapidCom(SimpleHoster): self.account.relogin(self.user) self.retry(max_tries=3, reason=str(e)) - found = re.search(self.LINK_PATTERN, self.html) - if found: - link = found.group(1) + m = re.search(self.LINK_PATTERN, self.html) + if m: + link = m.group(1) self.logDebug("Premium link: %s" % link) self.download(link, disposition=True) else: -- cgit v1.2.3 From ba916633f2bedb04c7358000b91aed69f52e8e43 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 1 Aug 2014 19:35:59 +0200 Subject: Remove trailing whitespaces + remove license headers + import urllib methods directly + sort and fix key attributes + use save_join instead join + sort some import declarations + other minor code cosmetics --- module/plugins/hoster/ShareRapidCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/ShareRapidCom.py') diff --git a/module/plugins/hoster/ShareRapidCom.py b/module/plugins/hoster/ShareRapidCom.py index 5f17a2f62..414e92feb 100644 --- a/module/plugins/hoster/ShareRapidCom.py +++ b/module/plugins/hoster/ShareRapidCom.py @@ -21,8 +21,8 @@ def getInfo(urls): class ShareRapidCom(SimpleHoster): __name__ = "ShareRapidCom" - __version__ = "0.54" __type__ = "hoster" + __version__ = "0.54" __pattern__ = r'http://(?:www\.)?(share|mega)rapid\.cz/soubor/\d+/.+' -- cgit v1.2.3 From 4709a41c176dd2947709b7f35ccc84213d574624 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 26 Sep 2014 16:59:26 +0200 Subject: Rename SH flags --- module/plugins/hoster/ShareRapidCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/ShareRapidCom.py') diff --git a/module/plugins/hoster/ShareRapidCom.py b/module/plugins/hoster/ShareRapidCom.py index 414e92feb..9d77ba714 100644 --- a/module/plugins/hoster/ShareRapidCom.py +++ b/module/plugins/hoster/ShareRapidCom.py @@ -34,7 +34,7 @@ class ShareRapidCom(SimpleHoster): FILE_SIZE_PATTERN = r'Velikost:\s*\s*(?P[0-9.]+) (?P[kKMG])i?B' OFFLINE_PATTERN = ur'Nastala chyba 404|Soubor byl smazán' - SH_CHECK_TRAFFIC = True + FORCE_CHECK_TRAFFIC = True LINK_PATTERN = r'([^<]+)' ERR_LOGIN_PATTERN = ur'
Stahování je přístupné pouze přihlášeným uživatelům' -- cgit v1.2.3 From b0868ae6446078bacf1635dde5e4ab316b4a94cb Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Oct 2014 18:57:59 +0200 Subject: New __authors__ key replaces __author_name__ and __author_mail__ + Whitespaces and EOF fixup --- module/plugins/hoster/ShareRapidCom.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/ShareRapidCom.py') diff --git a/module/plugins/hoster/ShareRapidCom.py b/module/plugins/hoster/ShareRapidCom.py index 9d77ba714..5d539baaf 100644 --- a/module/plugins/hoster/ShareRapidCom.py +++ b/module/plugins/hoster/ShareRapidCom.py @@ -27,8 +27,11 @@ class ShareRapidCom(SimpleHoster): __pattern__ = r'http://(?:www\.)?(share|mega)rapid\.cz/soubor/\d+/.+' __description__ = """MegaRapid.cz hoster plugin""" - __author_name__ = ("MikyWoW", "zoidberg", "stickell", "Walter Purcaro") - __author_mail__ = ("mikywow@seznam.cz", "zoidberg@mujmail.cz", "l.stickell@yahoo.it", "vuolter@gmail.com") + __authors__ = [("MikyWoW", "mikywow@seznam.cz"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com")] + FILE_NAME_PATTERN = r']*>]*>(?:]*>)?(?P[^<]+)' FILE_SIZE_PATTERN = r'Velikost:\s*\s*(?P[0-9.]+) (?P[kKMG])i?B' -- cgit v1.2.3 From ae7a7e66981456e5bbe2b54006d79b6f907be7a4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 8 Oct 2014 20:18:13 +0200 Subject: Add __license__ key attribute to plugins --- module/plugins/hoster/ShareRapidCom.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hoster/ShareRapidCom.py') diff --git a/module/plugins/hoster/ShareRapidCom.py b/module/plugins/hoster/ShareRapidCom.py index 5d539baaf..9b80a9914 100644 --- a/module/plugins/hoster/ShareRapidCom.py +++ b/module/plugins/hoster/ShareRapidCom.py @@ -27,6 +27,7 @@ class ShareRapidCom(SimpleHoster): __pattern__ = r'http://(?:www\.)?(share|mega)rapid\.cz/soubor/\d+/.+' __description__ = """MegaRapid.cz hoster plugin""" + __license__ = "GPLv3" __authors__ = [("MikyWoW", "mikywow@seznam.cz"), ("zoidberg", "zoidberg@mujmail.cz"), ("stickell", "l.stickell@yahoo.it"), -- cgit v1.2.3 From 6632ded30de12bc16644b26de2605ec6b3bdd42a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 9 Oct 2014 13:12:12 +0200 Subject: ShareRapidCom -> MegaRapidCz --- module/plugins/hoster/ShareRapidCom.py | 70 ---------------------------------- 1 file changed, 70 deletions(-) delete mode 100644 module/plugins/hoster/ShareRapidCom.py (limited to 'module/plugins/hoster/ShareRapidCom.py') diff --git a/module/plugins/hoster/ShareRapidCom.py b/module/plugins/hoster/ShareRapidCom.py deleted file mode 100644 index 9b80a9914..000000000 --- a/module/plugins/hoster/ShareRapidCom.py +++ /dev/null @@ -1,70 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from pycurl import HTTPHEADER - -from module.network.RequestFactory import getRequest -from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo - - -def getInfo(urls): - h = getRequest() - h.c.setopt(HTTPHEADER, - ["Accept: text/html", - "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0"]) - for url in urls: - html = h.load(url, decode=True) - file_info = parseFileInfo(ShareRapidCom, url, html) - yield file_info - - -class ShareRapidCom(SimpleHoster): - __name__ = "ShareRapidCom" - __type__ = "hoster" - __version__ = "0.54" - - __pattern__ = r'http://(?:www\.)?(share|mega)rapid\.cz/soubor/\d+/.+' - - __description__ = """MegaRapid.cz hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("MikyWoW", "mikywow@seznam.cz"), - ("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it"), - ("Walter Purcaro", "vuolter@gmail.com")] - - - FILE_NAME_PATTERN = r']*>]*>(?:]*>)?(?P[^<]+)' - FILE_SIZE_PATTERN = r'Velikost:\s*\s*(?P[0-9.]+) (?P[kKMG])i?B' - OFFLINE_PATTERN = ur'Nastala chyba 404|Soubor byl smazán' - - FORCE_CHECK_TRAFFIC = True - - LINK_PATTERN = r'([^<]+)' - ERR_LOGIN_PATTERN = ur'
Stahování je přístupné pouze přihlášeným uživatelům' - ERR_CREDIT_PATTERN = ur'
Stahování zdarma je možné jen přes náš' - - - def setup(self): - self.chunkLimit = 1 - - def handlePremium(self): - try: - self.html = self.load(self.pyfile.url, decode=True) - except BadHeader, e: - self.account.relogin(self.user) - self.retry(max_tries=3, reason=str(e)) - - m = re.search(self.LINK_PATTERN, self.html) - if m: - link = m.group(1) - self.logDebug("Premium link: %s" % link) - self.download(link, disposition=True) - else: - if re.search(self.ERR_LOGIN_PATTERN, self.html): - self.relogin(self.user) - self.retry(max_tries=3, reason="User login failed") - elif re.search(self.ERR_CREDIT_PATTERN, self.html): - self.fail("Not enough credit left") - else: - self.fail("Download link not found") -- cgit v1.2.3