From 03374192ff2a74fea3c7a2201c3ef9ef929e3a39 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 14 Sep 2014 16:50:20 +0200 Subject: [BasePlugin] Little code cosmetics --- module/plugins/hoster/BasePlugin.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster') diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 54d789054..573288ade 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- -from re import match, search +import re + from urllib import unquote from urlparse import urlparse @@ -25,10 +26,11 @@ class BasePlugin(Hoster): self.chunkLimit = -1 self.resumeDownload = True + def process(self, pyfile): """main function""" - #debug part, for api exerciser + #: debug part, for api exerciser if pyfile.url.startswith("DEBUG_API"): self.multiDL = False return @@ -74,6 +76,7 @@ class BasePlugin(Hoster): else: self.fail("No Plugin matched and not a downloadable url.") + def downloadFile(self, pyfile): url = pyfile.url @@ -86,7 +89,7 @@ class BasePlugin(Hoster): if 'location' in header: self.logDebug("Location: " + header['location']) - base = match(r'https?://[^/]+', url).group(0) + base = re.match(r'https?://[^/]+', url).group(0) if header['location'].startswith("http"): url = header['location'] elif header['location'].startswith("/"): @@ -100,7 +103,7 @@ class BasePlugin(Hoster): if 'content-disposition' in header: self.logDebug("Content-Disposition: " + header['content-disposition']) - m = search("filename(?P=|\*=(?P.+)'')(?P.*)", header['content-disposition']) + m = re.search("filename(?P=|\*=(?P.+)'')(?P.*)", header['content-disposition']) if m: disp = m.groupdict() self.logDebug(disp) -- cgit v1.2.3 From df2dcf1ccdbcc5197a224df9946595df907dc749 Mon Sep 17 00:00:00 2001 From: igel-kun Date: Mon, 15 Sep 2014 23:10:37 +0200 Subject: [XFilesharingPro] Embedded urls support --- module/plugins/hoster/XFileSharingPro.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'module/plugins/hoster') diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index 25492fb49..d7e24e0b0 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -21,7 +21,7 @@ class XFileSharingPro(SimpleHoster): """ __name__ = "XFileSharingPro" __type__ = "hoster" - __version__ = "0.32" + __version__ = "0.33" __pattern__ = r'^unmatchable$' @@ -29,6 +29,8 @@ class XFileSharingPro(SimpleHoster): __author_name__ = ("zoidberg", "stickell") __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it") + + FILE_URL_REPLACEMENTS = [(r'/embed-(\w{12}).*', r'/\1')] #: support embedded files FILE_INFO_PATTERN = r'Filename:(?P[^<]+)\s*.*?\((?P[^<]+)\)' FILE_NAME_PATTERN = r'[\d\.\,]+) ?(?P\w+)?\)' @@ -55,6 +57,7 @@ class XFileSharingPro(SimpleHoster): self.chunkLimit = 1 + def process(self, pyfile): self.prepare() @@ -88,6 +91,7 @@ class XFileSharingPro(SimpleHoster): else: self.handleFree() + def prepare(self): """ Initialize important variables """ if not hasattr(self, "HOSTER_NAME"): @@ -98,6 +102,7 @@ class XFileSharingPro(SimpleHoster): self.captcha = self.errmsg = None self.passwords = self.getPassword().splitlines() + def getDirectDownloadLink(self): """ Get download link for premium users with direct download enabled """ self.req.http.lastURL = self.pyfile.url @@ -114,11 +119,13 @@ class XFileSharingPro(SimpleHoster): return location + def handleFree(self): url = self.getDownloadLink() self.logDebug("Download URL: %s" % url) self.startDownload(url) + def getDownloadLink(self): for i in xrange(5): self.logDebug("Getting download link: #%d" % i) @@ -145,6 +152,7 @@ class XFileSharingPro(SimpleHoster): return m.group(1) + def handlePremium(self): self.html = self.load(self.pyfile.url, post=self.getPostParameters()) m = re.search(self.LINK_PATTERN, self.html) @@ -152,6 +160,7 @@ class XFileSharingPro(SimpleHoster): self.parseError('DIRECT LINK') self.startDownload(m.group(1)) + def handleOverriden(self): #only tested with easybytez.com self.html = self.load("http://www.%s/" % self.HOSTER_NAME) @@ -189,6 +198,7 @@ class XFileSharingPro(SimpleHoster): else: self.retry() + def startDownload(self, link): link = link.strip() if self.captcha: @@ -196,6 +206,7 @@ class XFileSharingPro(SimpleHoster): self.logDebug('DIRECT LINK: %s' % link) self.download(link, disposition=True) + def checkErrors(self): m = re.search(self.ERROR_PATTERN, self.html) if m: @@ -227,6 +238,7 @@ class XFileSharingPro(SimpleHoster): return self.errmsg + def getPostParameters(self): for _ in xrange(3): if not self.errmsg: @@ -288,6 +300,7 @@ class XFileSharingPro(SimpleHoster): else: self.parseError('FORM: %s' % (inputs['op'] if 'op' in inputs else 'UNKNOWN')) + def handleCaptcha(self, inputs): m = re.search(self.RECAPTCHA_URL_PATTERN, self.html) if m: -- cgit v1.2.3 From 7257e2ec613a1dc8dee249d68b81a0b61e2d281c Mon Sep 17 00:00:00 2001 From: stickell Date: Wed, 17 Sep 2014 18:26:23 +0200 Subject: [PremiumTo] fixed issue with get parameter on download --- module/plugins/hoster/PremiumTo.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster') diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py index 3ab7e34ac..92bec9295 100644 --- a/module/plugins/hoster/PremiumTo.py +++ b/module/plugins/hoster/PremiumTo.py @@ -11,7 +11,7 @@ from module.utils import fs_encode class PremiumTo(Hoster): __name__ = "PremiumTo" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __pattern__ = r'https?://(?:www\.)?premium.to/.*' __description__ = """Premium.to hoster plugin""" __author_name__ = ("RaNaN", "zoidberg", "stickell") @@ -34,8 +34,7 @@ class PremiumTo(Hoster): self.req.setOption("timeout", 120) self.download( - "http://premium.to/api/getfile.php", - get={"username": self.account.username, "password": self.account.password, "link": quote(pyfile.url, "")}, + "http://premium.to/api/getfile.php?username=%s&password=%s&link=%s" % (self.account.username, self.account.password, quote(pyfile.url, "")), disposition=True) check = self.checkDownload({"nopremium": "No premium account available"}) -- cgit v1.2.3 From 59b1df9619770b21eb9ed2e5d7e705ca7f99fb49 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 24 Sep 2014 19:16:52 +0200 Subject: [ZippyshareCom] Partially rewritten --- module/plugins/hoster/ZippyshareCom.py | 73 ++++++++++++++-------------------- 1 file changed, 30 insertions(+), 43 deletions(-) (limited to 'module/plugins/hoster') diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index 33a672198..8d81e6f24 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -1,74 +1,61 @@ # -*- coding: utf-8 -*- -# -# Test links: -# http://www13.zippyshare.com/v/18665333/file.html import re +from os import path +from urlparse import urljoin + from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" - __version__ = "0.49" + __version__ = "0.50" __pattern__ = r'(?Phttp://www\d{0,2}\.zippyshare.com)/v(?:/|iew.jsp.*key=)(?P\d+)' - __description__ = """Zippyshare.com hoster plugin""" - __author_name__ = ("spoob", "zoidberg", "stickell", "skylab") - __author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz", "l.stickell@yahoo.it", "development@sky-lab.de") + __description__ = """ Zippyshare.com hoster plugin """ + __author_name__ = ("stickell", "skylab", "Walter Purcaro") + __author_mail__ = ("l.stickell@yahoo.it", "development@sky-lab.de", "vuolter@gmail.com") + FILE_NAME_PATTERN = r'Zippyshare\.com - (?P<N>[^<]+)' FILE_SIZE_PATTERN = r'>Size:\s*]*>(?P[0-9.,]+) (?P[kKMG]+)i?B
' FILE_INFO_PATTERN = r'document\.getElementById\(\'dlbutton\'\)\.href = "[^;]*/(?P[^"]+)";' - OFFLINE_PATTERN = r'>File does not exist on this server' + OFFLINE_PATTERN = r'>File does not exist on this server<' SH_COOKIES = [(".zippyshare.com", "ziplocale", "en")] def setup(self): self.multiDL = True + self.resumeDownload = True + def handleFree(self): - url = self.get_file_url() - if not url: - self.fail("Download URL not found.") + url = self.get_link() self.logDebug("Download URL: %s" % url) self.download(url) - def get_file_url(self): - """returns the absolute downloadable filepath""" - url_parts = re.search(r'(addthis:url="(http://www(\d+).zippyshare.com/v/(\d*)/file.html))', self.html) - number = url_parts.group(4) - check = re.search(r'