summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-12-22 16:45:04 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-12-22 16:45:04 +0100
commit854efeb463bd98cb8e22f1f78f5ce97e6c0ab49f (patch)
tree3128578d89f36fed0aa5ab7b3ede6311751dd7f8 /module/plugins/hoster
parent[UlozTo] Fix TRAFFIC_LEFT_PATTERN (diff)
downloadpyload-854efeb463bd98cb8e22f1f78f5ce97e6c0ab49f.tar.xz
Spare code cosmetics
Diffstat (limited to 'module/plugins/hoster')
-rw-r--r--module/plugins/hoster/BitshareCom.py6
-rw-r--r--module/plugins/hoster/DailymotionCom.py8
-rw-r--r--module/plugins/hoster/FilejungleCom.py2
-rw-r--r--module/plugins/hoster/FileserveCom.py8
-rw-r--r--module/plugins/hoster/LetitbitNet.py2
-rw-r--r--module/plugins/hoster/MediafireCom.py33
-rw-r--r--module/plugins/hoster/RarefileNet.py2
-rw-r--r--module/plugins/hoster/RyushareCom.py4
-rw-r--r--module/plugins/hoster/SoundcloudCom.py10
-rw-r--r--module/plugins/hoster/TurbobitNet.py4
-rw-r--r--module/plugins/hoster/UlozTo.py4
-rw-r--r--module/plugins/hoster/UploadStationCom.py2
-rw-r--r--module/plugins/hoster/VimeoCom.py2
-rw-r--r--module/plugins/hoster/WebshareCz.py2
14 files changed, 45 insertions, 44 deletions
diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py
index 17d29680e..6a497f4bc 100644
--- a/module/plugins/hoster/BitshareCom.py
+++ b/module/plugins/hoster/BitshareCom.py
@@ -13,7 +13,7 @@ class BitshareCom(SimpleHoster):
__type__ = "hoster"
__version__ = "0.51"
- __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/(?P<id1>\w+)(/(?P<name>.*?)\.html)?|\?f=(?P<id2>\w+))'
+ __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/(?P<id1>\w+)(/(?P<NAME>.*?)\.html)?|\?f=(?P<id2>\w+))'
__description__ = """Bitshare.com hoster plugin"""
__license__ = "GPLv3"
@@ -43,7 +43,7 @@ class BitshareCom(SimpleHoster):
# File id
m = re.match(self.__pattern__, pyfile.url)
- self.file_id = max(m.group('id1'), m.group('id2'))
+ self.file_id = max(m.group('ID1'), m.group('ID2'))
self.logDebug("File id is [%s]" % self.file_id)
# Load main page
@@ -61,7 +61,7 @@ class BitshareCom(SimpleHoster):
# File name
m = re.match(self.__pattern__, pyfile.url)
- name1 = m.group('name') if m else None
+ name1 = m.group('NAME') if m else None
m = re.search(self.INFO_PATTERN, self.html)
name2 = m.group('N') if m else None
pyfile.name = max(name1, name2)
diff --git a/module/plugins/hoster/DailymotionCom.py b/module/plugins/hoster/DailymotionCom.py
index f07a34f8a..dc42d1f60 100644
--- a/module/plugins/hoster/DailymotionCom.py
+++ b/module/plugins/hoster/DailymotionCom.py
@@ -15,7 +15,7 @@ def getInfo(urls):
request = {"fields": "access_error,status,title"}
for url in urls:
- id = regex.match(url).group("ID")
+ id = regex.match(url).group('ID')
page = getURL(apiurl % id, get=request)
info = json_loads(page)
@@ -60,8 +60,8 @@ class DailymotionCom(Hoster):
for result in re.finditer(r"\"(?P<URL>http:\\/\\/www.dailymotion.com\\/cdn\\/H264-(?P<QF>.*?)\\.*?)\"",
self.html):
- url = result.group("URL")
- qf = result.group("QF")
+ url = result.group('URL')
+ qf = result.group('QF')
link = url.replace("\\", "")
quality = tuple(int(x) for x in qf.split("x"))
@@ -116,7 +116,7 @@ class DailymotionCom(Hoster):
def process(self, pyfile):
self.checkInfo(pyfile)
- id = re.match(self.__pattern__, pyfile.url).group("ID")
+ id = re.match(self.__pattern__, pyfile.url).group('ID')
self.html = self.load("http://www.dailymotion.com/embed/video/" + id, decode=True)
streams = self.getStreams()
diff --git a/module/plugins/hoster/FilejungleCom.py b/module/plugins/hoster/FilejungleCom.py
index 8431da7fa..d5367e0be 100644
--- a/module/plugins/hoster/FilejungleCom.py
+++ b/module/plugins/hoster/FilejungleCom.py
@@ -9,7 +9,7 @@ class FilejungleCom(FileserveCom):
__type__ = "hoster"
__version__ = "0.51"
- __pattern__ = r'http://(?:www\.)?filejungle\.com/f/(?P<id>[^/]+).*'
+ __pattern__ = r'http://(?:www\.)?filejungle\.com/f/(?P<ID>[^/]+).*'
__description__ = """Filejungle.com hoster plugin"""
__license__ = "GPLv3"
diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py
index 871a3dd26..2d4478e63 100644
--- a/module/plugins/hoster/FileserveCom.py
+++ b/module/plugins/hoster/FileserveCom.py
@@ -35,7 +35,7 @@ class FileserveCom(Hoster):
__type__ = "hoster"
__version__ = "0.52"
- __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P<id>[^/]+).*'
+ __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P<ID>[^/]+).*'
__description__ = """Fileserve.com hoster plugin"""
__license__ = "GPLv3"
@@ -50,7 +50,7 @@ class FileserveCom(Hoster):
LINKCHECK_TR = r'<tr>\s*(<td>http://www\.fileserve\.com/file/.*?)</tr>'
LINKCHECK_TD = r'<td>(?:<[^>]*>|&nbsp;)*([^<]*)'
- CAPTCHA_KEY_PATTERN = r'var reCAPTCHA_publickey=\'(?P<key>.+?)\''
+ CAPTCHA_KEY_PATTERN = r'var reCAPTCHA_publickey=\'(.+?)\''
LONG_WAIT_PATTERN = r'<li class="title">You need to wait (\d+) (\w+) to start another download\.</li>'
LINK_EXPIRED_PATTERN = r'Your download link has expired'
DAILY_LIMIT_PATTERN = r'Your daily download limit has been reached'
@@ -59,7 +59,7 @@ class FileserveCom(Hoster):
def setup(self):
self.resumeDownload = self.multiDL = self.premium
- self.file_id = re.match(self.__pattern__, self.pyfile.url).group('id')
+ self.file_id = re.match(self.__pattern__, self.pyfile.url).group('ID')
self.url = "%s%s" % (self.URLS[0], self.file_id)
self.logDebug("File ID: %s URL: %s" % (self.file_id, self.url))
@@ -155,7 +155,7 @@ class FileserveCom(Hoster):
def doCaptcha(self):
- captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group("key")
+ captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group(1)
recaptcha = ReCaptcha(self)
for _i in xrange(5):
diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py
index ed8d4a39d..5fcb5e08b 100644
--- a/module/plugins/hoster/LetitbitNet.py
+++ b/module/plugins/hoster/LetitbitNet.py
@@ -50,7 +50,7 @@ class LetitbitNet(SimpleHoster):
URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "letitbit.net")]
SECONDS_PATTERN = r'seconds\s*=\s*(\d+);'
- CAPTCHA_CONTROL_FIELD = r'recaptcha_control_field\s=\s\'(?P<value>.+?)\''
+ CAPTCHA_CONTROL_FIELD = r'recaptcha_control_field\s=\s\'(.+?)\''
def setup(self):
diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py
index 4b420242d..5f88051a6 100644
--- a/module/plugins/hoster/MediafireCom.py
+++ b/module/plugins/hoster/MediafireCom.py
@@ -15,23 +15,28 @@ def checkHTMLHeader(url):
try:
for _i in xrange(3):
header = getURL(url, just_header=True)
+
for line in header.splitlines():
line = line.lower()
+
if 'location' in line:
url = line.split(':', 1)[1].strip()
if 'error.php?errno=320' in url:
return url, 1
+
if not url.startswith('http://'):
url = 'http://www.mediafire.com' + url
+
break
+
elif 'content-disposition' in line:
return url, 2
else:
break
except:
return url, 3
-
- return url, 0
+ else:
+ return url, 0
def getInfo(urls):
@@ -59,16 +64,12 @@ class MediafireCom(SimpleHoster):
("stickell", "l.stickell@yahoo.it")]
- LINK_PATTERN = r'<div class="download_link"[^>]*(?:z-index:(?P<zindex>\d+))?[^>]*>\s*<a href="(?P<href>http://[^"]+)"'
- JS_KEY_PATTERN = r'DoShow\(\'mfpromo1\'\);[^{]*{((\w+)=\'\';.*?)eval\(\2\);'
- JS_ZMODULO_PATTERN = r'\(\'z-index\'\)\) \% (\d+)\)\);'
- PAGE1_ACTION_PATTERN = r'<link rel="canonical" href="([^"]+)"/>'
- PASSWORD_PATTERN = r'<form name="form_password"'
-
- NAME_PATTERN = r'<META NAME="description" CONTENT="(?P<N>[^"]+)"/>'
- INFO_PATTERN = r'oFileSharePopup\.ald\(\'(?P<ID>[^\']*)\',\'(?P<N>[^\']*)\',\'(?P<S>[^\']*)\',\'\',\'(?P<sha256>[^\']*)\'\)'
+ NAME_PATTERN = r'<META NAME="description" CONTENT="(?P<N>[^"]+)"/>'
+ INFO_PATTERN = r'oFileSharePopup\.ald\(\'(?P<ID>[^\']*)\',\'(?P<N>[^\']*)\',\'(?P<S>[^\']*)\',\'\',\'(?P<sha256>[^\']*)\'\)'
OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. </div>'
+ PASSWORD_PATTERN = r'<form name="form_password"'
+
def setup(self):
self.multiDL = False
@@ -77,11 +78,11 @@ class MediafireCom(SimpleHoster):
def process(self, pyfile):
pyfile.url = re.sub(r'/view/?\?', '/?', pyfile.url)
- self.url, result = checkHTMLHeader(pyfile.url)
- self.logDebug("Location (%d): %s" % (result, self.url))
+ self.link, result = checkHTMLHeader(pyfile.url)
+ self.logDebug("Location (%d): %s" % (result, self.link))
if result == 0:
- self.html = self.load(self.url, decode=True)
+ self.html = self.load(self.link, decode=True)
self.checkCaptcha()
self.multiDL = True
self.check_data = self.getFileInfo()
@@ -94,7 +95,7 @@ class MediafireCom(SimpleHoster):
self.offline()
else:
self.multiDL = True
- self.download(self.url, disposition=True)
+ self.download(self.link, disposition=True)
def handleFree(self):
@@ -103,7 +104,7 @@ class MediafireCom(SimpleHoster):
if password:
self.logInfo(_("Password protected link, trying ") + password)
- self.html = self.load(self.url, post={"downloadp": password})
+ self.html = self.load(self.link, post={"downloadp": password})
if self.PASSWORD_PATTERN in self.html:
self.fail(_("Incorrect password"))
@@ -121,7 +122,7 @@ class MediafireCom(SimpleHoster):
def checkCaptcha(self):
solvemedia = SolveMedia(self)
challenge, response = solvemedia.challenge()
- self.html = self.load(self.url,
+ self.html = self.load(self.link,
post={'adcopy_challenge': challenge,
'adcopy_response' : response},
decode=True)
diff --git a/module/plugins/hoster/RarefileNet.py b/module/plugins/hoster/RarefileNet.py
index e847c7cf3..bc2382dc1 100644
--- a/module/plugins/hoster/RarefileNet.py
+++ b/module/plugins/hoster/RarefileNet.py
@@ -19,7 +19,7 @@ class RarefileNet(XFSHoster):
HOSTER_DOMAIN = "rarefile.net"
- LINK_PATTERN = r'<a href="(?P<link>[^"]+)">(?P=link)</a>'
+ LINK_PATTERN = r'<a href="(.+?)">(?P=\1)</a>'
getInfo = create_getInfo(RarefileNet)
diff --git a/module/plugins/hoster/RyushareCom.py b/module/plugins/hoster/RyushareCom.py
index b01613abb..0964c51fc 100644
--- a/module/plugins/hoster/RyushareCom.py
+++ b/module/plugins/hoster/RyushareCom.py
@@ -25,7 +25,7 @@ class RyushareCom(XFSHoster):
HOSTER_DOMAIN = "ryushare.com"
- WAIT_PATTERN = r'You have to wait ((?P<hour>\d+) hour[s]?, )?((?P<min>\d+) minute[s], )?(?P<sec>\d+) second[s]'
+ WAIT_PATTERN = r'You have to wait ((?P<H>\d+) hour[s]?, )?((?P<M>\d+) minute[s], )?(?P<S>\d+) second[s]'
LINK_PATTERN = r'<a href="([^"]+)">Click here to download<'
@@ -49,7 +49,7 @@ class RyushareCom(XFSHoster):
m = re.search(self.WAIT_PATTERN, self.html)
if m:
wait = m.groupdict(0)
- waittime = int(wait['hour']) * 60 * 60 + int(wait['min']) * 60 + int(wait['sec'])
+ waittime = int(wait['H']) * 60 * 60 + int(wait['M']) * 60 + int(wait['S'])
self.setWait(waittime, True)
retry = True
diff --git a/module/plugins/hoster/SoundcloudCom.py b/module/plugins/hoster/SoundcloudCom.py
index 79c8a2f1e..4665dff05 100644
--- a/module/plugins/hoster/SoundcloudCom.py
+++ b/module/plugins/hoster/SoundcloudCom.py
@@ -25,23 +25,23 @@ class SoundcloudCom(Hoster):
m = re.search(r'<div class="haudio.*?large.*?" data-sc-track="(?P<ID>\d*)"', page)
songId = clientId = ""
if m:
- songId = m.group("ID")
+ songId = m.group('ID')
if len(songId) <= 0:
self.logError(_("Could not find song id"))
self.offline()
else:
m = re.search(r'"clientID":"(?P<CID>.*?)"', page)
if m:
- clientId = m.group("CID")
+ clientId = m.group('CID')
if len(clientId) <= 0:
clientId = "b45b1aa10f1ac2941910a7f0d10f8e28"
m = re.search(r'<em itemprop="name">\s(?P<TITLE>.*?)\s</em>', page)
if m:
- pyfile.name = m.group("TITLE") + ".mp3"
+ pyfile.name = m.group('TITLE') + ".mp3"
else:
- pyfile.name = re.match(self.__pattern__, pyfile.url).group("SID") + ".mp3"
+ pyfile.name = re.match(self.__pattern__, pyfile.url).group('SID') + ".mp3"
# url to retrieve the actual song url
page = self.load("https://api.sndcdn.com/i1/tracks/%s/streams" % songId, get={"client_id": clientId})
@@ -49,7 +49,7 @@ class SoundcloudCom(Hoster):
# for now we choose the first stream found in all cases
# it could be improved if relevant for this hoster
streams = [
- (result.group("QUALITY"), result.group("URL"))
+ (result.group('QUALITY'), result.group('URL'))
for result in re.finditer(r'"(?P<QUALITY>.*?)":"(?P<URL>.*?)"', page)
]
self.logDebug("Found Streams", streams)
diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py
index 9d7dcc67b..258ec7d3e 100644
--- a/module/plugins/hoster/TurbobitNet.py
+++ b/module/plugins/hoster/TurbobitNet.py
@@ -35,7 +35,7 @@ class TurbobitNet(SimpleHoster):
SIZE_PATTERN = r'class="file-size">(?P<S>[\d.,]+) (?P<U>[\w^_]+)'
OFFLINE_PATTERN = r'<h2>File Not Found</h2>|html\(\'File (?:was )?not found'
- LINK_PATTERN = r'(?P<url>/download/redirect/[^"\']+)'
+ LINK_PATTERN = r'(/download/redirect/[^"\']+)'
LIMIT_WAIT_PATTERN = r'<div id=\'timeout\'>(\d+)<'
CAPTCHA_PATTERN = r'<img alt="Captcha" src="(.+?)"'
@@ -166,7 +166,7 @@ class TurbobitNet(SimpleHoster):
m = re.search(self.LINK_PATTERN, self.html)
if m is None:
self.error(_("Download link not found"))
- self.url = "http://turbobit.net" + m.group('url')
+ self.url = "http://turbobit.net" + m.group(1)
self.download(self.url)
diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py
index 0574734c5..6b84a5e1b 100644
--- a/module/plugins/hoster/UlozTo.py
+++ b/module/plugins/hoster/UlozTo.py
@@ -32,10 +32,10 @@ class UlozTo(SimpleHoster):
URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "www.ulozto.net")]
SIZE_REPLACEMENTS = [('([\d.]+)\s([kMG])B', convertDecimalPrefix)]
- ADULT_PATTERN = r'<form action="(?P<link>[^\"]*)" method="post" id="frm-askAgeForm">'
+ ADULT_PATTERN = r'<form action="([^\"]*)" method="post" id="frm-askAgeForm">'
PASSWD_PATTERN = r'<div class="passwordProtectedFile">'
VIPLINK_PATTERN = r'<a href="[^"]*\?disclaimer=1" class="linkVip">'
- TOKEN_PATTERN = r'<input type="hidden" name="_token_" .*?value="(?P<token>.+?)"'
+ TOKEN_PATTERN = r'<input type="hidden" name="_token_" .*?value="(.+?)"'
FREE_URL_PATTERN = r'<div class="freeDownloadForm"><form action="([^"]+)"'
PREMIUM_URL_PATTERN = r'<div class="downloadForm"><form action="([^"]+)"'
diff --git a/module/plugins/hoster/UploadStationCom.py b/module/plugins/hoster/UploadStationCom.py
index fa6e3f693..d987770fe 100644
--- a/module/plugins/hoster/UploadStationCom.py
+++ b/module/plugins/hoster/UploadStationCom.py
@@ -8,7 +8,7 @@ class UploadStationCom(DeadHoster):
__type__ = "hoster"
__version__ = "0.52"
- __pattern__ = r'http://(?:www\.)?uploadstation\.com/file/(?P<id>\w+)'
+ __pattern__ = r'http://(?:www\.)?uploadstation\.com/file/(?P<ID>\w+)'
__description__ = """UploadStation.com hoster plugin"""
__license__ = "GPLv3"
diff --git a/module/plugins/hoster/VimeoCom.py b/module/plugins/hoster/VimeoCom.py
index 9e4abf702..0e42c1674 100644
--- a/module/plugins/hoster/VimeoCom.py
+++ b/module/plugins/hoster/VimeoCom.py
@@ -41,7 +41,7 @@ class VimeoCom(SimpleHoster):
html = self.js.eval(self.load(self.pyfile.url, get={'action': "download", 'password': password}, decode=True))
pattern = r'href="(?P<URL>http://vimeo\.com.+?)".*?\>(?P<QL>.+?) '
else:
- id = re.match(self.__pattern__, self.pyfile.url).group("ID")
+ id = re.match(self.__pattern__, self.pyfile.url).group('ID')
html = self.load("https://player.vimeo.com/video/" + id, get={'password': password})
pattern = r'"(?P<QL>\w+)":{"profile".*?"(?P<URL>http://pdl\.vimeocdn\.com.+?)"'
diff --git a/module/plugins/hoster/WebshareCz.py b/module/plugins/hoster/WebshareCz.py
index 7b9c097c5..a08341ff3 100644
--- a/module/plugins/hoster/WebshareCz.py
+++ b/module/plugins/hoster/WebshareCz.py
@@ -41,7 +41,7 @@ class WebshareCz(SimpleHoster):
def handleFree(self):
- fid = re.match(self.__pattern__, self.pyfile.url).group("ID")
+ fid = re.match(self.__pattern__, self.pyfile.url).group('ID')
wst = self.account.infos['wst'] if self.account and 'wst' in self.account.infos else ""
api_data = getURL('https://webshare.cz/api/file_link/',