diff options
| author | 2013-02-28 20:19:35 +0100 | |
|---|---|---|
| committer | 2013-02-28 20:19:35 +0100 | |
| commit | e9cfc828529f22a3ef6e6eba9e91daf1a0d99155 (patch) | |
| tree | 0d9b6d6645057caf29aa97442c97dbfdb9c52365 | |
| parent | fixed last commit (diff) | |
| parent | XFileSharingPro: Cleaning the download link (diff) | |
| download | pyload-e9cfc828529f22a3ef6e6eba9e91daf1a0d99155.tar.xz | |
Merge pull request #26 from stickell/stable
SpeedLoadOrg now uses XFileSharing Pro
| -rw-r--r-- | module/plugins/hoster/SpeedLoadOrg.py | 65 | ||||
| -rw-r--r-- | module/plugins/hoster/XFileSharingPro.py | 5 | 
2 files changed, 14 insertions, 56 deletions
| diff --git a/module/plugins/hoster/SpeedLoadOrg.py b/module/plugins/hoster/SpeedLoadOrg.py index a725d9ae0..65eead5a5 100644 --- a/module/plugins/hoster/SpeedLoadOrg.py +++ b/module/plugins/hoster/SpeedLoadOrg.py @@ -1,61 +1,18 @@  # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo -from module.network.RequestFactory import getURL -from module.plugins.ReCaptcha import ReCaptcha -from module.common.json_layer import json_loads -import re +from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo - -def getInfo(urls): -    for url in urls: -        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 = (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): +class SpeedLoadOrg(XFileSharingPro):      __name__ = "SpeedLoadOrg"      __type__ = "hoster" -    __pattern__ = r"http://(www\.)?speedload\.org/(?P<ID>\w+).*" -    __version__ = "0.06" +    __pattern__ = r"http://(www\.)?speedload\.org/(?P<ID>\w+)" +    __version__ = "1.00"      __description__ = """Speedload.org hoster plugin""" -    __author_name__ = ("z00nx", "stickell") -    __author_mail__ = ("z00nx0@gmail.com", "l.stickell@yahoo.it") +    __author_name__ = ("stickell") +    __author_mail__ = ("l.stickell@yahoo.it") + +    FILE_NAME_PATTERN = r'Filename:</b></td><td nowrap>(?P<N>[^<]+)</td></tr>' +    FILE_SIZE_PATTERN = r'Size:</b></td><td>[\w. ]+<small>\((?P<S>\d+) bytes\)</small>' -    FILE_NAME_PATTERN = '<div class="d_file[^>]+>\s+<div>\s+<div[^>]+>(?P<N>[^<]+)</div>' -    FILE_SIZE_PATTERN = 'File Size: </span>(?P<S>[^<]+)</span>' -    FILE_OFFLINE_PATTERN = '<div class="promo" style="[^"]+">' -    RECAPTCHA_KEY = '6LenSdkSAAAAAJyoP5jFZl4NNell2r4rzfXRZXGW' +    HOSTER_NAME = "speedload.org" -    def handleFree(self): -        self.api_data = getAPIData(self.pyfile.url) -        recaptcha = ReCaptcha(self) -        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) -        check = self.checkDownload({ -            "html": re.compile("\A<!DOCTYPE html PUBLIC"), -            "busy": "You are already downloading a file. Please upgrade to premium.", -            "socket": "Could not open socket"}) -        if check == "html": -            self.logDebug("Wrong captcha entered") -            self.invalidCaptcha() -            self.retry() -        elif check == "busy": -            self.retry(10, 300, "Already downloading") -        elif check == "socket": -            self.fail("Server error: Could not open socket") +getInfo = create_getInfo(SpeedLoadOrg) diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index 0bf7618c8..ac3e1d5de 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -34,7 +34,7 @@ class XFileSharingPro(SimpleHoster):      __name__ = "XFileSharingPro"      __type__ = "hoster"      __pattern__ = r"^unmatchable$" -    __version__ = "0.15" +    __version__ = "0.16"      __description__ = """XFileSharingPro common hoster base"""      __author_name__ = ("zoidberg")      __author_mail__ = ("zoidberg@mujmail.cz") @@ -184,6 +184,7 @@ class XFileSharingPro(SimpleHoster):          self.retry()      def startDownload(self, link): +        link = link.strip()          if self.captcha: self.correctCaptcha()          self.logDebug('DIRECT LINK: %s' % link)          self.download(link) @@ -301,4 +302,4 @@ class XFileSharingPro(SimpleHoster):                      return 3          return 0 -getInfo = create_getInfo(XFileSharingPro)
\ No newline at end of file +getInfo = create_getInfo(XFileSharingPro) | 
