From 3cbbb91b400cf6388523fbec945a6e97a6ae24e1 Mon Sep 17 00:00:00 2001 From: Stefano Date: Thu, 21 Feb 2013 22:15:44 +0100 Subject: SpeedLoadOrg: Detect offline files Added the FILE_OFFLINE_PATTERN to detect offline files --- module/plugins/hoster/SpeedLoadOrg.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/plugins/hoster/SpeedLoadOrg.py b/module/plugins/hoster/SpeedLoadOrg.py index e74114742..7035812eb 100644 --- a/module/plugins/hoster/SpeedLoadOrg.py +++ b/module/plugins/hoster/SpeedLoadOrg.py @@ -20,13 +20,14 @@ class SpeedLoadOrg(SimpleHoster): __name__ = "SpeedLoadOrg" __type__ = "hoster" __pattern__ = r"http://(www\.)?speedload\.org/(?P\w+).*" - __version__ = "0.04" + __version__ = "0.05" __description__ = """Speedload.org hoster plugin""" __author_name__ = ("z00nx", "stickell") __author_mail__ = ("z00nx0@gmail.com", "l.stickell@yahoo.it") FILE_NAME_PATTERN = '
' RECAPTCHA_KEY = '6LenSdkSAAAAAJyoP5jFZl4NNell2r4rzfXRZXGW' API_URL = 'http://speedload.org/api/single_link.php?shortUrl=' -- cgit v1.2.3 From 2d8da79200604a4672daf0b0fb07e8aed3ae2b22 Mon Sep 17 00:00:00 2001 From: Stefano Date: Thu, 21 Feb 2013 22:19:20 +0100 Subject: SpeedLoadOrg: getInfo now uses API --- module/plugins/hoster/SpeedLoadOrg.py | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/module/plugins/hoster/SpeedLoadOrg.py b/module/plugins/hoster/SpeedLoadOrg.py index 7035812eb..82ed23ad6 100644 --- a/module/plugins/hoster/SpeedLoadOrg.py +++ b/module/plugins/hoster/SpeedLoadOrg.py @@ -8,19 +8,30 @@ import re def getInfo(urls): for url in urls: - header = getURL(url, just_header=True) - if 'Location: http://speedload.org/index.php' in header: - file_info = (url, 0, 1, url) + api_data = getAPIData(url) + online = False if 'File Not Found' in api_data else True + if online: + file_info = (api_data['originalFilename'], api_data['size'], 2 , url) else: - file_info = parseFileInfo(SpeedLoadOrg, url, getURL(url, decode=True)) + file_info = (url, 0, 1 , url) yield file_info +def getAPIData(url): + API_URL = 'http://speedload.org/api/single_link.php?shortUrl=' + + file_id = re.search(SpeedLoadOrg.__pattern__, url).group('ID') + api_data = json_loads(getURL(API_URL + file_id, decode = True)) + if isinstance(api_data, dict): + api_data['size'] = api_data['fileSize'] + + return api_data + class SpeedLoadOrg(SimpleHoster): __name__ = "SpeedLoadOrg" __type__ = "hoster" __pattern__ = r"http://(www\.)?speedload\.org/(?P\w+).*" - __version__ = "0.05" + __version__ = "0.06" __description__ = """Speedload.org hoster plugin""" __author_name__ = ("z00nx", "stickell") __author_mail__ = ("z00nx0@gmail.com", "l.stickell@yahoo.it") @@ -32,9 +43,8 @@ class SpeedLoadOrg(SimpleHoster): API_URL = 'http://speedload.org/api/single_link.php?shortUrl=' def handleFree(self): - self.getApiData() + self.api_data = getAPIData(self.pyfile.url) recaptcha = ReCaptcha(self) - self.load challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) post_data = {'recaptcha_challenge_field': challenge, 'recaptcha_response_field': response, 'submit': 'continue', 'submitted': '1', 'd': '1'} self.download(self.pyfile.url, post=post_data) @@ -50,8 +60,3 @@ class SpeedLoadOrg(SimpleHoster): self.retry(10, 300, "Already downloading") elif check == "socket": self.fail("Server error: Could not open socket") - - def getApiData(self): - self.file_id = re.search(self.__pattern__, self.pyfile.url).group('ID') - self.api_data = json_loads(getURL(self.API_URL + self.file_id)) - self.api_data['size'] = self.api_data['fileSize'] -- cgit v1.2.3 From 64213890db8ab8e5e7197dbe23dff3e070532e31 Mon Sep 17 00:00:00 2001 From: Stefano Date: Thu, 21 Feb 2013 22:22:05 +0100 Subject: SpeedLoadOrg: removed duplicated string --- module/plugins/hoster/SpeedLoadOrg.py | 1 - 1 file changed, 1 deletion(-) diff --git a/module/plugins/hoster/SpeedLoadOrg.py b/module/plugins/hoster/SpeedLoadOrg.py index 82ed23ad6..a725d9ae0 100644 --- a/module/plugins/hoster/SpeedLoadOrg.py +++ b/module/plugins/hoster/SpeedLoadOrg.py @@ -40,7 +40,6 @@ class SpeedLoadOrg(SimpleHoster): FILE_SIZE_PATTERN = 'File Size: (?P[^<]+)' FILE_OFFLINE_PATTERN = '
' RECAPTCHA_KEY = '6LenSdkSAAAAAJyoP5jFZl4NNell2r4rzfXRZXGW' - API_URL = 'http://speedload.org/api/single_link.php?shortUrl=' def handleFree(self): self.api_data = getAPIData(self.pyfile.url) -- cgit v1.2.3