diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-10-22 19:44:59 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-10-22 19:47:17 +0200 |
commit | 0eb6e7ec4a1144dcca824d8add049787d3da1762 (patch) | |
tree | d653f5fe28bb247a3c4fadeca9bf6278d744f929 /module/plugins/hoster | |
parent | Spare code cosmetics (diff) | |
download | pyload-0eb6e7ec4a1144dcca824d8add049787d3da1762.tar.xz |
Two space before function declaration
Diffstat (limited to 'module/plugins/hoster')
73 files changed, 184 insertions, 2 deletions
diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py index 74509110c..1b65237a0 100644 --- a/module/plugins/hoster/AlldebridCom.py +++ b/module/plugins/hoster/AlldebridCom.py @@ -31,10 +31,12 @@ class AlldebridCom(Hoster): name += "%s.tmp" % randrange(100, 999) return name + def setup(self): self.chunkLimit = 16 self.resumeDownload = True + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url diff --git a/module/plugins/hoster/BayfilesCom.py b/module/plugins/hoster/BayfilesCom.py index b78af6286..8622f4dca 100644 --- a/module/plugins/hoster/BayfilesCom.py +++ b/module/plugins/hoster/BayfilesCom.py @@ -63,12 +63,14 @@ class BayfilesCom(SimpleHoster): self.error("Free link") self.startDownload(m.group(1)) + def handlePremium(self): m = re.search(self.PREMIUM_LINK_PATTERN, self.html) if m is None: self.error("Premium link") self.startDownload(m.group(1)) + def startDownload(self, url): self.logDebug("%s URL: %s" % ("Premium" if self.premium else "Free", url)) self.download(url) diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py index ffd586f74..9da1861ce 100644 --- a/module/plugins/hoster/BezvadataCz.py +++ b/module/plugins/hoster/BezvadataCz.py @@ -25,6 +25,7 @@ class BezvadataCz(SimpleHoster): def setup(self): self.multiDL = self.resumeDownload = True + def handleFree(self): #download button m = re.search(r'<a class="stahnoutSoubor".*?href="(.*?)"', self.html) @@ -75,12 +76,14 @@ class BezvadataCz(SimpleHoster): self.download(url) + def checkErrors(self): if 'images/button-download-disable.png' in self.html: self.longWait(5 * 60, 24) #: parallel dl limit elif '<div class="infobox' in self.html: self.tempOffline() + def loadcaptcha(self, data, *args, **kwargs): return data.decode("base64") diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 9f2f23d9e..2b8278a7e 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -62,6 +62,7 @@ class CzshareCom(SimpleHoster): return True + def handlePremium(self): # parse download link try: @@ -75,6 +76,7 @@ class CzshareCom(SimpleHoster): self.download("http://sdilej.cz/profi_down.php", post=inputs, disposition=True) self.checkDownloadedFile() + def handleFree(self): # get free url m = re.search(self.FREE_URL_PATTERN, self.html) @@ -126,6 +128,7 @@ class CzshareCom(SimpleHoster): self.download(url) self.checkDownloadedFile() + def checkDownloadedFile(self): # check download check = self.checkDownload({ diff --git a/module/plugins/hoster/DailymotionCom.py b/module/plugins/hoster/DailymotionCom.py index 726663ca6..b4ef6fa92 100644 --- a/module/plugins/hoster/DailymotionCom.py +++ b/module/plugins/hoster/DailymotionCom.py @@ -54,6 +54,7 @@ class DailymotionCom(Hoster): def setup(self): self.resumeDownload = self.multiDL = True + def getStreams(self): streams = [] for result in re.finditer(r"\"(?P<URL>http:\\/\\/www.dailymotion.com\\/cdn\\/H264-(?P<QF>.*?)\\.*?)\"", @@ -65,6 +66,7 @@ class DailymotionCom(Hoster): streams.append((quality, link)) return sorted(streams, key=lambda x: x[0][::-1]) + def getQuality(self): q = self.getConfig("quality") if q == "Lowest": @@ -75,6 +77,7 @@ class DailymotionCom(Hoster): quality = int(q.rsplit(" ")[1][:-1]) return quality + def getLink(self, streams, quality): if quality > 0: for x, s in reversed([item for item in enumerate(streams)]): @@ -91,6 +94,7 @@ class DailymotionCom(Hoster): self.logInfo("Download video quality %sx%s" % s[0]) return s[1] + def checkInfo(self, pyfile): pyfile.name, pyfile.size, pyfile.status, pyfile.url = getInfo([pyfile.url])[0] if pyfile.status == 1: @@ -98,6 +102,7 @@ class DailymotionCom(Hoster): elif pyfile.status == 6: self.tempOffline() + def process(self, pyfile): self.checkInfo(pyfile) diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py index 06a485eae..93840b108 100644 --- a/module/plugins/hoster/DateiTo.py +++ b/module/plugins/hoster/DateiTo.py @@ -65,6 +65,7 @@ class DateiTo(SimpleHoster): self.logDebug("Download URL", download_url) self.download(download_url) + def checkErrors(self): m = re.search(self.PARALELL_PATTERN, self.html) if m: @@ -73,6 +74,7 @@ class DateiTo(SimpleHoster): self.wait(wait_time + 1, False) self.retry() + def doWait(self): m = re.search(self.WAIT_PATTERN, self.html) wait_time = int(m.group(1)) if m else 30 diff --git a/module/plugins/hoster/DebridItaliaCom.py b/module/plugins/hoster/DebridItaliaCom.py index 4e961fa9f..b1a2a4c77 100644 --- a/module/plugins/hoster/DebridItaliaCom.py +++ b/module/plugins/hoster/DebridItaliaCom.py @@ -21,6 +21,7 @@ class DebridItaliaCom(Hoster): self.chunkLimit = -1 self.resumeDownload = True + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index ade91e7d4..16340036f 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -101,6 +101,7 @@ class DepositfilesCom(SimpleHoster): except: self.retry(wait_time=60) + def handlePremium(self): if '<span class="html_download_api-gold_traffic_limit">' in self.html: self.logWarning("Download limit reached") diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py index b653e2a8f..8932e749c 100644 --- a/module/plugins/hoster/DlFreeFr.py +++ b/module/plugins/hoster/DlFreeFr.py @@ -14,6 +14,7 @@ class CustomBrowser(Browser): def __init__(self, bucket=None, options={}): Browser.__init__(self, bucket, options) + def load(self, *args, **kwargs): post = kwargs.get("post") diff --git a/module/plugins/hoster/EdiskCz.py b/module/plugins/hoster/EdiskCz.py index 5112c55ab..a2e1937fb 100644 --- a/module/plugins/hoster/EdiskCz.py +++ b/module/plugins/hoster/EdiskCz.py @@ -27,6 +27,7 @@ class EdiskCz(SimpleHoster): def setup(self): self.multiDL = False + def process(self, pyfile): url = re.sub("/(stahni|sk/stahni)/", "/en/download/", pyfile.url) diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index a4a4e6881..d7c4b2eeb 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -31,6 +31,7 @@ class EuroshareEu(SimpleHoster): self.multiDL = self.resumeDownload = self.premium self.req.setOption("timeout", 120) + def handlePremium(self): if self.ERR_NOT_LOGGED_IN_PATTERN in self.html: self.account.relogin(self.user) @@ -46,6 +47,7 @@ class EuroshareEu(SimpleHoster): elif check == "json": self.fail(self.lastCheck.group(1)) + def handleFree(self): if re.search(self.ERR_PARDL_PATTERN, self.html) is not None: self.longWait(5 * 60, 12) diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index 7f61f7d7c..b1e834c61 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -30,10 +30,12 @@ class FastixRu(Hoster): name += "%s.tmp" % randrange(100, 999) return name + def setup(self): self.chunkLimit = 3 self.resumeDownload = True + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index 2a8d3af7d..0019a5708 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -60,6 +60,7 @@ class FastshareCz(SimpleHoster): elif check == "wrong_captcha": self.retry(max_tries=5, reason="Wrong captcha") + def handlePremium(self): header = self.load(self.pyfile.url, just_header=True) if "location" in header: diff --git a/module/plugins/hoster/FileStoreTo.py b/module/plugins/hoster/FileStoreTo.py index 549335a04..b8e56271b 100644 --- a/module/plugins/hoster/FileStoreTo.py +++ b/module/plugins/hoster/FileStoreTo.py @@ -25,6 +25,7 @@ class FileStoreTo(SimpleHoster): def setup(self): self.resumeDownload = self.multiDL = True + def handleFree(self): self.wait(10) ldc = re.search(r'wert="(\w+)"', self.html).group(1) diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 5672e780d..659a2cc0f 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -37,6 +37,7 @@ class FilecloudIo(SimpleHoster): self.resumeDownload = self.multiDL = True self.chunkLimit = 1 + def handleFree(self): data = {"ukey": self.file_info['ID']} @@ -104,6 +105,7 @@ class FilecloudIo(SimpleHoster): else: self.fail("Unexpected server response") + def handlePremium(self): akey = self.account.getAccountData(self.user)['akey'] ukey = self.file_info['ID'] diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index a5942e261..0801ca9a1 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -85,6 +85,7 @@ class FilefactoryCom(SimpleHoster): elif check == "error": self.fail("Unknown error") + def handlePremium(self): header = self.load(self.pyfile.url, just_header=True) if 'location' in header: diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 0748b64f2..45fb2e644 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -93,6 +93,7 @@ class FilepostCom(SimpleHoster): # Download self.download(download_url) + def getJsonResponse(self, get_dict, post_dict, field): json_response = json_loads(self.load('https://filepost.com/files/get/', get=get_dict, post=post_dict)) self.logDebug(json_response) diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py index 2889e0565..cd8069efc 100644 --- a/module/plugins/hoster/FilesMailRu.py +++ b/module/plugins/hoster/FilesMailRu.py @@ -45,6 +45,7 @@ class FilesMailRu(Hoster): if not self.account: self.multiDL = False + def process(self, pyfile): self.html = self.load(pyfile.url) self.url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>' @@ -68,20 +69,24 @@ class FilesMailRu(Hoster): self.download(self.getFileUrl()) self.myPostProcess() + def prepare(self): """You have to wait some seconds. Otherwise you will get a 40Byte HTML Page instead of the file you expected""" self.setWait(10) self.wait() return True + def getFileUrl(self): """gives you the URL to the file. Extracted from the Files.mail.ru HTML-page stored in self.html""" return re.search(self.url_pattern, self.html).group(0).split('<a href="')[1].split('" onclick="return Act')[0] + def getFileName(self): """gives you the Name for each file. Also extracted from the HTML-Page""" return re.search(self.url_pattern, self.html).group(0).split(', event)">')[1].split('</a>')[0] + def myPostProcess(self): # searches the file for HTMl-Code. Sometimes the Redirect # doesn't work (maybe a curl Problem) and you get only a small diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 4e722eb9f..7a06472d3 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -64,6 +64,7 @@ class FileserveCom(Hoster): self.url = "%s%s" % (self.URLS[0], self.file_id) self.logDebug("File ID: %s URL: %s" % (self.file_id, self.url)) + def process(self, pyfile): pyfile.name, pyfile.size, status, self.url = checkFile(self, [self.url])[0] if status != 2: @@ -75,6 +76,7 @@ class FileserveCom(Hoster): else: self.handleFree() + def handleFree(self): self.html = self.load(self.url) action = self.load(self.url, post={"checkDownload": "check"}, decode=True) @@ -132,6 +134,7 @@ class FileserveCom(Hoster): self.thread.m.reconnecting.wait(3) # Ease issue with later downloads appearing to be in parallel + def doTimmer(self): response = self.load(self.url, post={"downloadLink": "wait"}, decode=True) self.logDebug("Wait response : %s" % response[:80]) @@ -150,6 +153,7 @@ class FileserveCom(Hoster): self.setWait(wait_time) self.wait() + def doCaptcha(self): captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group("key") recaptcha = ReCaptcha(self) @@ -170,12 +174,14 @@ class FileserveCom(Hoster): else: self.fail("Invalid captcha") + def doLongWait(self, m): wait_time = (int(m.group(1)) * {'seconds': 1, 'minutes': 60, 'hours': 3600}[m.group(2)]) if m else 12 * 60 self.setWait(wait_time, True) self.wait() self.retry() + def handlePremium(self): premium_url = None if self.__name__ == "FileserveCom": diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index df06f2e74..6287545cb 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -26,6 +26,7 @@ class FreakshareCom(Hoster): self.multiDL = False self.req_opts = [] + def process(self, pyfile): self.pyfile = pyfile @@ -62,6 +63,7 @@ class FreakshareCom(Hoster): elif check == "downloadserver": self.retry(5, 15 * 60, "No Download server") + def prepare(self): pyfile = self.pyfile @@ -81,10 +83,12 @@ class FreakshareCom(Hoster): return True + def download_html(self): self.load("http://freakshare.com/index.php", {"language": "EN"}) # Set english language in server session self.html = self.load(self.pyfile.url) + def get_file_url(self): """ returns the absolute downloadable filepath """ @@ -97,6 +101,7 @@ class FreakshareCom(Hoster): else: self.offline() + def get_file_name(self): if not self.html: self.download_html() @@ -110,6 +115,7 @@ class FreakshareCom(Hoster): else: return self.pyfile.url + def get_file_size(self): size = 0 if not self.html: @@ -124,6 +130,7 @@ class FreakshareCom(Hoster): return size + def get_waiting_time(self): if not self.html: self.download_html() @@ -138,6 +145,7 @@ class FreakshareCom(Hoster): else: return 60 + def file_exists(self): """ returns True or False """ @@ -148,6 +156,7 @@ class FreakshareCom(Hoster): else: return True + def get_download_options(self): re_envelope = re.search(r".*?value=\"Free\sDownload\".*?\n*?(.*?<.*?>\n*)*?\n*\s*?</form>", self.html).group(0) # get the whole request diff --git a/module/plugins/hoster/FreeWayMe.py b/module/plugins/hoster/FreeWayMe.py index 996c8b6aa..88ba982f6 100644 --- a/module/plugins/hoster/FreeWayMe.py +++ b/module/plugins/hoster/FreeWayMe.py @@ -20,6 +20,7 @@ class FreeWayMe(Hoster): self.chunkLimit = 1 self.multiDL = self.premium + def process(self, pyfile): if not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "FreeWayMe") diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index 1a995ce28..7ce7cd3e6 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -58,6 +58,7 @@ class FshareVn(SimpleHoster): self.handleFree() self.checkDownloadedFile() + def handleFree(self): self.html = self.load(self.pyfile.url, decode=True) @@ -94,9 +95,11 @@ class FshareVn(SimpleHoster): self.wait() self.download(self.url) + def handlePremium(self): self.download(self.pyfile.url) + def checkErrors(self): if '/error.php?' in self.req.lastEffectiveURL or u"Liên kết bạn chá»n khÃŽng tá»n" in self.html: self.offline() @@ -111,6 +114,7 @@ class FshareVn(SimpleHoster): self.logError("Unknown error occured or wait time not parsed") self.retry(30, 2 * 60, "Unknown error") + def checkDownloadedFile(self): # check download check = self.checkDownload({ diff --git a/module/plugins/hoster/GamefrontCom.py b/module/plugins/hoster/GamefrontCom.py index b7e7f0bc8..2009d06ab 100644 --- a/module/plugins/hoster/GamefrontCom.py +++ b/module/plugins/hoster/GamefrontCom.py @@ -28,6 +28,7 @@ class GamefrontCom(Hoster): self.resumeDownload = self.multiDL = True self.chunkLimit = -1 + def process(self, pyfile): self.pyfile = pyfile self.html = self.load(pyfile.url, decode=True) @@ -44,12 +45,14 @@ class GamefrontCom(Hoster): self.download(link) + def _checkOnline(self): if re.search(self.PATTERN_OFFLINE, self.html): return False else: return True + def _getName(self): name = re.search(self.PATTERN_FILENAME, self.html) if name is None: @@ -57,6 +60,7 @@ class GamefrontCom(Hoster): return name.group(1) + def _getLink(self): self.html2 = self.load("http://www.gamefront.com/" + re.search("(files/service/thankyou\\?id=\w+)", self.html).group(1)) diff --git a/module/plugins/hoster/GigapetaCom.py b/module/plugins/hoster/GigapetaCom.py index efec11079..65d940c5a 100644 --- a/module/plugins/hoster/GigapetaCom.py +++ b/module/plugins/hoster/GigapetaCom.py @@ -55,6 +55,7 @@ class GigapetaCom(SimpleHoster): self.logDebug("Download URL: %s" % download_url) self.download(download_url) + def checkErrors(self): if "All threads for IP" in self.html: self.logDebug("Your IP is already downloading a file - wait and retry") diff --git a/module/plugins/hoster/GooIm.py b/module/plugins/hoster/GooIm.py index d27b38f1f..d8f4c6190 100644 --- a/module/plugins/hoster/GooIm.py +++ b/module/plugins/hoster/GooIm.py @@ -27,6 +27,7 @@ class GooIm(SimpleHoster): def setup(self): self.multiDL = self.resumeDownload = True + def handleFree(self): url = self.pyfile.url self.html = self.load(url, cookies=True) diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py index 10975829c..7a8579e78 100644 --- a/module/plugins/hoster/HellshareCz.py +++ b/module/plugins/hoster/HellshareCz.py @@ -27,6 +27,7 @@ class HellshareCz(SimpleHoster): self.resumeDownload = self.multiDL = True if self.account else False self.chunkLimit = 1 + def process(self, pyfile): if not self.account: self.fail("User not logged in") diff --git a/module/plugins/hoster/IfolderRu.py b/module/plugins/hoster/IfolderRu.py index 774761049..176225e30 100644 --- a/module/plugins/hoster/IfolderRu.py +++ b/module/plugins/hoster/IfolderRu.py @@ -33,6 +33,7 @@ class IfolderRu(SimpleHoster): self.resumeDownload = self.multiDL = True if self.account else False self.chunkLimit = 1 + def process(self, pyfile): file_id = re.match(self.__pattern__, pyfile.url).group('ID') self.html = self.load("http://rusfolder.com/%s" % file_id, cookies=True, decode=True) diff --git a/module/plugins/hoster/JumbofilesCom.py b/module/plugins/hoster/JumbofilesCom.py index fe0b72804..f43ee7697 100644 --- a/module/plugins/hoster/JumbofilesCom.py +++ b/module/plugins/hoster/JumbofilesCom.py @@ -25,6 +25,7 @@ class JumbofilesCom(SimpleHoster): def setup(self): self.resumeDownload = self.multiDL = True + def handleFree(self): ukey = re.match(self.__pattern__, self.pyfile.url).group(1) post_data = {"id": ukey, "op": "download3", "rand": ""} diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 8443c2206..002c986e2 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -56,7 +56,7 @@ class LetitbitNet(SimpleHoster): def setup(self): self.resumeDownload = True - #TODO confirm that resume works + def getFileInfo(self): api_rep = api_download_info(self.pyfile.url) @@ -67,6 +67,7 @@ class LetitbitNet(SimpleHoster): else: self.offline() + def handleFree(self): action, inputs = self.parseHtmlForm('id="ifree_form"') if not action: @@ -149,6 +150,7 @@ class LetitbitNet(SimpleHoster): else: self.fail("Download did not finish correctly") + def handlePremium(self): api_key = self.user premium_key = self.account.getAccountData(self.user)['password'] diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index 3372a505d..b96c9492c 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -27,6 +27,7 @@ class LinksnappyCom(Hoster): self.chunkLimit = -1 self.resumeDownload = True + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url @@ -67,6 +68,7 @@ class LinksnappyCom(Hoster): if check == "html302": self.retry(wait_time=5, reason="Linksnappy returns only HTML data.") + @staticmethod def _get_host(url): host = urlsplit(url).netloc diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py index fe5a80679..4a4d4a047 100644 --- a/module/plugins/hoster/LuckyShareNet.py +++ b/module/plugins/hoster/LuckyShareNet.py @@ -38,6 +38,7 @@ class LuckyShareNet(SimpleHoster): self.retry(reason="Hash expired") return json_loads(rep) + # TODO: There should be a filesize limit for free downloads # TODO: Some files could not be downloaded in free mode def handleFree(self): diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py index c2581aa9f..31b85b433 100644 --- a/module/plugins/hoster/MediafireCom.py +++ b/module/plugins/hoster/MediafireCom.py @@ -71,6 +71,7 @@ class MediafireCom(SimpleHoster): def setup(self): self.multiDL = False + def process(self, pyfile): pyfile.url = re.sub(r'/view/?\?', '/?', pyfile.url) @@ -93,6 +94,7 @@ class MediafireCom(SimpleHoster): self.multiDL = True self.download(self.url, disposition=True) + def handleFree(self): passwords = self.getPassword().splitlines() while self.PASSWORD_PATTERN in self.html: @@ -111,6 +113,7 @@ class MediafireCom(SimpleHoster): self.download(download_url) + def checkCaptcha(self): solvemedia = SolveMedia(self) diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index ca0569c6b..68b7e0c1e 100644 --- a/module/plugins/hoster/MegaDebridEu.py +++ b/module/plugins/hoster/MegaDebridEu.py @@ -29,6 +29,7 @@ class MegaDebridEu(Hoster): except IndexError: return "" + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url @@ -47,6 +48,7 @@ class MegaDebridEu(Hoster): pyfile.name = filename self.download(new_url, disposition=True) + def connectToApi(self): """ Connexion to the mega-debrid API @@ -63,6 +65,7 @@ class MegaDebridEu(Hoster): else: return False + def debridLink(self, linkToDebrid): """ Debrid a link @@ -78,6 +81,7 @@ class MegaDebridEu(Hoster): else: self.exitOnFail("Unable to debrid %s" % linkToDebrid) + def exitOnFail(self, msg): """ exit the plugin on fail case diff --git a/module/plugins/hoster/MegaRapidCz.py b/module/plugins/hoster/MegaRapidCz.py index 153f6ea8b..01b2aaf70 100644 --- a/module/plugins/hoster/MegaRapidCz.py +++ b/module/plugins/hoster/MegaRapidCz.py @@ -48,6 +48,7 @@ class MegaRapidCz(SimpleHoster): def setup(self): self.chunkLimit = 1 + def handlePremium(self): try: self.html = self.load(self.pyfile.url, decode=True) diff --git a/module/plugins/hoster/MegacrypterCom.py b/module/plugins/hoster/MegacrypterCom.py index 67dec2a0b..5464dedce 100644 --- a/module/plugins/hoster/MegacrypterCom.py +++ b/module/plugins/hoster/MegacrypterCom.py @@ -29,6 +29,7 @@ class MegacrypterCom(MegaNz): self.logDebug("API Response: " + resp) return json_loads(resp) + def process(self, pyfile): # match is guaranteed because plugin was chosen to handle url node = re.match(self.__pattern__, pyfile.url).group(1) diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py index 1ce16f30c..f7c8b47fd 100644 --- a/module/plugins/hoster/MultishareCz.py +++ b/module/plugins/hoster/MultishareCz.py @@ -38,9 +38,11 @@ class MultishareCz(SimpleHoster): else: self.handleOverriden() + def handleFree(self): self.download("http://www.multishare.cz/html/download_free.php?ID=%s" % self.fileID) + def handlePremium(self): if not self.checkCredit(): self.logWarning("Not enough credit left to download file") @@ -48,6 +50,7 @@ class MultishareCz(SimpleHoster): self.download("http://www.multishare.cz/html/download_premium.php?ID=%s" % self.fileID) + def handleOverriden(self): if not self.premium: self.fail("Only premium users can download from other hosters") @@ -63,6 +66,7 @@ class MultishareCz(SimpleHoster): self.logDebug(url, params) self.download(url, get=params) + def checkCredit(self): self.acc_info = self.account.getAccountInfo(self.user, True) self.logInfo("User %s has %i MB left" % (self.user, self.acc_info['trafficleft'] / 1024)) diff --git a/module/plugins/hoster/MyfastfileCom.py b/module/plugins/hoster/MyfastfileCom.py index 8fbae3e0a..d3a699e98 100644 --- a/module/plugins/hoster/MyfastfileCom.py +++ b/module/plugins/hoster/MyfastfileCom.py @@ -22,6 +22,7 @@ class MyfastfileCom(Hoster): self.chunkLimit = -1 self.resumeDownload = True + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url diff --git a/module/plugins/hoster/MyvideoDe.py b/module/plugins/hoster/MyvideoDe.py index 1f02b5b69..1f8c785a7 100644 --- a/module/plugins/hoster/MyvideoDe.py +++ b/module/plugins/hoster/MyvideoDe.py @@ -24,19 +24,23 @@ class MyvideoDe(Hoster): pyfile.name = self.get_file_name() self.download(self.get_file_url()) + def download_html(self): self.html = self.load(self.pyfile.url) + def get_file_url(self): videoId = re.search(r"addVariable\('_videoid','(.*)'\);p.addParam\('quality'", self.html).group(1) videoServer = re.search("rel='image_src' href='(.*)thumbs/.*' />", self.html).group(1) file_url = videoServer + videoId + ".flv" return file_url + def get_file_name(self): file_name_pattern = r'<h1 class=\'globalHd\'>(.*)</h1>' return unescape(re.search(file_name_pattern, self.html).group(1).replace("/", "") + '.flv') + def file_exists(self): self.download_html() self.load(str(self.pyfile.url), cookies=False, just_header=True) diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 0c255afbe..800de3068 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -66,12 +66,14 @@ class NetloadIn(Hoster): def setup(self): self.multiDL = self.resumeDownload = self.premium + def process(self, pyfile): self.url = pyfile.url self.prepare() pyfile.setStatus("downloading") self.proceed(self.url) + def prepare(self): self.download_api_data() @@ -93,6 +95,7 @@ class NetloadIn(Hoster): self.fail("Failed") return False + def download_api_data(self, n=0): url = self.url id_regex = re.compile(self.__pattern__) @@ -134,6 +137,7 @@ class NetloadIn(Hoster): else: self.api_data = False + def final_wait(self, page): wait_time = self.get_wait_time(page) self.setWait(wait_time) @@ -141,6 +145,7 @@ class NetloadIn(Hoster): self.wait() self.url = self.get_file_url(page) + def download_html(self): self.logDebug("Netload: Entering download_html") page = self.load(self.url, decode=True) @@ -227,6 +232,7 @@ class NetloadIn(Hoster): return False + def get_file_url(self, page): try: file_url_pattern = r'<a class="Orange_Link" href="(http://.+)".?>Or click here' @@ -242,10 +248,12 @@ class NetloadIn(Hoster): self.logDebug("Netload: Getting final link failed") return None + def get_wait_time(self, page): wait_seconds = int(re.search(r"countdown\((.+),'change\(\)'\)", page).group(1)) / 100 return wait_seconds + def proceed(self, url): self.logDebug("Netload: Downloading..") diff --git a/module/plugins/hoster/NowDownloadEu.py b/module/plugins/hoster/NowDownloadEu.py index 57d31acd5..256b2c801 100644 --- a/module/plugins/hoster/NowDownloadEu.py +++ b/module/plugins/hoster/NowDownloadEu.py @@ -34,6 +34,7 @@ class NowDownloadEu(SimpleHoster): self.multiDL = self.resumeDownload = True self.chunkLimit = -1 + def handleFree(self): tokenlink = re.search(self.TOKEN_PATTERN, self.html) continuelink = re.search(self.CONTINUE_PATTERN, self.html) diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py index 5c3a36318..1b50ae8a2 100644 --- a/module/plugins/hoster/OverLoadMe.py +++ b/module/plugins/hoster/OverLoadMe.py @@ -31,10 +31,12 @@ class OverLoadMe(Hoster): name += "%s.tmp" % randrange(100, 999) return name + def setup(self): self.chunkLimit = 5 self.resumeDownload = True + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url diff --git a/module/plugins/hoster/PornhostCom.py b/module/plugins/hoster/PornhostCom.py index 51426de71..6fb0fad83 100644 --- a/module/plugins/hoster/PornhostCom.py +++ b/module/plugins/hoster/PornhostCom.py @@ -25,11 +25,13 @@ class PornhostCom(Hoster): pyfile.name = self.get_file_name() self.download(self.get_file_url()) + # Old interface def download_html(self): url = self.pyfile.url self.html = self.load(url) + def get_file_url(self): """ returns the absolute downloadable filepath """ @@ -47,6 +49,7 @@ class PornhostCom(Hoster): return url.group(1).strip() + def get_file_name(self): if not self.html: self.download_html() @@ -63,6 +66,7 @@ class PornhostCom(Hoster): return name + def file_exists(self): """ returns True or False """ diff --git a/module/plugins/hoster/PornhubCom.py b/module/plugins/hoster/PornhubCom.py index 60b57d2c8..01204010d 100644 --- a/module/plugins/hoster/PornhubCom.py +++ b/module/plugins/hoster/PornhubCom.py @@ -25,10 +25,12 @@ class PornhubCom(Hoster): pyfile.name = self.get_file_name() self.download(self.get_file_url()) + def download_html(self): url = self.pyfile.url self.html = self.load(url) + def get_file_url(self): """ returns the absolute downloadable filepath """ @@ -57,6 +59,7 @@ class PornhubCom(Hoster): return re.search(r'flv_url.*(http.*?)##post_roll', content).group(1) + def get_file_name(self): if not self.html: self.download_html() @@ -73,6 +76,7 @@ class PornhubCom(Hoster): return name + '.flv' + def file_exists(self): """ returns True or False """ diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py index ed96f315b..8595304c4 100644 --- a/module/plugins/hoster/PremiumTo.py +++ b/module/plugins/hoster/PremiumTo.py @@ -26,6 +26,7 @@ class PremiumTo(Hoster): self.resumeDownload = True self.chunkLimit = 1 + def process(self, pyfile): if not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "premium.to") @@ -66,6 +67,7 @@ class PremiumTo(Hoster): if err: self.fail(err) + def getTraffic(self): try: api_r = self.load("http://premium.to/api/straffic.php", diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index 5946565c6..12de0fa5b 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -53,6 +53,7 @@ class QuickshareCz(SimpleHoster): if check == "err": self.fail("File not m or plugin defect") + def handleFree(self): # get download url download_url = '%s/download.php' % self.jsvars['server'] @@ -83,6 +84,7 @@ class QuickshareCz(SimpleHoster): # download file self.download(download_url) + def handlePremium(self): download_url = '%s/download_premium.php' % self.jsvars['server'] data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ("ID1", "ID2", "ID4", "ID5")) diff --git a/module/plugins/hoster/RPNetBiz.py b/module/plugins/hoster/RPNetBiz.py index 3132001ed..0d032ef2f 100644 --- a/module/plugins/hoster/RPNetBiz.py +++ b/module/plugins/hoster/RPNetBiz.py @@ -22,6 +22,7 @@ class RPNetBiz(Hoster): self.chunkLimit = -1 self.resumeDownload = True + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): link_status = {'generated': pyfile.url} diff --git a/module/plugins/hoster/RapidshareCom.py b/module/plugins/hoster/RapidshareCom.py index befbbb123..2dd36b84e 100644 --- a/module/plugins/hoster/RapidshareCom.py +++ b/module/plugins/hoster/RapidshareCom.py @@ -70,10 +70,12 @@ class RapidshareCom(Hoster): self.chunkLimit = -1 if self.premium else 1 self.multiDL = self.resumeDownload = self.premium + def process(self, pyfile): self.url = pyfile.url self.prepare() + def prepare(self): m = re.match(self.__pattern__, self.url) @@ -106,6 +108,7 @@ class RapidshareCom(Hoster): else: self.fail("Unknown response code.") + def handleFree(self): while self.no_download: self.dl_dict = self.freeWait() @@ -128,12 +131,14 @@ class RapidshareCom(Hoster): self.offset += 5 self.handleFree() + def handlePremium(self): info = self.account.getAccountInfo(self.user, True) self.logDebug("%s: Use Premium Account" % self.__name__) url = self.api_data['mirror'] self.download(url, get={"directstart": 1}) + def download_api_data(self, force=False): """ http://images.rapidshare.com/apidoc.txt @@ -168,6 +173,7 @@ class RapidshareCom(Hoster): self.api_data['mirror'] = "http://rs%(serverid)s%(shorthost)s.rapidshare.com/files/%(fileid)s/%(filename)s" % self.api_data + def freeWait(self): """downloads html with the important information """ @@ -219,6 +225,7 @@ class RapidshareCom(Hoster): return dl_dict + def get_file_name(self): if self.api_data['filename']: return self.api_data['filename'] diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py index fe6db98cb..cf1f825ef 100644 --- a/module/plugins/hoster/RealdebridCom.py +++ b/module/plugins/hoster/RealdebridCom.py @@ -32,10 +32,12 @@ class RealdebridCom(Hoster): name += "%s.tmp" % randrange(100, 999) return name + def setup(self): self.chunkLimit = 3 self.resumeDownload = True + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url diff --git a/module/plugins/hoster/RedtubeCom.py b/module/plugins/hoster/RedtubeCom.py index f8ac81693..d136d145b 100644 --- a/module/plugins/hoster/RedtubeCom.py +++ b/module/plugins/hoster/RedtubeCom.py @@ -26,10 +26,12 @@ class RedtubeCom(Hoster): pyfile.name = self.get_file_name() self.download(self.get_file_url()) + def download_html(self): url = self.pyfile.url self.html = self.load(url) + def get_file_url(self): """ returns the absolute downloadable filepath """ @@ -40,12 +42,14 @@ class RedtubeCom(Hoster): return file_url + def get_file_name(self): if not self.html: self.download_html() return re.search('<title>(.*?)- RedTube - Free Porn Videos</title>', self.html).group(1).strip() + ".flv" + def file_exists(self): """ returns True or False """ diff --git a/module/plugins/hoster/RehostTo.py b/module/plugins/hoster/RehostTo.py index e1f719c19..80465724d 100644 --- a/module/plugins/hoster/RehostTo.py +++ b/module/plugins/hoster/RehostTo.py @@ -20,10 +20,12 @@ class RehostTo(Hoster): def getFilename(self, url): return unquote(url.rsplit("/", 1)[1]) + def setup(self): self.chunkLimit = 1 self.resumeDownload = True + def process(self, pyfile): if not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "rehost.to") diff --git a/module/plugins/hoster/RemixshareCom.py b/module/plugins/hoster/RemixshareCom.py index 4e812b20d..94be78b4f 100644 --- a/module/plugins/hoster/RemixshareCom.py +++ b/module/plugins/hoster/RemixshareCom.py @@ -38,6 +38,7 @@ class RemixshareCom(SimpleHoster): self.multiDL = True self.chunkLimit = 1 + def handleFree(self): b = re.search(self.LINK_PATTERN, self.html) if not b: diff --git a/module/plugins/hoster/ShareplaceCom.py b/module/plugins/hoster/ShareplaceCom.py index 84be2706f..bef14de0f 100644 --- a/module/plugins/hoster/ShareplaceCom.py +++ b/module/plugins/hoster/ShareplaceCom.py @@ -24,6 +24,7 @@ class ShareplaceCom(Hoster): self.prepare() self.download(self.get_file_url()) + def prepare(self): if not self.file_exists(): self.offline() @@ -35,6 +36,7 @@ class ShareplaceCom(Hoster): self.logDebug("%s: Waiting %d seconds." % (self.__name__, wait_time)) self.wait() + def get_waiting_time(self): if not self.html: self.download_html() @@ -48,10 +50,12 @@ class ShareplaceCom(Hoster): return sec + def download_html(self): url = re.sub("shareplace.com\/\?", "shareplace.com//index1.php/?a=", self.pyfile.url) self.html = self.load(url, decode=True) + def get_file_url(self): """ returns the absolute downloadable filepath """ @@ -66,12 +70,14 @@ class ShareplaceCom(Hoster): else: self.fail("absolute filepath could not be found. offline? ") + def get_file_name(self): if not self.html: self.download_html() return re.search("<title>\s*(.*?)\s*</title>", self.html).group(1) + def file_exists(self): """ returns True or False """ diff --git a/module/plugins/hoster/SimplyPremiumCom.py b/module/plugins/hoster/SimplyPremiumCom.py index e78a1f469..965c1421a 100644 --- a/module/plugins/hoster/SimplyPremiumCom.py +++ b/module/plugins/hoster/SimplyPremiumCom.py @@ -24,6 +24,7 @@ class SimplyPremiumCom(Hoster): self.chunkLimit = 16 self.resumeDownload = False + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url diff --git a/module/plugins/hoster/SimplydebridCom.py b/module/plugins/hoster/SimplydebridCom.py index c7df990e3..dea82591d 100644 --- a/module/plugins/hoster/SimplydebridCom.py +++ b/module/plugins/hoster/SimplydebridCom.py @@ -21,6 +21,7 @@ class SimplydebridCom(Hoster): self.resumeDownload = self.multiDL = True self.chunkLimit = 1 + def process(self, pyfile): if not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "simply-debrid.com") diff --git a/module/plugins/hoster/StreamCz.py b/module/plugins/hoster/StreamCz.py index 1459ca5f1..d4ebd7701 100644 --- a/module/plugins/hoster/StreamCz.py +++ b/module/plugins/hoster/StreamCz.py @@ -42,8 +42,8 @@ class StreamCz(Hoster): self.multiDL = True self.resumeDownload = True - def process(self, pyfile): + def process(self, pyfile): self.html = self.load(pyfile.url, decode=True) if re.search(self.OFFLINE_PATTERN, self.html): diff --git a/module/plugins/hoster/TwoSharedCom.py b/module/plugins/hoster/TwoSharedCom.py index 6b755219a..e1cdead9b 100644 --- a/module/plugins/hoster/TwoSharedCom.py +++ b/module/plugins/hoster/TwoSharedCom.py @@ -27,6 +27,7 @@ class TwoSharedCom(SimpleHoster): def setup(self): self.resumeDownload = self.multiDL = True + def handleFree(self): m = re.search(self.LINK_PATTERN, self.html) if m is None: diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index 2d4762ba6..9b70c8efa 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -44,6 +44,7 @@ class UlozTo(SimpleHoster): self.multiDL = self.premium self.resumeDownload = True + def process(self, pyfile): pyfile.url = re.sub(r"(?<=http://)([^/]+)", "www.ulozto.net", pyfile.url) self.html = self.load(pyfile.url, decode=True, cookies=True) @@ -81,6 +82,7 @@ class UlozTo(SimpleHoster): self.doCheckDownload() + def handleFree(self): action, inputs = self.parseHtmlForm('id="frm-downloadDialog-freeDownloadForm"') if not action or not inputs: @@ -115,11 +117,13 @@ class UlozTo(SimpleHoster): self.multiDL = True self.download("http://www.ulozto.net" + action, post=inputs, cookies=True, disposition=True) + def handlePremium(self): self.download(self.pyfile.url + "?do=directDownload", disposition=True) #parsed_url = self.findDownloadURL(premium=True) #self.download(parsed_url, post={"download": "Download"}) + def findDownloadURL(self, premium=False): msg = "%s link" % ("Premium" if premium else "Free") m = re.search(self.PREMIUM_URL_PATTERN if premium else self.FREE_URL_PATTERN, self.html) @@ -129,6 +133,7 @@ class UlozTo(SimpleHoster): self.logDebug("%s: %s" % (msg, parsed_url)) return parsed_url + def doCheckDownload(self): check = self.checkDownload({ "wrong_captcha": re.compile(r'<ul class="error">\s*<li>Error rewriting the text.</li>'), diff --git a/module/plugins/hoster/UloziskoSk.py b/module/plugins/hoster/UloziskoSk.py index 4323a71e5..2db2ce65e 100644 --- a/module/plugins/hoster/UloziskoSk.py +++ b/module/plugins/hoster/UloziskoSk.py @@ -38,6 +38,7 @@ class UloziskoSk(SimpleHoster): else: self.handleFree() + def handleFree(self): m = re.search(self.LINK_PATTERN, self.html) if m is None: diff --git a/module/plugins/hoster/UnrestrictLi.py b/module/plugins/hoster/UnrestrictLi.py index 2acb7816d..a2ee2a020 100644 --- a/module/plugins/hoster/UnrestrictLi.py +++ b/module/plugins/hoster/UnrestrictLi.py @@ -34,6 +34,7 @@ class UnrestrictLi(Hoster): self.chunkLimit = 16 self.resumeDownload = True + def process(self, pyfile): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url @@ -82,6 +83,7 @@ class UnrestrictLi(Hoster): self.load("https://unrestrict.li/history/&delete=all") self.logInfo("Download history deleted") + def setNameSize(self): if 'name' in self.api_data: self.pyfile.name = self.api_data['name'] diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 73a903902..764bb75de 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -119,6 +119,7 @@ class UploadedTo(Hoster): self.fileID = getID(self.pyfile.url) self.pyfile.url = "http://uploaded.net/file/%s" % self.fileID + def process(self, pyfile): self.load("http://uploaded.net/language/en", just_header=True) @@ -158,6 +159,7 @@ class UploadedTo(Hoster): else: self.handleFree() + def handlePremium(self): info = self.account.getAccountInfo(self.user, True) self.logDebug("%(name)s: Use Premium Account (%(left)sGB left)" % {"name": self.__name__, @@ -183,6 +185,7 @@ class UploadedTo(Hoster): print "Premium URL: " + url self.download(url, post={}) + def handleFree(self): self.html = self.load(self.pyfile.url, decode=True) diff --git a/module/plugins/hoster/UploadheroCom.py b/module/plugins/hoster/UploadheroCom.py index 753ad6807..f2bcaea6a 100644 --- a/module/plugins/hoster/UploadheroCom.py +++ b/module/plugins/hoster/UploadheroCom.py @@ -58,12 +58,14 @@ class UploadheroCom(SimpleHoster): self.download(download_url) + def handlePremium(self): self.logDebug("%s: Use Premium Account" % self.__name__) link = re.search(self.PREMIUM_URL_PATTERN, self.html).group(1) self.logDebug("Downloading link : '%s'" % link) self.download(link) + def checkErrors(self): m = re.search(self.IP_BLOCKED_PATTERN, self.html) if m: diff --git a/module/plugins/hoster/VeehdCom.py b/module/plugins/hoster/VeehdCom.py index f82d429d1..47f95ed41 100644 --- a/module/plugins/hoster/VeehdCom.py +++ b/module/plugins/hoster/VeehdCom.py @@ -22,10 +22,12 @@ class VeehdCom(Hoster): def _debug(self, msg): self.logDebug("[%s] %s" % (self.__name__, msg)) + def setup(self): self.multiDL = True self.req.canContinue = True + def process(self, pyfile): self.download_html() if not self.file_exists(): @@ -34,11 +36,13 @@ class VeehdCom(Hoster): pyfile.name = self.get_file_name() self.download(self.get_file_url()) + def download_html(self): url = self.pyfile.url self._debug("Requesting page: %s" % (repr(url),)) self.html = self.load(url) + def file_exists(self): if not self.html: self.download_html() @@ -47,6 +51,7 @@ class VeehdCom(Hoster): return False return True + def get_file_name(self): if not self.html: self.download_html() @@ -65,6 +70,7 @@ class VeehdCom(Hoster): return re.sub(pattern, self.getConfig('replacement_char'), name) + '.avi' + def get_file_url(self): """ returns the absolute downloadable filepath """ diff --git a/module/plugins/hoster/VeohCom.py b/module/plugins/hoster/VeohCom.py index a4b94f40f..f35ed2510 100644 --- a/module/plugins/hoster/VeohCom.py +++ b/module/plugins/hoster/VeohCom.py @@ -30,6 +30,7 @@ class VeohCom(SimpleHoster): self.resumeDownload = self.multiDL = True self.chunkLimit = -1 + def handleFree(self): quality = self.getConfig("quality") if quality == "Auto": diff --git a/module/plugins/hoster/VimeoCom.py b/module/plugins/hoster/VimeoCom.py index 2f554ee1b..8de7fad88 100644 --- a/module/plugins/hoster/VimeoCom.py +++ b/module/plugins/hoster/VimeoCom.py @@ -32,6 +32,7 @@ class VimeoCom(SimpleHoster): self.resumeDownload = self.multiDL = True self.chunkLimit = -1 + def handleFree(self): password = self.getPassword() diff --git a/module/plugins/hoster/WebshareCz.py b/module/plugins/hoster/WebshareCz.py index 6e0354d12..42f1e9a14 100644 --- a/module/plugins/hoster/WebshareCz.py +++ b/module/plugins/hoster/WebshareCz.py @@ -43,6 +43,7 @@ class WebshareCz(SimpleHoster): self.logDebug("Direct link: " + direct) self.download(direct, disposition=True) + def getFileInfo(self): self.logDebug("URL: %s" % self.pyfile.url) diff --git a/module/plugins/hoster/WrzucTo.py b/module/plugins/hoster/WrzucTo.py index 47731642d..896da1c1b 100644 --- a/module/plugins/hoster/WrzucTo.py +++ b/module/plugins/hoster/WrzucTo.py @@ -28,6 +28,7 @@ class WrzucTo(SimpleHoster): def setup(self): self.multiDL = True + def handleFree(self): data = dict(re.findall(r'(md5|file): "(.*?)"', self.html)) if len(data) != 2: diff --git a/module/plugins/hoster/XHamsterCom.py b/module/plugins/hoster/XHamsterCom.py index dae9a8eae..7257b2988 100644 --- a/module/plugins/hoster/XHamsterCom.py +++ b/module/plugins/hoster/XHamsterCom.py @@ -41,10 +41,12 @@ class XHamsterCom(Hoster): pyfile.name = self.get_file_name() + self.desired_fmt self.download(self.get_file_url()) + def download_html(self): url = self.pyfile.url self.html = self.load(url) + def get_file_url(self): """ returns the absolute downloadable filepath """ @@ -94,6 +96,7 @@ class XHamsterCom(Hoster): return long_url + def get_file_name(self): if not self.html: self.download_html() @@ -114,6 +117,7 @@ class XHamsterCom(Hoster): return name.group(1) + def file_exists(self): """ returns True or False """ diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py index db9c5edf9..244c3d7e2 100644 --- a/module/plugins/hoster/Xdcc.py +++ b/module/plugins/hoster/Xdcc.py @@ -33,6 +33,7 @@ class Xdcc(Hoster): self.timeout = 30 self.multiDL = False + def process(self, pyfile): # change request type self.req = pyfile.m.core.requestFactory.getRequest(self.__name__, type="XDCC") @@ -59,6 +60,7 @@ class Xdcc(Hoster): self.fail("Server blocked our ip, retry again later manually") + def doDownload(self, url): self.pyfile.setStatus("waiting") # real link diff --git a/module/plugins/hoster/YoupornCom.py b/module/plugins/hoster/YoupornCom.py index 37788b9f7..821a7a8d6 100644 --- a/module/plugins/hoster/YoupornCom.py +++ b/module/plugins/hoster/YoupornCom.py @@ -26,10 +26,12 @@ class YoupornCom(Hoster): pyfile.name = self.get_file_name() self.download(self.get_file_url()) + def download_html(self): url = self.pyfile.url self.html = self.load(url, post={"user_choice": "Enter"}, cookies=False) + def get_file_url(self): """ returns the absolute downloadable filepath """ @@ -38,6 +40,7 @@ class YoupornCom(Hoster): return re.search(r'(http://download\.youporn\.com/download/\d+\?save=1)">', self.html).group(1) + def get_file_name(self): if not self.html: self.download_html() @@ -45,6 +48,7 @@ class YoupornCom(Hoster): file_name_pattern = r'<title>(.+) - ' return re.search(file_name_pattern, self.html).group(1).replace("&", "&").replace("/", "") + '.flv' + def file_exists(self): """ returns True or False """ diff --git a/module/plugins/hoster/YourfilesTo.py b/module/plugins/hoster/YourfilesTo.py index 4487a728a..9de5929ff 100644 --- a/module/plugins/hoster/YourfilesTo.py +++ b/module/plugins/hoster/YourfilesTo.py @@ -25,6 +25,7 @@ class YourfilesTo(Hoster): self.prepare() self.download(self.get_file_url()) + def prepare(self): if not self.file_exists(): self.offline() @@ -36,6 +37,7 @@ class YourfilesTo(Hoster): self.logDebug("%s: Waiting %d seconds." % (self.__name__, wait_time)) self.wait() + def get_waiting_time(self): if not self.html: self.download_html() @@ -49,10 +51,12 @@ class YourfilesTo(Hoster): return sec + def download_html(self): url = self.pyfile.url self.html = self.load(url) + def get_file_url(self): """ returns the absolute downloadable filepath """ @@ -64,12 +68,14 @@ class YourfilesTo(Hoster): else: self.fail("absolute filepath could not be found. offline? ") + def get_file_name(self): if not self.html: self.download_html() return re.search("<title>(.*)</title>", self.html).group(1) + def file_exists(self): """ returns True or False """ diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index 5eacdc738..f16e9ae43 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -16,6 +16,7 @@ def which(program): Courtesy of http://stackoverflow.com/a/377028/675646""" + def is_exe(fpath): return os.path.isfile(fpath) and os.access(fpath, os.X_OK) @@ -85,6 +86,7 @@ class YoutubeCom(Hoster): def setup(self): self.resumeDownload = self.multiDL = True + def process(self, pyfile): pyfile.url = replace_patterns(pyfile.url, self.FILE_URL_REPLACEMENTS) html = self.load(pyfile.url, decode=True) diff --git a/module/plugins/hoster/ZDF.py b/module/plugins/hoster/ZDF.py index 83a3bd95c..274dd474a 100644 --- a/module/plugins/hoster/ZDF.py +++ b/module/plugins/hoster/ZDF.py @@ -29,15 +29,18 @@ class ZDF(Hoster): any(f.text == "progressive" for f in video.iter("facet")), ) + @staticmethod def video_valid(video): return video.findtext("url").startswith("http") and video.findtext("url").endswith(".mp4") and \ video.findtext("facets/facet").startswith("progressive") + @staticmethod def get_id(url): return int(re.search(r"\D*(\d{4,})\D*", url).group(1)) + def process(self, pyfile): xml = fromstring(self.load(self.XML_API % self.get_id(pyfile.url))) diff --git a/module/plugins/hoster/ZeveraCom.py b/module/plugins/hoster/ZeveraCom.py index 5720579bb..9394a5c93 100644 --- a/module/plugins/hoster/ZeveraCom.py +++ b/module/plugins/hoster/ZeveraCom.py @@ -19,6 +19,7 @@ class ZeveraCom(Hoster): self.resumeDownload = self.multiDL = True self.chunkLimit = 1 + def process(self, pyfile): if not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "zevera.com") |