summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster')
-rw-r--r--module/plugins/hoster/ARD.py13
-rw-r--r--module/plugins/hoster/AlldebridCom.py168
-rw-r--r--module/plugins/hoster/BasePlugin.py48
-rw-r--r--module/plugins/hoster/BayfilesCom.py49
-rw-r--r--module/plugins/hoster/BezvadataCz.py16
-rw-r--r--module/plugins/hoster/BillionuploadsCom.py2
-rw-r--r--module/plugins/hoster/BitshareCom.py92
-rw-r--r--module/plugins/hoster/BoltsharingCom.py2
-rw-r--r--module/plugins/hoster/CatShareNet.py3
-rw-r--r--module/plugins/hoster/ChipDe.py31
-rw-r--r--module/plugins/hoster/CloudzerNet.py5
-rw-r--r--module/plugins/hoster/CramitIn.py12
-rw-r--r--module/plugins/hoster/CrockoCom.py43
-rw-r--r--module/plugins/hoster/CyberlockerCh.py2
-rw-r--r--module/plugins/hoster/CzshareCom.py35
-rw-r--r--module/plugins/hoster/DailymotionCom.py10
-rw-r--r--module/plugins/hoster/DataportCz.py28
-rw-r--r--module/plugins/hoster/DateiTo.py55
-rw-r--r--module/plugins/hoster/DebridItaliaCom.py4
-rw-r--r--module/plugins/hoster/DepositfilesCom.py55
-rw-r--r--module/plugins/hoster/DlFreeFr.py114
-rw-r--r--module/plugins/hoster/EdiskCz.py7
-rw-r--r--module/plugins/hoster/EgoFilesCom.py206
-rw-r--r--module/plugins/hoster/EuroshareEu.py7
-rw-r--r--module/plugins/hoster/ExtabitCom.py9
-rw-r--r--module/plugins/hoster/FastixRu.py66
-rw-r--r--module/plugins/hoster/FastshareCz.py20
-rw-r--r--module/plugins/hoster/FileApeCom.py33
-rw-r--r--module/plugins/hoster/FilecloudIo.py47
-rw-r--r--module/plugins/hoster/FilejungleCom.py14
-rw-r--r--module/plugins/hoster/FilepostCom.py93
-rw-r--r--module/plugins/hoster/FilerNet.py2
-rw-r--r--module/plugins/hoster/FilerioCom.py14
-rw-r--r--module/plugins/hoster/FilesMailRu.py36
-rw-r--r--module/plugins/hoster/FileserveCom.py127
-rw-r--r--module/plugins/hoster/FileshareInUa.py35
-rw-r--r--module/plugins/hoster/FilezyNet.py4
-rw-r--r--module/plugins/hoster/FlyFilesNet.py8
-rw-r--r--module/plugins/hoster/FourSharedCom.py22
-rw-r--r--module/plugins/hoster/FreakshareCom.py338
-rw-r--r--module/plugins/hoster/FreevideoCz.py2
-rw-r--r--module/plugins/hoster/FshareVn.py32
-rw-r--r--module/plugins/hoster/Ftp.py181
-rw-r--r--module/plugins/hoster/GamefrontCom.py39
-rw-r--r--module/plugins/hoster/GigapetaCom.py41
-rw-r--r--module/plugins/hoster/HellshareCz.py10
-rw-r--r--module/plugins/hoster/HellspyCz.py17
-rw-r--r--module/plugins/hoster/HotfileCom.py67
-rw-r--r--module/plugins/hoster/HundredEightyUploadCom.py3
-rw-r--r--module/plugins/hoster/IcyFilesCom.py18
-rw-r--r--module/plugins/hoster/IfileIt.py23
-rw-r--r--module/plugins/hoster/IfolderRu.py18
-rw-r--r--module/plugins/hoster/JumbofilesCom.py11
-rw-r--r--module/plugins/hoster/LetitbitNet.py38
-rw-r--r--module/plugins/hoster/LuckyShareNet.py144
-rw-r--r--module/plugins/hoster/MegaNz.py18
-rw-r--r--module/plugins/hoster/MegacrypterCom.py22
-rw-r--r--module/plugins/hoster/MegasharesCom.py46
-rw-r--r--module/plugins/hoster/MovReelCom.py202
-rw-r--r--module/plugins/hoster/MultiDebridCom.py4
-rw-r--r--module/plugins/hoster/MultishareCz.py52
-rw-r--r--module/plugins/hoster/MyvideoDe.py5
-rw-r--r--module/plugins/hoster/NarodRu.py22
-rw-r--r--module/plugins/hoster/NetloadIn.py90
-rw-r--r--module/plugins/hoster/NovafileCom.py14
-rw-r--r--module/plugins/hoster/NowDownloadEu.py16
-rw-r--r--module/plugins/hoster/OneFichierCom.py41
-rw-r--r--module/plugins/hoster/PornhostCom.py151
-rw-r--r--module/plugins/hoster/PornhubCom.py167
-rw-r--r--module/plugins/hoster/Premium4Me.py140
-rw-r--r--module/plugins/hoster/PremiumizeMe.py105
-rw-r--r--module/plugins/hoster/PutlockerCom.py5
-rw-r--r--module/plugins/hoster/QuickshareCz.py42
-rw-r--r--module/plugins/hoster/RapidgatorNet.py5
-rw-r--r--module/plugins/hoster/RapidshareCom.py122
-rw-r--r--module/plugins/hoster/RarefileNet.py3
-rw-r--r--module/plugins/hoster/RealdebridCom.py178
-rw-r--r--module/plugins/hoster/RedtubeCom.py112
-rw-r--r--module/plugins/hoster/RehostTo.py9
-rw-r--r--module/plugins/hoster/ReloadCc.py32
-rw-r--r--module/plugins/hoster/RyushareCom.py10
-rw-r--r--module/plugins/hoster/SecureUploadEu.py1
-rw-r--r--module/plugins/hoster/SendmywayCom.py1
-rw-r--r--module/plugins/hoster/SendspaceCom.py19
-rw-r--r--module/plugins/hoster/Share4webCom.py6
-rw-r--r--module/plugins/hoster/Share76Com.py2
-rw-r--r--module/plugins/hoster/ShareFilesCo.py8
-rw-r--r--module/plugins/hoster/ShareRapidCom.py44
-rw-r--r--module/plugins/hoster/SharebeesCom.py1
-rw-r--r--module/plugins/hoster/ShareonlineBiz.py124
-rw-r--r--module/plugins/hoster/ShareplaceCom.py168
-rw-r--r--module/plugins/hoster/ShragleCom.py57
-rw-r--r--module/plugins/hoster/SpeedLoadOrg.py4
-rw-r--r--module/plugins/hoster/SpeedfileCz.py6
-rw-r--r--module/plugins/hoster/StreamCz.py36
-rw-r--r--module/plugins/hoster/StreamcloudEu.py27
-rw-r--r--module/plugins/hoster/TurbobitNet.py62
-rw-r--r--module/plugins/hoster/TurbouploadCom.py15
-rw-r--r--module/plugins/hoster/TusfilesNet.py2
-rw-r--r--module/plugins/hoster/TwoSharedCom.py15
-rw-r--r--module/plugins/hoster/UlozTo.py60
-rw-r--r--module/plugins/hoster/UloziskoSk.py13
-rw-r--r--module/plugins/hoster/UnibytesCom.py38
-rw-r--r--module/plugins/hoster/UnrestrictLi.py22
-rw-r--r--module/plugins/hoster/UploadStationCom.py46
-rw-r--r--module/plugins/hoster/UploadedTo.py17
-rw-r--r--module/plugins/hoster/UploadheroCom.py43
-rw-r--r--module/plugins/hoster/UploadingCom.py223
-rw-r--r--module/plugins/hoster/UptoboxCom.py10
-rw-r--r--module/plugins/hoster/VeehdCom.py34
-rw-r--r--module/plugins/hoster/WarserverCz.py41
-rw-r--r--module/plugins/hoster/WebshareCz.py15
-rw-r--r--module/plugins/hoster/WrzucTo.py38
-rw-r--r--module/plugins/hoster/WuploadCom.py6
-rw-r--r--module/plugins/hoster/X7To.py185
-rw-r--r--module/plugins/hoster/XFileSharingPro.py67
-rw-r--r--module/plugins/hoster/XHamsterCom.py39
-rw-r--r--module/plugins/hoster/XVideosCom.py4
-rw-r--r--module/plugins/hoster/Xdcc.py453
-rw-r--r--module/plugins/hoster/YibaishiwuCom.py22
-rw-r--r--module/plugins/hoster/YoupornCom.py11
-rw-r--r--module/plugins/hoster/YourfilesTo.py164
-rw-r--r--module/plugins/hoster/YoutubeCom.py55
-rw-r--r--module/plugins/hoster/ZDF.py9
-rw-r--r--module/plugins/hoster/ZeveraCom.py214
-rw-r--r--module/plugins/hoster/ZippyshareCom.py113
126 files changed, 3513 insertions, 3159 deletions
diff --git a/module/plugins/hoster/ARD.py b/module/plugins/hoster/ARD.py
index 5ab65cd4b..4404994b3 100644
--- a/module/plugins/hoster/ARD.py
+++ b/module/plugins/hoster/ARD.py
@@ -1,4 +1,3 @@
-
import subprocess
import re
import os.path
@@ -10,6 +9,7 @@ from module.plugins.Hoster import Hoster
# Requires rtmpdump
# by Roland Beermann
+
class RTMP:
# TODO: Port to some RTMP-library like rtmpy or similar
# TODO?: Integrate properly into the API of pyLoad
@@ -37,17 +37,20 @@ class RTMP:
return subprocess.check_call(args)
+
class ARD(Hoster):
__name__ = "ARD Mediathek"
- __version__ = "0.1"
+ __version__ = "0.11"
__pattern__ = r"http://www\.ardmediathek\.de/.*"
__config__ = []
def process(self, pyfile):
site = self.load(pyfile.url)
- avail_videos = re.findall(r"""mediaCollection.addMediaStream\(0, ([0-9]*), "([^\"]*)", "([^\"]*)", "[^\"]*"\);""", site)
- avail_videos.sort(key=lambda videodesc: int(videodesc[0]), reverse=True) # The higher the number, the better the quality
+ avail_videos = re.findall(
+ r'mediaCollection.addMediaStream\(0, ([0-9]*), "([^\"]*)", "([^\"]*)", "[^\"]*"\);', site)
+ avail_videos.sort(key=lambda videodesc: int(videodesc[0]),
+ reverse=True) # The higher the number, the better the quality
quality, url, playpath = avail_videos[0]
@@ -73,7 +76,7 @@ class ARD(Hoster):
chown(location, uid, gid)
except Exception, e:
- self.log.warning(_("Setting User and Group failed: %s") % str(e))
+ self.logWarning(_("Setting User and Group failed: %s") % str(e))
output_file = save_join(location, save_path(pyfile.name)) + os.path.splitext(playpath)[1]
diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py
index efc96ff28..cdb5ccc08 100644
--- a/module/plugins/hoster/AlldebridCom.py
+++ b/module/plugins/hoster/AlldebridCom.py
@@ -1,84 +1,84 @@
-# -*- coding: utf-8 -*-
-
-import re
-from urllib import unquote
-from random import randrange
-from module.plugins.Hoster import Hoster
-from module.common.json_layer import json_loads
-from module.utils import parseFileSize
-
-
-class AlldebridCom(Hoster):
- __name__ = "AlldebridCom"
- __version__ = "0.31"
- __type__ = "hoster"
-
- __pattern__ = r"https?://.*alldebrid\..*"
- __description__ = """Alldebrid.com hoster plugin"""
- __author_name__ = ("Andy, Voigt")
- __author_mail__ = ("spamsales@online.de")
-
- def getFilename(self, url):
- try:
- name = unquote(url.rsplit("/", 1)[1])
- except IndexError:
- name = "Unknown_Filename..."
- if name.endswith("..."): #incomplete filename, append random stuff
- name += "%s.tmp" % randrange(100, 999)
- return name
-
- def init(self):
- self.tries = 0
- self.chunkLimit = 3
- self.resumeDownload = True
-
- def process(self, pyfile):
- if not self.account:
- self.logError("Please enter your AllDebrid account or deactivate this plugin")
- self.fail("No AllDebrid account provided")
-
- self.log.debug("AllDebrid: Old URL: %s" % pyfile.url)
- if re.match(self.__pattern__, pyfile.url):
- new_url = pyfile.url
- else:
- password = self.getPassword().splitlines()
- password = "" if not password else password[0]
-
- url = "http://www.alldebrid.com/service.php?link=%s&json=true&pw=%s" % (pyfile.url, password)
- page = self.load(url)
- data = json_loads(page)
-
- self.logDebug("Json data: %s" % str(data))
-
- if data["error"]:
- if data["error"] == "This link isn't available on the hoster website.":
- self.offline()
- else:
- self.logWarning(data["error"])
- self.tempOffline()
- else:
- if self.pyfile.name and not self.pyfile.name.endswith('.tmp'):
- self.pyfile.name = data["filename"]
- self.pyfile.size = parseFileSize(data["filesize"])
- new_url = data["link"]
-
- if self.getConfig("https"):
- new_url = new_url.replace("http://", "https://")
- else:
- new_url = new_url.replace("https://", "http://")
-
- self.logDebug("AllDebrid: New URL: %s" % new_url)
-
- if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"):
- #only use when name wasnt already set
- pyfile.name = self.getFilename(new_url)
-
- self.download(new_url, disposition=True)
-
- check = self.checkDownload({"error": "<title>An error occured while processing your request</title>",
- "empty": re.compile(r"^$")})
-
- if check == "error":
- self.retry(reason="An error occured while generating link.", wait_time=60)
- elif check == "empty":
- self.retry(reason="Downloaded File was empty.", wait_time=60)
+# -*- coding: utf-8 -*-
+
+import re
+from urllib import unquote
+from random import randrange
+from module.plugins.Hoster import Hoster
+from module.common.json_layer import json_loads
+from module.utils import parseFileSize
+
+
+class AlldebridCom(Hoster):
+ __name__ = "AlldebridCom"
+ __version__ = "0.33"
+ __type__ = "hoster"
+
+ __pattern__ = r"https?://.*alldebrid\..*"
+ __description__ = """Alldebrid.com hoster plugin"""
+ __author_name__ = ("Andy, Voigt")
+ __author_mail__ = ("spamsales@online.de")
+
+ def getFilename(self, url):
+ try:
+ name = unquote(url.rsplit("/", 1)[1])
+ except IndexError:
+ name = "Unknown_Filename..."
+ if name.endswith("..."): #incomplete filename, append random stuff
+ name += "%s.tmp" % randrange(100, 999)
+ return name
+
+ def init(self):
+ self.tries = 0
+ self.chunkLimit = 3
+ self.resumeDownload = True
+
+ def process(self, pyfile):
+ if not self.account:
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "AllDebrid")
+ self.fail("No AllDebrid account provided")
+
+ self.logDebug("AllDebrid: Old URL: %s" % pyfile.url)
+ if re.match(self.__pattern__, pyfile.url):
+ new_url = pyfile.url
+ else:
+ password = self.getPassword().splitlines()
+ password = "" if not password else password[0]
+
+ url = "http://www.alldebrid.com/service.php?link=%s&json=true&pw=%s" % (pyfile.url, password)
+ page = self.load(url)
+ data = json_loads(page)
+
+ self.logDebug("Json data: %s" % str(data))
+
+ if data["error"]:
+ if data["error"] == "This link isn't available on the hoster website.":
+ self.offline()
+ else:
+ self.logWarning(data["error"])
+ self.tempOffline()
+ else:
+ if self.pyfile.name and not self.pyfile.name.endswith('.tmp'):
+ self.pyfile.name = data["filename"]
+ self.pyfile.size = parseFileSize(data["filesize"])
+ new_url = data["link"]
+
+ if self.getConfig("https"):
+ new_url = new_url.replace("http://", "https://")
+ else:
+ new_url = new_url.replace("https://", "http://")
+
+ self.logDebug("AllDebrid: New URL: %s" % new_url)
+
+ if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"):
+ #only use when name wasnt already set
+ pyfile.name = self.getFilename(new_url)
+
+ self.download(new_url, disposition=True)
+
+ check = self.checkDownload({"error": "<title>An error occured while processing your request</title>",
+ "empty": re.compile(r"^$")})
+
+ if check == "error":
+ self.retry(reason="An error occured while generating link.", wait_time=60)
+ elif check == "empty":
+ self.retry(reason="Downloaded File was empty.", wait_time=60)
diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py
index f8d494e39..2bdfda7c4 100644
--- a/module/plugins/hoster/BasePlugin.py
+++ b/module/plugins/hoster/BasePlugin.py
@@ -8,11 +8,12 @@ from module.network.HTTPRequest import BadHeader
from module.plugins.Hoster import Hoster
from module.utils import html_unescape, remove_chars
+
class BasePlugin(Hoster):
__name__ = "BasePlugin"
__type__ = "hoster"
__pattern__ = r"^unmatchable$"
- __version__ = "0.17"
+ __version__ = "0.19"
__description__ = """Base Plugin when any other didnt fit"""
__author_name__ = ("RaNaN")
__author_mail__ = ("RaNaN@pyload.org")
@@ -29,17 +30,17 @@ class BasePlugin(Hoster):
self.multiDL = False
return
-# self.__name__ = "NetloadIn"
-# pyfile.name = "test"
-# self.html = self.load("http://localhost:9000/short")
-# self.download("http://localhost:9000/short")
-# self.api = self.load("http://localhost:9000/short")
-# self.decryptCaptcha("http://localhost:9000/captcha")
-#
-# if pyfile.url == "79":
-# self.core.api.addPackage("test", [str(i) for i in range(80)], 1)
-#
-# return
+ # self.__name__ = "NetloadIn"
+ # pyfile.name = "test"
+ # self.html = self.load("http://localhost:9000/short")
+ # self.download("http://localhost:9000/short")
+ # self.api = self.load("http://localhost:9000/short")
+ # self.decryptCaptcha("http://localhost:9000/captcha")
+ #
+ # if pyfile.url == "79":
+ # self.core.api.addPackage("test", [str(i) for i in range(80)], 1)
+ #
+ # return
if pyfile.url.startswith("http"):
try:
@@ -49,7 +50,7 @@ class BasePlugin(Hoster):
self.logDebug("Auth required")
account = self.core.accountManager.getAccountPlugin('Http')
- servers = [ x['login'] for x in account.getAllAccounts() ]
+ servers = [x['login'] for x in account.getAllAccounts()]
server = urlparse(pyfile.url).netloc
if server in servers:
@@ -70,20 +71,25 @@ class BasePlugin(Hoster):
else:
self.fail("No Plugin matched and not a downloadable url.")
-
def downloadFile(self, pyfile):
url = pyfile.url
for i in range(5):
- header = self.load(url, just_header = True)
+ header = self.load(url, just_header=True)
# self.load does not raise a BadHeader on 404 responses, do it here
- if header.has_key('code') and header['code'] == 404:
+ if 'code' in header and header['code'] == 404:
raise BadHeader(404)
if 'location' in header:
self.logDebug("Location: " + header['location'])
- url = unquote(header['location'])
+ base = search(r'https?://[^/]+', url).group(0)
+ if header['location'].startswith("http"):
+ url = unquote(header['location'])
+ elif header['location'].startswith("/"):
+ url = base + unquote(header['location'])
+ else:
+ url = '%s/%s' % (base, unquote(header['location']))
else:
break
@@ -95,11 +101,13 @@ class BasePlugin(Hoster):
if m:
disp = m.groupdict()
self.logDebug(disp)
- if not disp['enc']: disp['enc'] = 'utf-8'
+ if not disp['enc']:
+ disp['enc'] = 'utf-8'
name = remove_chars(disp['name'], "\"';").strip()
name = unicode(unquote(name), disp['enc'])
- if not name: name = url
+ if not name:
+ name = url
pyfile.name = name
self.logDebug("Filename: %s" % pyfile.name)
- self.download(url, disposition=True) \ No newline at end of file
+ self.download(url, disposition=True)
diff --git a/module/plugins/hoster/BayfilesCom.py b/module/plugins/hoster/BayfilesCom.py
index 190d9a952..bb1e78bb3 100644
--- a/module/plugins/hoster/BayfilesCom.py
+++ b/module/plugins/hoster/BayfilesCom.py
@@ -17,10 +17,11 @@
"""
import re
+from time import time
+
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-from module.plugins.ReCaptcha import ReCaptcha
from module.common.json_layer import json_loads
-from time import time
+
class BayfilesCom(SimpleHoster):
__name__ = "BayfilesCom"
@@ -33,50 +34,53 @@ class BayfilesCom(SimpleHoster):
FILE_INFO_PATTERN = r'<p title="(?P<N>[^"]+)">[^<]*<strong>(?P<S>[0-9., ]+)(?P<U>[kKMG])i?B</strong></p>'
FILE_OFFLINE_PATTERN = r'(<p>The requested file could not be found.</p>|<title>404 Not Found</title>)'
-
+
WAIT_PATTERN = r'>Your IP [0-9.]* has recently downloaded a file\. Upgrade to premium or wait (\d+) minutes\.<'
VARS_PATTERN = r'var vfid = (\d+);\s*var delay = (\d+);'
LINK_PATTERN = r"javascript:window.location.href = '([^']+)';"
PREMIUM_LINK_PATTERN = r'(?:<a class="highlighted-btn" href="|(?=http://s\d+\.baycdn\.com/dl/))(.*?)"'
-
+
def handleFree(self):
found = re.search(self.WAIT_PATTERN, self.html)
if found:
self.setWait(int(found.group(1)) * 60)
self.wait()
self.retry()
-
+
# Get download token
found = re.search(self.VARS_PATTERN, self.html)
- if not found: self.parseError('VARS')
+ if not found:
+ self.parseError('VARS')
vfid, delay = found.groups()
-
- response = json_loads(self.load('http://bayfiles.com/ajax_download', get = {
+
+ response = json_loads(self.load('http://bayfiles.com/ajax_download', get={
"_": time() * 1000,
"action": "startTimer",
- "vfid": vfid}, decode = True))
-
- if not "token" in response or not response['token']:
- self.fail('No token')
-
+ "vfid": vfid}, decode=True))
+
+ if not "token" in response or not response['token']:
+ self.fail('No token')
+
self.setWait(int(delay))
self.wait()
-
- self.html = self.load('http://bayfiles.com/ajax_download', get = {
+
+ self.html = self.load('http://bayfiles.com/ajax_download', get={
"token": response['token'],
"action": "getLink",
"vfid": vfid})
# Get final link and download
found = re.search(self.LINK_PATTERN, self.html)
- if not found: self.parseError("Free link")
+ if not found:
+ self.parseError("Free link")
self.startDownload(found.group(1))
-
- def handlePremium(self):
+
+ def handlePremium(self):
found = re.search(self.PREMIUM_LINK_PATTERN, self.html)
- if not found: self.parseError("Premium link")
+ if not found:
+ self.parseError("Premium link")
self.startDownload(found.group(1))
-
+
def startDownload(self, url):
self.logDebug("%s URL: %s" % ("Premium" if self.premium else "Free", url))
self.download(url)
@@ -84,10 +88,11 @@ class BayfilesCom(SimpleHoster):
check = self.checkDownload({
"waitforfreeslots": re.compile(r"<title>BayFiles</title>"),
"notfound": re.compile(r"<title>404 Not Found</title>")
- })
+ })
if check == "waitforfreeslots":
self.retry(60, 300, "Wait for free slot")
elif check == "notfound":
self.retry(60, 300, "404 Not found")
-
+
+
getInfo = create_getInfo(BayfilesCom)
diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py
index cb9bae07c..d923a0633 100644
--- a/module/plugins/hoster/BezvadataCz.py
+++ b/module/plugins/hoster/BezvadataCz.py
@@ -19,6 +19,7 @@
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
class BezvadataCz(SimpleHoster):
__name__ = "BezvadataCz"
__type__ = "hoster"
@@ -38,7 +39,8 @@ class BezvadataCz(SimpleHoster):
def handleFree(self):
#download button
found = re.search(r'<a class="stahnoutSoubor".*?href="(.*?)"', self.html)
- if not found: self.parseError("page1 URL")
+ if not found:
+ self.parseError("page1 URL")
url = "http://bezvadata.cz%s" % found.group(1)
#captcha form
@@ -46,10 +48,12 @@ class BezvadataCz(SimpleHoster):
self.checkErrors()
for i in range(5):
action, inputs = self.parseHtmlForm('frm-stahnoutFreeForm')
- if not inputs: self.parseError("FreeForm")
+ if not inputs:
+ self.parseError("FreeForm")
found = re.search(r'<img src="data:image/png;base64,(.*?)"', self.html)
- if not found: self.parseError("captcha img")
+ if not found:
+ self.parseError("captcha img")
#captcha image is contained in html page as base64encoded data but decryptCaptcha() expects image url
self.load, proper_load = self.loadcaptcha, self.load
@@ -70,7 +74,8 @@ class BezvadataCz(SimpleHoster):
self.html = self.load("http://bezvadata.cz%s" % action, post=inputs)
self.checkErrors()
found = re.search(r'<a class="stahnoutSoubor2" href="(.*?)">', self.html)
- if not found: self.parseError("page2 URL")
+ if not found:
+ self.parseError("page2 URL")
url = "http://bezvadata.cz%s" % found.group(1)
self.logDebug("DL URL %s" % url)
@@ -84,11 +89,12 @@ class BezvadataCz(SimpleHoster):
def checkErrors(self):
if 'images/button-download-disable.png' in self.html:
- self.longWait(300, 24) #parallel dl limit
+ self.longWait(300, 24) # parallel dl limit
elif '<div class="infobox' in self.html:
self.tempOffline()
def loadcaptcha(self, data, *args, **kwargs):
return data.decode("base64")
+
getInfo = create_getInfo(BezvadataCz)
diff --git a/module/plugins/hoster/BillionuploadsCom.py b/module/plugins/hoster/BillionuploadsCom.py
index 5b053d547..91e869c59 100644
--- a/module/plugins/hoster/BillionuploadsCom.py
+++ b/module/plugins/hoster/BillionuploadsCom.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
class BillionuploadsCom(XFileSharingPro):
__name__ = "BillionuploadsCom"
__type__ = "hoster"
@@ -14,4 +15,5 @@ class BillionuploadsCom(XFileSharingPro):
FILE_SIZE_PATTERN = r'<b>Size:</b>(?P<S>.*?)<br>'
HOSTER_NAME = "billionuploads.com"
+
getInfo = create_getInfo(BillionuploadsCom)
diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py
index 644345387..82c2fe9cb 100644
--- a/module/plugins/hoster/BitshareCom.py
+++ b/module/plugins/hoster/BitshareCom.py
@@ -2,58 +2,24 @@
from __future__ import with_statement
import re
-from pycurl import FOLLOWLOCATION
-
-from module.plugins.Hoster import Hoster
-from module.plugins.ReCaptcha import ReCaptcha
-from module.network.RequestFactory import getRequest
-
-
-def getInfo(urls):
- result = []
-
- for url in urls:
-
- # Get file info html
- req = getRequest()
- req.cj.setCookie(BitshareCom.HOSTER_DOMAIN, "language_selection", "EN")
- html = req.load(url)
- req.close()
-
- # Check online
- if re.search(BitshareCom.FILE_OFFLINE_PATTERN, html):
- result.append((url, 0, 1, url))
- continue
-
- # Name
- name1 = re.search(BitshareCom.__pattern__, url).group('name')
- m = re.search(BitshareCom.FILE_INFO_PATTERN, html)
- name2 = m.group('name')
- name = max(name1, name2)
-
- # Size
- value = float(m.group('size'))
- units = m.group('units')
- pow = {'KB' : 1, 'MB' : 2, 'GB' : 3}[units]
- size = int(value*1024**pow)
-
- # Return info
- result.append((name, size, 2, url))
-
- yield result
-
-class BitshareCom(Hoster):
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.plugins.internal.CaptchaService import ReCaptcha
+
+
+class BitshareCom(SimpleHoster):
__name__ = "BitshareCom"
__type__ = "hoster"
__pattern__ = r"http://(www\.)?bitshare\.com/(files/(?P<id1>[a-zA-Z0-9]+)(/(?P<name>.*?)\.html)?|\?f=(?P<id2>[a-zA-Z0-9]+))"
- __version__ = "0.47"
+ __version__ = "0.48"
__description__ = """Bitshare.Com File Download Hoster"""
__author_name__ = ("paulking", "fragonib")
__author_mail__ = (None, "fragonib[AT]yahoo[DOT]es")
-
+
HOSTER_DOMAIN = "bitshare.com"
- FILE_OFFLINE_PATTERN = r'''(>We are sorry, but the requested file was not found in our database|>Error - File not available<|The file was deleted either by the uploader, inactivity or due to copyright claim)'''
- FILE_INFO_PATTERN = r'<h1>(Downloading|Streaming)\s(?P<name>.+?)\s-\s(?P<size>[\d.]+)\s(?P<units>..)yte</h1>'
+ FILE_OFFLINE_PATTERN = r'(>We are sorry, but the requested file was not found in our database|>Error - File not available<|The file was deleted either by the uploader, inactivity or due to copyright claim)'
+ FILE_NAME_PATTERN = r'Download:</td>\s*<td><input type="text" value="http://bitshare\.com/files/\w+/(?P<N>[^"]+)\.html"'
+ FILE_SIZE_PATTERN = r'- (?P<S>[\d.]+) (?P<U>\w+)</h1>'
FILE_AJAXID_PATTERN = r'var ajaxdl = "(.*?)";'
CAPTCHA_KEY_PATTERN = r"http://api\.recaptcha\.net/challenge\?k=(.*?) "
TRAFFIC_USED_UP = r"Your Traffic is used up for today. Upgrade to premium to continue!"
@@ -65,12 +31,12 @@ class BitshareCom(Hoster):
def process(self, pyfile):
if self.premium:
self.account.relogin(self.user)
-
+
self.pyfile = pyfile
-
+
# File id
m = re.match(self.__pattern__, self.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
@@ -100,24 +66,23 @@ class BitshareCom(Hoster):
# Ajax file id
self.ajaxid = re.search(BitshareCom.FILE_AJAXID_PATTERN, self.html).group(1)
self.logDebug("File ajax id is [%s]" % self.ajaxid)
-
+
# This may either download our file or forward us to an error page
- url = self.getDownloadUrl()
+ url = self.getDownloadUrl()
self.logDebug("Downloading file with url [%s]" % url)
self.download(url)
-
def getDownloadUrl(self):
# Return location if direct download is active
if self.premium:
- header = self.load(self.pyfile.url, cookies = True, just_header = True)
+ header = self.load(self.pyfile.url, cookies=True, just_header=True)
if 'location' in header:
- return header['location']
-
+ return header['location']
+
# Get download info
self.logDebug("Getting download info")
response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html",
- post={"request" : "generateID", "ajaxid" : self.ajaxid})
+ post={"request": "generateID", "ajaxid": self.ajaxid})
self.handleErrors(response, ':')
parts = response.split(":")
filetype = parts[0]
@@ -142,24 +107,24 @@ class BitshareCom(Hoster):
id = re.search(BitshareCom.CAPTCHA_KEY_PATTERN, self.html).group(1)
# Try up to 3 times
for i in range(3):
- self.logDebug("Resolving ReCaptcha with key [%s], round %d" % (id, i+1))
+ self.logDebug("Resolving ReCaptcha with key [%s], round %d" % (id, i + 1))
recaptcha = ReCaptcha(self)
challenge, code = recaptcha.challenge(id)
response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html",
- post={"request" : "validateCaptcha", "ajaxid" : self.ajaxid, "recaptcha_challenge_field" : challenge, "recaptcha_response_field" : code})
+ post={"request": "validateCaptcha", "ajaxid": self.ajaxid,
+ "recaptcha_challenge_field": challenge, "recaptcha_response_field": code})
if self.handleCaptchaErrors(response):
break
-
# Get download URL
self.logDebug("Getting download url")
response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html",
- post={"request" : "getDownloadURL", "ajaxid" : self.ajaxid})
+ post={"request": "getDownloadURL", "ajaxid": self.ajaxid})
self.handleErrors(response, '#')
- url = response.split("#")[-1]
-
+ url = response.split("#")[-1]
+
return url
-
+
def handleErrors(self, response, separator):
self.logDebug("Checking response [%s]" % response)
if "ERROR:Session timed out" in response:
@@ -177,3 +142,6 @@ class BitshareCom(Hoster):
self.retry()
self.logDebug("Wrong captcha")
self.invalidCaptcha()
+
+
+getInfo = create_getInfo(BitshareCom)
diff --git a/module/plugins/hoster/BoltsharingCom.py b/module/plugins/hoster/BoltsharingCom.py
index 2f42c8b23..f9cc91ca5 100644
--- a/module/plugins/hoster/BoltsharingCom.py
+++ b/module/plugins/hoster/BoltsharingCom.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
class BoltsharingCom(XFileSharingPro):
__name__ = "BoltsharingCom"
__type__ = "hoster"
@@ -12,4 +13,5 @@ class BoltsharingCom(XFileSharingPro):
HOSTER_NAME = "boltsharing.com"
+
getInfo = create_getInfo(BoltsharingCom)
diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py
index 47063096e..66d46c2e8 100644
--- a/module/plugins/hoster/CatShareNet.py
+++ b/module/plugins/hoster/CatShareNet.py
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-from module.plugins.ReCaptcha import ReCaptcha
+from module.plugins.internal.CaptchaService import ReCaptcha
class CatShareNet(SimpleHoster):
@@ -35,4 +35,5 @@ class CatShareNet(SimpleHoster):
self.invalidCaptcha()
self.retry()
+
getInfo = create_getInfo(CatShareNet)
diff --git a/module/plugins/hoster/ChipDe.py b/module/plugins/hoster/ChipDe.py
index fcb84a300..8e13b914d 100644
--- a/module/plugins/hoster/ChipDe.py
+++ b/module/plugins/hoster/ChipDe.py
@@ -4,21 +4,22 @@
import re
from module.plugins.Crypter import Crypter
+
class ChipDe(Crypter):
- __name__ = "ChipDe"
- __type__ = "container"
- __pattern__ = r"http://(?:www\.)?chip.de/video/.*\.html"
- __version__ = "0.1"
- __description__ = """Chip.de Container Plugin"""
- __author_name__ = ('4Christopher')
- __author_mail__ = ('4Christopher@gmx.de')
+ __name__ = "ChipDe"
+ __type__ = "container"
+ __pattern__ = r"http://(?:www\.)?chip.de/video/.*\.html"
+ __version__ = "0.1"
+ __description__ = """Chip.de Container Plugin"""
+ __author_name__ = ('4Christopher')
+ __author_mail__ = ('4Christopher@gmx.de')
- def decrypt(self, pyfile):
- self.html = self.load(pyfile.url)
- try:
- url = re.search(r'"(http://video.chip.de/\d+?/.*)"', self.html).group(1)
- self.logDebug('The file URL is %s' % url)
- except:
- self.fail('Failed to find the URL')
+ def decrypt(self, pyfile):
+ self.html = self.load(pyfile.url)
+ try:
+ url = re.search(r'"(http://video.chip.de/\d+?/.*)"', self.html).group(1)
+ self.logDebug('The file URL is %s' % url)
+ except:
+ self.fail('Failed to find the URL')
- self.packages.append((self.pyfile.package().name, [ url ], self.pyfile.package().folder))
+ self.packages.append((self.pyfile.package().name, [url], self.pyfile.package().folder))
diff --git a/module/plugins/hoster/CloudzerNet.py b/module/plugins/hoster/CloudzerNet.py
index 2701752ce..e95f90792 100644
--- a/module/plugins/hoster/CloudzerNet.py
+++ b/module/plugins/hoster/CloudzerNet.py
@@ -2,7 +2,7 @@
import re
from module.plugins.internal.SimpleHoster import SimpleHoster
from module.common.json_layer import json_loads
-from module.plugins.ReCaptcha import ReCaptcha
+from module.plugins.internal.CaptchaService import ReCaptcha
from module.network.RequestFactory import getURL
from module.utils import parseFileSize
@@ -52,7 +52,8 @@ class CloudzerNet(SimpleHoster):
recaptcha = ReCaptcha(self)
challenge, response = recaptcha.challenge(self.CAPTCHA_KEY)
post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response}
- response = json_loads(self.load('http://cloudzer.net/io/ticket/captcha/%s' % self.file_info['ID'], post=post_data, cookies=True))
+ response = json_loads(self.load('http://cloudzer.net/io/ticket/captcha/%s' % self.file_info['ID'],
+ post=post_data, cookies=True))
self.logDebug("Captcha check response", response)
self.logDebug("First check")
diff --git a/module/plugins/hoster/CramitIn.py b/module/plugins/hoster/CramitIn.py
index 171fba0ff..68df322f5 100644
--- a/module/plugins/hoster/CramitIn.py
+++ b/module/plugins/hoster/CramitIn.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
class CramitIn(XFileSharingPro):
__name__ = "CramitIn"
__type__ = "hoster"
@@ -9,12 +10,13 @@ class CramitIn(XFileSharingPro):
__description__ = """Cramit.in hoster plugin"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
-
+
FILE_INFO_PATTERN = r'<span class=t2>\s*(?P<N>.*?)</span>.*?<small>\s*\((?P<S>.*?)\)'
- DIRECT_LINK_PATTERN = r'href="(http://cramit.in/file_download/.*?)"'
+ DIRECT_LINK_PATTERN = r'href="(http://cramit.in/file_download/.*?)"'
HOSTER_NAME = "cramit.in"
-
+
def setup(self):
- self.resumeDownload = self.multiDL = self.premium
+ self.resumeDownload = self.multiDL = self.premium
+
-getInfo = create_getInfo(CramitIn) \ No newline at end of file
+getInfo = create_getInfo(CramitIn)
diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py
index 27ab52436..7d5336cd9 100644
--- a/module/plugins/hoster/CrockoCom.py
+++ b/module/plugins/hoster/CrockoCom.py
@@ -1,15 +1,17 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-from module.plugins.ReCaptcha import ReCaptcha
import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.plugins.internal.CaptchaService import ReCaptcha
+
+
class CrockoCom(SimpleHoster):
__name__ = "CrockoCom"
__type__ = "hoster"
__pattern__ = r"http://(www\.)?(crocko|easy-share).com/.*"
- __version__ = "0.13"
+ __version__ = "0.14"
__description__ = """Crocko Download Hoster"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
@@ -20,45 +22,46 @@ class CrockoCom(SimpleHoster):
DOWNLOAD_URL_PATTERN = r"window.location ='([^']+)';"
CAPTCHA_URL_PATTERN = re.compile(r"u='(/file_contents/captcha/\w+)';\s*w='(\d+)';")
CAPTCHA_KEY_PATTERN = re.compile(r'Recaptcha.create\("([^"]+)"')
-
+
FORM_PATTERN = r'<form method="post" action="([^"]+)">(.*?)</form>'
FORM_INPUT_PATTERN = r'<input[^>]* name="?([^" ]+)"? value="?([^" ]+)"?[^>]*>'
-
+
FILE_NAME_REPLACEMENTS = [(r'<[^>]*>', '')]
def handleFree(self):
if "You need Premium membership to download this file." in self.html:
self.fail("You need Premium membership to download this file.")
-
- url = False
+
for i in range(5):
found = re.search(self.CAPTCHA_URL_PATTERN, self.html)
- if found:
+ if found:
url, wait_time = 'http://crocko.com' + found.group(1), found.group(2)
self.setWait(wait_time)
self.wait()
self.html = self.load(url)
- else:
- break
-
+ else:
+ break
+
found = re.search(self.CAPTCHA_KEY_PATTERN, self.html)
- if not found: self.parseError('Captcha KEY')
+ if not found:
+ self.parseError('Captcha KEY')
captcha_key = found.group(1)
-
+
found = re.search(self.FORM_PATTERN, self.html, re.DOTALL)
- if not found: self.parseError('ACTION')
+ if not found:
+ self.parseError('ACTION')
action, form = found.groups()
inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form))
-
+
recaptcha = ReCaptcha(self)
-
+
for i in range(5):
inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key)
- self.download(action, post = inputs)
-
+ self.download(action, post=inputs)
+
check = self.checkDownload({
"captcha_err": self.CAPTCHA_KEY_PATTERN
- })
+ })
if check == "captcha_err":
self.invalidCaptcha()
@@ -67,5 +70,5 @@ class CrockoCom(SimpleHoster):
else:
self.fail('No valid captcha solution received')
+
getInfo = create_getInfo(CrockoCom)
- \ No newline at end of file
diff --git a/module/plugins/hoster/CyberlockerCh.py b/module/plugins/hoster/CyberlockerCh.py
index 57dd26787..19a4473b3 100644
--- a/module/plugins/hoster/CyberlockerCh.py
+++ b/module/plugins/hoster/CyberlockerCh.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
class CyberlockerCh(XFileSharingPro):
__name__ = "CyberlockerCh"
__type__ = "hoster"
@@ -12,4 +13,5 @@ class CyberlockerCh(XFileSharingPro):
HOSTER_NAME = "cyberlocker.ch"
+
getInfo = create_getInfo(CyberlockerCh)
diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py
index 347427586..8f6f76d84 100644
--- a/module/plugins/hoster/CzshareCom.py
+++ b/module/plugins/hoster/CzshareCom.py
@@ -23,6 +23,7 @@ import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError
from module.utils import parseFileSize
+
class CzshareCom(SimpleHoster):
__name__ = "CzshareCom"
__type__ = "hoster"
@@ -34,7 +35,7 @@ class CzshareCom(SimpleHoster):
FILE_NAME_PATTERN = r'<div class="tab" id="parameters">\s*<p>\s*Cel. n.zev: <a href=[^>]*>(?P<N>[^<]+)</a>'
FILE_SIZE_PATTERN = r'<div class="tab" id="category">(?:\s*<p>[^\n]*</p>)*\s*Velikost:\s*(?P<S>[0-9., ]+)(?P<U>[kKMG])i?B\s*</div>'
FILE_OFFLINE_PATTERN = r'<div class="header clearfix">\s*<h2 class="red">'
-
+
FILE_SIZE_REPLACEMENTS = [(' ', '')]
FILE_URL_REPLACEMENTS = [(r'http://[^/]*/download.php\?.*?id=(\w+).*', r'http://czshare.com/\1/x/')]
SH_CHECK_TRAFFIC = True
@@ -57,11 +58,12 @@ class CzshareCom(SimpleHoster):
self.account.relogin(self.user)
self.html = self.load(self.pyfile.url, cookies=True, decode=True)
found = re.search(self.USER_CREDIT_PATTERN, self.html)
- if not found: return False
+ if not found:
+ return False
# check user credit
try:
- credit = parseFileSize(found.group(1).replace(' ',''), found.group(2))
+ credit = parseFileSize(found.group(1).replace(' ', ''), found.group(2))
self.logInfo("Premium download for %i KiB of Credit" % (self.pyfile.size / 1024))
self.logInfo("User %s has %i KiB left" % (self.user, credit / 1024))
if credit < self.pyfile.size:
@@ -70,11 +72,11 @@ class CzshareCom(SimpleHoster):
except Exception, e:
# let's continue and see what happens...
self.logError('Parse error (CREDIT): %s' % e)
-
- return True
-
- def handlePremium(self):
- # parse download link
+
+ return True
+
+ def handlePremium(self):
+ # parse download link
try:
form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.DOTALL).group(1)
inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form))
@@ -121,20 +123,20 @@ class CzshareCom(SimpleHoster):
break
else:
self.fail("No valid captcha code entered")
-
+
found = re.search("countdown_number = (\d+);", self.html)
self.setWait(int(found.group(1)) if found else 50)
# download the file, destination is determined by pyLoad
- self.logDebug("WAIT URL", self.req.lastEffectiveURL)
- found = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL)
+ self.logDebug("WAIT URL", self.req.lastEffectiveURL)
+ found = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL)
if not found:
raise PluginParseError('Download URL')
url = "http://%s/download.php?%s" % (found.group(1), found.group(2))
-
- self.wait()
- self.multiDL = True
+
+ self.wait()
+ self.multiDL = True
self.download(url)
self.checkDownloadedFile()
@@ -145,7 +147,7 @@ class CzshareCom(SimpleHoster):
"credit": re.compile(r"^Nem.*te dostate.*n.* kredit.$"),
"multi_dl": re.compile(self.MULTIDL_PATTERN),
"captcha_err": "<li>Zadaný ověřovací kód nesouhlasí!</li>"
- })
+ })
if check == "tempoffline":
self.fail("File not available - try later")
@@ -156,5 +158,6 @@ class CzshareCom(SimpleHoster):
elif check == "captcha_err":
self.invalidCaptcha()
self.retry()
-
+
+
getInfo = create_getInfo(CzshareCom)
diff --git a/module/plugins/hoster/DailymotionCom.py b/module/plugins/hoster/DailymotionCom.py
index 1b411393d..ab8ff7910 100644
--- a/module/plugins/hoster/DailymotionCom.py
+++ b/module/plugins/hoster/DailymotionCom.py
@@ -5,6 +5,7 @@ import re
from urllib import unquote
from module.plugins.Hoster import Hoster
+
class DailymotionCom(Hoster):
__name__ = 'DailymotionCom'
__type__ = 'hoster'
@@ -22,12 +23,13 @@ class DailymotionCom(Hoster):
r'<span class="title foreground" title="(.*?)">',
r'"(?:vs_videotitle|videoTitle|dm_title|ss_mediaTitle)": "(.*?)"'):
filename = re.search(pattern, html)
- if filename is not None: break
+ if filename is not None:
+ break
else:
self.fail("Unable to find file name")
- pyfile.name = filename.group(1)+'.mp4'
- self.logDebug('Filename='+pyfile.name)
+ pyfile.name = filename.group(1) + '.mp4'
+ self.logDebug('Filename=' + pyfile.name)
allLinksInfo = re.search(r'"sequence":"(.*?)"', html)
self.logDebug(allLinksInfo.groups())
allLinksInfo = unquote(allLinksInfo.group(1))
@@ -44,4 +46,4 @@ class DailymotionCom(Hoster):
def getQuality(self, quality, data):
link = re.search('"' + quality + '":"(http:[^<>"\']+)"', data)
if link is not None:
- return link.group(1).replace('\\','') \ No newline at end of file
+ return link.group(1).replace('\\', '')
diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py
index 3dc581bf1..1e24388d7 100644
--- a/module/plugins/hoster/DataportCz.py
+++ b/module/plugins/hoster/DataportCz.py
@@ -16,10 +16,9 @@
@author: zoidberg
"""
-import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError
-from pycurl import FOLLOWLOCATION
-
+
+
class DataportCz(SimpleHoster):
__name__ = "DataportCz"
__type__ = "hoster"
@@ -32,26 +31,26 @@ class DataportCz(SimpleHoster):
FILE_SIZE_PATTERN = r'<td class="fil">Velikost</td>\s*<td>(?P<S>[^<]+)</td>'
FILE_OFFLINE_PATTERN = r'<h2>Soubor nebyl nalezen</h2>'
FILE_URL_REPLACEMENTS = [(__pattern__, r'http://www.dataport.cz/file/\1')]
-
- CAPTCHA_URL_PATTERN = r'<section id="captcha_bg">\s*<img src="(.*?)"'
+
+ CAPTCHA_URL_PATTERN = r'<section id="captcha_bg">\s*<img src="(.*?)"'
FREE_SLOTS_PATTERN = ur'Počet volných slotů: <span class="darkblue">(\d+)</span><br />'
- def handleFree(self):
+ def handleFree(self):
captchas = {"1": "jkeG", "2": "hMJQ", "3": "vmEK", "4": "ePQM", "5": "blBd"}
-
+
for i in range(60):
action, inputs = self.parseHtmlForm('free_download_form')
self.logDebug(action, inputs)
if not action or not inputs:
raise PluginParseError('free_download_form')
-
+
if "captchaId" in inputs and inputs["captchaId"] in captchas:
- inputs['captchaCode'] = captchas[inputs["captchaId"]]
+ inputs['captchaCode'] = captchas[inputs["captchaId"]]
else:
raise PluginParseError('captcha')
-
- self.html = self.download("http://www.dataport.cz%s" % action, post = inputs)
-
+
+ self.html = self.download("http://www.dataport.cz%s" % action, post=inputs)
+
check = self.checkDownload({"captcha": 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");',
"slot": 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'})
if check == "captcha":
@@ -60,9 +59,10 @@ class DataportCz(SimpleHoster):
self.logDebug("No free slots - wait 60s and retry")
self.setWait(60, False)
self.wait()
- self.html = self.load(self.pyfile.url, decode = True)
+ self.html = self.load(self.pyfile.url, decode=True)
continue
else:
break
-
+
+
create_getInfo(DataportCz) \ No newline at end of file
diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py
index 8d994c179..d7760d940 100644
--- a/module/plugins/hoster/DateiTo.py
+++ b/module/plugins/hoster/DateiTo.py
@@ -18,7 +18,8 @@
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-from module.plugins.ReCaptcha import ReCaptcha
+from module.plugins.internal.CaptchaService import ReCaptcha
+
class DateiTo(SimpleHoster):
__name__ = "DateiTo"
@@ -33,47 +34,48 @@ class DateiTo(SimpleHoster):
FILE_SIZE_PATTERN = r'Dateigr&ouml;&szlig;e:</td>\s*<td colspan="2">(?P<S>.*?)</'
FILE_OFFLINE_PATTERN = r'>Datei wurde nicht gefunden<|>Bitte wähle deine Datei aus... <'
PARALELL_PATTERN = r'>Du lädst bereits eine Datei herunter<'
-
+
WAIT_PATTERN = r'countdown\({seconds: (\d+)'
DATA_PATTERN = r'url: "(.*?)", data: "(.*?)",'
RECAPTCHA_KEY_PATTERN = r'Recaptcha.create\("(.*?)"'
-
+
def handleFree(self):
url = 'http://datei.to/ajax/download.php'
data = {'P': 'I', 'ID': self.file_info['ID']}
-
- recaptcha = ReCaptcha(self)
-
+
+ recaptcha = ReCaptcha(self)
+
for i in range(10):
- self.logDebug("URL", url, "POST", data)
- self.html = self.load(url, post = data)
+ self.logDebug("URL", url, "POST", data)
+ self.html = self.load(url, post=data)
self.checkErrors()
-
+
if url.endswith('download.php') and 'P' in data:
if data['P'] == 'I':
self.doWait()
-
+
elif data['P'] == 'IV':
- break
-
+ break
+
found = re.search(self.DATA_PATTERN, self.html)
- if not found: self.parseError('data')
+ if not found:
+ self.parseError('data')
url = 'http://datei.to/' + found.group(1)
data = dict(x.split('=') for x in found.group(2).split('&'))
-
+
if url.endswith('recaptcha.php'):
found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html)
recaptcha_key = found.group(1) if found else "6LdBbL8SAAAAAI0vKUo58XRwDd5Tu_Ze1DA7qTao"
-
- data['recaptcha_challenge_field'], data['recaptcha_response_field'] = recaptcha.challenge(recaptcha_key)
-
+
+ data['recaptcha_challenge_field'], data['recaptcha_response_field'] = recaptcha.challenge(recaptcha_key)
+
else:
- self.fail('Too bad...')
-
+ self.fail('Too bad...')
+
download_url = self.html
self.logDebug('Download URL', download_url)
self.download(download_url)
-
+
def checkErrors(self):
found = re.search(self.PARALELL_PATTERN, self.html)
if found:
@@ -82,13 +84,14 @@ class DateiTo(SimpleHoster):
self.setWait(wait_time + 1, False)
self.wait(300)
self.retry()
-
- def doWait(self):
+
+ def doWait(self):
found = re.search(self.WAIT_PATTERN, self.html)
wait_time = int(found.group(1)) if found else 30
self.setWait(wait_time + 1, False)
-
- self.load('http://datei.to/ajax/download.php', post = {'P': 'Ads'})
- self.wait()
-
+
+ self.load('http://datei.to/ajax/download.php', post={'P': 'Ads'})
+ self.wait()
+
+
getInfo = create_getInfo(DateiTo)
diff --git a/module/plugins/hoster/DebridItaliaCom.py b/module/plugins/hoster/DebridItaliaCom.py
index 470c4ae5d..1c2f4246b 100644
--- a/module/plugins/hoster/DebridItaliaCom.py
+++ b/module/plugins/hoster/DebridItaliaCom.py
@@ -22,7 +22,7 @@ from module.plugins.Hoster import Hoster
class DebridItaliaCom(Hoster):
__name__ = "DebridItaliaCom"
- __version__ = "0.03"
+ __version__ = "0.04"
__type__ = "hoster"
__pattern__ = r"https?://.*debriditalia\.com"
__description__ = """Debriditalia.com hoster plugin"""
@@ -35,7 +35,7 @@ class DebridItaliaCom(Hoster):
def process(self, pyfile):
if not self.account:
- self.logError("Please enter your DebridItalia account or deactivate this plugin")
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "DebridItalia")
self.fail("No DebridItalia account provided")
self.logDebug("Old URL: %s" % pyfile.url)
diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py
index eb64ae4de..1ede3b715 100644
--- a/module/plugins/hoster/DepositfilesCom.py
+++ b/module/plugins/hoster/DepositfilesCom.py
@@ -4,14 +4,14 @@
import re
from urllib import unquote
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-from module.network.RequestFactory import getURL
-from module.plugins.ReCaptcha import ReCaptcha
+from module.plugins.internal.CaptchaService import ReCaptcha
+
class DepositfilesCom(SimpleHoster):
__name__ = "DepositfilesCom"
__type__ = "hoster"
__pattern__ = r"http://[\w\.]*?(depositfiles\.com|dfiles\.eu)(/\w{1,3})?/files/[\w]+"
- __version__ = "0.43"
+ __version__ = "0.44"
__description__ = """Depositfiles.com Download Hoster"""
__author_name__ = ("spoob", "zoidberg")
__author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz")
@@ -21,7 +21,8 @@ class DepositfilesCom(SimpleHoster):
FILE_INFO_PATTERN = r'<script type="text/javascript">eval\( unescape\(\'(?P<N>.*?)\''
FILE_OFFLINE_PATTERN = r'<span class="html_download_api-not_exists"></span>'
FILE_URL_REPLACEMENTS = [(r"\.com(/.*?)?/files", ".com/en/files"), (r"\.html$", "")]
- FILE_NAME_REPLACEMENTS = [(r'\%u([0-9A-Fa-f]{4})', lambda m: unichr(int(m.group(1), 16))), (r'.*<b title="(?P<N>[^"]+).*', "\g<N>" )]
+ FILE_NAME_REPLACEMENTS = [(r'\%u([0-9A-Fa-f]{4})', lambda m: unichr(int(m.group(1), 16))),
+ (r'.*<b title="(?P<N>[^"]+).*', "\g<N>" )]
RECAPTCHA_PATTERN = r"Recaptcha.create\('([^']+)'"
DOWNLOAD_LINK_PATTERN = r'<form id="downloader_file_form" action="(http://.+?\.(dfiles\.eu|depositfiles\.com)/.+?)" method="post"'
@@ -31,11 +32,12 @@ class DepositfilesCom(SimpleHoster):
self.resumeDownload = self.premium
def handleFree(self):
- self.html = self.load(self.pyfile.url, post={"gateway_result":"1"}, cookies = True)
- if re.search(self.FILE_OFFLINE_PATTERN, self.html): self.offline()
+ self.html = self.load(self.pyfile.url, post={"gateway_result": "1"}, cookies=True)
+ if re.search(self.FILE_OFFLINE_PATTERN, self.html):
+ self.offline()
if re.search(r'File is checked, please try again in a minute.', self.html) is not None:
- self.log.info("DepositFiles.com: The file is being checked. Waiting 1 minute.")
+ self.logInfo("DepositFiles.com: The file is being checked. Waiting 1 minute.")
self.setWait(61)
self.wait()
self.retry()
@@ -43,7 +45,7 @@ class DepositfilesCom(SimpleHoster):
wait = re.search(r'html_download_api-limit_interval\">(\d+)</span>', self.html)
if wait:
wait_time = int(wait.group(1))
- self.log.info( "%s: Traffic used up. Waiting %d seconds." % (self.__name__, wait_time) )
+ self.logInfo("%s: Traffic used up. Waiting %d seconds." % (self.__name__, wait_time))
self.setWait(wait_time)
self.wantReconnect = True
self.wait()
@@ -52,7 +54,7 @@ class DepositfilesCom(SimpleHoster):
wait = re.search(r'>Try in (\d+) minutes or use GOLD account', self.html)
if wait:
wait_time = int(wait.group(1))
- self.log.info( "%s: All free slots occupied. Waiting %d minutes." % (self.__name__, wait_time) )
+ self.logInfo("%s: All free slots occupied. Waiting %d minutes." % (self.__name__, wait_time))
self.setWait(wait_time * 60, False)
wait = re.search(r'Please wait (\d+) sec', self.html)
@@ -60,33 +62,38 @@ class DepositfilesCom(SimpleHoster):
self.setWait(int(wait.group(1)))
found = re.search(r"var fid = '(\w+)';", self.html)
- if not found: self.retry(wait_time=5)
- params = {'fid' : found.group(1)}
- self.logDebug ("FID: %s" % params['fid'])
+ if not found:
+ self.retry(wait_time=5)
+ params = {'fid': found.group(1)}
+ self.logDebug("FID: %s" % params['fid'])
captcha_key = '6LdRTL8SAAAAAE9UOdWZ4d0Ky-aeA7XfSqyWDM2m'
found = re.search(self.RECAPTCHA_PATTERN, self.html)
- if found: captcha_key = found.group(1)
- self.logDebug ("CAPTCHA_KEY: %s" % captcha_key)
+ if found:
+ captcha_key = found.group(1)
+ self.logDebug("CAPTCHA_KEY: %s" % captcha_key)
self.wait()
recaptcha = ReCaptcha(self)
for i in range(5):
- self.html = self.load("http://depositfiles.com/get_file.php", get = params)
+ self.html = self.load("http://depositfiles.com/get_file.php", get=params)
if '<input type=button value="Continue" onclick="check_recaptcha' in self.html:
- if not captcha_key: self.parseError('Captcha key')
- if 'response' in params: self.invalidCaptcha()
+ if not captcha_key:
+ self.parseError('Captcha key')
+ if 'response' in params:
+ self.invalidCaptcha()
params['challenge'], params['response'] = recaptcha.challenge(captcha_key)
self.logDebug(params)
continue
found = re.search(self.DOWNLOAD_LINK_PATTERN, self.html)
if found:
- if 'response' in params: self.correctCaptcha()
+ if 'response' in params:
+ self.correctCaptcha()
link = unquote(found.group(1))
- self.logDebug ("LINK: %s" % link)
+ self.logDebug("LINK: %s" % link)
break
else:
self.parseError('Download link')
@@ -94,9 +101,9 @@ class DepositfilesCom(SimpleHoster):
self.fail('No valid captcha response received')
try:
- self.download(link, disposition = True)
+ self.download(link, disposition=True)
except:
- self.retry(wait_time = 60)
+ self.retry(wait_time=60)
def handlePremium(self):
if '<span class="html_download_api-gold_traffic_limit">' in self.html:
@@ -105,8 +112,10 @@ class DepositfilesCom(SimpleHoster):
elif 'onClick="show_gold_offer' in self.html:
self.account.relogin(self.user)
self.retry()
- link = unquote(re.search('<div id="download_url">\s*<a href="(http://.+?\.depositfiles.com/.+?)"', self.html).group(1))
+ link = unquote(
+ re.search('<div id="download_url">\s*<a href="(http://.+?\.depositfiles.com/.+?)"', self.html).group(1))
self.multiDL = True
- self.download(link, disposition = True)
+ self.download(link, disposition=True)
+
getInfo = create_getInfo(DepositfilesCom)
diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py
index 44906e7e8..bb2dfa036 100644
--- a/module/plugins/hoster/DlFreeFr.py
+++ b/module/plugins/hoster/DlFreeFr.py
@@ -2,17 +2,18 @@
# -*- coding: utf-8 -*-
import re
+import pycurl
+
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns
from module.common.json_layer import json_loads
-
-import pycurl
from module.network.Browser import Browser
from module.network.CookieJar import CookieJar
+
class CustomBrowser(Browser):
def __init__(self, bucket=None, options={}):
Browser.__init__(self, bucket, options)
-
+
def load(self, *args, **kwargs):
post = kwargs.get("post")
if post is None:
@@ -28,30 +29,36 @@ class CustomBrowser(Browser):
self.http.c.setopt(pycurl.CUSTOMREQUEST, "GET")
return Browser.load(self, *args, **kwargs)
-"""
-Class to support adyoulike captcha service
-"""
+
class AdYouLike():
+ """
+ Class to support adyoulike captcha service
+ """
ADYOULIKE_INPUT_PATTERN = r'Adyoulike.create\((.*?)\);'
ADYOULIKE_CALLBACK = r'Adyoulike.g._jsonp_5579316662423138'
- ADYOULIKE_CHALLENGE_PATTERN = ADYOULIKE_CALLBACK + r'\((.*?)\)'
-
- def __init__(self, plugin, engine = "adyoulike"):
+ ADYOULIKE_CHALLENGE_PATTERN = ADYOULIKE_CALLBACK + r'\((.*?)\)'
+
+ def __init__(self, plugin, engine="adyoulike"):
self.plugin = plugin
self.engine = engine
-
- def challenge(self, html):
+
+ def challenge(self, html):
adyoulike_data_string = None
found = re.search(self.ADYOULIKE_INPUT_PATTERN, html)
if found:
adyoulike_data_string = found.group(1)
else:
self.plugin.fail("Can't read AdYouLike input data")
-
- ayl_data = json_loads(adyoulike_data_string) #{"adyoulike":{"key":"P~zQ~O0zV0WTiAzC-iw0navWQpCLoYEP"},"all":{"element_id":"ayl_private_cap_92300","lang":"fr","env":"prod"}}
- res = self.plugin.load(r'http://api-ayl.appspot.com/challenge?key=%(ayl_key)s&env=%(ayl_env)s&callback=%(callback)s' % {"ayl_key": ayl_data[self.engine]["key"], "ayl_env": ayl_data["all"]["env"], "callback": self.ADYOULIKE_CALLBACK})
-
+ # {"adyoulike":{"key":"P~zQ~O0zV0WTiAzC-iw0navWQpCLoYEP"},
+ # "all":{"element_id":"ayl_private_cap_92300","lang":"fr","env":"prod"}}
+ ayl_data = json_loads(adyoulike_data_string)
+
+ res = self.plugin.load(
+ r'http://api-ayl.appspot.com/challenge?key=%(ayl_key)s&env=%(ayl_env)s&callback=%(callback)s' % {
+ "ayl_key": ayl_data[self.engine]["key"], "ayl_env": ayl_data["all"]["env"],
+ "callback": self.ADYOULIKE_CALLBACK})
+
found = re.search(self.ADYOULIKE_CHALLENGE_PATTERN, res)
challenge_string = None
if found:
@@ -59,12 +66,20 @@ class AdYouLike():
else:
self.plugin.fail("Invalid AdYouLike challenge")
challenge_data = json_loads(challenge_string)
-
+
return ayl_data, challenge_data
-
+
def result(self, ayl, challenge):
"""
- Adyoulike.g._jsonp_5579316662423138({"translations":{"fr":{"instructions_visual":"Recopiez « Soonnight » ci-dessous :"}},"site_under":true,"clickable":true,"pixels":{"VIDEO_050":[],"DISPLAY":[],"VIDEO_000":[],"VIDEO_100":[],"VIDEO_025":[],"VIDEO_075":[]},"medium_type":"image/adyoulike","iframes":{"big":"<iframe src=\"http://www.soonnight.com/campagn.html\" scrolling=\"no\" height=\"250\" width=\"300\" frameborder=\"0\"></iframe>"},"shares":{},"id":256,"token":"e6QuI4aRSnbIZJg02IsV6cp4JQ9~MjA1","formats":{"small":{"y":300,"x":0,"w":300,"h":60},"big":{"y":0,"x":0,"w":300,"h":250},"hover":{"y":440,"x":0,"w":300,"h":60}},"tid":"SqwuAdxT1EZoi4B5q0T63LN2AkiCJBg5"})
+ Adyoulike.g._jsonp_5579316662423138
+ ({"translations":{"fr":{"instructions_visual":"Recopiez « Soonnight » ci-dessous :"}},
+ "site_under":true,"clickable":true,"pixels":{"VIDEO_050":[],"DISPLAY":[],"VIDEO_000":[],"VIDEO_100":[],
+ "VIDEO_025":[],"VIDEO_075":[]},"medium_type":"image/adyoulike",
+ "iframes":{"big":"<iframe src=\"http://www.soonnight.com/campagn.html\" scrolling=\"no\"
+ height=\"250\" width=\"300\" frameborder=\"0\"></iframe>"},"shares":{},"id":256,
+ "token":"e6QuI4aRSnbIZJg02IsV6cp4JQ9~MjA1","formats":{"small":{"y":300,"x":0,"w":300,"h":60},
+ "big":{"y":0,"x":0,"w":300,"h":250},"hover":{"y":440,"x":0,"w":300,"h":60}},
+ "tid":"SqwuAdxT1EZoi4B5q0T63LN2AkiCJBg5"})
"""
response = None
try:
@@ -76,54 +91,55 @@ class AdYouLike():
self.plugin.fail("Can't parse instructions visual")
except KeyError:
self.plugin.fail("No instructions visual")
-
+
#TODO: Supports captcha
-
+
if not response:
self.plugin.fail("AdYouLike result failed")
-
- return {"_ayl_captcha_engine" : self.engine,
- "_ayl_env" : ayl["all"]["env"],
- "_ayl_tid" : challenge["tid"],
- "_ayl_token_challenge" : challenge["token"],
- "_ayl_response": response }
+
+ return {"_ayl_captcha_engine": self.engine,
+ "_ayl_env": ayl["all"]["env"],
+ "_ayl_tid": challenge["tid"],
+ "_ayl_token_challenge": challenge["token"],
+ "_ayl_response": response}
+
class DlFreeFr(SimpleHoster):
__name__ = "DlFreeFr"
__type__ = "hoster"
__pattern__ = r"http://dl\.free\.fr/([a-zA-Z0-9]+|getfile\.pl\?file=/[a-zA-Z0-9]+)"
- __version__ = "0.24"
+ __version__ = "0.25"
__description__ = """dl.free.fr download hoster"""
__author_name__ = ("the-razer", "zoidberg", "Toilal")
__author_mail__ = ("daniel_ AT gmx DOT net", "zoidberg@mujmail.cz", "toilal.dev@gmail.com")
-
+
FILE_NAME_PATTERN = r"Fichier:</td>\s*<td[^>]*>(?P<N>[^>]*)</td>"
FILE_SIZE_PATTERN = r"Taille:</td>\s*<td[^>]*>(?P<S>[\d.]+[KMG])o"
FILE_OFFLINE_PATTERN = r"Erreur 404 - Document non trouv|Fichier inexistant|Le fichier demand&eacute; n'a pas &eacute;t&eacute; trouv&eacute;"
#FILE_URL_PATTERN = r'href="(?P<url>http://.*?)">T&eacute;l&eacute;charger ce fichier'
-
+
def setup(self):
self.multiDL = True
self.limitDL = 5
self.resumeDownload = True
- self.chunkLimit = 1
+ self.chunkLimit = 1
def init(self):
factory = self.core.requestFactory
self.req = CustomBrowser(factory.bucket, factory.getOptions())
-
+
def process(self, pyfile):
self.req.setCookieJar(None)
-
+
pyfile.url = replace_patterns(pyfile.url, self.FILE_URL_REPLACEMENTS)
valid_url = pyfile.url
- headers = self.load(valid_url, just_header = True)
-
+ headers = self.load(valid_url, just_header=True)
+
self.html = None
if headers.get('code') == 302:
valid_url = headers.get('location')
- headers = self.load(valid_url, just_header = True)
-
+ headers = self.load(valid_url, just_header=True)
+
if headers.get('code') == 200:
content_type = headers.get('content-type')
if content_type and content_type.startswith("text/html"):
@@ -132,23 +148,23 @@ class DlFreeFr(SimpleHoster):
self.handleFree()
else:
# Direct access to requested file for users using free.fr as Internet Service Provider.
- self.download(valid_url, disposition=True)
+ self.download(valid_url, disposition=True)
elif headers.get('code') == 404:
self.offline()
else:
self.fail("Invalid return code: " + str(headers.get('code')))
-
- def handleFree(self):
+
+ def handleFree(self):
action, inputs = self.parseHtmlForm('action="getfile.pl"')
-
+
adyoulike = AdYouLike(self)
ayl, challenge = adyoulike.challenge(self.html)
result = adyoulike.result(ayl, challenge)
inputs.update(result)
-
- self.load("http://dl.free.fr/getfile.pl", post = inputs)
- headers = self.getLastHeaders()
- if headers.get("code") == 302 and headers.has_key("set-cookie") and headers.has_key("location"):
+
+ self.load("http://dl.free.fr/getfile.pl", post=inputs)
+ headers = self.getLastHeaders()
+ if headers.get("code") == 302 and "set-cookie" in headers and "location" in headers:
found = re.search("(.*?)=(.*?); path=(.*?); domain=(.*?)", headers.get("set-cookie"))
cj = CookieJar(__name__)
if found:
@@ -157,16 +173,17 @@ class DlFreeFr(SimpleHoster):
self.fail("Cookie error")
location = headers.get("location")
self.req.setCookieJar(cj)
- self.download(location, disposition=True);
+ self.download(location, disposition=True)
else:
self.fail("Invalid response")
-
+
def getLastHeaders(self):
#parse header
header = {"code": self.req.code}
for line in self.req.http.header.splitlines():
line = line.strip()
- if not line or ":" not in line: continue
+ if not line or ":" not in line:
+ continue
key, none, value = line.partition(":")
key = key.lower().strip()
@@ -181,4 +198,5 @@ class DlFreeFr(SimpleHoster):
header[key] = value
return header
-getInfo = create_getInfo(DlFreeFr)
+
+getInfo = create_getInfo(DlFreeFr)
diff --git a/module/plugins/hoster/EdiskCz.py b/module/plugins/hoster/EdiskCz.py
index a253be0d9..c172e7447 100644
--- a/module/plugins/hoster/EdiskCz.py
+++ b/module/plugins/hoster/EdiskCz.py
@@ -19,6 +19,7 @@
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
class EdiskCz(SimpleHoster):
__name__ = "EdiskCz"
__type__ = "hoster"
@@ -42,7 +43,8 @@ class EdiskCz(SimpleHoster):
self.logDebug('URL:' + url)
found = re.search(self.ACTION_PATTERN, url)
- if found is None: self.parseError("ACTION")
+ if found is None:
+ self.parseError("ACTION")
action = found.group(1)
self.html = self.load(url, decode=True)
@@ -59,4 +61,5 @@ class EdiskCz(SimpleHoster):
self.download(url)
-getInfo = create_getInfo(EdiskCz) \ No newline at end of file
+
+getInfo = create_getInfo(EdiskCz)
diff --git a/module/plugins/hoster/EgoFilesCom.py b/module/plugins/hoster/EgoFilesCom.py
index 7e6673210..274286cf1 100644
--- a/module/plugins/hoster/EgoFilesCom.py
+++ b/module/plugins/hoster/EgoFilesCom.py
@@ -1,103 +1,103 @@
-# -*- coding: utf-8 -*-
-
-############################################################################
-# This program is free software: you can redistribute it and/or modify #
-# it under the terms of the GNU Affero General Public License as #
-# published by the Free Software Foundation, either version 3 of the #
-# License, or (at your option) any later version. #
-# #
-# This program is distributed in the hope that it will be useful, #
-# but WITHOUT ANY WARRANTY; without even the implied warranty of #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
-# GNU Affero General Public License for more details. #
-# #
-# You should have received a copy of the GNU Affero General Public License #
-# along with this program. If not, see <http://www.gnu.org/licenses/>. #
-############################################################################
-
-# Test link (random.bin):
-# http://egofiles.com/mOZfMI1WLZ6HBkGG/random.bin
-
-import re
-
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-from module.plugins.ReCaptcha import ReCaptcha
-
-
-class EgoFilesCom(SimpleHoster):
- __name__ = "EgoFilesCom"
- __type__ = "hoster"
- __pattern__ = r"https?://(www\.)?egofiles.com/(\w+)"
- __version__ = "0.13"
- __description__ = """Egofiles.com Download Hoster"""
- __author_name__ = ("stickell")
- __author_mail__ = ("l.stickell@yahoo.it")
-
- FILE_INFO_PATTERN = r'<div class="down-file">\s+(?P<N>[^\t]+)\s+<div class="file-properties">\s+(File size|Rozmiar): (?P<S>[\w.]+) (?P<U>\w+) \|'
- FILE_OFFLINE_PATTERN = r'(File size|Rozmiar): 0 KB'
- WAIT_TIME_PATTERN = r'For next free download you have to wait <strong>((?P<m>\d*)m)? ?((?P<s>\d+)s)?</strong>'
- DIRECT_LINK_PATTERN = r'<a href="(?P<link>[^"]+)">Download ></a>'
- RECAPTCHA_KEY = '6LeXatQSAAAAAHezcjXyWAni-4t302TeYe7_gfvX'
-
- def init(self):
- self.file_info = {}
- # Set English language
- self.load("https://egofiles.com/ajax/lang.php?lang=en", just_header=True)
-
- def process(self, pyfile):
- if self.premium and (not self.SH_CHECK_TRAFFIC or self.checkTrafficLeft()):
- self.handlePremium()
- else:
- self.handleFree()
-
- def handleFree(self):
- self.html = self.load(self.pyfile.url, decode=True)
- self.getFileInfo()
-
- # Wait time between free downloads
- if 'For next free download you have to wait' in self.html:
- m = re.search(self.WAIT_TIME_PATTERN, self.html).groupdict('0')
- waittime = int(m['m']) * 60 + int(m['s'])
- self.setWait(waittime, True)
- self.wait()
-
- downloadURL = ''
- recaptcha = ReCaptcha(self)
- for i in xrange(5):
- challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
- post_data = {'recaptcha_challenge_field': challenge,
- 'recaptcha_response_field': response}
- self.html = self.load(self.pyfile.url, post=post_data, decode=True)
- m = re.search(self.DIRECT_LINK_PATTERN, self.html)
- if not m:
- self.logInfo('Wrong captcha')
- self.invalidCaptcha()
- elif hasattr(m, 'group'):
- downloadURL = m.group('link')
- self.correctCaptcha()
- break
- else:
- self.fail('Unknown error - Plugin may be out of date')
-
- if not downloadURL:
- self.fail("No Download url retrieved/all captcha attempts failed")
-
- self.download(downloadURL, disposition=True)
-
- def handlePremium(self):
- header = self.load(self.pyfile.url, just_header=True)
- if header.has_key('location'):
- self.logDebug('DIRECT LINK from header: ' + header['location'])
- self.download(header['location'])
- else:
- self.html = self.load(self.pyfile.url, decode=True)
- self.getFileInfo()
- m = re.search(r'<a href="(?P<link>[^"]+)">Download ></a>', self.html)
- if not m:
- self.parseError('Unable to detect direct download url')
- else:
- self.logDebug('DIRECT URL from html: ' + m.group('link'))
- self.download(m.group('link'), disposition=True)
-
-
-getInfo = create_getInfo(EgoFilesCom)
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+# Test link (random.bin):
+# http://egofiles.com/mOZfMI1WLZ6HBkGG/random.bin
+
+import re
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.plugins.internal.CaptchaService import ReCaptcha
+
+
+class EgoFilesCom(SimpleHoster):
+ __name__ = "EgoFilesCom"
+ __type__ = "hoster"
+ __pattern__ = r"https?://(www\.)?egofiles.com/(\w+)"
+ __version__ = "0.13"
+ __description__ = """Egofiles.com Download Hoster"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ FILE_INFO_PATTERN = r'<div class="down-file">\s+(?P<N>[^\t]+)\s+<div class="file-properties">\s+(File size|Rozmiar): (?P<S>[\w.]+) (?P<U>\w+) \|'
+ FILE_OFFLINE_PATTERN = r'(File size|Rozmiar): 0 KB'
+ WAIT_TIME_PATTERN = r'For next free download you have to wait <strong>((?P<m>\d*)m)? ?((?P<s>\d+)s)?</strong>'
+ DIRECT_LINK_PATTERN = r'<a href="(?P<link>[^"]+)">Download ></a>'
+ RECAPTCHA_KEY = '6LeXatQSAAAAAHezcjXyWAni-4t302TeYe7_gfvX'
+
+ def init(self):
+ self.file_info = {}
+ # Set English language
+ self.load("https://egofiles.com/ajax/lang.php?lang=en", just_header=True)
+
+ def process(self, pyfile):
+ if self.premium and (not self.SH_CHECK_TRAFFIC or self.checkTrafficLeft()):
+ self.handlePremium()
+ else:
+ self.handleFree()
+
+ def handleFree(self):
+ self.html = self.load(self.pyfile.url, decode=True)
+ self.getFileInfo()
+
+ # Wait time between free downloads
+ if 'For next free download you have to wait' in self.html:
+ m = re.search(self.WAIT_TIME_PATTERN, self.html).groupdict('0')
+ waittime = int(m['m']) * 60 + int(m['s'])
+ self.setWait(waittime, True)
+ self.wait()
+
+ downloadURL = ''
+ recaptcha = ReCaptcha(self)
+ for i in xrange(5):
+ challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
+ post_data = {'recaptcha_challenge_field': challenge,
+ 'recaptcha_response_field': response}
+ self.html = self.load(self.pyfile.url, post=post_data, decode=True)
+ m = re.search(self.DIRECT_LINK_PATTERN, self.html)
+ if not m:
+ self.logInfo('Wrong captcha')
+ self.invalidCaptcha()
+ elif hasattr(m, 'group'):
+ downloadURL = m.group('link')
+ self.correctCaptcha()
+ break
+ else:
+ self.fail('Unknown error - Plugin may be out of date')
+
+ if not downloadURL:
+ self.fail("No Download url retrieved/all captcha attempts failed")
+
+ self.download(downloadURL, disposition=True)
+
+ def handlePremium(self):
+ header = self.load(self.pyfile.url, just_header=True)
+ if header.has_key('location'):
+ self.logDebug('DIRECT LINK from header: ' + header['location'])
+ self.download(header['location'])
+ else:
+ self.html = self.load(self.pyfile.url, decode=True)
+ self.getFileInfo()
+ m = re.search(r'<a href="(?P<link>[^"]+)">Download ></a>', self.html)
+ if not m:
+ self.parseError('Unable to detect direct download url')
+ else:
+ self.logDebug('DIRECT URL from html: ' + m.group('link'))
+ self.download(m.group('link'), disposition=True)
+
+
+getInfo = create_getInfo(EgoFilesCom)
diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py
index 5224dfd9f..03bec8bbd 100644
--- a/module/plugins/hoster/EuroshareEu.py
+++ b/module/plugins/hoster/EuroshareEu.py
@@ -19,6 +19,7 @@
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
class EuroshareEu(SimpleHoster):
__name__ = "EuroshareEu"
__type__ = "hoster"
@@ -48,8 +49,7 @@ class EuroshareEu(SimpleHoster):
self.download(self.pyfile.url.rstrip('/') + "/download/")
check = self.checkDownload({"login": re.compile(self.ERR_NOT_LOGGED_IN_PATTERN),
- "json": re.compile(r'\{"status":"error".*?"message":"(.*?)"')
- })
+ "json": re.compile(r'\{"status":"error".*?"message":"(.*?)"')})
if check == "login" or (check == "json" and self.lastCheck.group(1) == "Access token expired"):
self.account.relogin(self.user)
self.retry(reason="Access token expired")
@@ -71,4 +71,5 @@ class EuroshareEu(SimpleHoster):
if check == "multi_dl":
self.longWait(300, 12)
-getInfo = create_getInfo(EuroshareEu) \ No newline at end of file
+
+getInfo = create_getInfo(EuroshareEu)
diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py
index fd91bb023..f68627b56 100644
--- a/module/plugins/hoster/ExtabitCom.py
+++ b/module/plugins/hoster/ExtabitCom.py
@@ -19,7 +19,7 @@
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-from module.plugins.ReCaptcha import ReCaptcha
+from module.plugins.internal.CaptchaService import ReCaptcha
from module.common.json_layer import json_loads
@@ -27,7 +27,7 @@ class ExtabitCom(SimpleHoster):
__name__ = "ExtabitCom"
__type__ = "hoster"
__pattern__ = r"http://(\w+\.)*extabit\.com/(file|go|fid)/(?P<ID>\w+)"
- __version__ = "0.3"
+ __version__ = "0.4"
__description__ = """Extabit.com"""
__author_name__ = ("zoidberg")
@@ -36,7 +36,7 @@ class ExtabitCom(SimpleHoster):
FILE_OFFLINE_PATTERN = r'<h1>File not found</h1>'
TEMP_OFFLINE_PATTERN = r">(File is temporary unavailable|No download mirror)<"
- DOWNLOAD_LINK_PATTERN = r'"(http://guest\d+\.extabit\.com/[a-z0-9]+/.*?)"'
+ DOWNLOAD_LINK_PATTERN = r'[\'"](http://guest\d+\.extabit\.com/[a-z0-9]+/.*?)[\'"]'
def handleFree(self):
if r">Only premium users can download this file" in self.html:
@@ -73,7 +73,8 @@ class ExtabitCom(SimpleHoster):
else:
self.parseError('Captcha')
- if not "href" in response: self.parseError('JSON')
+ if not "href" in response:
+ self.parseError('JSON')
self.html = self.load("http://extabit.com/file/%s%s" % (fileID, response['href']))
m = re.search(self.DOWNLOAD_LINK_PATTERN, self.html)
diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py
new file mode 100644
index 000000000..4d3e7b93d
--- /dev/null
+++ b/module/plugins/hoster/FastixRu.py
@@ -0,0 +1,66 @@
+# -*- coding: utf-8 -*-
+
+import re
+from urllib import unquote
+from random import randrange
+from module.plugins.Hoster import Hoster
+from module.common.json_layer import json_loads
+
+
+class FastixRu(Hoster):
+ __name__ = "FastixRu"
+ __version__ = "0.02"
+ __type__ = "hoster"
+ __pattern__ = r"http?://.*fastix.ru\..*"
+ __description__ = """Fastix hoster plugin"""
+ __author_name__ = ("Massimo, Rosamilia")
+ __author_mail__ = ("max@spiritix.eu")
+
+ def getFilename(self, url):
+ try:
+ name = unquote(url.rsplit("/", 1)[1])
+ except IndexError:
+ name = "Unknown_Filename..."
+ if name.endswith("..."): # incomplete filename, append random stuff
+ name += "%s.tmp" % randrange(100, 999)
+ return name
+
+ def init(self):
+ self.chunkLimit = 3
+ self.resumeDownload = True
+
+ def process(self, pyfile):
+ if not self.account:
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "Fastix")
+ self.fail("No Fastix account provided")
+
+ self.logDebug("Old URL: %s" % pyfile.url)
+ if re.match(self.__pattern__, pyfile.url):
+ new_url = pyfile.url
+ else:
+ api_key = self.account.getAccountData(self.user)
+ api_key = api_key["api"]
+ url = "http://fastix.ru/api_v2/?apikey=%s&sub=getdirectlink&link=%s" % (api_key, pyfile.url)
+ page = self.load(url)
+ data = json_loads(page)
+ self.logDebug("Json data: %s" % str(data))
+ if "error\":true" in page:
+ self.offline()
+ else:
+ new_url = data["downloadlink"]
+
+ self.logDebug("New URL: %s" % new_url)
+
+ if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"):
+ #only use when name wasnt already set
+ pyfile.name = self.getFilename(new_url)
+
+ self.download(new_url, disposition=True)
+
+ check = self.checkDownload({"error": "<title>An error occurred while processing your request</title>",
+ "empty": re.compile(r"^$")})
+
+ if check == "error":
+ self.retry(reason="An error occurred while generating link.", wait_time=60)
+ elif check == "empty":
+ self.retry(reason="Downloaded File was empty.", wait_time=60)
diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py
index 1dbf9fe8f..b44d55a2d 100644
--- a/module/plugins/hoster/FastshareCz.py
+++ b/module/plugins/hoster/FastshareCz.py
@@ -33,7 +33,7 @@ class FastshareCz(SimpleHoster):
FILE_INFO_PATTERN = r'<h1 class="dwp">(?P<N>[^<]+)</h1>\s*<div class="fileinfo">\s*(?:Velikost|Size)\s*: (?P<S>[^,]+),'
FILE_OFFLINE_PATTERN = ur'<td align=center>Tento soubor byl smazán'
- FILE_URL_REPLACEMENTS = [('#.*','')]
+ FILE_URL_REPLACEMENTS = [('#.*', '')]
FREE_URL_PATTERN = ur'<form method=post action=(/free/.*?)><b>Stáhnout FREE.*?<img src="([^"]*)">'
PREMIUM_URL_PATTERN = r'(http://data\d+\.fastshare\.cz/download\.php\?id=\d+\&[^\s\"\'<>]+)'
@@ -45,7 +45,7 @@ class FastshareCz(SimpleHoster):
if self.premium and (not self.SH_CHECK_TRAFFIC or self.checkTrafficLeft()):
self.handlePremium()
else:
- self.html = self.load(pyfile.url, decode = not self.SH_BROKEN_ENCODING, cookies = self.SH_COOKIES)
+ self.html = self.load(pyfile.url, decode=not self.SH_BROKEN_ENCODING, cookies=self.SH_COOKIES)
self.getFileInfo()
self.handleFree()
@@ -56,14 +56,16 @@ class FastshareCz(SimpleHoster):
self.retry(120, "No free slots")
found = re.search(self.FREE_URL_PATTERN, self.html)
- if not found: self.parseError("Free URL")
+ if not found:
+ self.parseError("Free URL")
action, captcha_src = found.groups()
captcha = self.decryptCaptcha("http://www.fastshare.cz/" + captcha_src)
- self.download("http://www.fastshare.cz/" + action, post = {"code": captcha, "submit": u"stáhnout"})
+ self.download("http://www.fastshare.cz/" + action, post={"code": captcha, "submit": u"stáhnout"})
check = self.checkDownload({
- "paralell_dl": "<title>FastShare.cz</title>|<script>alert\('Pres FREE muzete stahovat jen jeden soubor najednou.'\)"
- })
+ "paralell_dl":
+ "<title>FastShare.cz</title>|<script>alert\('Pres FREE muzete stahovat jen jeden soubor najednou.'\)"
+ })
self.logDebug(self.req.lastEffectiveURL, self.req.lastURL, self.req.code)
if check == "paralell_dl":
@@ -83,7 +85,8 @@ class FastshareCz(SimpleHoster):
self.resetAccount()
found = re.search(self.PREMIUM_URL_PATTERN, self.html)
- if not found: self.parseError("Premium URL")
+ if not found:
+ self.parseError("Premium URL")
url = found.group(1)
self.logDebug("PREMIUM URL: %s" % url)
@@ -93,4 +96,5 @@ class FastshareCz(SimpleHoster):
if check == "credit":
self.resetAccount()
-getInfo = create_getInfo(FastshareCz) \ No newline at end of file
+
+getInfo = create_getInfo(FastshareCz)
diff --git a/module/plugins/hoster/FileApeCom.py b/module/plugins/hoster/FileApeCom.py
index 1f933e776..2ba01f3a0 100644
--- a/module/plugins/hoster/FileApeCom.py
+++ b/module/plugins/hoster/FileApeCom.py
@@ -5,11 +5,12 @@ import re
from module.plugins.Hoster import Hoster
+
class FileApeCom(Hoster):
__name__ = "FileApeCom"
__type__ = "hoster"
__pattern__ = r"http://(www\.)?fileape\.com/(index\.php\?act=download\&id=|dl/)\w+"
- __version__ = "0.1"
+ __version__ = "0.11"
__description__ = """FileApe Download Hoster"""
__author_name__ = ("espes")
@@ -21,27 +22,29 @@ class FileApeCom(Hoster):
self.pyfile = pyfile
self.html = self.load(self.pyfile.url)
-
+
if "This file is either temporarily unavailable or does not exist" in self.html:
self.offline()
-
- self.html = self.load(self.pyfile.url+"&g=1")
-
+
+ self.html = self.load(self.pyfile.url + "&g=1")
+
continueMatch = re.search(r"window\.location = '(http://.*?)'", self.html)
if not continueMatch:
continueMatch = re.search(r"'(http://fileape\.com/\?act=download&t=[A-Za-z0-9_-]+)'", self.html)
if continueMatch:
continuePage = continueMatch.group(1)
else:
- self.fail("Plugin Defect")
-
+ self.fail("Plugin Defect")
+
wait = 60
- waitMatch = re.search("id=\"waitnumber\" style=\"font-size:2em; text-align:center; width:33px; height:33px;\">(\\d+)</span>", self.html)
+ waitMatch = re.search(
+ "id=\"waitnumber\" style=\"font-size:2em; text-align:center; width:33px; height:33px;\">(\\d+)</span>",
+ self.html)
if waitMatch:
wait = int(waitMatch.group(1))
- self.setWait(wait+3)
+ self.setWait(wait + 3)
self.wait()
-
+
self.html = self.load(continuePage)
linkMatch = \
re.search(r"<div style=\"text-align:center; font-size: 30px;\"><a href=\"(http://.*?)\"", self.html)
@@ -51,12 +54,12 @@ class FileApeCom(Hoster):
link = linkMatch.group(1)
else:
self.fail("Plugin Defect")
-
+
pyfile.name = link.rpartition('/')[2]
-
+
self.download(link)
-
+
check = self.checkDownload({"exp": "Download ticket expired"})
if check == "exp":
- self.log.info("Ticket expired, retrying...")
- self.retry() \ No newline at end of file
+ self.logInfo("Ticket expired, retrying...")
+ self.retry()
diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py
index 4a096e400..92735d579 100644
--- a/module/plugins/hoster/FilecloudIo.py
+++ b/module/plugins/hoster/FilecloudIo.py
@@ -19,8 +19,8 @@
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError
from module.common.json_layer import json_loads
-from module.plugins.ReCaptcha import ReCaptcha
-from module.network.RequestFactory import getURL
+from module.plugins.internal.CaptchaService import ReCaptcha
+
class FilecloudIo(SimpleHoster):
__name__ = "FilecloudIo"
@@ -34,59 +34,59 @@ class FilecloudIo(SimpleHoster):
FILE_NAME_PATTERN = r'id="aliasSpan">(?P<N>.*?)&nbsp;&nbsp;<'
FILE_OFFLINE_PATTERN = r'l10n.(FILES__DOESNT_EXIST|REMOVED)'
TEMP_OFFLINE_PATTERN = r'l10n.FILES__WARNING'
-
+
UKEY_PATTERN = r"'ukey'\s*:'(\w+)',"
AB1_PATTERN = r"if\( __ab1 == '(\w+)' \)"
ERROR_MSG_PATTERN = r"var __error_msg\s*=\s*l10n\.(.*?);"
DOWNLOAD_LINK_PATTERN = r'"(http://s\d+.filecloud.io/%s/\d+/.*?)"'
- RECAPTCHA_KEY_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';"
+ RECAPTCHA_KEY_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';"
RECAPTCHA_KEY = '6Lf5OdISAAAAAEZObLcx5Wlv4daMaASRov1ysDB1'
-
+
def setup(self):
self.resumeDownload = self.multiDL = True
self.chunkLimit = 1
-
+
def handleFree(self):
data = {"ukey": self.file_info['ID']}
-
+
found = re.search(self.AB1_PATTERN, self.html)
if not found:
raise PluginParseError("__AB1")
data["__ab1"] = found.group(1)
-
+
if not self.account:
self.fail("User not logged in")
elif not self.account.logged_in:
recaptcha = ReCaptcha(self)
captcha_challenge, captcha_response = recaptcha.challenge(self.RECAPTCHA_KEY)
- self.account.form_data = {"recaptcha_challenge_field" : captcha_challenge,
- "recaptcha_response_field" : captcha_response}
+ self.account.form_data = {"recaptcha_challenge_field": captcha_challenge,
+ "recaptcha_response_field": captcha_response}
self.account.relogin(self.user)
- self.retry(max_tries = 2)
-
+ self.retry(max_tries=2)
+
json_url = "http://filecloud.io/download-request.json"
- response = self.load(json_url, post = data)
- self.logDebug(response)
+ response = self.load(json_url, post=data)
+ self.logDebug(response)
response = json_loads(response)
-
+
if "error" in response and response["error"]:
self.fail(response)
-
+
self.logDebug(response)
if response["captcha"]:
recaptcha = ReCaptcha(self)
found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html)
captcha_key = found.group(1) if found else self.RECAPTCHA_KEY
data["ctype"] = "recaptcha"
-
+
for i in range(5):
data["recaptcha_challenge"], data["recaptcha_response"] = recaptcha.challenge(captcha_key)
-
+
json_url = "http://filecloud.io/download-request.json"
- response = self.load(json_url, post = data)
+ response = self.load(json_url, post=data)
self.logDebug(response)
response = json_loads(response)
-
+
if "retry" in response and response["retry"]:
self.invalidCaptcha()
else:
@@ -102,11 +102,12 @@ class FilecloudIo(SimpleHoster):
raise PluginParseError("Download URL")
download_url = found.group(1)
self.logDebug("Download URL: %s" % download_url)
-
+
if "size" in self.file_info and self.file_info['size']:
- self.check_data = {"size": int(self.file_info['size'])}
+ self.check_data = {"size": int(self.file_info['size'])}
self.download(download_url)
else:
self.fail("Unexpected server response")
-getInfo = create_getInfo(FilecloudIo) \ No newline at end of file
+
+getInfo = create_getInfo(FilecloudIo)
diff --git a/module/plugins/hoster/FilejungleCom.py b/module/plugins/hoster/FilejungleCom.py
index fd833eef2..0fb0b6150 100644
--- a/module/plugins/hoster/FilejungleCom.py
+++ b/module/plugins/hoster/FilejungleCom.py
@@ -19,6 +19,7 @@
from module.plugins.hoster.FileserveCom import FileserveCom, checkFile
from module.plugins.Plugin import chunks
+
class FilejungleCom(FileserveCom):
__name__ = "FilejungleCom"
__type__ = "hoster"
@@ -27,12 +28,15 @@ class FilejungleCom(FileserveCom):
__description__ = """Filejungle.com plugin - free only"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
-
- URLS = ['http://www.filejungle.com/f/', 'http://www.filejungle.com/check_links.php', 'http://www.filejungle.com/checkReCaptcha.php']
+
+ URLS = ['http://www.filejungle.com/f/', 'http://www.filejungle.com/check_links.php',
+ 'http://www.filejungle.com/checkReCaptcha.php']
LINKCHECK_TR = r'<li>\s*(<div class="col1">.*?)</li>'
LINKCHECK_TD = r'<div class="(?:col )?col\d">(?:<[^>]*>|&nbsp;)*([^<]*)'
-
+
LONG_WAIT_PATTERN = r'<h1>Please wait for (\d+) (\w+)\s*to download the next file\.</h1>'
-def getInfo(urls):
- for chunk in chunks(urls, 100): yield checkFile(FilejungleCom, chunk) \ No newline at end of file
+
+def getInfo(urls):
+ for chunk in chunks(urls, 100):
+ yield checkFile(FilejungleCom, chunk)
diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py
index bc47856e5..0c3cb925b 100644
--- a/module/plugins/hoster/FilepostCom.py
+++ b/module/plugins/hoster/FilepostCom.py
@@ -22,10 +22,12 @@
"""
import re
+from time import time
+
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-from module.plugins.ReCaptcha import ReCaptcha
+from module.plugins.internal.CaptchaService import ReCaptcha
from module.common.json_layer import json_loads
-from time import time
+
class FilepostCom(SimpleHoster):
__name__ = "FilepostCom"
@@ -47,65 +49,73 @@ class FilepostCom(SimpleHoster):
file_id = re.search(self.__pattern__, self.pyfile.url).group(1)
found = re.search(self.FLP_TOKEN_PATTERN, self.html)
- if not found: self.parseError("Token")
+ if not found:
+ self.parseError("Token")
flp_token = found.group(1)
found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html)
- if not found: self.parseError("Captcha key")
+ if not found:
+ self.parseError("Captcha key")
captcha_key = found.group(1)
# Get wait time
- get_dict = {'SID' : self.req.cj.getCookie('SID'), 'JsHttpRequest' : str(int(time()*10000)) + '-xml'}
- post_dict = {'action' : 'set_download', 'token' : flp_token, 'code' : file_id}
- wait_time = int(self.getJsonResponse(get_dict, post_dict, 'wait_time'))
+ get_dict = {'SID': self.req.cj.getCookie('SID'), 'JsHttpRequest': str(int(time() * 10000)) + '-xml'}
+ post_dict = {'action': 'set_download', 'token': flp_token, 'code': file_id}
+ wait_time = int(self.getJsonResponse(get_dict, post_dict, 'wait_time'))
if wait_time > 0:
self.setWait(wait_time)
- self.wait()
-
- post_dict = {"token" : flp_token, "code" : file_id, "file_pass" : ''}
-
+ self.wait()
+
+ post_dict = {"token": flp_token, "code": file_id, "file_pass": ''}
+
if 'var is_pass_exists = true;' in self.html:
# Solve password
for file_pass in self.getPassword().splitlines():
- get_dict['JsHttpRequest'] = str(int(time()*10000)) + '-xml'
+ get_dict['JsHttpRequest'] = str(int(time() * 10000)) + '-xml'
post_dict['file_pass'] = file_pass
- self.logInfo("Password protected link, trying " + file_pass)
-
- download_url = self.getJsonResponse(get_dict, post_dict, 'link')
- if download_url:
+ self.logInfo("Password protected link, trying " + file_pass)
+
+ download_url = self.getJsonResponse(get_dict, post_dict, 'link')
+ if download_url:
break
-
- else: self.fail("No or incorrect password")
-
+
+ else:
+ self.fail("No or incorrect password")
+
else:
# Solve recaptcha
recaptcha = ReCaptcha(self)
-
+
for pokus in range(5):
- get_dict['JsHttpRequest'] = str(int(time()*10000)) + '-xml'
+ get_dict['JsHttpRequest'] = str(int(time() * 10000)) + '-xml'
if pokus:
- post_dict["recaptcha_challenge_field"], post_dict["recaptcha_response_field"] = recaptcha.challenge(captcha_key)
- self.logDebug(u"RECAPTCHA: %s : %s : %s" % (captcha_key, post_dict["recaptcha_challenge_field"], post_dict["recaptcha_response_field"]))
-
+ post_dict["recaptcha_challenge_field"], post_dict["recaptcha_response_field"] = recaptcha.challenge(
+ captcha_key)
+ self.logDebug(u"RECAPTCHA: %s : %s : %s" % (
+ captcha_key, post_dict["recaptcha_challenge_field"], post_dict["recaptcha_response_field"]))
+
download_url = self.getJsonResponse(get_dict, post_dict, 'link')
if download_url:
- if pokus: self.correctCaptcha()
+ if pokus:
+ self.correctCaptcha()
break
elif pokus:
self.invalidCaptcha()
-
- else: self.fail("Invalid captcha")
-
+
+ else:
+ self.fail("Invalid captcha")
+
# 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.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)
-
- if not 'js' in json_response: self.parseError('JSON %s 1' % field)
-
+
+ if not 'js' in json_response:
+ self.parseError('JSON %s 1' % field)
+
# i changed js_answer to json_response['js'] since js_answer is nowhere set.
# i don't know the JSON-HTTP specs in detail, but the previous author
# accessed json_response['js']['error'] as well as js_answer['error'].
@@ -115,9 +125,9 @@ class FilepostCom(SimpleHoster):
self.retry(json_response['js']['params']['next_download'])
# ~? self.retry(js_answer['params']['next_download'])
elif 'Wrong file password' in json_response['js']['error']:
- return None
+ return None
elif 'You entered a wrong CAPTCHA code' in json_response['js']['error']:
- return None
+ return None
elif 'CAPTCHA Code nicht korrekt' in json_response['js']['error']:
return None
elif 'CAPTCHA' in json_response['js']['error']:
@@ -126,10 +136,11 @@ class FilepostCom(SimpleHoster):
else:
self.fail(json_response['js']['error'])
# ~? self.fail(js_answer['error'])
-
- if not 'answer' in json_response['js'] or not field in json_response['js']['answer']:
+
+ if not 'answer' in json_response['js'] or not field in json_response['js']['answer']:
self.parseError('JSON %s 2' % field)
-
+
return json_response['js']['answer'][field]
-
+
+
getInfo = create_getInfo(FilepostCom)
diff --git a/module/plugins/hoster/FilerNet.py b/module/plugins/hoster/FilerNet.py
index 815685ef8..8e8cee526 100644
--- a/module/plugins/hoster/FilerNet.py
+++ b/module/plugins/hoster/FilerNet.py
@@ -23,7 +23,7 @@ import pycurl
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-from module.plugins.ReCaptcha import ReCaptcha
+from module.plugins.internal.CaptchaService import ReCaptcha
class FilerNet(SimpleHoster):
diff --git a/module/plugins/hoster/FilerioCom.py b/module/plugins/hoster/FilerioCom.py
index 7be0fa4f6..7adffc4ed 100644
--- a/module/plugins/hoster/FilerioCom.py
+++ b/module/plugins/hoster/FilerioCom.py
@@ -1,20 +1,22 @@
# -*- coding: utf-8 -*-
from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
class FilerioCom(XFileSharingPro):
__name__ = "FilerioCom"
__type__ = "hoster"
__pattern__ = r"http://(?:\w*\.)*(filerio\.(in|com)|filekeen\.com)/\w{12}"
- __version__ = "0.02"
+ __version__ = "0.02"
__description__ = """FileRio.in hoster plugin"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
-
+
FILE_OFFLINE_PATTERN = '<b>&quot;File Not Found&quot;</b>|File has been removed due to Copyright Claim'
HOSTER_NAME = "filerio.in"
- FILE_URL_REPLACEMENTS = [(r'http://.*?/','http://filerio.in/')]
-
+ FILE_URL_REPLACEMENTS = [(r'http://.*?/', 'http://filerio.in/')]
+
def setup(self):
- self.resumeDownload = self.multiDL = self.premium
+ self.resumeDownload = self.multiDL = self.premium
+
-getInfo = create_getInfo(FilerioCom) \ No newline at end of file
+getInfo = create_getInfo(FilerioCom)
diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py
index 5f36de3c4..b18fec77b 100644
--- a/module/plugins/hoster/FilesMailRu.py
+++ b/module/plugins/hoster/FilesMailRu.py
@@ -6,6 +6,7 @@ from module.plugins.Hoster import Hoster
from module.network.RequestFactory import getURL
from module.plugins.Plugin import chunks
+
def getInfo(urls):
result = []
for chunk in chunks(urls, 10):
@@ -23,21 +24,20 @@ def getInfo(urls):
except:
pass
-
# status 1=OFFLINE, 2=OK, 3=UNKNOWN
# result.append((#name,#size,#status,#url))
yield result
+
class FilesMailRu(Hoster):
__name__ = "FilesMailRu"
__type__ = "hoster"
__pattern__ = r"http://files\.mail\.ru/.*"
- __version__ = "0.3"
+ __version__ = "0.31"
__description__ = """Files.Mail.Ru One-Klick Hoster"""
__author_name__ = ("oZiRiz")
__author_mail__ = ("ich@oziriz.de")
-
def setup(self):
if not self.account:
self.multiDL = False
@@ -46,17 +46,17 @@ class FilesMailRu(Hoster):
def process(self, pyfile):
self.html = self.load(pyfile.url)
self.url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>'
-
+
#marks the file as "offline" when the pattern was found on the html-page'''
if r'<div class="errorMessage mb10">' in self.html:
self.offline()
-
+
elif r'Page cannot be displayed' in self.html:
self.offline()
-
+
#the filename that will be showed in the list (e.g. test.part1.rar)'''
pyfile.name = self.getFileName()
-
+
#prepare and download'''
if not self.account:
self.prepare()
@@ -67,25 +67,25 @@ class FilesMailRu(Hoster):
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'''
+ """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'''
- file_url = re.search(self.url_pattern, self.html).group(0).split('<a href="')[1].split('" onclick="return Act')[0]
+ """gives you the URL to the file. Extracted from the Files.mail.ru HTML-page stored in self.html"""
+ file_url = re.search(self.url_pattern, self.html).group(0).split('<a href="')[1].split('" onclick="return Act')[
+ 0]
return file_url
-
def getFileName(self):
- '''gives you the Name for each file. Also extracted from the HTML-Page'''
+ """gives you the Name for each file. Also extracted from the HTML-Page"""
file_name = re.search(self.url_pattern, self.html).group(0).split(', event)">')[1].split('</a>')[0]
return file_name
-
+
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
+ # searches the file for HTMl-Code. Sometimes the Redirect
+ # doesn't work (maybe a curl Problem) and you get only a small
# HTML file and the Download is marked as "finished"
# then the download will be restarted. It's only bad for these
# who want download a HTML-File (it's one in a million ;-) )
@@ -96,5 +96,7 @@ class FilesMailRu(Hoster):
# (Loading 100MB in to ram is not an option)
check = self.checkDownload({"html": "<meta name="}, read_size=50000)
if check == "html":
- self.log.info(_("There was HTML Code in the Downloaded File("+ self.pyfile.name +")...redirect error? The Download will be restarted."))
+ self.logInfo(_(
+ "There was HTML Code in the Downloaded File (%s)...redirect error? The Download will be restarted." %
+ self.pyfile.name))
self.retry()
diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py
index 04c297661..e8e78f9b0 100644
--- a/module/plugins/hoster/FileserveCom.py
+++ b/module/plugins/hoster/FileserveCom.py
@@ -17,29 +17,31 @@
import re
from module.plugins.Hoster import Hoster
from module.network.RequestFactory import getURL
-from module.plugins.ReCaptcha import ReCaptcha
+from module.plugins.internal.CaptchaService import ReCaptcha
from module.common.json_layer import json_loads
from module.utils import parseFileSize
from module.plugins.Plugin import chunks
+
def checkFile(plugin, urls):
- html = getURL(plugin.URLS[1], post = {"urls": "\n".join(urls)}, decode=True)
+ html = getURL(plugin.URLS[1], post={"urls": "\n".join(urls)}, decode=True)
- file_info = []
+ file_info = []
for li in re.finditer(plugin.LINKCHECK_TR, html, re.DOTALL):
try:
cols = re.findall(plugin.LINKCHECK_TD, li.group(1))
if cols:
file_info.append((
cols[1] if cols[1] != '--' else cols[0],
- parseFileSize(cols[2]) if cols[2] != '--' else 0,
+ parseFileSize(cols[2]) if cols[2] != '--' else 0,
2 if cols[3].startswith('Available') else 1,
cols[0]))
except Exception, e:
continue
-
+
return file_info
+
class FileserveCom(Hoster):
__name__ = "FileserveCom"
__type__ = "hoster"
@@ -48,49 +50,49 @@ class FileserveCom(Hoster):
__description__ = """Fileserve.Com File Download Hoster"""
__author_name__ = ("jeix", "mkaay", "paul king", "zoidberg")
__author_mail__ = ("jeix@hasnomail.de", "mkaay@mkaay.de", "", "zoidberg@mujmail.cz")
-
- URLS = ['http://www.fileserve.com/file/', 'http://www.fileserve.com/link-checker.php', 'http://www.fileserve.com/checkReCaptcha.php']
+
+ URLS = ['http://www.fileserve.com/file/', 'http://www.fileserve.com/link-checker.php',
+ 'http://www.fileserve.com/checkReCaptcha.php']
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>[^']+)'"
LONG_WAIT_PATTERN = r'<li class="title">You need to wait (\d+) (\w+) to start another download\.</li>'
LINK_EXPIRED_PATTERN = "Your download link has expired"
DAILY_LIMIT_PATTERN = "Your daily download limit has been reached"
NOT_LOGGED_IN_PATTERN = '<form (name="loginDialogBoxForm"|id="login_form")|<li><a href="/login.php">Login</a></li>'
-
+
# shares code with FilejungleCom and UploadstationCom
-
+
def setup(self):
self.resumeDownload = self.multiDL = True if self.premium else False
-
+
self.file_id = re.search(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))
def process(self, pyfile):
- pyfile.name, pyfile.size, status, self.url = checkFile(self, [self.url])[0]
- if status != 2: self.offline()
- self.logDebug("File Name: %s Size: %d" % (pyfile.name, pyfile.size))
-
+ pyfile.name, pyfile.size, status, self.url = checkFile(self, [self.url])[0]
+ if status != 2:
+ self.offline()
+ self.logDebug("File Name: %s Size: %d" % (pyfile.name, pyfile.size))
+
if self.premium:
self.handlePremium()
else:
self.handleFree()
-
+
def handleFree(self):
- self.html = self.load(self.url)
+ self.html = self.load(self.url)
action = self.load(self.url, post={"checkDownload": "check"}, decode=True)
action = json_loads(action)
self.logDebug(action)
-
+
if "fail" in action:
if action["fail"] == "timeLimit":
- self.html = self.load(self.url,
- post={"checkDownload": "showError",
- "errorType": "timeLimit"},
- decode=True)
-
+ self.html = self.load(self.url,post={"checkDownload": "showError", "errorType": "timeLimit"},
+ decode=True)
+
self.doLongWait(re.search(self.LONG_WAIT_PATTERN, self.html))
elif action["fail"] == "parallelDownload":
@@ -99,17 +101,17 @@ class FileserveCom(Hoster):
else:
self.fail("Download check returned %s" % action["fail"])
-
- elif "success" in action:
+
+ elif "success" in action:
if action["success"] == "showCaptcha":
self.doCaptcha()
self.doTimmer()
elif action["success"] == "showTimmer":
self.doTimmer()
-
+
else:
- self.fail("Unknown server response")
-
+ self.fail("Unknown server response")
+
# show download link
response = self.load(self.url, post={"downloadLink": "show"}, decode=True)
self.logDebug("show downloadLink response : %s" % response)
@@ -117,7 +119,7 @@ class FileserveCom(Hoster):
self.fail("Couldn't retrieve download url")
# this may either download our file or forward us to an error page
- self.download(self.url, post = {"download": "normal"})
+ self.download(self.url, post={"download": "normal"})
self.logDebug(self.req.http.lastEffectiveURL)
check = self.checkDownload({"expired": self.LINK_EXPIRED_PATTERN,
@@ -135,24 +137,23 @@ class FileserveCom(Hoster):
self.wait()
self.retry(max_tries=0)
- self.thread.m.reconnecting.wait(3) # Ease issue with later downloads appearing to be in parallel
-
+ 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)
+ response = self.load(self.url, post={"downloadLink": "wait"}, decode=True)
self.logDebug("wait response : %s" % response[:80])
if "fail" in response:
self.fail("Failed getting wait time")
- if self.__name__ == "FilejungleCom":
+ if self.__name__ == "FilejungleCom":
found = re.search(r'"waitTime":(\d+)', response)
- if not found: self.fail("Cannot get wait time")
+ if not found:
+ self.fail("Cannot get wait time")
wait_time = int(found.group(1))
else:
wait_time = int(response) + 3
-
+
self.setWait(wait_time)
self.wait()
@@ -164,48 +165,56 @@ class FileserveCom(Hoster):
challenge, code = recaptcha.challenge(captcha_key)
response = json_loads(self.load(self.URLS[2],
- post={'recaptcha_challenge_field': challenge,
- 'recaptcha_response_field': code,
- 'recaptcha_shortencode_field': self.file_id}))
+ post={'recaptcha_challenge_field': challenge,
+ 'recaptcha_response_field': code,
+ 'recaptcha_shortencode_field': self.file_id}))
self.logDebug("reCaptcha response : %s" % response)
if not response["success"]:
self.invalidCaptcha()
else:
self.correctCaptcha()
break
- else: self.fail("Invalid captcha")
-
+ 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 720
+ wait_time = (int(m.group(1)) * {'seconds': 1, 'minutes': 60, 'hours': 3600}[m.group(2)]) if m else 720
self.setWait(wait_time, True)
self.wait()
self.retry()
-
+
def handlePremium(self):
- premium_url = None
+ premium_url = None
if self.__name__ == "FileserveCom":
#try api download
response = self.load("http://app.fileserve.com/api/download/premium/",
- post = {"username": self.user,
- "password": self.account.getAccountData(self.user)["password"],
- "shorten": self.file_id},
- decode = True)
+ post={"username": self.user,
+ "password": self.account.getAccountData(self.user)["password"],
+ "shorten": self.file_id},
+ decode=True)
if response:
response = json_loads(response)
- if response['error_code'] == "302": premium_url = response['next']
- elif response['error_code'] in ["305", "500"]: self.tempOffline()
- elif response['error_code'] in ["403", "605"]: self.resetAccount()
- elif response['error_code'] in ["606", "607", "608"]: self.offline()
- else: self.logError(response['error_code'], response['error_message'])
-
+ if response['error_code'] == "302":
+ premium_url = response['next']
+ elif response['error_code'] in ["305", "500"]:
+ self.tempOffline()
+ elif response['error_code'] in ["403", "605"]:
+ self.resetAccount()
+ elif response['error_code'] in ["606", "607", "608"]:
+ self.offline()
+ else:
+ self.logError(response['error_code'], response['error_message'])
+
self.download(premium_url or self.pyfile.url)
-
- if not premium_url:
+
+ if not premium_url:
check = self.checkDownload({"login": re.compile(self.NOT_LOGGED_IN_PATTERN)})
-
+
if check == "login":
self.account.relogin(self.user)
self.retry(reason=_("Not logged in."))
+
def getInfo(urls):
- for chunk in chunks(urls, 100): yield checkFile(FileserveCom, chunk) \ No newline at end of file
+ for chunk in chunks(urls, 100):
+ yield checkFile(FileserveCom, chunk)
diff --git a/module/plugins/hoster/FileshareInUa.py b/module/plugins/hoster/FileshareInUa.py
index 9700b2d0a..d3724f728 100644
--- a/module/plugins/hoster/FileshareInUa.py
+++ b/module/plugins/hoster/FileshareInUa.py
@@ -1,9 +1,9 @@
-from urllib import urlencode
import re
from module.plugins.Hoster import Hoster
from module.network.RequestFactory import getURL
from module.utils import parseFileSize
+
class FileshareInUa(Hoster):
__name__ = "FileshareInUa"
__type__ = "hoster"
@@ -12,12 +12,12 @@ class FileshareInUa(Hoster):
__description__ = """fileshare.in.ua hoster plugin"""
__author_name__ = ("fwannmacher")
__author_mail__ = ("felipe@warhammerproject.com")
-
+
HOSTER_NAME = "fileshare.in.ua"
PATTERN_FILENAME = r'<h3 class="b-filename">(.*?)</h3>'
PATTERN_FILESIZE = r'<b class="b-filesize">(.*?)</b>'
PATTERN_OFFLINE = "This file doesn't exist, or has been removed."
-
+
def setup(self):
self.resumeDownload = True
self.multiDL = True
@@ -28,51 +28,52 @@ class FileshareInUa(Hoster):
if not self._checkOnline():
self.offline()
-
+
self.pyfile.name = self._getName()
-
+
self.link = self._getLink()
-
+
if not self.link.startswith('http://'):
self.link = "http://fileshare.in.ua" + self.link
- self.download(self.link)
+ self.download(self.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:
self.fail("%s: Plugin broken." % self.__name__)
return name.group(1)
-
- def _getLink(self):
+
+ def _getLink(self):
return re.search("<a href=\"(/get/.+)\" class=\"b-button m-blue m-big\" >", self.html).group(1)
+
def getInfo(urls):
result = []
-
- for url in urls:
+
+ for url in urls:
html = getURL(url)
-
+
if re.search(FileshareInUa.PATTERN_OFFLINE, html):
result.append((url, 0, 1, url))
else:
name = re.search(FileshareInUa.PATTERN_FILENAME, html)
-
+
if name is None:
result.append((url, 0, 1, url))
continue
-
+
name = name.group(1)
size = re.search(FileshareInUa.PATTERN_FILESIZE, html)
- size = parseFileSize(size.group(1))
-
+ size = parseFileSize(size.group(1))
+
result.append((name, size, 3, url))
yield result
diff --git a/module/plugins/hoster/FilezyNet.py b/module/plugins/hoster/FilezyNet.py
index 7c5729c2d..c31707089 100644
--- a/module/plugins/hoster/FilezyNet.py
+++ b/module/plugins/hoster/FilezyNet.py
@@ -2,6 +2,7 @@
import re
from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
class FilezyNet(XFileSharingPro):
__name__ = "FilezyNet"
__type__ = "hoster"
@@ -23,11 +24,12 @@ class FilezyNet(XFileSharingPro):
self.logDebug("Getting download link")
data = self.getPostParameters()
- self.html = self.load(self.pyfile.url, post = data, ref = True, decode = True)
+ self.html = self.load(self.pyfile.url, post=data, ref=True, decode=True)
obfuscated_js = re.search(self.DOWNLOAD_JS_PATTERN, self.html)
dl_file_now = self.js.eval(obfuscated_js.group(1))
link = re.search(self.DIRECT_LINK_PATTERN, dl_file_now)
return link.group(1)
+
getInfo = create_getInfo(FilezyNet)
diff --git a/module/plugins/hoster/FlyFilesNet.py b/module/plugins/hoster/FlyFilesNet.py
index 0ffb76191..8d0ff0a08 100644
--- a/module/plugins/hoster/FlyFilesNet.py
+++ b/module/plugins/hoster/FlyFilesNet.py
@@ -4,9 +4,10 @@
import re
import urllib
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.plugins.internal.SimpleHoster import SimpleHoster
from module.network.RequestFactory import getURL
+
class FlyFilesNet(SimpleHoster):
__name__ = "FlyFilesNet"
__version__ = "0.1"
@@ -17,7 +18,6 @@ class FlyFilesNet(SimpleHoster):
FILE_NAME_PATTERN = r'flyfiles\.net/.*/(.*)'
def process(self, pyfile):
-
pyfile.name = re.search(self.FILE_NAME_PATTERN, pyfile.url).group(1)
pyfile.name = urllib.unquote_plus(pyfile.name)
@@ -31,11 +31,11 @@ class FlyFilesNet(SimpleHoster):
if parsed_url == '#downlink|' or parsed_url == "#downlink|#":
self.logWarning("Could not get the download URL. Please wait 10 minutes.")
- self.setWait(600, True) # wait 10 minutes
+ self.setWait(600, True) # wait 10 minutes
self.wait()
self.retry()
- download_url = parsed_url.replace('#downlink|','')
+ download_url = parsed_url.replace('#downlink|', '')
self.logDebug("Download URL: %s" % download_url)
self.download(download_url)
diff --git a/module/plugins/hoster/FourSharedCom.py b/module/plugins/hoster/FourSharedCom.py
index 518ae2ae6..6b3e33284 100644
--- a/module/plugins/hoster/FourSharedCom.py
+++ b/module/plugins/hoster/FourSharedCom.py
@@ -1,9 +1,11 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
class FourSharedCom(SimpleHoster):
__name__ = "FourSharedCom"
__type__ = "hoster"
@@ -18,7 +20,7 @@ class FourSharedCom(SimpleHoster):
FILE_OFFLINE_PATTERN = 'The file link that you requested is not valid\.|This file was deleted.'
FILE_NAME_REPLACEMENTS = [(r"&#(\d+).", lambda m: unichr(int(m.group(1))))]
FILE_SIZE_REPLACEMENTS = [(",", "")]
-
+
DOWNLOAD_BUTTON_PATTERN = 'id="btnLink" href="(.*?)"'
FID_PATTERN = 'name="d3fid" value="(.*?)"'
DOWNLOAD_URL_PATTERN = r'name="d3link" value="(.*?)"'
@@ -26,28 +28,30 @@ class FourSharedCom(SimpleHoster):
def handleFree(self):
if not self.account:
self.fail("User not logged in")
-
+
found = re.search(self.DOWNLOAD_BUTTON_PATTERN, self.html)
if found:
link = found.group(1)
else:
link = re.sub(r'/(download|get|file|document|photo|video|audio)/', r'/get/', self.pyfile.url)
-
+
self.html = self.load(link)
-
+
found = re.search(self.DOWNLOAD_URL_PATTERN, self.html)
- if not found: self.parseError('Download link')
+ if not found:
+ self.parseError('Download link')
link = found.group(1)
-
+
try:
found = re.search(self.FID_PATTERN, self.html)
response = self.load('http://www.4shared.com/web/d2/getFreeDownloadLimitInfo?fileId=%s' % found.group(1))
self.logDebug(response)
except:
pass
-
+
self.setWait(20)
self.wait()
self.download(link)
-getInfo = create_getInfo(FourSharedCom) \ No newline at end of file
+
+getInfo = create_getInfo(FourSharedCom)
diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py
index 56e02cbdc..5a42d1a47 100644
--- a/module/plugins/hoster/FreakshareCom.py
+++ b/module/plugins/hoster/FreakshareCom.py
@@ -1,167 +1,171 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import re
-from module.plugins.Hoster import Hoster
-from module.plugins.ReCaptcha import ReCaptcha
-
-class FreakshareCom(Hoster):
- __name__ = "FreakshareCom"
- __type__ = "hoster"
- __pattern__ = r"http://(?:www\.)?freakshare\.(net|com)/files/\S*?/"
- __version__ = "0.37"
- __description__ = """Freakshare.com Download Hoster"""
- __author_name__ = ("sitacuisses","spoob","mkaay", "Toilal")
- __author_mail__ = ("sitacuisses@yahoo.de","spoob@pyload.org","mkaay@mkaay.de", "toilal.dev@gmail.com")
-
- def setup(self):
- self.html = None
- self.wantReconnect = False
- self.multiDL = False
- self.req_opts = []
-
- def process(self, pyfile):
- self.pyfile = pyfile
-
- pyfile.url = pyfile.url.replace("freakshare.net/","freakshare.com/")
-
- if self.account:
- self.html = self.load(pyfile.url, cookies=False)
- pyfile.name = self.get_file_name()
- self.download(pyfile.url)
-
- else:
- self.prepare()
- self.get_file_url()
-
- self.download(self.pyfile.url, post=self.req_opts)
-
-
- check = self.checkDownload({"bad": "bad try",
- "paralell": "> Sorry, you cant download more then 1 files at time. <",
- "empty": "Warning: Unknown: Filename cannot be empty",
- "wrong_captcha": "Wrong Captcha!"})
-
- if check == "bad":
- self.fail("Bad Try.")
- if check == "paralell":
- self.setWait(300, True)
- self.wait()
- self.retry()
- if check == "empty":
- self.fail("File not downloadable")
- if check == "wrong_captcha":
- self.invalidCaptcha()
- self.retry()
-
- def prepare(self):
- pyfile = self.pyfile
-
- self.wantReconnect = False
-
- self.download_html()
-
- if not self.file_exists():
- self.offline()
-
- self.setWait( self.get_waiting_time() )
-
- pyfile.name = self.get_file_name()
- pyfile.size = self.get_file_size()
-
- self.wait()
-
- 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
- """
- if self.html is None:
- self.download_html()
- if not self.wantReconnect:
- self.req_opts = self.get_download_options() # get the Post options for the Request
- #file_url = self.pyfile.url
- #return file_url
- else:
- self.offline()
-
- def get_file_name(self):
- if self.html is None:
- self.download_html()
- if not self.wantReconnect:
- file_name = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">([^ ]+)", self.html)
- if file_name is not None:
- file_name = file_name.group(1)
- else:
- file_name = self.pyfile.url
- return file_name
- else:
- return self.pyfile.url
-
- def get_file_size(self):
- size = 0
- if self.html is None:
- self.download_html()
- if not self.wantReconnect:
- file_size_check = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">[^ ]+ - ([^ ]+) (\w\w)yte", self.html)
- if file_size_check is not None:
- units = float(file_size_check.group(1).replace(",", ""))
- pow = {'KB': 1, 'MB': 2, 'GB': 3}[file_size_check.group(2)]
- size = int(units * 1024 ** pow)
-
- return size
-
- def get_waiting_time(self):
- if self.html is None:
- self.download_html()
-
- if "Your Traffic is used up for today" in self.html:
- self.wantReconnect = True
- return 24*3600
-
- timestring = re.search('\s*var\s(?:downloadWait|time)\s=\s(\d*)[.\d]*;', self.html)
- if timestring:
- return int(timestring.group(1)) + 1 #add 1 sec as tenths of seconds are cut off
- else:
- return 60
-
-
- def file_exists(self):
- """ returns True or False
- """
- if self.html is None:
- self.download_html()
- if re.search(r"This file does not exist!", self.html) is not None:
- return False
- 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
- to_sort = re.findall(r"<input\stype=\"hidden\"\svalue=\"(.*?)\"\sname=\"(.*?)\"\s\/>", re_envelope)
- request_options = dict((n, v) for (v, n) in to_sort)
-
- herewego = self.load(self.pyfile.url, None, request_options) # the actual download-Page
-
- # comment this in, when it doesnt work
- # with open("DUMP__FS_.HTML", "w") as fp:
- # fp.write(herewego)
-
- to_sort = re.findall(r"<input\stype=\".*?\"\svalue=\"(\S*?)\".*?name=\"(\S*?)\"\s.*?\/>", herewego)
- request_options = dict((n, v) for (v, n) in to_sort)
-
- # comment this in, when it doesnt work as well
- #print "\n\n%s\n\n" % ";".join(["%s=%s" % x for x in to_sort])
-
- challenge = re.search(r"http://api\.recaptcha\.net/challenge\?k=([0-9A-Za-z]+)", herewego)
-
- if challenge:
- re_captcha = ReCaptcha(self)
- request_options["recaptcha_challenge_field"], request_options["recaptcha_response_field"] \
- = re_captcha.challenge(challenge.group(1))
-
- return request_options
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Hoster import Hoster
+from module.plugins.internal.CaptchaService import ReCaptcha
+
+
+class FreakshareCom(Hoster):
+ __name__ = "FreakshareCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?freakshare\.(net|com)/files/\S*?/"
+ __version__ = "0.38"
+ __description__ = """Freakshare.com Download Hoster"""
+ __author_name__ = ("sitacuisses", "spoob", "mkaay", "Toilal")
+ __author_mail__ = ("sitacuisses@yahoo.de", "spoob@pyload.org", "mkaay@mkaay.de", "toilal.dev@gmail.com")
+
+ def setup(self):
+ self.html = None
+ self.wantReconnect = False
+ self.multiDL = False
+ self.req_opts = []
+
+ def process(self, pyfile):
+ self.pyfile = pyfile
+
+ pyfile.url = pyfile.url.replace("freakshare.net/", "freakshare.com/")
+
+ if self.account:
+ self.html = self.load(pyfile.url, cookies=False)
+ pyfile.name = self.get_file_name()
+ self.download(pyfile.url)
+
+ else:
+ self.prepare()
+ self.get_file_url()
+
+ self.download(self.pyfile.url, post=self.req_opts)
+
+ check = self.checkDownload({"bad": "bad try",
+ "paralell": "> Sorry, you cant download more then 1 files at time. <",
+ "empty": "Warning: Unknown: Filename cannot be empty",
+ "wrong_captcha": "Wrong Captcha!",
+ "downloadserver": "No Downloadserver. Please try again later!"})
+
+ if check == "bad":
+ self.fail("Bad Try.")
+ elif check == "paralell":
+ self.setWait(300, True)
+ self.wait()
+ self.retry()
+ elif check == "empty":
+ self.fail("File not downloadable")
+ elif check == "wrong_captcha":
+ self.invalidCaptcha()
+ self.retry()
+ elif check == "downloadserver":
+ self.retry(5, 900, 'No Download server')
+
+ def prepare(self):
+ pyfile = self.pyfile
+
+ self.wantReconnect = False
+
+ self.download_html()
+
+ if not self.file_exists():
+ self.offline()
+
+ self.setWait(self.get_waiting_time())
+
+ pyfile.name = self.get_file_name()
+ pyfile.size = self.get_file_size()
+
+ self.wait()
+
+ 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
+ """
+ if self.html is None:
+ self.download_html()
+ if not self.wantReconnect:
+ self.req_opts = self.get_download_options() # get the Post options for the Request
+ #file_url = self.pyfile.url
+ #return file_url
+ else:
+ self.offline()
+
+ def get_file_name(self):
+ if self.html is None:
+ self.download_html()
+ if not self.wantReconnect:
+ file_name = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">([^ ]+)", self.html)
+ if file_name is not None:
+ file_name = file_name.group(1)
+ else:
+ file_name = self.pyfile.url
+ return file_name
+ else:
+ return self.pyfile.url
+
+ def get_file_size(self):
+ size = 0
+ if self.html is None:
+ self.download_html()
+ if not self.wantReconnect:
+ file_size_check = re.search(
+ r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">[^ ]+ - ([^ ]+) (\w\w)yte", self.html)
+ if file_size_check is not None:
+ units = float(file_size_check.group(1).replace(",", ""))
+ pow = {'KB': 1, 'MB': 2, 'GB': 3}[file_size_check.group(2)]
+ size = int(units * 1024 ** pow)
+
+ return size
+
+ def get_waiting_time(self):
+ if self.html is None:
+ self.download_html()
+
+ if "Your Traffic is used up for today" in self.html:
+ self.wantReconnect = True
+ return 24 * 3600
+
+ timestring = re.search('\s*var\s(?:downloadWait|time)\s=\s(\d*)[.\d]*;', self.html)
+ if timestring:
+ return int(timestring.group(1)) + 1 # add 1 sec as tenths of seconds are cut off
+ else:
+ return 60
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html is None:
+ self.download_html()
+ if re.search(r"This file does not exist!", self.html) is not None:
+ return False
+ 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
+ to_sort = re.findall(r"<input\stype=\"hidden\"\svalue=\"(.*?)\"\sname=\"(.*?)\"\s\/>", re_envelope)
+ request_options = dict((n, v) for (v, n) in to_sort)
+
+ herewego = self.load(self.pyfile.url, None, request_options) # the actual download-Page
+
+ # comment this in, when it doesnt work
+ # with open("DUMP__FS_.HTML", "w") as fp:
+ # fp.write(herewego)
+
+ to_sort = re.findall(r"<input\stype=\".*?\"\svalue=\"(\S*?)\".*?name=\"(\S*?)\"\s.*?\/>", herewego)
+ request_options = dict((n, v) for (v, n) in to_sort)
+
+ # comment this in, when it doesnt work as well
+ #print "\n\n%s\n\n" % ";".join(["%s=%s" % x for x in to_sort])
+
+ challenge = re.search(r"http://api\.recaptcha\.net/challenge\?k=([0-9A-Za-z]+)", herewego)
+
+ if challenge:
+ re_captcha = ReCaptcha(self)
+ request_options["recaptcha_challenge_field"], request_options["recaptcha_response_field"] \
+ = re_captcha.challenge(challenge.group(1))
+
+ return request_options
diff --git a/module/plugins/hoster/FreevideoCz.py b/module/plugins/hoster/FreevideoCz.py
index 19eb77470..c5da074ed 100644
--- a/module/plugins/hoster/FreevideoCz.py
+++ b/module/plugins/hoster/FreevideoCz.py
@@ -20,6 +20,7 @@ import re
from module.plugins.Hoster import Hoster
from module.network.RequestFactory import getURL
+
def getInfo(urls):
result = []
@@ -33,6 +34,7 @@ def getInfo(urls):
result.append((url, 0, 2, url))
yield result
+
class FreevideoCz(Hoster):
__name__ = "FreevideoCz"
__type__ = "hoster"
diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py
index 926781b40..fa0bcb253 100644
--- a/module/plugins/hoster/FshareVn.py
+++ b/module/plugins/hoster/FshareVn.py
@@ -1,25 +1,29 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
-from module.network.RequestFactory import getURL
import re
from time import strptime, mktime, gmtime
+from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
+from module.network.RequestFactory import getURL
+
+
def getInfo(urls):
for url in urls:
- html = getURL('http://www.fshare.vn/check_link.php', post = {
- "action" : "check_link",
- "arrlinks" : url
- }, decode = True)
+ html = getURL('http://www.fshare.vn/check_link.php', post={
+ "action": "check_link",
+ "arrlinks": url
+ }, decode=True)
file_info = parseFileInfo(FshareVn, url, html)
yield file_info
+
def doubleDecode(m):
return m.group(1).decode('raw_unicode_escape')
+
class FshareVn(SimpleHoster):
__name__ = "FshareVn"
__type__ = "hoster"
@@ -37,10 +41,10 @@ class FshareVn(SimpleHoster):
WAIT_PATTERN = ur'Lượt tải xuống kế tiếp là:\s*(.*?)\s*<'
def process(self, pyfile):
- self.html = self.load('http://www.fshare.vn/check_link.php', post = {
+ self.html = self.load('http://www.fshare.vn/check_link.php', post={
"action": "check_link",
"arrlinks": pyfile.url
- }, decode = True)
+ }, decode=True)
self.getFileInfo()
if self.premium:
@@ -50,14 +54,15 @@ class FshareVn(SimpleHoster):
self.checkDownloadedFile()
def handleFree(self):
- self.html = self.load(self.pyfile.url, decode = True)
+ self.html = self.load(self.pyfile.url, decode=True)
self.checkErrors()
action, inputs = self.parseHtmlForm('frm_download')
self.url = self.pyfile.url + action
- if not inputs: self.parseError('FORM')
+ if not inputs:
+ self.parseError('FORM')
elif 'link_file_pwd_dl' in inputs:
for password in self.getPassword().splitlines():
self.logInfo('Password protected link, trying "%s"' % password)
@@ -76,7 +81,8 @@ class FshareVn(SimpleHoster):
self.setWait(int(found.group(1)) if found else 30)
found = re.search(self.DOWNLOAD_URL_PATTERN, self.html)
- if not found: self.parseError('FREE DL URL')
+ if not found:
+ self.parseError('FREE DL URL')
self.url = found.group(1)
self.logDebug("FREE DL URL: %s" % self.url)
@@ -104,8 +110,8 @@ class FshareVn(SimpleHoster):
def checkDownloadedFile(self):
# check download
check = self.checkDownload({
- "not_found": ("<head><title>404 Not Found</title></head>")
- })
+ "not_found": "<head><title>404 Not Found</title></head>"
+ })
if check == "not_found":
self.fail("File not found on server")
diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py
index 3bda3b32e..77992372a 100644
--- a/module/plugins/hoster/Ftp.py
+++ b/module/plugins/hoster/Ftp.py
@@ -1,91 +1,90 @@
-# -*- coding: utf-8 -*-
-
-"""
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License,
- or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>.
-
- @author: jeix
- @author: mkaay
-"""
-from urlparse import urlparse, urljoin
-from urllib import quote, unquote
-import pycurl, re
-
-from module.plugins.Hoster import Hoster
-from module.network.HTTPRequest import BadHeader
-
-class Ftp(Hoster):
- __name__ = "Ftp"
- __version__ = "0.41"
- __pattern__ = r'(ftps?|sftp)://(.*?:.*?@)?.*?/.*' # ftp://user:password@ftp.server.org/path/to/file
- __type__ = "hoster"
- __description__ = """A Plugin that allows you to download from an from an ftp directory"""
- __author_name__ = ("jeix", "mkaay", "zoidberg")
- __author_mail__ = ("jeix@hasnomail.com", "mkaay@mkaay.de", "zoidberg@mujmail.cz")
-
- def setup(self):
- self.chunkLimit = -1
- self.resumeDownload = True
-
- def process(self, pyfile):
- parsed_url = urlparse(pyfile.url)
- netloc = parsed_url.netloc
-
- pyfile.name = parsed_url.path.rpartition('/')[2]
- try:
- pyfile.name = unquote(str(pyfile.name)).decode('utf8')
- except:
- pass
-
- if not "@" in netloc:
- servers = [ x['login'] for x in self.account.getAllAccounts() ] if self.account else []
-
- if netloc in servers:
- self.logDebug("Logging on to %s" % netloc)
- self.req.addAuth(self.account.accounts[netloc]["password"])
- else:
- for pwd in pyfile.package().password.splitlines():
- if ":" in pwd:
- self.req.addAuth(pwd.strip())
- break
-
- self.req.http.c.setopt(pycurl.NOBODY, 1)
-
- try:
- response = self.load(pyfile.url)
- except pycurl.error, e:
- self.fail("Error %d: %s" % e.args)
-
- self.req.http.c.setopt(pycurl.NOBODY, 0)
- self.logDebug(self.req.http.header)
-
- found = re.search(r"Content-Length:\s*(\d+)", response)
- if found:
- pyfile.size = int(found.group(1))
- self.download(pyfile.url)
- else:
- #Naive ftp directory listing
- if re.search(r'^25\d.*?"', self.req.http.header, re.M):
- pyfile.url = pyfile.url.rstrip('/')
- pkgname = "/".join((pyfile.package().name,urlparse(pyfile.url).path.rpartition('/')[2]))
- pyfile.url += '/'
- self.req.http.c.setopt(48, 1) # CURLOPT_DIRLISTONLY
- response = self.load(pyfile.url, decode = False)
- links = [ pyfile.url + quote(x) for x in response.splitlines() ]
- self.logDebug("LINKS", links)
- self.core.api.addPackage(pkgname, links, 1)
- #self.core.files.addLinks(links, pyfile.package().id)
- else:
- self.fail("Unexpected server response")
-
- \ No newline at end of file
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: jeix
+ @author: mkaay
+"""
+from urlparse import urlparse
+from urllib import quote, unquote
+import pycurl
+import re
+
+from module.plugins.Hoster import Hoster
+
+
+class Ftp(Hoster):
+ __name__ = "Ftp"
+ __version__ = "0.41"
+ __pattern__ = r'(ftps?|sftp)://(.*?:.*?@)?.*?/.*' # ftp://user:password@ftp.server.org/path/to/file
+ __type__ = "hoster"
+ __description__ = """A Plugin that allows you to download from an from an ftp directory"""
+ __author_name__ = ("jeix", "mkaay", "zoidberg")
+ __author_mail__ = ("jeix@hasnomail.com", "mkaay@mkaay.de", "zoidberg@mujmail.cz")
+
+ def setup(self):
+ self.chunkLimit = -1
+ self.resumeDownload = True
+
+ def process(self, pyfile):
+ parsed_url = urlparse(pyfile.url)
+ netloc = parsed_url.netloc
+
+ pyfile.name = parsed_url.path.rpartition('/')[2]
+ try:
+ pyfile.name = unquote(str(pyfile.name)).decode('utf8')
+ except:
+ pass
+
+ if not "@" in netloc:
+ servers = [x['login'] for x in self.account.getAllAccounts()] if self.account else []
+
+ if netloc in servers:
+ self.logDebug("Logging on to %s" % netloc)
+ self.req.addAuth(self.account.accounts[netloc]["password"])
+ else:
+ for pwd in pyfile.package().password.splitlines():
+ if ":" in pwd:
+ self.req.addAuth(pwd.strip())
+ break
+
+ self.req.http.c.setopt(pycurl.NOBODY, 1)
+
+ try:
+ response = self.load(pyfile.url)
+ except pycurl.error, e:
+ self.fail("Error %d: %s" % e.args)
+
+ self.req.http.c.setopt(pycurl.NOBODY, 0)
+ self.logDebug(self.req.http.header)
+
+ found = re.search(r"Content-Length:\s*(\d+)", response)
+ if found:
+ pyfile.size = int(found.group(1))
+ self.download(pyfile.url)
+ else:
+ #Naive ftp directory listing
+ if re.search(r'^25\d.*?"', self.req.http.header, re.M):
+ pyfile.url = pyfile.url.rstrip('/')
+ pkgname = "/".join((pyfile.package().name, urlparse(pyfile.url).path.rpartition('/')[2]))
+ pyfile.url += '/'
+ self.req.http.c.setopt(48, 1) # CURLOPT_DIRLISTONLY
+ response = self.load(pyfile.url, decode=False)
+ links = [pyfile.url + quote(x) for x in response.splitlines()]
+ self.logDebug("LINKS", links)
+ self.core.api.addPackage(pkgname, links, 1)
+ #self.core.files.addLinks(links, pyfile.package().id)
+ else:
+ self.fail("Unexpected server response")
diff --git a/module/plugins/hoster/GamefrontCom.py b/module/plugins/hoster/GamefrontCom.py
index 34fda09d2..a76eb9b2f 100644
--- a/module/plugins/hoster/GamefrontCom.py
+++ b/module/plugins/hoster/GamefrontCom.py
@@ -3,6 +3,7 @@ from module.plugins.Hoster import Hoster
from module.network.RequestFactory import getURL
from module.utils import parseFileSize
+
class GamefrontCom(Hoster):
__name__ = "GamefrontCom"
__type__ = "hoster"
@@ -11,12 +12,12 @@ class GamefrontCom(Hoster):
__description__ = """gamefront.com hoster plugin"""
__author_name__ = ("fwannmacher")
__author_mail__ = ("felipe@warhammerproject.com")
-
+
HOSTER_NAME = "gamefront.com"
PATTERN_FILENAME = r'<title>(.*?) | Game Front'
PATTERN_FILESIZE = r'<dt>File Size:</dt>[\n\s]*<dd>(.*?)</dd>'
PATTERN_OFFLINE = "This file doesn't exist, or has been removed."
-
+
def setup(self):
self.resumeDownload = True
self.multiDL = False
@@ -27,54 +28,56 @@ class GamefrontCom(Hoster):
if not self._checkOnline():
self.offline()
-
+
self.pyfile.name = self._getName()
-
+
self.link = self._getLink()
-
+
if not self.link.startswith('http://'):
self.link = "http://www.gamefront.com/" + self.link
- self.download(self.link)
+ self.download(self.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:
self.fail("%s: Plugin broken." % self.__name__)
return name.group(1)
-
- def _getLink(self):
- self.html2 = self.load("http://www.gamefront.com/" + re.search("(files/service/thankyou\\?id=[A-Za-z0-9]+)", self.html).group(1))
+
+ def _getLink(self):
+ self.html2 = self.load("http://www.gamefront.com/" + re.search("(files/service/thankyou\\?id=[A-Za-z0-9]+)",
+ self.html).group(1))
self.link = re.search("<a href=\"(http://media[0-9]+\.gamefront.com/.*)\">click here</a>", self.html2)
return self.link.group(1).replace("&amp;", "&")
+
def getInfo(urls):
result = []
-
- for url in urls:
+
+ for url in urls:
html = getURL(url)
-
+
if re.search(GamefrontCom.PATTERN_OFFLINE, html):
result.append((url, 0, 1, url))
else:
name = re.search(GamefrontCom.PATTERN_FILENAME, html)
-
+
if name is None:
result.append((url, 0, 1, url))
continue
-
+
name = name.group(1)
size = re.search(GamefrontCom.PATTERN_FILESIZE, html)
- size = parseFileSize(size.group(1))
-
+ size = parseFileSize(size.group(1))
+
result.append((name, size, 3, url))
- yield result \ No newline at end of file
+ yield result
diff --git a/module/plugins/hoster/GigapetaCom.py b/module/plugins/hoster/GigapetaCom.py
index 28ba35abe..de5d94513 100644
--- a/module/plugins/hoster/GigapetaCom.py
+++ b/module/plugins/hoster/GigapetaCom.py
@@ -18,9 +18,11 @@
import re
from random import randint
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from pycurl import FOLLOWLOCATION
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
class GigapetaCom(SimpleHoster):
__name__ = "GigapetaCom"
__type__ = "hoster"
@@ -34,40 +36,41 @@ class GigapetaCom(SimpleHoster):
FILE_NAME_PATTERN = r'<img src=".*" alt="file" />-->\s*(?P<N>.*?)\s*</td>'
FILE_SIZE_PATTERN = r'<th>\s*Size\s*</th>\s*<td>\s*(?P<S>.*?)\s*</td>'
FILE_OFFLINE_PATTERN = r'<div id="page_error">'
-
- def handleFree(self):
- captcha_key = str(randint(1,100000000))
+
+ def handleFree(self):
+ captcha_key = str(randint(1, 100000000))
captcha_url = "http://gigapeta.com/img/captcha.gif?x=%s" % captcha_key
-
+
self.req.http.c.setopt(FOLLOWLOCATION, 0)
-
+
for i in range(5):
self.checkErrors()
-
- captcha = self.decryptCaptcha(captcha_url)
- self.html = self.load(self.pyfile.url, post = {
- "captcha_key": captcha_key,
+
+ captcha = self.decryptCaptcha(captcha_url)
+ self.html = self.load(self.pyfile.url, post={
+ "captcha_key": captcha_key,
"captcha": captcha,
"download": "Download"})
-
+
found = re.search(r"Location\s*:\s*(.*)", self.req.http.header, re.I)
if found:
- download_url = found.group(1)
- break
+ download_url = found.group(1)
+ break
elif "Entered figures don&#96;t coincide with the picture" in self.html:
- self.invalidCaptcha()
+ self.invalidCaptcha()
else:
- self.fail("No valid captcha code entered")
-
+ self.fail("No valid captcha code entered")
+
self.req.http.c.setopt(FOLLOWLOCATION, 1)
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")
self.setWait(300, True)
self.wait()
self.retry()
-
-getInfo = create_getInfo(GigapetaCom) \ No newline at end of file
+
+
+getInfo = create_getInfo(GigapetaCom)
diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py
index aa494e34e..5fdcca7ae 100644
--- a/module/plugins/hoster/HellshareCz.py
+++ b/module/plugins/hoster/HellshareCz.py
@@ -17,7 +17,6 @@
"""
import re
-from math import ceil
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
@@ -39,18 +38,21 @@ class HellshareCz(SimpleHoster):
self.chunkLimit = 1
def process(self, pyfile):
- if not self.account: self.fail("User not logged in")
+ if not self.account:
+ self.fail("User not logged in")
pyfile.url = re.search(self.__pattern__, pyfile.url).group(1)
- self.html = self.load(pyfile.url, decode = True)
+ self.html = self.load(pyfile.url, decode=True)
self.getFileInfo()
if not self.checkTrafficLeft():
self.fail("Not enough traffic left for user %s." % self.user)
found = re.search(self.SHOW_WINDOW_PATTERN, self.html)
- if not found: self.parseError('SHOW WINDOW')
+ if not found:
+ self.parseError('SHOW WINDOW')
self.url = "http://www.hellshare.com" + found.group(1)
self.logDebug("DOWNLOAD URL: " + self.url)
self.download(self.url)
+
getInfo = create_getInfo(HellshareCz)
diff --git a/module/plugins/hoster/HellspyCz.py b/module/plugins/hoster/HellspyCz.py
index 9858c82b7..2e0746ff4 100644
--- a/module/plugins/hoster/HellspyCz.py
+++ b/module/plugins/hoster/HellspyCz.py
@@ -19,6 +19,7 @@
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
class HellspyCz(SimpleHoster):
__name__ = "HellspyCz"
__type__ = "hoster"
@@ -32,7 +33,7 @@ class HellspyCz(SimpleHoster):
FILE_NAME_PATTERN = r'<h1 title="(?P<N>.*?)"'
FILE_OFFLINE_PATTERN = r'<h2>(404 - Page|File) not found</h2>'
FILE_URL_REPLACEMENTS = [(__pattern__, r"http://www.hellspy.com\1")]
-
+
CREDIT_LEFT_PATTERN = r'<strong>Credits: </strong>\s*(\d+)'
DOWNLOAD_AGAIN_PATTERN = r'<a id="button-download-start"[^>]*title="You can download the file without deducting your credit.">'
DOWNLOAD_URL_PATTERN = r"launchFullDownload\('([^']+)'"
@@ -44,14 +45,14 @@ class HellspyCz(SimpleHoster):
def handleFree(self):
self.fail("Only premium users can download from HellSpy.cz")
- def handlePremium(self):
+ def handlePremium(self):
# set PHPSESSID cookie
cj = self.account.getAccountCookies(self.user)
cj.setCookie(".hellspy.com", "PHPSESSID", self.account.phpsessid)
self.logDebug("PHPSESSID: " + cj.getCookie("PHPSESSID"))
info = self.account.getAccountInfo(self.user, True)
- self.logInfo("User %s has %i credits left" % (self.user, info["trafficleft"]/1024))
+ self.logInfo("User %s has %i credits left" % (self.user, info["trafficleft"] / 1024))
if self.pyfile.size / 1024 > info["trafficleft"]:
self.logWarning("Not enough credit left to download file")
@@ -59,12 +60,14 @@ class HellspyCz(SimpleHoster):
# get premium download URL and download
self.html = self.load(self.pyfile.url + "?download=1")
found = re.search(self.DOWNLOAD_URL_PATTERN, self.html)
- if not found: self.parseError("Download URL")
+ if not found:
+ self.parseError("Download URL")
url = found.group(1)
self.logDebug("Download URL: " + url)
self.download(url)
info = self.account.getAccountInfo(self.user, True)
- self.logInfo("User %s has %i credits left" % (self.user, info["trafficleft"]/1024))
-
-getInfo = create_getInfo(HellspyCz) \ No newline at end of file
+ self.logInfo("User %s has %i credits left" % (self.user, info["trafficleft"] / 1024))
+
+
+getInfo = create_getInfo(HellspyCz)
diff --git a/module/plugins/hoster/HotfileCom.py b/module/plugins/hoster/HotfileCom.py
index 902a5601b..df08419fa 100644
--- a/module/plugins/hoster/HotfileCom.py
+++ b/module/plugins/hoster/HotfileCom.py
@@ -3,39 +3,42 @@
import re
from module.plugins.Hoster import Hoster
-from module.plugins.ReCaptcha import ReCaptcha
+from module.plugins.internal.CaptchaService import ReCaptcha
from module.network.RequestFactory import getURL
from module.plugins.Plugin import chunks
+
def getInfo(urls):
api_url_base = "http://api.hotfile.com/"
-
+
for chunk in chunks(urls, 90):
- api_param_file = {"action":"checklinks","links": ",".join(chunk),"fields":"id,status,name,size"} #api only supports old style links
+ api_param_file = {"action": "checklinks", "links": ",".join(chunk),
+ "fields": "id,status,name,size"} #api only supports old style links
src = getURL(api_url_base, post=api_param_file, decode=True)
result = []
for i, res in enumerate(src.split("\n")):
if not res:
continue
fields = res.split(",")
-
+
if fields[1] in ("1", "2"):
status = 2
else:
status = 1
-
+
result.append((fields[2], int(fields[3]), status, chunk[i]))
yield result
+
class HotfileCom(Hoster):
__name__ = "HotfileCom"
__type__ = "hoster"
__pattern__ = r"https?://(www.)?hotfile\.com/dl/\d+/[0-9a-zA-Z]+/"
__version__ = "0.36"
__description__ = """Hotfile.com Download Hoster"""
- __author_name__ = ("sitacuisses","spoob","mkaay","JoKoT3")
- __author_mail__ = ("sitacuisses@yhoo.de","spoob@pyload.org","mkaay@mkaay.de","jokot3@gmail.com")
+ __author_name__ = ("sitacuisses", "spoob", "mkaay", "JoKoT3")
+ __author_mail__ = ("sitacuisses@yhoo.de", "spoob@pyload.org", "mkaay@mkaay.de", "jokot3@gmail.com")
FILE_OFFLINE_PATTERN = r'File is removed'
@@ -44,7 +47,7 @@ class HotfileCom(Hoster):
self.wantReconnect = False
self.htmlwithlink = None
self.url = None
-
+
if self.premium:
self.multiDL = True
self.resumeDownload = True
@@ -52,7 +55,7 @@ class HotfileCom(Hoster):
else:
self.multiDL = False
self.chunkLimit = 1
-
+
def apiCall(self, method, post, login=False):
if not self.account and login:
return
@@ -60,21 +63,21 @@ class HotfileCom(Hoster):
return self.account.apiCall(method, post, self.user)
post.update({"action": method})
return self.load("http://api.hotfile.com/", post=post, decode=True)
-
+
def process(self, pyfile):
self.wantReconnect = False
-
- args = {"links":self.pyfile.url, "fields":"id,status,name,size,sha1"}
+
+ args = {"links": self.pyfile.url, "fields": "id,status,name,size,sha1"}
resp = self.apiCall("checklinks", args)
self.api_data = {}
for k, v in zip(args["fields"].split(","), resp.strip().split(",")):
self.api_data[k] = v
-
+
if self.api_data["status"] == "0":
self.offline()
pyfile.name = self.api_data["name"]
-
+
if not self.premium:
self.downloadHTML()
@@ -83,19 +86,19 @@ class HotfileCom(Hoster):
self.setWait(self.getWaitTime())
self.wait()
-
+
self.freeDownload()
else:
- dl = self.account.apiCall("getdirectdownloadlink", {"link":self.pyfile.url}, self.user)
+ dl = self.account.apiCall("getdirectdownloadlink", {"link": self.pyfile.url}, self.user)
#dl = unquote(dl).strip() <- Made problems
dl = dl.strip()
self.download(dl)
def downloadHTML(self):
- self.html[0] = self.load(self.pyfile.url, get={"lang":"en"})
+ self.html[0] = self.load(self.pyfile.url, get={"lang": "en"})
def freeDownload(self):
-
+
form_content = re.search(r"<form style=.*(\n<.*>\s*)*?[\n\t]?<tr>", self.html[0])
if form_content is None:
print self.html[0]
@@ -103,35 +106,35 @@ class HotfileCom(Hoster):
form_content = form_content.group(0)
form_posts = dict(re.findall(r"<input\stype=hidden\sname=(\S*)\svalue=(\S*)>", form_content))
-
+
self.html[1] = self.load(self.pyfile.url, post=form_posts)
challenge = re.search(r"http://api\.recaptcha\.net/challenge\?k=([0-9A-Za-z]+)", self.html[1])
-
+
if challenge:
re_captcha = ReCaptcha(self)
challenge, result = re_captcha.challenge(challenge.group(1))
-
- url = re.search(r'<form action="(/dl/[^"]+)', self.html[1] )
-
- self.html[1] = self.load("http://hotfile.com"+url.group(1), post={"action": "checkcaptcha",
- "recaptcha_challenge_field" : challenge,
- "recaptcha_response_field": result})
-
+
+ url = re.search(r'<form action="(/dl/[^"]+)', self.html[1])
+
+ self.html[1] = self.load("http://hotfile.com" + url.group(1), post={"action": "checkcaptcha",
+ "recaptcha_challenge_field": challenge,
+ "recaptcha_response_field": result})
+
if "Wrong Code. Please try again." in self.html[1]:
self.freeDownload()
return
-
+
file_url = re.search(r'a href="(http://hotfile\.com/get/\S*)"', self.html[1]).group(1)
self.download(file_url)
-
+
def getWaitTime(self):
free_limit_pattern = re.compile(r"timerend=d\.getTime\(\)\+(\d+);")
matches = free_limit_pattern.findall(self.html[0])
if matches:
- wait_time = (sum([int(match) for match in matches])/1000) or 60
- if wait_time > 300:
+ wait_time = (sum([int(match) for match in matches]) / 1000) or 60
+ if wait_time > 300:
self.wantReconnect = True
return wait_time + 1
else:
- self.fail("Don't know how long to wait. Cannot proceed.") \ No newline at end of file
+ self.fail("Don't know how long to wait. Cannot proceed.")
diff --git a/module/plugins/hoster/HundredEightyUploadCom.py b/module/plugins/hoster/HundredEightyUploadCom.py
index d8b744359..3cf32d338 100644
--- a/module/plugins/hoster/HundredEightyUploadCom.py
+++ b/module/plugins/hoster/HundredEightyUploadCom.py
@@ -15,6 +15,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
############################################################################
+# Test links (random.bin):
+# http://180upload.com/js9qdm6kjnrs
+
from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
diff --git a/module/plugins/hoster/IcyFilesCom.py b/module/plugins/hoster/IcyFilesCom.py
index 34737e560..53c934675 100644
--- a/module/plugins/hoster/IcyFilesCom.py
+++ b/module/plugins/hoster/IcyFilesCom.py
@@ -20,6 +20,7 @@ import re
from module.plugins.Hoster import Hoster
from module.network.RequestFactory import getURL
+
def getInfo(urls):
result = []
for url in urls:
@@ -36,8 +37,8 @@ def getInfo(urls):
size = (int(size.group(1)) * 1000000)
result.append((name, size, 2, url))
yield result
-
-
+
+
class IcyFilesCom(Hoster):
__name__ = "IcyFilesCom"
__type__ = "hoster"
@@ -54,32 +55,31 @@ class IcyFilesCom(Hoster):
WAIT_PATTERN = r'<div class="counter">(\d+)</div>'
TOOMUCH_PATTERN = r'Sorry dude, you have downloaded too much\. Please wait (\d+) seconds'
-
def setup(self):
self.multiDL = False
-
+
def process(self, pyfile):
self.html = self.load(pyfile.url, decode=True)
# check if offline
if re.search(self.FILE_OFFLINE_PATTERN, self.html):
self.offline()
- # All Downloadtickets in use
+ # All Downloadtickets in use
timmy = re.search(self.WAIT_LONGER_PATTERN, self.html)
if timmy:
self.logDebug("waitforfreeslot")
self.waitForFreeSlot()
- # Wait the waittime
+ # Wait the waittime
timmy = re.search(self.WAIT_PATTERN, self.html)
if timmy:
self.logDebug("waiting", timmy.group(1))
self.setWait(int(timmy.group(1)) + 2, False)
- self.wait()
+ self.wait()
# Downloaded to much
timmy = re.search(self.TOOMUCH_PATTERN, self.html)
if timmy:
self.logDebug("too much", timmy.group(1))
self.setWait(int(timmy.group(1)), True)
- self.wait()
+ self.wait()
# Find Name
found = re.search(self.FILE_NAME_PATTERN, self.html)
if found is None:
@@ -98,7 +98,7 @@ class IcyFilesCom(Hoster):
"skippedcountdown": re.compile(r"^Dont skip the countdown$"),
"waitforfreeslots": re.compile(self.WAIT_LONGER_PATTERN),
"downloadedtoomuch": re.compile(self.TOOMUCH_PATTERN)
- })
+ })
if check == "skippedcountdown":
self.fail("Countdown error")
elif check == "notfound":
diff --git a/module/plugins/hoster/IfileIt.py b/module/plugins/hoster/IfileIt.py
index bf394f340..0e3bdd227 100644
--- a/module/plugins/hoster/IfileIt.py
+++ b/module/plugins/hoster/IfileIt.py
@@ -19,8 +19,8 @@
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.common.json_layer import json_loads
-from module.plugins.ReCaptcha import ReCaptcha
-from module.network.RequestFactory import getURL
+from module.plugins.internal.CaptchaService import ReCaptcha
+
class IfileIt(SimpleHoster):
__name__ = "IfileIt"
@@ -37,17 +37,17 @@ class IfileIt(SimpleHoster):
FILE_INFO_PATTERN = r'<span style="cursor: default;[^>]*>\s*(?P<N>.*?)\s*&nbsp;\s*<strong>\s*(?P<S>[0-9.]+)\s*(?P<U>[kKMG])i?B\s*</strong>\s*</span>'
FILE_OFFLINE_PATTERN = r'<span style="cursor: default;[^>]*>\s*&nbsp;\s*<strong>\s*</strong>\s*</span>'
TEMP_OFFLINE_PATTERN = r'<span class="msg_red">Downloading of this file is temporarily disabled</span>'
-
- def handleFree(self):
+
+ def handleFree(self):
ukey = re.search(self.__pattern__, self.pyfile.url).group(1)
json_url = 'http://ifile.it/new_download-request.json'
- post_data = {"ukey" : ukey, "ab": "0"}
-
- json_response = json_loads(self.load(json_url, post = post_data))
+ post_data = {"ukey": ukey, "ab": "0"}
+
+ json_response = json_loads(self.load(json_url, post=post_data))
self.logDebug(json_response)
if json_response['status'] == 3:
self.offline()
-
+
if json_response["captcha"]:
captcha_key = re.search(self.RECAPTCHA_KEY_PATTERN, self.html).group(1)
recaptcha = ReCaptcha(self)
@@ -55,9 +55,9 @@ class IfileIt(SimpleHoster):
for i in range(5):
post_data["recaptcha_challenge"], post_data["recaptcha_response"] = recaptcha.challenge(captcha_key)
- json_response = json_loads(self.load(json_url, post = post_data))
+ json_response = json_loads(self.load(json_url, post=post_data))
self.logDebug(json_response)
-
+
if json_response["retry"]:
self.invalidCaptcha()
else:
@@ -71,4 +71,5 @@ class IfileIt(SimpleHoster):
self.download(json_response["ticket_url"])
-getInfo = create_getInfo(IfileIt) \ No newline at end of file
+
+getInfo = create_getInfo(IfileIt)
diff --git a/module/plugins/hoster/IfolderRu.py b/module/plugins/hoster/IfolderRu.py
index 6accbc524..dc1ef8fe2 100644
--- a/module/plugins/hoster/IfolderRu.py
+++ b/module/plugins/hoster/IfolderRu.py
@@ -17,9 +17,8 @@
"""
import re
-from urllib import quote
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-from module.network.RequestFactory import getURL
+
class IfolderRu(SimpleHoster):
__name__ = "IfolderRu"
@@ -34,7 +33,7 @@ class IfolderRu(SimpleHoster):
FILE_NAME_PATTERN = ur'(?:<div><span>)?Название:(?:</span>)? <b>(?P<N>[^<]+)</b><(?:/div|br)>'
FILE_SIZE_PATTERN = ur'(?:<div><span>)?Размер:(?:</span>)? <b>(?P<S>[^<]+)</b><(?:/div|br)>'
FILE_OFFLINE_PATTERN = ur'<p>Файл номер <b>[^<]*</b> (не найден|удален) !!!</p>'
-
+
SESSION_ID_PATTERN = r'<a href=(http://ints.(?:rusfolder.com|ifolder.ru)/ints/sponsor/\?bi=\d*&session=([^&]+)&u=[^>]+)>'
INTS_SESSION_PATTERN = r'\(\'ints_session\'\);\s*if\(tag\)\{tag.value = "([^"]+)";\}'
HIDDEN_INPUT_PATTERN = r"var v = .*?name='([^']+)' value='1'"
@@ -52,7 +51,7 @@ class IfolderRu(SimpleHoster):
url = re.search('<a href="(http://ints\..*?=)"', self.html).group(1)
self.html = self.load(url, cookies=True, decode=True)
-
+
url, session_id = re.search(self.SESSION_ID_PATTERN, self.html).groups()
self.html = self.load(url, cookies=True, decode=True)
@@ -68,23 +67,22 @@ class IfolderRu(SimpleHoster):
action, inputs = self.parseHtmlForm('ID="Form1"')
inputs['ints_session'] = re.search(self.INTS_SESSION_PATTERN, self.html).group(1)
inputs[re.search(self.HIDDEN_INPUT_PATTERN, self.html).group(1)] = '1'
- inputs['confirmed_number'] = self.decryptCaptcha(captcha_url, cookies = True)
+ inputs['confirmed_number'] = self.decryptCaptcha(captcha_url, cookies=True)
inputs['action'] = '1'
self.logDebug(inputs)
- self.html = self.load(url, decode = True, cookies = True, post = inputs)
+ self.html = self.load(url, decode=True, cookies=True, post=inputs)
if self.WRONG_CAPTCHA_PATTERN in self.html:
self.invalidCaptcha()
else:
- break;
+ break
else:
self.fail("Invalid captcha")
- #self.html = self.load("http://rusfolder.com/%s?ints_code=%s" % (file_id, session_id), decode=True, cookies = True)
-
download_url = re.search(self.DOWNLOAD_LINK_PATTERN, self.html).group(1)
self.correctCaptcha()
self.logDebug("Download URL: %s" % download_url)
self.download(download_url)
-getInfo = create_getInfo(IfolderRu) \ No newline at end of file
+
+getInfo = create_getInfo(IfolderRu)
diff --git a/module/plugins/hoster/JumbofilesCom.py b/module/plugins/hoster/JumbofilesCom.py
index 9e8adb512..93885a6a3 100644
--- a/module/plugins/hoster/JumbofilesCom.py
+++ b/module/plugins/hoster/JumbofilesCom.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-from module.utils import html_unescape
+
class JumbofilesCom(SimpleHoster):
__name__ = "JumbofilesCom"
@@ -11,7 +11,7 @@ class JumbofilesCom(SimpleHoster):
__description__ = """JumboFiles.com hoster plugin"""
__author_name__ = ("godofdream")
__author_mail__ = ("soilfiction@gmail.com")
-
+
FILE_INFO_PATTERN = '<TR><TD>(?P<N>[^<]+?)\s*<small>\((?P<S>[\d.]+)\s*(?P<U>[KMG][bB])\)</small></TD></TR>'
FILE_OFFLINE_PATTERN = 'Not Found or Deleted / Disabled due to inactivity or DMCA'
DIRECT_LINK_PATTERN = '<meta http-equiv="refresh" content="10;url=(.+)">'
@@ -22,10 +22,11 @@ class JumbofilesCom(SimpleHoster):
def handleFree(self):
ukey = re.search(self.__pattern__, self.pyfile.url).group(1)
- post_data = {"id" : ukey, "op": "download3", "rand": ""}
- html = self.load(self.pyfile.url, post = post_data, decode=True)
+ post_data = {"id": ukey, "op": "download3", "rand": ""}
+ html = self.load(self.pyfile.url, post=post_data, decode=True)
url = re.search(self.DIRECT_LINK_PATTERN, html).group(1)
self.logDebug("Download " + url)
self.download(url)
-
+
+
getInfo = create_getInfo(JumbofilesCom)
diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py
index c63272f27..8748817eb 100644
--- a/module/plugins/hoster/LetitbitNet.py
+++ b/module/plugins/hoster/LetitbitNet.py
@@ -19,7 +19,7 @@
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.common.json_layer import json_loads
-from module.plugins.ReCaptcha import ReCaptcha
+from module.plugins.internal.CaptchaService import ReCaptcha
class LetitbitNet(SimpleHoster):
@@ -55,23 +55,21 @@ class LetitbitNet(SimpleHoster):
self.html = self.load(self.DOMAIN + action, post=inputs, cookies=True)
- """
- action, inputs = self.parseHtmlForm('id="d3_form"')
- if not action: self.parseError("page 2 / d3_form")
- #self.logDebug(action, inputs)
-
- self.html = self.load(action, post = inputs, cookies = True)
-
- try:
- ajax_check_url, captcha_url = re.search(self.CHECK_URL_PATTERN, self.html).groups()
- found = re.search(self.SECONDS_PATTERN, self.html)
- seconds = int(found.group(1)) if found else 60
- self.setWait(seconds+1)
- self.wait()
- except Exception, e:
- self.logError(e)
- self.parseError("page 3 / js")
- """
+ # action, inputs = self.parseHtmlForm('id="d3_form"')
+ # if not action: self.parseError("page 2 / d3_form")
+ # #self.logDebug(action, inputs)
+ #
+ # self.html = self.load(action, post = inputs, cookies = True)
+ #
+ # try:
+ # ajax_check_url, captcha_url = re.search(self.CHECK_URL_PATTERN, self.html).groups()
+ # found = re.search(self.SECONDS_PATTERN, self.html)
+ # seconds = int(found.group(1)) if found else 60
+ # self.setWait(seconds+1)
+ # self.wait()
+ # except Exception, e:
+ # self.logError(e)
+ # self.parseError("page 3 / js")
found = re.search(self.SECONDS_PATTERN, self.html)
seconds = int(found.group(1)) if found else 60
@@ -89,7 +87,8 @@ class LetitbitNet(SimpleHoster):
recaptcha = ReCaptcha(self)
challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
- post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response, "recaptcha_control_field": recaptcha_control_field}
+ post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response,
+ "recaptcha_control_field": recaptcha_control_field}
self.logDebug("Post data to send", post_data)
response = self.load('%s/ajax/check_recaptcha.php' % self.DOMAIN, post=post_data, cookies=True)
self.logDebug(response)
@@ -122,4 +121,5 @@ class LetitbitNet(SimpleHoster):
else:
self.fail("Download did not finish correctly")
+
getInfo = create_getInfo(LetitbitNet)
diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py
index a1e866089..08e44d9f6 100644
--- a/module/plugins/hoster/LuckyShareNet.py
+++ b/module/plugins/hoster/LuckyShareNet.py
@@ -1,72 +1,72 @@
-# -*- coding: utf-8 -*-
-
-import re
-from module.lib.bottle import json_loads
-
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-from module.plugins.ReCaptcha import ReCaptcha
-
-
-class LuckyShareNet(SimpleHoster):
- __name__ = "LuckyShareNet"
- __type__ = "hoster"
- __pattern__ = r"https?://(www\.)?luckyshare.net/(?P<ID>\d{10,})"
- __version__ = "0.02"
- __description__ = """LuckyShare.net Download Hoster"""
- __author_name__ = ("stickell")
- __author_mail__ = ("l.stickell@yahoo.it")
-
- FILE_INFO_PATTERN = r"<h1 class='file_name'>(?P<N>\S+)</h1>\s*<span class='file_size'>Filesize: (?P<S>[\d.]+)(?P<U>\w+)</span>"
- FILE_OFFLINE_PATTERN = 'There is no such file available'
- RECAPTCHA_KEY = '6LdivsgSAAAAANWh-d7rPE1mus4yVWuSQIJKIYNw'
-
- def parseJson(self, rep):
- if 'AJAX Error' in rep:
- html = self.load(self.pyfile.url, decode=True)
- m = re.search(r"waitingtime = (\d+);", html)
- if m:
- waittime = int(m.group(1))
- self.logDebug('You have to wait %d seconds between free downloads' % waittime)
- self.retry(wait_time=waittime)
- else:
- self.parseError('Unable to detect wait time between free downloads')
- elif 'Hash expired' in rep:
- 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):
- file_id = re.search(self.__pattern__, self.pyfile.url).group('ID')
- self.logDebug('File ID: ' + file_id)
- rep = self.load(r"http://luckyshare.net/download/request/type/time/file/" + file_id, decode=True)
- self.logDebug('JSON: ' + rep)
- json = self.parseJson(rep)
-
- self.setWait(int(json['time']))
- self.wait()
-
- recaptcha = ReCaptcha(self)
- for i in xrange(5):
- challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
- rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" %
- (challenge, response, json['hash']), decode=True)
- self.logDebug('JSON: ' + rep)
- if 'link' in rep:
- json.update(self.parseJson(rep))
- self.correctCaptcha()
- break
- elif 'Verification failed' in rep:
- self.logInfo('Wrong captcha')
- self.invalidCaptcha()
- else:
- self.parseError('Unable to get downlaod link')
-
- if not json['link']:
- self.fail("No Download url retrieved/all captcha attempts failed")
-
- self.logDebug('Direct URL: ' + json['link'])
- self.download(json['link'])
-
-
-getInfo = create_getInfo(LuckyShareNet)
+# -*- coding: utf-8 -*-
+
+import re
+from module.lib.bottle import json_loads
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.plugins.internal.CaptchaService import ReCaptcha
+
+
+class LuckyShareNet(SimpleHoster):
+ __name__ = "LuckyShareNet"
+ __type__ = "hoster"
+ __pattern__ = r"https?://(www\.)?luckyshare.net/(?P<ID>\d{10,})"
+ __version__ = "0.02"
+ __description__ = """LuckyShare.net Download Hoster"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ FILE_INFO_PATTERN = r"<h1 class='file_name'>(?P<N>\S+)</h1>\s*<span class='file_size'>Filesize: (?P<S>[\d.]+)(?P<U>\w+)</span>"
+ FILE_OFFLINE_PATTERN = 'There is no such file available'
+ RECAPTCHA_KEY = '6LdivsgSAAAAANWh-d7rPE1mus4yVWuSQIJKIYNw'
+
+ def parseJson(self, rep):
+ if 'AJAX Error' in rep:
+ html = self.load(self.pyfile.url, decode=True)
+ m = re.search(r"waitingtime = (\d+);", html)
+ if m:
+ waittime = int(m.group(1))
+ self.logDebug('You have to wait %d seconds between free downloads' % waittime)
+ self.retry(wait_time=waittime)
+ else:
+ self.parseError('Unable to detect wait time between free downloads')
+ elif 'Hash expired' in rep:
+ 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):
+ file_id = re.search(self.__pattern__, self.pyfile.url).group('ID')
+ self.logDebug('File ID: ' + file_id)
+ rep = self.load(r"http://luckyshare.net/download/request/type/time/file/" + file_id, decode=True)
+ self.logDebug('JSON: ' + rep)
+ json = self.parseJson(rep)
+
+ self.setWait(int(json['time']))
+ self.wait()
+
+ recaptcha = ReCaptcha(self)
+ for i in xrange(5):
+ challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
+ rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" %
+ (challenge, response, json['hash']), decode=True)
+ self.logDebug('JSON: ' + rep)
+ if 'link' in rep:
+ json.update(self.parseJson(rep))
+ self.correctCaptcha()
+ break
+ elif 'Verification failed' in rep:
+ self.logInfo('Wrong captcha')
+ self.invalidCaptcha()
+ else:
+ self.parseError('Unable to get downlaod link')
+
+ if not json['link']:
+ self.fail("No Download url retrieved/all captcha attempts failed")
+
+ self.logDebug('Direct URL: ' + json['link'])
+ self.download(json['link'])
+
+
+getInfo = create_getInfo(LuckyShareNet)
diff --git a/module/plugins/hoster/MegaNz.py b/module/plugins/hoster/MegaNz.py
index e5be4eeb7..db97f6859 100644
--- a/module/plugins/hoster/MegaNz.py
+++ b/module/plugins/hoster/MegaNz.py
@@ -9,17 +9,18 @@ from base64 import standard_b64decode
from Crypto.Cipher import AES
from Crypto.Util import Counter
-from module.common.json_layer import json
+from module.common.json_layer import json_loads, json_dumps
from module.plugins.Hoster import Hoster
#def getInfo(urls):
# pass
+
class MegaNz(Hoster):
__name__ = "MegaNz"
__type__ = "hoster"
__pattern__ = r"https?://([a-z0-9]+\.)?mega\.co\.nz/#!([a-zA-Z0-9!_\-]+)"
- __version__ = "0.12"
+ __version__ = "0.13"
__description__ = """mega.co.nz hoster plugin"""
__author_name__ = ("RaNaN", )
__author_mail__ = ("ranan@pyload.org", )
@@ -42,9 +43,9 @@ class MegaNz(Hoster):
# generate a session id, no idea where to obtain elsewhere
uid = random.randint(10 << 9, 10 ** 10)
- resp = self.load(self.API_URL % uid, post=json.dumps([kwargs]))
+ resp = self.load(self.API_URL % uid, post=json_dumps([kwargs]))
self.logDebug("Api Response: " + resp)
- return json.loads(resp)
+ return json_loads(resp)
def decryptAttr(self, data, key):
@@ -55,7 +56,7 @@ class MegaNz(Hoster):
self.fail(_("Decryption failed"))
# Data is padded, 0-bytes must be stripped
- return json.loads(attr.replace("MEGA", "").rstrip("\0").strip())
+ return json_loads(attr.replace("MEGA", "").rstrip("\0").strip())
def decryptFile(self, key):
""" Decrypts the file at lastDownload` """
@@ -64,7 +65,7 @@ class MegaNz(Hoster):
n = key[16:24]
# convert counter to long and shift bytes
- ctr = Counter.new(128, initial_value=long(n.encode("hex"),16) << 64)
+ ctr = Counter.new(128, initial_value=long(n.encode("hex"), 16) << 64)
cipher = AES.new(self.getCipherKey(key), AES.MODE_CTR, counter=ctr)
self.pyfile.setStatus("decrypting")
@@ -73,10 +74,11 @@ class MegaNz(Hoster):
# TODO: calculate CBC-MAC for checksum
- size = 2 ** 15 # buffer size, 32k
+ size = 2 ** 15 # buffer size, 32k
while True:
buf = f.read(size)
- if not buf: break
+ if not buf:
+ break
df.write(cipher.decrypt(buf))
diff --git a/module/plugins/hoster/MegacrypterCom.py b/module/plugins/hoster/MegacrypterCom.py
index 9f012e5be..c166146dd 100644
--- a/module/plugins/hoster/MegacrypterCom.py
+++ b/module/plugins/hoster/MegacrypterCom.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import re
-from module.common.json_layer import json
+from module.common.json_layer import json_loads, json_dumps
from module.plugins.hoster.MegaNz import MegaNz
@@ -9,7 +9,7 @@ class MegacrypterCom(MegaNz):
__name__ = "MegacrypterCom"
__type__ = "hoster"
__pattern__ = r"(https?://[a-z0-9]{0,10}\.?megacrypter\.com/[a-zA-Z0-9!_\-]+)"
- __version__ = "0.1"
+ __version__ = "0.2"
__description__ = """megacrypter plugin, based and inherits from RaNaN's MegaNz plugin"""
__author_name__ = ("GonzaloSR", )
__author_mail__ = ("gonzalo@gonzalosr.com", )
@@ -17,35 +17,27 @@ class MegacrypterCom(MegaNz):
API_URL = "http://megacrypter.com/api"
FILE_SUFFIX = ".crypted"
-
def callApi(self, **kwargs):
""" Dispatch a call to the api, see megacrypter.com/api_doc """
- self.logDebug("JSON request: " + json.dumps(kwargs))
- resp = self.load(self.API_URL, post=json.dumps(kwargs))
+ self.logDebug("JSON request: " + json_dumps(kwargs))
+ resp = self.load(self.API_URL, post=json_dumps(kwargs))
self.logDebug("API Response: " + resp)
- return json.loads(resp)
+ return json_loads(resp)
-
def process(self, pyfile):
-
- key = None
-
# match is guaranteed because plugin was chosen to handle url
node = re.search(self.__pattern__, pyfile.url).group(1)
-
# get Mega.co.nz link info
info = self.callApi(link=node, m="info")
-
+
# get crypted file URL
dl = self.callApi(link=node, m="dl")
-
# TODO: map error codes, implement password protection
# if info["pass"] == true:
# crypted_file_key, md5_file_key = info["key"].split("#")
-
key = self.b64_decode(info["key"])
pyfile.name = info["name"] + self.FILE_SUFFIX
@@ -55,5 +47,3 @@ class MegacrypterCom(MegaNz):
# Everything is finished and final name can be set
pyfile.name = info["name"]
-
-
diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py
index 3fac633bc..3a66f356a 100644
--- a/module/plugins/hoster/MegasharesCom.py
+++ b/module/plugins/hoster/MegasharesCom.py
@@ -20,20 +20,21 @@ import re
from time import time
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
class MegasharesCom(SimpleHoster):
__name__ = "MegasharesCom"
__type__ = "hoster"
__pattern__ = r"http://(\w+\.)?megashares.com/.*"
- __version__ = "0.21"
+ __version__ = "0.22"
__description__ = """megashares.com plugin - free only"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
FILE_NAME_PATTERN = '<h1 class="black xxl"[^>]*title="(?P<N>[^"]+)">'
FILE_SIZE_PATTERN = '<strong><span class="black">Filesize:</span></strong> (?P<S>[0-9.]+) (?P<U>[kKMG])i?B<br />'
- DOWNLOAD_URL_PATTERN = '<div id="show_download_button_%d"[^>]*>\s*<a href="([^"]+)">'
- PASSPORT_LEFT_PATTERN = 'Your Download Passport is: <[^>]*>(\w+).*\s*You have\s*<[^>]*>\s*([0-9.]+) ([kKMG]i?B)'
- PASSPORT_RENEW_PATTERN = 'Your download passport will renew in\s*<strong>(\d+)</strong>:<strong>(\d+)</strong>:<strong>(\d+)</strong>'
+ DOWNLOAD_URL_PATTERN = r'<div id="show_download_button_%d"[^>]*>\s*<a href="([^"]+)">'
+ PASSPORT_LEFT_PATTERN = r'Your Download Passport is: <[^>]*>(\w+).*\s*You have\s*<[^>]*>\s*([0-9.]+) ([kKMG]i?B)'
+ PASSPORT_RENEW_PATTERN = r'Your download passport will renew in\s*<strong>(\d+)</strong>:<strong>(\d+)</strong>:<strong>(\d+)</strong>'
REACTIVATE_NUM_PATTERN = r'<input[^>]*id="random_num" value="(\d+)" />'
REACTIVATE_PASSPORT_PATTERN = r'<input[^>]*id="passport_num" value="(\w+)" />'
REQUEST_URI_PATTERN = r'var request_uri = "([^"]+)";'
@@ -43,16 +44,16 @@ class MegasharesCom(SimpleHoster):
def setup(self):
self.resumeDownload = True
self.multiDL = True if self.premium else False
-
+
def handlePremium(self):
self.handleDownload(True)
def handleFree(self):
self.html = self.load(self.pyfile.url, decode=True)
-
+
if self.NO_SLOTS_PATTERN in self.html:
- self.retry(wait_time = 300)
-
+ self.retry(wait_time=300)
+
self.getFileInfo()
#if self.pyfile.size > 576716800: self.fail("This file is too large for free download")
@@ -62,15 +63,16 @@ class MegasharesCom(SimpleHoster):
passport_num = found.group(1)
request_uri = re.search(self.REQUEST_URI_PATTERN, self.html).group(1)
- for i in range(5):
+ for _ in range(5):
random_num = re.search(self.REACTIVATE_NUM_PATTERN, self.html).group(1)
- verifyinput = self.decryptCaptcha("http://megashares.com/index.php?secgfx=gfx&random_num=%s" % random_num)
+ verifyinput = self.decryptCaptcha(
+ "http://megashares.com/index.php?secgfx=gfx&random_num=%s" % random_num)
self.logInfo("Reactivating passport %s: %s %s" % (passport_num, random_num, verifyinput))
url = "http://d01.megashares.com%s&rs=check_passport_renewal" % request_uri + \
- "&rsargs[]=%s&rsargs[]=%s&rsargs[]=%s" % (verifyinput, random_num, passport_num) + \
- "&rsargs[]=replace_sec_pprenewal&rsrnd=%s" % str(int(time()*1000))
+ "&rsargs[]=%s&rsargs[]=%s&rsargs[]=%s" % (verifyinput, random_num, passport_num) + \
+ "&rsargs[]=replace_sec_pprenewal&rsrnd=%s" % str(int(time() * 1000))
self.logDebug(url)
response = self.load(url)
@@ -79,30 +81,34 @@ class MegasharesCom(SimpleHoster):
self.retry(0)
else:
self.invalidCaptcha()
- else: self.fail("Failed to reactivate passport")
+ else:
+ self.fail("Failed to reactivate passport")
# Check traffic left on passport
found = re.search(self.PASSPORT_LEFT_PATTERN, self.html)
- if not found: self.fail('Passport not found')
+ if not found:
+ self.fail('Passport not found')
self.logInfo("Download passport: %s" % found.group(1))
data_left = float(found.group(2)) * 1024 ** {'KB': 1, 'MB': 2, 'GB': 3}[found.group(3)]
self.logInfo("Data left: %s %s (%d MB needed)" % (found.group(2), found.group(3), self.pyfile.size / 1048576))
-
+
if not data_left:
found = re.search(self.PASSPORT_RENEW_PATTERN, self.html)
renew = (found.group(1) + 60 * (found.group(2) + 60 * found.group(3))) if found else 600
self.retry(renew, 15, "Unable to get passport")
-
+
self.handleDownload(False)
-
- def handleDownload(self, premium = False):
+
+ def handleDownload(self, premium=False):
# Find download link;
found = re.search(self.DOWNLOAD_URL_PATTERN % (1 if premium else 2), self.html)
msg = '%s download URL' % ('Premium' if premium else 'Free')
- if not found: self.parseError(msg)
-
+ if not found:
+ self.parseError(msg)
+
download_url = found.group(1)
self.logDebug("%s: %s" % (msg, download_url))
self.download(download_url)
+
getInfo = create_getInfo(MegasharesCom) \ No newline at end of file
diff --git a/module/plugins/hoster/MovReelCom.py b/module/plugins/hoster/MovReelCom.py
index 6f5f1d3f1..2fbff66a6 100644
--- a/module/plugins/hoster/MovReelCom.py
+++ b/module/plugins/hoster/MovReelCom.py
@@ -4,103 +4,107 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.utils import html_unescape
from module.network.RequestFactory import getURL
+
class MovReelCom(SimpleHoster):
- __name__ = "MovReelCom"
- __type__ = "hoster"
- __pattern__ = r"http://movreel.com/.*"
- __version__ = "1.00"
- __description__ = """MovReel.com hoster plugin"""
- __author_name__ = ("JorisV83")
- __author_mail__ = ("jorisv83-pyload@yahoo.com")
-
- FILE_INFO_PATTERN = r'You have requested <font color="red">http://movreel.com/.*/(?P<N>.+?)</font>.*\((?P<S>[\d.]+) (?P<U>..)\)</font>'
- FILE_OFFLINE_PATTERN = r'<b>File Not Found</b>'
-
- def setup(self):
- self.resumeDownload = True
- self.multiDL = False
-
- def handleFree(self):
-
- # Define search patterns
- op_pattern = '<input type="hidden" name="op" value="(.*)">'
- id_pattern = '<input type="hidden" name="id" value="(.*)">'
- fn_pattern = '<input type="hidden" name="fname" value="(.*)">'
- re_pattern = '<input type="hidden" name="referer" value="(.*)">'
- ul_pattern = '<input type="hidden" name="usr_login" value="(.*)">'
- rand_pattern = '<input type="hidden" name="rand" value="(.*)">'
- link_pattern = "var file_link = '(.*)';"
- downlimit_pattern = '<br><p class="err">You have reached the download-limit: .*</p>'
-
- # Get HTML source
- self.logDebug("Getting first HTML source")
- html = self.load(self.pyfile.url)
- self.logDebug(" > Done")
-
- op_val = re.search(op_pattern, html).group(1)
- id_val = re.search(id_pattern, html).group(1)
- fn_val = re.search(fn_pattern, html).group(1)
- re_val = re.search(re_pattern, html).group(1)
- ul_val = re.search(ul_pattern, html).group(1)
-
- # Debug values
- self.logDebug(" > Op " + op_val)
- self.logDebug(" > Id " + id_val)
- self.logDebug(" > Fname " + fn_val)
- self.logDebug(" > Referer " + re_val)
- self.logDebug(" > User Login " + ul_val)
-
- # Create post data
- post_data = {"op" : op_val, "usr_login" : ul_val, "id" : id_val, "fname" : fn_val, "referer" : re_val, "method_free" : "+Free+Download"}
-
- # Post and get new HTML source
- self.logDebug("Getting second HTML source")
- html = self.load(self.pyfile.url, post = post_data, decode=True)
- self.logDebug(" > Done")
-
- # Check download limit
- if re.search(downlimit_pattern, html) is not None:
- self.retry(3, 7200, "Download limit reached, wait 2h")
-
- # Retrieve data
- if re.search(op_pattern, html) is not None:
- op_val = re.search(op_pattern, html).group(1)
- else:
- self.retry(3, 10, "Second html: no op found!!")
-
- if re.search(id_pattern, html) is not None:
- id_val = re.search(id_pattern, html).group(1)
- else:
- self.retry(3, 10, "Second html: no id found!!")
-
- if re.search(rand_pattern, html) is not None:
- rand_val = re.search(rand_pattern, html).group(1)
- else:
- self.retry(3, 10, "Second html: no rand found!!")
-
- re_val = self.pyfile.url
-
- # Debug values
- self.logDebug(" > Op " + op_val)
- self.logDebug(" > Id " + id_val)
- self.logDebug(" > Rand " + rand_val)
- self.logDebug(" > Referer " + re_val)
-
- # Create post data
- post_data = {"op" : op_val, "id" : id_val, "rand" : rand_val, "referer" : re_val, "method_free" : "+Free+Download", "method_premium" : "", "down_direct" : "1"}
-
- # Post and get new HTML source
- self.logDebug("Getting third HTML source")
- html = self.load(self.pyfile.url, post = post_data, decode=True)
- self.logDebug(" > Done")
-
- # Get link value
- if re.search(link_pattern, html) is not None:
- link_val = re.search(link_pattern, html).group(1)
- self.logDebug(" > Link " + link_val)
- self.download(link_val)
- else:
- self.logDebug("No link found!!")
- self.retry(3, 10, "No link found!!")
-
-getInfo = create_getInfo(MovReelCom) \ No newline at end of file
+ __name__ = "MovReelCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://movreel.com/.*"
+ __version__ = "1.00"
+ __description__ = """MovReel.com hoster plugin"""
+ __author_name__ = ("JorisV83")
+ __author_mail__ = ("jorisv83-pyload@yahoo.com")
+
+ FILE_INFO_PATTERN = r'You have requested <font color="red">http://movreel.com/.*/(?P<N>.+?)</font>.*\((?P<S>[\d.]+) (?P<U>..)\)</font>'
+ FILE_OFFLINE_PATTERN = r'<b>File Not Found</b>'
+
+ def setup(self):
+ self.resumeDownload = True
+ self.multiDL = False
+
+ def handleFree(self):
+
+ # Define search patterns
+ op_pattern = '<input type="hidden" name="op" value="(.*)">'
+ id_pattern = '<input type="hidden" name="id" value="(.*)">'
+ fn_pattern = '<input type="hidden" name="fname" value="(.*)">'
+ re_pattern = '<input type="hidden" name="referer" value="(.*)">'
+ ul_pattern = '<input type="hidden" name="usr_login" value="(.*)">'
+ rand_pattern = '<input type="hidden" name="rand" value="(.*)">'
+ link_pattern = "var file_link = '(.*)';"
+ downlimit_pattern = '<br><p class="err">You have reached the download-limit: .*</p>'
+
+ # Get HTML source
+ self.logDebug("Getting first HTML source")
+ html = self.load(self.pyfile.url)
+ self.logDebug(" > Done")
+
+ op_val = re.search(op_pattern, html).group(1)
+ id_val = re.search(id_pattern, html).group(1)
+ fn_val = re.search(fn_pattern, html).group(1)
+ re_val = re.search(re_pattern, html).group(1)
+ ul_val = re.search(ul_pattern, html).group(1)
+
+ # Debug values
+ self.logDebug(" > Op " + op_val)
+ self.logDebug(" > Id " + id_val)
+ self.logDebug(" > Fname " + fn_val)
+ self.logDebug(" > Referer " + re_val)
+ self.logDebug(" > User Login " + ul_val)
+
+ # Create post data
+ post_data = {"op": op_val, "usr_login": ul_val, "id": id_val, "fname": fn_val, "referer": re_val,
+ "method_free": "+Free+Download"}
+
+ # Post and get new HTML source
+ self.logDebug("Getting second HTML source")
+ html = self.load(self.pyfile.url, post=post_data, decode=True)
+ self.logDebug(" > Done")
+
+ # Check download limit
+ if re.search(downlimit_pattern, html) is not None:
+ self.retry(3, 7200, "Download limit reached, wait 2h")
+
+ # Retrieve data
+ if re.search(op_pattern, html) is not None:
+ op_val = re.search(op_pattern, html).group(1)
+ else:
+ self.retry(3, 10, "Second html: no op found!!")
+
+ if re.search(id_pattern, html) is not None:
+ id_val = re.search(id_pattern, html).group(1)
+ else:
+ self.retry(3, 10, "Second html: no id found!!")
+
+ if re.search(rand_pattern, html) is not None:
+ rand_val = re.search(rand_pattern, html).group(1)
+ else:
+ self.retry(3, 10, "Second html: no rand found!!")
+
+ re_val = self.pyfile.url
+
+ # Debug values
+ self.logDebug(" > Op " + op_val)
+ self.logDebug(" > Id " + id_val)
+ self.logDebug(" > Rand " + rand_val)
+ self.logDebug(" > Referer " + re_val)
+
+ # Create post data
+ post_data = {"op": op_val, "id": id_val, "rand": rand_val, "referer": re_val, "method_free": "+Free+Download",
+ "method_premium": "", "down_direct": "1"}
+
+ # Post and get new HTML source
+ self.logDebug("Getting third HTML source")
+ html = self.load(self.pyfile.url, post=post_data, decode=True)
+ self.logDebug(" > Done")
+
+ # Get link value
+ if re.search(link_pattern, html) is not None:
+ link_val = re.search(link_pattern, html).group(1)
+ self.logDebug(" > Link " + link_val)
+ self.download(link_val)
+ else:
+ self.logDebug("No link found!!")
+ self.retry(3, 10, "No link found!!")
+
+
+getInfo = create_getInfo(MovReelCom)
diff --git a/module/plugins/hoster/MultiDebridCom.py b/module/plugins/hoster/MultiDebridCom.py
index ca98e8a0e..7280504cb 100644
--- a/module/plugins/hoster/MultiDebridCom.py
+++ b/module/plugins/hoster/MultiDebridCom.py
@@ -23,7 +23,7 @@ from module.common.json_layer import json_loads
class MultiDebridCom(Hoster):
__name__ = "MultiDebridCom"
- __version__ = "0.01"
+ __version__ = "0.02"
__type__ = "hoster"
__pattern__ = r"http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/dl/"
__description__ = """Multi-debrid.com hoster plugin"""
@@ -36,7 +36,7 @@ class MultiDebridCom(Hoster):
def process(self, pyfile):
if not self.account:
- self.logError("Please enter your Multi-debrid.com account or deactivate this plugin")
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "Multi-debrid.com")
self.fail("No Multi-debrid.com account provided")
self.logDebug("Original URL: %s" % pyfile.url)
diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py
index a0dda30b8..f9289a923 100644
--- a/module/plugins/hoster/MultishareCz.py
+++ b/module/plugins/hoster/MultishareCz.py
@@ -20,6 +20,7 @@ import re
from random import random
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
class MultishareCz(SimpleHoster):
__name__ = "MultishareCz"
__type__ = "hoster"
@@ -31,50 +32,51 @@ class MultishareCz(SimpleHoster):
FILE_INFO_PATTERN = ur'(?:<li>Název|Soubor): <strong>(?P<N>[^<]+)</strong><(?:/li><li|br)>Velikost: <strong>(?P<S>[^<]+)</strong>'
FILE_OFFLINE_PATTERN = ur'<h1>Stáhnout soubor</h1><p><strong>Požadovaný soubor neexistuje.</strong></p>'
FILE_SIZE_REPLACEMENTS = [('&nbsp;', '')]
-
+
def process(self, pyfile):
msurl = re.match(self.__pattern__, pyfile.url)
if msurl:
- self.fileID = msurl.group('ID')
- self.html = self.load(pyfile.url, decode = True)
+ self.fileID = msurl.group('ID')
+ self.html = self.load(pyfile.url, decode=True)
self.getFileInfo()
-
+
if self.premium:
self.handlePremium()
else:
- self.handleFree()
- else:
- self.handleOverriden()
+ self.handleFree()
+ 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")
- self.resetAccount()
-
+ self.resetAccount()
+
self.download("http://www.multishare.cz/html/download_premium.php?ID=%s" % self.fileID)
-
+
def handleOverriden(self):
- if not self.premium:
+ if not self.premium:
self.fail("Only premium users can download from other hosters")
-
- self.html = self.load('http://www.multishare.cz/html/mms_ajax.php', post = {"link": self.pyfile.url}, decode = True)
- self.getFileInfo()
-
+
+ self.html = self.load('http://www.multishare.cz/html/mms_ajax.php', post={"link": self.pyfile.url}, decode=True)
+ self.getFileInfo()
+
if not self.checkCredit():
self.fail("Not enough credit left to download file")
-
- url = "http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random()*10000*random())
- params = {"u_ID" : self.acc_info["u_ID"], "u_hash" : self.acc_info["u_hash"], "link" : self.pyfile.url}
+
+ url = "http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random() * 10000 * random())
+ params = {"u_ID": self.acc_info["u_ID"], "u_hash": self.acc_info["u_hash"], "link": self.pyfile.url}
self.logDebug(url, params)
- self.download(url, get = params)
-
- def checkCredit(self):
+ 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))
-
+ self.logInfo("User %s has %i MB left" % (self.user, self.acc_info["trafficleft"] / 1024))
+
return self.pyfile.size / 1024 <= self.acc_info["trafficleft"]
-getInfo = create_getInfo(MultishareCz) \ No newline at end of file
+
+getInfo = create_getInfo(MultishareCz)
diff --git a/module/plugins/hoster/MyvideoDe.py b/module/plugins/hoster/MyvideoDe.py
index f2d2082a7..e32fee5c8 100644
--- a/module/plugins/hoster/MyvideoDe.py
+++ b/module/plugins/hoster/MyvideoDe.py
@@ -4,6 +4,7 @@ import re
from module.plugins.Hoster import Hoster
from module.unescape import unescape
+
class MyvideoDe(Hoster):
__name__ = "MyvideoDe"
__type__ = "hoster"
@@ -12,10 +13,10 @@ class MyvideoDe(Hoster):
__description__ = """Myvideo.de Video Download Hoster"""
__author_name__ = ("spoob")
__author_mail__ = ("spoob@pyload.org")
-
+
def setup(self):
self.html = None
-
+
def process(self, pyfile):
self.pyfile = pyfile
self.download_html()
diff --git a/module/plugins/hoster/NarodRu.py b/module/plugins/hoster/NarodRu.py
index 335860de9..590268910 100644
--- a/module/plugins/hoster/NarodRu.py
+++ b/module/plugins/hoster/NarodRu.py
@@ -20,6 +20,7 @@ import re
from random import random
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
class NarodRu(SimpleHoster):
__name__ = "NarodRu"
__type__ = "hoster"
@@ -31,10 +32,11 @@ class NarodRu(SimpleHoster):
FILE_NAME_PATTERN = r'<dt class="name">(?:<[^<]*>)*(?P<N>[^<]+)</dt>'
FILE_SIZE_PATTERN = r'<dd class="size">(?P<S>\d[^<]*)</dd>'
FILE_OFFLINE_PATTERN = r'<title>404</title>|Файл удален с сервиса|Закончился срок хранения файла\.'
-
+
FILE_SIZE_REPLACEMENTS = [(u'КБ', 'KB'), (u'МБ', 'MB'), (u'ГБ', 'GB')]
- FILE_URL_REPLACEMENTS = [("narod.yandex.ru/", "narod.ru/"), (r"/start/[0-9]+\.\w+-narod\.yandex\.ru/([0-9]{6,15})/\w+/(\w+)", r"/disk/\1/\2")]
-
+ FILE_URL_REPLACEMENTS = [("narod.yandex.ru/", "narod.ru/"),
+ (r"/start/[0-9]+\.\w+-narod\.yandex\.ru/([0-9]{6,15})/\w+/(\w+)", r"/disk/\1/\2")]
+
CAPTCHA_PATTERN = r'<number url="(.*?)">(\w+)</number>'
DOWNLOAD_LINK_PATTERN = r'<a class="h-link" rel="yandex_bar" href="(.+?)">'
@@ -42,12 +44,13 @@ class NarodRu(SimpleHoster):
for i in range(5):
self.html = self.load('http://narod.ru/disk/getcapchaxml/?rnd=%d' % int(random() * 777))
found = re.search(self.CAPTCHA_PATTERN, self.html)
- if not found: self.parseError('Captcha')
+ if not found:
+ self.parseError('Captcha')
post_data = {"action": "sendcapcha"}
captcha_url, post_data['key'] = found.groups()
post_data['rep'] = self.decryptCaptcha(captcha_url)
-
- self.html = self.load(self.pyfile.url, post = post_data, decode = True)
+
+ self.html = self.load(self.pyfile.url, post=post_data, decode=True)
found = re.search(self.DOWNLOAD_LINK_PATTERN, self.html)
if found:
url = 'http://narod.ru' + found.group(1)
@@ -59,8 +62,9 @@ class NarodRu(SimpleHoster):
self.parseError('Download link')
else:
self.fail("No valid captcha code entered")
-
+
self.logDebug('Download link: ' + url)
- self.download(url)
+ self.download(url)
+
-getInfo = create_getInfo(NarodRu) \ No newline at end of file
+getInfo = create_getInfo(NarodRu)
diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py
index e616badc2..d150443f0 100644
--- a/module/plugins/hoster/NetloadIn.py
+++ b/module/plugins/hoster/NetloadIn.py
@@ -4,16 +4,13 @@
import re
from time import sleep, time
-
from module.plugins.Hoster import Hoster
from module.network.RequestFactory import getURL
from module.plugins.Plugin import chunks
-
def getInfo(urls):
- ## returns list of tupels (name, size (in bytes), status (see FileDatabase), url)
-
+ ## returns list of tupels (name, size (in bytes), status (see FileDatabase), url)
apiurl = "http://api.netload.in/info.php?auth=Zf9SnQh9WiReEsb18akjvQGqT0I830e8&bz=1&md5=1&file_id="
id_regex = re.compile(NetloadIn.__pattern__)
@@ -24,9 +21,9 @@ def getInfo(urls):
for url in chunk:
match = id_regex.search(url)
if match:
- ids = ids + match.group(1) +";"
+ ids = ids + match.group(1) + ";"
- api = getURL(apiurl+ids, decode = True)
+ api = getURL(apiurl + ids, decode=True)
if api is None or len(api) < 10:
print "Netload prefetch: failed "
@@ -44,18 +41,19 @@ def getInfo(urls):
size = int(tmp[2])
except:
size = 0
- result.append( (tmp[1], size, 2 if tmp[3] == "online" else 1, chunk[i] ) )
+ result.append((tmp[1], size, 2 if tmp[3] == "online" else 1, chunk[i] ))
except:
print "Netload prefetch: Error while processing response: "
print r
yield result
+
class NetloadIn(Hoster):
__name__ = "NetloadIn"
__type__ = "hoster"
__pattern__ = r"https?://.*netload\.in/(?:datei(.*?)(?:\.htm|/)|index.php?id=10&file_id=)"
- __version__ = "0.42"
+ __version__ = "0.44"
__description__ = """Netload.in Download Hoster"""
__author_name__ = ("spoob", "RaNaN", "Gregy")
__author_mail__ = ("spoob@pyload.org", "ranan@pyload.org", "gregy@gregy.cz")
@@ -80,7 +78,7 @@ class NetloadIn(Hoster):
self.pyfile.name = self.api_data["filename"]
if self.premium:
- self.log.debug("Netload: Use Premium Account")
+ self.logDebug("Netload: Use Premium Account")
return True
if self.download_html():
@@ -88,7 +86,7 @@ class NetloadIn(Hoster):
else:
self.fail("Failed")
return False
-
+
def download_api_data(self, n=0):
url = self.url
id_regex = re.compile(self.__pattern__)
@@ -103,13 +101,15 @@ class NetloadIn(Hoster):
return
apiurl = "http://api.netload.in/info.php"
- src = self.load(apiurl, cookies=False, get={"file_id": match.group(1), "auth": "Zf9SnQh9WiReEsb18akjvQGqT0I830e8", "bz": "1", "md5": "1"}, decode = True).strip()
+ src = self.load(apiurl, cookies=False,
+ get={"file_id": match.group(1), "auth": "Zf9SnQh9WiReEsb18akjvQGqT0I830e8", "bz": "1",
+ "md5": "1"}, decode=True).strip()
if not src and n <= 3:
sleep(0.2)
- self.download_api_data(n+1)
- return
+ self.download_api_data(n + 1)
+ return
- self.log.debug("Netload: APIDATA: "+src)
+ self.logDebug("Netload: APIDATA: " + src)
self.api_data = {}
if src and ";" in src and src not in ("unknown file_data", "unknown_server_data", "No input file specified."):
lines = src.split(";")
@@ -121,31 +121,31 @@ class NetloadIn(Hoster):
if self.api_data["status"] == "online":
self.api_data["checksum"] = lines[4].strip()
else:
- self.api_data = False #check manually since api data is useless sometimes
+ self.api_data = False # check manually since api data is useless sometimes
- if lines[0] == lines[1] and lines[2] == "0": #useless api data
+ if lines[0] == lines[1] and lines[2] == "0": # useless api data
self.api_data = False
else:
self.api_data = False
-
+
def final_wait(self, page):
wait_time = self.get_wait_time(page)
self.setWait(wait_time)
- self.log.debug("Netload: final wait %d seconds" % wait_time)
+ self.logDebug("Netload: final wait %d seconds" % wait_time)
self.wait()
self.url = self.get_file_url(page)
def download_html(self):
- self.log.debug("Netload: Entering download_html")
+ self.logDebug("Netload: Entering download_html")
page = self.load(self.url, decode=True)
t = time() + 30
-
+
if "/share/templates/download_hddcrash.tpl" in page:
- self.log.error("Netload HDD Crash")
+ self.logError("Netload HDD Crash")
self.fail(_("File temporarily not available"))
-
+
if not self.api_data:
- self.log.debug("API Data may be useless, get details from html page")
+ self.logDebug("API Data may be useless, get details from html page")
if "* The file was deleted" in page:
self.offline()
@@ -163,34 +163,34 @@ class NetloadIn(Hoster):
if not page:
page = self.load(self.url)
t = time() + 30
-
+
if "/share/templates/download_hddcrash.tpl" in page:
- self.log.error("Netload HDD Crash")
+ self.logError("Netload HDD Crash")
self.fail(_("File temporarily not available"))
-
- self.log.debug("Netload: try number %d " % i)
+
+ self.logDebug("Netload: try number %d " % i)
if ">Your download is being prepared.<" in page:
- self.log.debug("Netload: We will prepare your download")
+ self.logDebug("Netload: We will prepare your download")
self.final_wait(page)
return True
if ">An access request has been made from IP address <" in page:
wait = self.get_wait_time(page)
if wait == 0:
- self.log.debug("Netload: Wait was 0 setting 30")
+ self.logDebug("Netload: Wait was 0 setting 30")
wait = 30
- self.log.info(_("Netload: waiting between downloads %d s." % wait))
+ self.logInfo(_("Netload: waiting between downloads %d s." % wait))
self.wantReconnect = True
self.setWait(wait)
self.wait()
return self.download_html()
-
- self.log.debug("Netload: Trying to find captcha")
+ self.logDebug("Netload: Trying to find captcha")
try:
- url_captcha_html = "http://netload.in/" + re.search('(index.php\?id=10&amp;.*&amp;captcha=1)', page).group(1).replace("amp;", "")
+ url_captcha_html = "http://netload.in/" + re.search('(index.php\?id=10&amp;.*&amp;captcha=1)',
+ page).group(1).replace("amp;", "")
except:
page = None
continue
@@ -199,25 +199,27 @@ class NetloadIn(Hoster):
page = self.load(url_captcha_html, cookies=True)
captcha_url = "http://netload.in/" + re.search('(share/includes/captcha.php\?t=\d*)', page).group(1)
except:
- self.log.debug("Netload: Could not find captcha, try again from beginning")
+ self.logDebug("Netload: Could not find captcha, try again from beginning")
captchawaited = False
continue
file_id = re.search('<input name="file_id" type="hidden" value="(.*)" />', page).group(1)
if not captchawaited:
wait = self.get_wait_time(page)
- if i == 0: self.pyfile.waitUntil = time() # dont wait contrary to time on website
- else: self.pyfile.waitUntil = t
- self.log.info(_("Netload: waiting for captcha %d s.") % (self.pyfile.waitUntil - time()))
+ if i == 0:
+ self.pyfile.waitUntil = time() # dont wait contrary to time on website
+ else:
+ self.pyfile.waitUntil = t
+ self.logInfo(_("Netload: waiting for captcha %d s.") % (self.pyfile.waitUntil - time()))
#self.setWait(wait)
self.wait()
captchawaited = True
captcha = self.decryptCaptcha(captcha_url)
- page = self.load("http://netload.in/index.php?id=10", post={"file_id": file_id, "captcha_check": captcha}, cookies=True)
+ page = self.load("http://netload.in/index.php?id=10", post={"file_id": file_id, "captcha_check": captcha},
+ cookies=True)
return False
-
def get_file_url(self, page):
try:
@@ -226,21 +228,20 @@ class NetloadIn(Hoster):
if attempt is not None:
return attempt.group(1)
else:
- self.log.debug("Netload: Backup try for final link")
+ self.logDebug("Netload: Backup try for final link")
file_url_pattern = r"<a href=\"(.+)\" class=\"Orange_Link\">Click here"
attempt = re.search(file_url_pattern, page)
- return "http://netload.in/"+attempt.group(1)
+ return "http://netload.in/" + attempt.group(1)
except:
- self.log.debug("Netload: Getting final link failed")
+ 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.log.debug("Netload: Downloading..")
+ self.logDebug("Netload: Downloading..")
self.download(url, disposition=True)
@@ -251,4 +252,3 @@ class NetloadIn(Hoster):
self.retry()
elif check == "offline":
self.offline()
-
diff --git a/module/plugins/hoster/NovafileCom.py b/module/plugins/hoster/NovafileCom.py
index dfd18761c..6457734e5 100644
--- a/module/plugins/hoster/NovafileCom.py
+++ b/module/plugins/hoster/NovafileCom.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
class NovafileCom(XFileSharingPro):
__name__ = "NovafileCom"
__type__ = "hoster"
@@ -9,16 +10,17 @@ class NovafileCom(XFileSharingPro):
__description__ = """novafile.com hoster plugin"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
-
+
FILE_SIZE_PATTERN = r'<div class="size">(?P<S>.+?)</div>'
#FILE_OFFLINE_PATTERN = '<b>&quot;File Not Found&quot;</b>|File has been removed due to Copyright Claim'
FORM_PATTERN = r'name="F\d+"'
ERROR_PATTERN = r'class="alert[^"]*alert-separate"[^>]*>\s*(?:<p>)?(.*?)\s*</'
DIRECT_LINK_PATTERN = r'<a href="(http://s\d+\.novafile\.com/.*?)" class="btn btn-green">Download File</a>'
-
- HOSTER_NAME = "novafile.com"
-
+
+ HOSTER_NAME = "novafile.com"
+
def setup(self):
- self.multiDL = False
+ self.multiDL = False
+
-getInfo = create_getInfo(NovafileCom) \ No newline at end of file
+getInfo = create_getInfo(NovafileCom)
diff --git a/module/plugins/hoster/NowDownloadEu.py b/module/plugins/hoster/NowDownloadEu.py
index 126ca3d89..4e4c32373 100644
--- a/module/plugins/hoster/NowDownloadEu.py
+++ b/module/plugins/hoster/NowDownloadEu.py
@@ -17,10 +17,10 @@
"""
import re
-from random import random
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.utils import fixup
+
class NowDownloadEu(SimpleHoster):
__name__ = "NowDownloadEu"
__type__ = "hoster"
@@ -46,21 +46,25 @@ class NowDownloadEu(SimpleHoster):
def handleFree(self):
tokenlink = re.search(self.FILE_TOKEN_PATTERN, self.html)
continuelink = re.search(self.FILE_CONTINUE_PATTERN, self.html)
- if (not tokenlink) or (not continuelink): self.fail('Plugin out of Date')
+ if (not tokenlink) or (not continuelink):
+ self.fail('Plugin out of Date')
wait = 60
found = re.search(self.FILE_WAIT_PATTERN, self.html)
- if found: wait = int(found.group(1))
+ if found:
+ wait = int(found.group(1))
self.html = self.load("http://www.nowdownload.eu" + str(tokenlink.group(1)))
self.setWait(wait)
- self.wait()
+ self.wait()
self.html = self.load("http://www.nowdownload.eu" + str(continuelink.group(1)))
url = re.search(self.FILE_DOWNLOAD_LINK, self.html)
- if not url: self.fail('Download Link not Found (Plugin out of Date?)')
+ if not url:
+ self.fail('Download Link not Found (Plugin out of Date?)')
self.logDebug('Download link: ' + str(url.group(1)))
- self.download(str(url.group(1)))
+ self.download(str(url.group(1)))
+
getInfo = create_getInfo(NowDownloadEu)
diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py
index c7c3384e9..9e2f53fd2 100644
--- a/module/plugins/hoster/OneFichierCom.py
+++ b/module/plugins/hoster/OneFichierCom.py
@@ -3,56 +3,59 @@
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
class OneFichierCom(SimpleHoster):
__name__ = "OneFichierCom"
__type__ = "hoster"
__pattern__ = r"(http://(\w+)\.((1fichier|d(es)?fichiers|pjointe)\.(com|fr|net|org)|(cjoint|mesfichiers|piecejointe|oi)\.(org|net)|tenvoi\.(com|org|net)|dl4free\.com|alterupload\.com|megadl.fr))"
__version__ = "0.47"
__description__ = """1fichier.com download hoster"""
- __author_name__ = ("fragonib", "the-razer", "zoidberg","imclem")
- __author_mail__ = ("fragonib[AT]yahoo[DOT]es", "daniel_ AT gmx DOT net", "zoidberg@mujmail.cz","imclem on github")
-
+ __author_name__ = ("fragonib", "the-razer", "zoidberg", "imclem")
+ __author_mail__ = ("fragonib[AT]yahoo[DOT]es", "daniel_ AT gmx DOT net", "zoidberg@mujmail.cz", "imclem on github")
+
FILE_NAME_PATTERN = r'">File name :</th>\s*<td>(?P<N>[^<]+)</td>'
FILE_SIZE_PATTERN = r'<th>File size :</th>\s*<td>(?P<S>[^<]+)</td>'
- FILE_OFFLINE_PATTERN = r'The (requested)? file (could not be found|has been deleted)'
+ FILE_OFFLINE_PATTERN = r'The (requested)? file (could not be found|has been deleted)'
FILE_URL_REPLACEMENTS = [(r'(http://[^/]*).*', r'\1/en/')]
-
- DOWNLOAD_LINK_PATTERN = r'<br/>&nbsp;<br/>&nbsp;<br/>&nbsp;\s+<a href="(?P<url>http://.*?)"'
+
+ DOWNLOAD_LINK_PATTERN = r'<br/>&nbsp;<br/>&nbsp;<br/>&nbsp;\s+<a href="(?P<url>http://.*?)"'
PASSWORD_PROTECTED_TOKEN = "protected by password"
WAITING_PATTERN = "Warning ! Without premium status, you can download only one file at a time and you must wait up to (\d+) minutes between each downloads."
+
def process(self, pyfile):
found = re.search(self.__pattern__, pyfile.url)
- file_id = found.group(2)
- url = "http://%s.%s/en/" % (found.group(2), found.group(3))
- self.html = self.load(url, decode = True)
-
+ file_id = found.group(2)
+ url = "http://%s.%s/en/" % (found.group(2), found.group(3))
+ self.html = self.load(url, decode=True)
+
found = re.search(self.WAITING_PATTERN, self.html)
if found:
self.waitAndRetry(int(found.group(1)) * 60)
-
+
self.getFileInfo()
-
+
url, inputs = self.parseHtmlForm('action="http://%s' % file_id)
if not url or not inputs:
self.parseError("Download link not found")
-
+
# Check for protection
if "pass" in inputs:
inputs['pass'] = self.getPassword()
-
- self.download(url, post = inputs)
-
+
+ self.download(url, post=inputs)
+
# Check download
self.checkDownloadedFile()
-
+
def checkDownloadedFile(self):
check = self.checkDownload({"wait": self.WAITING_PATTERN})
if check == "wait":
self.waitAndRetry(int(self.lastcheck.group(1)) * 60)
-
+
def waitAndRetry(self, wait_time):
self.setWait(wait_time, True)
self.wait()
self.retry()
-
+
+
getInfo = create_getInfo(OneFichierCom)
diff --git a/module/plugins/hoster/PornhostCom.py b/module/plugins/hoster/PornhostCom.py
index a4124c4a4..d443c6a0a 100644
--- a/module/plugins/hoster/PornhostCom.py
+++ b/module/plugins/hoster/PornhostCom.py
@@ -1,76 +1,75 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import re
-from module.plugins.Hoster import Hoster
-
-class PornhostCom(Hoster):
- __name__ = "PornhostCom"
- __type__ = "hoster"
- __pattern__ = r'http://[\w\.]*?pornhost\.com/([0-9]+/[0-9]+\.html|[0-9]+)'
- __version__ = "0.2"
- __description__ = """Pornhost.com Download Hoster"""
- __author_name__ = ("jeix")
- __author_mail__ = ("jeix@hasnomail.de")
-
- def process(self, pyfile):
- self.download_html()
- if not self.file_exists():
- self.offline()
-
- 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
- """
- if self.html is None:
- self.download_html()
-
- file_url = re.search(r'download this file</label>.*?<a href="(.*?)"', self.html)
- if not file_url:
- file_url = re.search(r'"(http://dl[0-9]+\.pornhost\.com/files/.*?/.*?/.*?/.*?/.*?/.*?\..*?)"', self.html)
- if not file_url:
- file_url = re.search(r'width: 894px; height: 675px">.*?<img src="(.*?)"', self.html)
- if not file_url:
- file_url = re.search(r'"http://file[0-9]+\.pornhost\.com/[0-9]+/.*?"', self.html) # TODO: fix this one since it doesn't match
-
- file_url = file_url.group(1).strip()
-
- return file_url
-
- def get_file_name(self):
- if self.html is None:
- self.download_html()
-
- name = re.search(r'<title>pornhost\.com - free file hosting with a twist - gallery(.*?)</title>', self.html)
- if not name:
- name = re.search(r'id="url" value="http://www\.pornhost\.com/(.*?)/"', self.html)
- if not name:
- name = re.search(r'<title>pornhost\.com - free file hosting with a twist -(.*?)</title>', self.html)
- if not name:
- name = re.search(r'"http://file[0-9]+\.pornhost\.com/.*?/(.*?)"', self.html)
-
- name = name.group(1).strip() + ".flv"
-
- return name
-
- def file_exists(self):
- """ returns True or False
- """
- if self.html is None:
- self.download_html()
-
- if re.search(r'gallery not found', self.html) is not None \
- or re.search(r'You will be redirected to', self.html) is not None:
- return False
- else:
- return True
-
-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Hoster import Hoster
+
+
+class PornhostCom(Hoster):
+ __name__ = "PornhostCom"
+ __type__ = "hoster"
+ __pattern__ = r'http://[\w\.]*?pornhost\.com/([0-9]+/[0-9]+\.html|[0-9]+)'
+ __version__ = "0.2"
+ __description__ = """Pornhost.com Download Hoster"""
+ __author_name__ = ("jeix")
+ __author_mail__ = ("jeix@hasnomail.de")
+
+ def process(self, pyfile):
+ self.download_html()
+ if not self.file_exists():
+ self.offline()
+
+ 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
+ """
+ if self.html is None:
+ self.download_html()
+
+ file_url = re.search(r'download this file</label>.*?<a href="(.*?)"', self.html)
+ if not file_url:
+ file_url = re.search(r'"(http://dl[0-9]+\.pornhost\.com/files/.*?/.*?/.*?/.*?/.*?/.*?\..*?)"', self.html)
+ if not file_url:
+ file_url = re.search(r'width: 894px; height: 675px">.*?<img src="(.*?)"', self.html)
+ if not file_url:
+ file_url = re.search(r'"http://file[0-9]+\.pornhost\.com/[0-9]+/.*?"',
+ self.html) # TODO: fix this one since it doesn't match
+
+ file_url = file_url.group(1).strip()
+
+ return file_url
+
+ def get_file_name(self):
+ if self.html is None:
+ self.download_html()
+
+ name = re.search(r'<title>pornhost\.com - free file hosting with a twist - gallery(.*?)</title>', self.html)
+ if not name:
+ name = re.search(r'id="url" value="http://www\.pornhost\.com/(.*?)/"', self.html)
+ if not name:
+ name = re.search(r'<title>pornhost\.com - free file hosting with a twist -(.*?)</title>', self.html)
+ if not name:
+ name = re.search(r'"http://file[0-9]+\.pornhost\.com/.*?/(.*?)"', self.html)
+
+ name = name.group(1).strip() + ".flv"
+
+ return name
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html is None:
+ self.download_html()
+
+ if re.search(r'gallery not found', self.html) is not None \
+ or re.search(r'You will be redirected to', self.html) is not None:
+ return False
+ else:
+ return True
diff --git a/module/plugins/hoster/PornhubCom.py b/module/plugins/hoster/PornhubCom.py
index e1ed612b9..7bbb8d919 100644
--- a/module/plugins/hoster/PornhubCom.py
+++ b/module/plugins/hoster/PornhubCom.py
@@ -1,83 +1,84 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import re
-from module.plugins.Hoster import Hoster
-
-class PornhubCom(Hoster):
- __name__ = "PornhubCom"
- __type__ = "hoster"
- __pattern__ = r'http://[\w\.]*?pornhub\.com/view_video\.php\?viewkey=[\w\d]+'
- __version__ = "0.5"
- __description__ = """Pornhub.com Download Hoster"""
- __author_name__ = ("jeix")
- __author_mail__ = ("jeix@hasnomail.de")
-
- def process(self, pyfile):
- self.download_html()
- if not self.file_exists():
- self.offline()
-
- 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
- """
- if self.html is None:
- self.download_html()
-
- url = "http://www.pornhub.com//gateway.php"
- video_id = self.pyfile.url.split('=')[-1]
- # thanks to jD team for this one v
- post_data = "\x00\x03\x00\x00\x00\x01\x00\x0c\x70\x6c\x61\x79\x65\x72\x43\x6f\x6e\x66\x69\x67\x00\x02\x2f\x31\x00\x00\x00\x44\x0a\x00\x00\x00\x03\x02\x00"
- post_data += chr(len(video_id))
- post_data += video_id
- post_data += "\x02\x00\x02\x2d\x31\x02\x00\x20"
- post_data += "add299463d4410c6d1b1c418868225f7"
-
- content = self.req.load(url, post=str(post_data))
-
- new_content = ""
- for x in content:
- if ord(x) < 32 or ord(x) > 176:
- new_content += '#'
- else:
- new_content += x
-
- content = new_content
-
- file_url = re.search(r'flv_url.*(http.*?)##post_roll', content).group(1)
-
- return file_url
-
- def get_file_name(self):
- if self.html is None:
- self.download_html()
-
- match = re.search(r'<title[^>]+>([^<]+) - ', self.html)
- if match:
- name = match.group(1)
- else:
- matches = re.findall('<h1>(.*?)</h1>', self.html)
- if len(matches) > 1:
- name = matches[1]
- else:
- name = matches[0]
-
- return name + '.flv'
-
- def file_exists(self):
- """ returns True or False
- """
- if self.html is None:
- self.download_html()
-
- if re.search(r'This video is no longer in our database or is in conversion', self.html) is not None:
- return False
- else:
- return True
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Hoster import Hoster
+
+
+class PornhubCom(Hoster):
+ __name__ = "PornhubCom"
+ __type__ = "hoster"
+ __pattern__ = r'http://[\w\.]*?pornhub\.com/view_video\.php\?viewkey=[\w\d]+'
+ __version__ = "0.5"
+ __description__ = """Pornhub.com Download Hoster"""
+ __author_name__ = ("jeix")
+ __author_mail__ = ("jeix@hasnomail.de")
+
+ def process(self, pyfile):
+ self.download_html()
+ if not self.file_exists():
+ self.offline()
+
+ 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
+ """
+ if self.html is None:
+ self.download_html()
+
+ url = "http://www.pornhub.com//gateway.php"
+ video_id = self.pyfile.url.split('=')[-1]
+ # thanks to jD team for this one v
+ post_data = "\x00\x03\x00\x00\x00\x01\x00\x0c\x70\x6c\x61\x79\x65\x72\x43\x6f\x6e\x66\x69\x67\x00\x02\x2f\x31\x00\x00\x00\x44\x0a\x00\x00\x00\x03\x02\x00"
+ post_data += chr(len(video_id))
+ post_data += video_id
+ post_data += "\x02\x00\x02\x2d\x31\x02\x00\x20"
+ post_data += "add299463d4410c6d1b1c418868225f7"
+
+ content = self.req.load(url, post=str(post_data))
+
+ new_content = ""
+ for x in content:
+ if ord(x) < 32 or ord(x) > 176:
+ new_content += '#'
+ else:
+ new_content += x
+
+ content = new_content
+
+ file_url = re.search(r'flv_url.*(http.*?)##post_roll', content).group(1)
+
+ return file_url
+
+ def get_file_name(self):
+ if self.html is None:
+ self.download_html()
+
+ match = re.search(r'<title[^>]+>([^<]+) - ', self.html)
+ if match:
+ name = match.group(1)
+ else:
+ matches = re.findall('<h1>(.*?)</h1>', self.html)
+ if len(matches) > 1:
+ name = matches[1]
+ else:
+ name = matches[0]
+
+ return name + '.flv'
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html is None:
+ self.download_html()
+
+ if re.search(r'This video is no longer in our database or is in conversion', self.html) is not None:
+ return False
+ else:
+ return True
diff --git a/module/plugins/hoster/Premium4Me.py b/module/plugins/hoster/Premium4Me.py
index 4058c707a..9a359b9cb 100644
--- a/module/plugins/hoster/Premium4Me.py
+++ b/module/plugins/hoster/Premium4Me.py
@@ -1,70 +1,70 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-from urllib import quote
-from os.path import exists
-from os import remove
-
-from module.plugins.Hoster import Hoster
-from module.utils import fs_encode
-
-
-class Premium4Me(Hoster):
- __name__ = "Premium4Me"
- __version__ = "0.07"
- __type__ = "hoster"
-
- __pattern__ = r"http://premium.to/.*"
- __description__ = """Premium.to hoster plugin"""
- __author_name__ = ("RaNaN", "zoidberg", "stickell")
- __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz", "l.stickell@yahoo.it")
-
- def setup(self):
- self.resumeDownload = True
- self.chunkLimit = 1
-
- def process(self, pyfile):
- if not self.account:
- self.logError(_("Please enter your premium.to account or deactivate this plugin"))
- self.fail("No premium.to account provided")
-
- self.logDebug("premium.to: Old URL: %s" % pyfile.url)
-
- tra = self.getTraffic()
-
- #raise timeout to 2min
- self.req.setOption("timeout", 120)
-
- self.download(
- "http://premium.to/api/getfile.php?authcode=%s&link=%s" % (self.account.authcode, quote(pyfile.url, "")),
- disposition=True)
-
- check = self.checkDownload({"nopremium": "No premium account available"})
-
- if check == "nopremium":
- self.retry(60, 300, 'No premium account available')
-
- err = ''
- if self.req.http.code == '420':
- # Custom error code send - fail
- lastDownload = fs_encode(self.lastDownload)
-
- if exists(lastDownload):
- f = open(lastDownload, "rb")
- err = f.read(256).strip()
- f.close()
- remove(lastDownload)
- else:
- err = 'File does not exist'
-
- trb = self.getTraffic()
- self.logInfo("Filesize: %d, Traffic used %d, traffic left %d" % (pyfile.size, tra - trb, trb))
-
- if err: self.fail(err)
-
- def getTraffic(self):
- try:
- traffic = int(self.load("http://premium.to/api/traffic.php?authcode=%s" % self.account.authcode))
- except:
- traffic = 0
- return traffic
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from urllib import quote
+from os.path import exists
+from os import remove
+
+from module.plugins.Hoster import Hoster
+from module.utils import fs_encode
+
+
+class Premium4Me(Hoster):
+ __name__ = "Premium4Me"
+ __version__ = "0.08"
+ __type__ = "hoster"
+
+ __pattern__ = r"http://premium.to/.*"
+ __description__ = """Premium.to hoster plugin"""
+ __author_name__ = ("RaNaN", "zoidberg", "stickell")
+ __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+
+ def setup(self):
+ 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")
+ self.fail("No premium.to account provided")
+
+ self.logDebug("premium.to: Old URL: %s" % pyfile.url)
+
+ tra = self.getTraffic()
+
+ #raise timeout to 2min
+ self.req.setOption("timeout", 120)
+
+ self.download(
+ "http://premium.to/api/getfile.php?authcode=%s&link=%s" % (self.account.authcode, quote(pyfile.url, "")),
+ disposition=True)
+
+ check = self.checkDownload({"nopremium": "No premium account available"})
+
+ if check == "nopremium":
+ self.retry(60, 300, 'No premium account available')
+
+ err = ''
+ if self.req.http.code == '420':
+ # Custom error code send - fail
+ lastDownload = fs_encode(self.lastDownload)
+
+ if exists(lastDownload):
+ f = open(lastDownload, "rb")
+ err = f.read(256).strip()
+ f.close()
+ remove(lastDownload)
+ else:
+ err = 'File does not exist'
+
+ trb = self.getTraffic()
+ self.logInfo("Filesize: %d, Traffic used %d, traffic left %d" % (pyfile.size, tra - trb, trb))
+
+ if err: self.fail(err)
+
+ def getTraffic(self):
+ try:
+ traffic = int(self.load("http://premium.to/api/traffic.php?authcode=%s" % self.account.authcode))
+ except:
+ traffic = 0
+ return traffic
diff --git a/module/plugins/hoster/PremiumizeMe.py b/module/plugins/hoster/PremiumizeMe.py
index 4ae59d198..c5c09857f 100644
--- a/module/plugins/hoster/PremiumizeMe.py
+++ b/module/plugins/hoster/PremiumizeMe.py
@@ -1,50 +1,55 @@
-from module.plugins.Hoster import Hoster
-
-from module.common.json_layer import json_loads
-
-class PremiumizeMe(Hoster):
- __name__ = "PremiumizeMe"
- __version__ = "0.11"
- __type__ = "hoster"
- __description__ = """Premiumize.Me hoster plugin"""
-
- # Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady create the regex patterns for us using getHosters in our PremiumizeMe hook.
- __pattern__ = None
-
- __author_name__ = ("Florian Franzen")
- __author_mail__ = ("FlorianFranzen@gmail.com")
-
- def process(self, pyfile):
- # Check account
- if not self.account or not self.account.canUse():
- self.logError(_("Please enter a valid premiumize.me account or deactivate this plugin"))
- self.fail("No valid premiumize.me account provided")
-
- # In some cases hostsers do not supply us with a filename at download, so we are going to set a fall back filename (e.g. for freakshare or xfileshare)
- self.pyfile.name = self.pyfile.name.split('/').pop() # Remove everthing before last slash
-
- # Correction for automatic assigned filename: Removing html at end if needed
- suffix_to_remove = ["html", "htm", "php", "php3", "asp", "shtm", "shtml", "cfml", "cfm"]
- temp = self.pyfile.name.split('.')
- if temp.pop() in suffix_to_remove:
- self.pyfile.name = ".".join(temp)
-
- # Get account data
- (user, data) = self.account.selectAccount()
-
- # Get rewritten link using the premiumize.me api v1 (see https://secure.premiumize.me/?show=api)
- answer = self.load("https://api.premiumize.me/pm-api/v1.php?method=directdownloadlink&params[login]=%s&params[pass]=%s&params[link]=%s" % (user, data['password'], self.pyfile.url))
- data = json_loads(answer)
-
- # Check status and decide what to do
- status = data['status']
- if status == 200:
- self.download(data['result']['location'], disposition=True)
- elif status == 400:
- self.fail("Invalid link")
- elif status == 404:
- self.offline()
- elif status >= 500:
- self.tempOffline()
- else:
- self.fail(data['statusmessage'])
+from module.plugins.Hoster import Hoster
+
+from module.common.json_layer import json_loads
+
+
+class PremiumizeMe(Hoster):
+ __name__ = "PremiumizeMe"
+ __version__ = "0.12"
+ __type__ = "hoster"
+ __description__ = """Premiumize.Me hoster plugin"""
+
+ # Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady
+ # create the regex patterns for us using getHosters in our PremiumizeMe hook.
+ __pattern__ = None
+
+ __author_name__ = ("Florian Franzen")
+ __author_mail__ = ("FlorianFranzen@gmail.com")
+
+ def process(self, pyfile):
+ # Check account
+ if not self.account or not self.account.canUse():
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "premiumize.me")
+ self.fail("No valid premiumize.me account provided")
+
+ # In some cases hostsers do not supply us with a filename at download, so we
+ # are going to set a fall back filename (e.g. for freakshare or xfileshare)
+ self.pyfile.name = self.pyfile.name.split('/').pop() # Remove everthing before last slash
+
+ # Correction for automatic assigned filename: Removing html at end if needed
+ suffix_to_remove = ["html", "htm", "php", "php3", "asp", "shtm", "shtml", "cfml", "cfm"]
+ temp = self.pyfile.name.split('.')
+ if temp.pop() in suffix_to_remove:
+ self.pyfile.name = ".".join(temp)
+
+ # Get account data
+ (user, data) = self.account.selectAccount()
+
+ # Get rewritten link using the premiumize.me api v1 (see https://secure.premiumize.me/?show=api)
+ answer = self.load(
+ "https://api.premiumize.me/pm-api/v1.php?method=directdownloadlink&params[login]=%s&params[pass]=%s&params[link]=%s" % (
+ user, data['password'], self.pyfile.url))
+ data = json_loads(answer)
+
+ # Check status and decide what to do
+ status = data['status']
+ if status == 200:
+ self.download(data['result']['location'], disposition=True)
+ elif status == 400:
+ self.fail("Invalid link")
+ elif status == 404:
+ self.offline()
+ elif status >= 500:
+ self.tempOffline()
+ else:
+ self.fail(data['statusmessage'])
diff --git a/module/plugins/hoster/PutlockerCom.py b/module/plugins/hoster/PutlockerCom.py
index b2016472d..0f62ea96d 100644
--- a/module/plugins/hoster/PutlockerCom.py
+++ b/module/plugins/hoster/PutlockerCom.py
@@ -28,7 +28,7 @@ class PutlockerCom(SimpleHoster):
__name__ = "PutlockerCom"
__type__ = "hoster"
__pattern__ = r'http://(www\.)?putlocker\.com/(file|embed)/[A-Z0-9]+'
- __version__ = "0.25"
+ __version__ = "0.27"
__description__ = """Putlocker.Com"""
__author_name__ = ("jeix", "stickell")
__author_mail__ = ("l.stickell@yahoo.it")
@@ -37,6 +37,9 @@ class PutlockerCom(SimpleHoster):
FILE_INFO_PATTERN = r'site-content">\s*<h1>(?P<N>.+)<strong>\( (?P<S>[^)]+) \)</strong></h1>'
def handleFree(self):
+ self.multiDL = True
+ self.chunkLimit = -1
+ self.resumeDownload = True
self.pyfile.url = re.sub(r'http://putlocker\.com', r'http://www.putlocker.com', self.pyfile.url)
self.html = self.load(self.pyfile.url, decode=True)
diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py
index 4932c4702..a781d7eff 100644
--- a/module/plugins/hoster/QuickshareCz.py
+++ b/module/plugins/hoster/QuickshareCz.py
@@ -17,9 +17,11 @@
"""
import re
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from pycurl import FOLLOWLOCATION
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
class QuickshareCz(SimpleHoster):
__name__ = "QuickshareCz"
__type__ = "hoster"
@@ -33,14 +35,14 @@ class QuickshareCz(SimpleHoster):
FILE_OFFLINE_PATTERN = r'<script type="text/javascript">location.href=\'/chyba\';</script>'
def process(self, pyfile):
- self.html = self.load(pyfile.url, decode = True)
+ self.html = self.load(pyfile.url, decode=True)
self.getFileInfo()
-
+
# parse js variables
- self.jsvars = dict((x, y.strip("'")) for x,y in re.findall(r"var (\w+) = ([0-9.]+|'[^']*')", self.html))
- self.logDebug(self.jsvars)
+ self.jsvars = dict((x, y.strip("'")) for x, y in re.findall(r"var (\w+) = ([0-9.]+|'[^']*')", self.html))
+ self.logDebug(self.jsvars)
pyfile.name = self.jsvars['ID3']
-
+
# determine download type - free or premium
if self.premium:
if 'UU_prihlasen' in self.jsvars:
@@ -51,32 +53,33 @@ class QuickshareCz(SimpleHoster):
elif float(self.jsvars['UU_kredit']) < float(self.jsvars['kredit_odecet']):
self.logWarning('Not enough credit left')
self.premium = False
-
+
if self.premium:
self.handlePremium()
else:
self.handleFree()
-
+
check = self.checkDownload({"err": re.compile(r"\AChyba!")}, max_size=100)
if check == "err":
self.fail("File not found or plugin defect")
-
- def handleFree(self):
+
+ def handleFree(self):
# get download url
download_url = '%s/download.php' % self.jsvars['server']
data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ('ID1', 'ID2', 'ID3', 'ID4'))
self.logDebug("FREE URL1:" + download_url, data)
-
- self.req.http.c.setopt(FOLLOWLOCATION, 0)
+
+ self.req.http.c.setopt(FOLLOWLOCATION, 0)
self.load(download_url, post=data)
- self.header = self.req.http.header
+ self.header = self.req.http.header
self.req.http.c.setopt(FOLLOWLOCATION, 1)
-
+
found = re.search("Location\s*:\s*(.*)", self.header, re.I)
- if not found: self.fail('File not found')
- download_url = found.group(1)
+ if not found:
+ self.fail('File not found')
+ download_url = found.group(1)
self.logDebug("FREE URL2:" + download_url)
-
+
# check errors
found = re.search(r'/chyba/(\d+)', download_url)
if found:
@@ -88,12 +91,13 @@ class QuickshareCz(SimpleHoster):
self.fail('Error %d' % found.group(1))
# download file
- self.download(download_url)
-
+ 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'))
self.logDebug("PREMIUM URL:" + download_url, data)
self.download(download_url, get=data)
+
getInfo = create_getInfo(QuickshareCz)
diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py
index 3c4611446..543d73966 100644
--- a/module/plugins/hoster/RapidgatorNet.py
+++ b/module/plugins/hoster/RapidgatorNet.py
@@ -29,13 +29,14 @@ class RapidgatorNet(SimpleHoster):
__name__ = "RapidgatorNet"
__type__ = "hoster"
__pattern__ = r"http://(?:www\.)?(rapidgator.net)/file/(\w+)"
- __version__ = "0.18"
+ __version__ = "0.19"
__description__ = """rapidgator.net"""
__author_name__ = ("zoidberg", "chrox", "stickell")
API_URL = 'http://rapidgator.net/api/file'
- FILE_INFO_PATTERN = r'Downloading:(\s*<[^>]*>)*\s*(?P<N>.*?)(\s*<[^>]*>)*\s*File size:\s*<strong>(?P<S>.*?)</strong>'
+ FILE_NAME_PATTERN = r'Downloading:(?:\s*<[^>]*>)*\s*(?P<N>.*?)(?:\s*<[^>]*>)'
+ FILE_SIZE_PATTERN = r'File size:\s*<strong>(?P<S>.*?)</strong>'
FILE_OFFLINE_PATTERN = r'<title>File not found</title>'
JSVARS_PATTERN = r"\s+var\s*(startTimerUrl|getDownloadUrl|captchaUrl|fid|secs)\s*=\s*'?(.*?)'?;"
diff --git a/module/plugins/hoster/RapidshareCom.py b/module/plugins/hoster/RapidshareCom.py
index 8b31dd42c..9d40b867f 100644
--- a/module/plugins/hoster/RapidshareCom.py
+++ b/module/plugins/hoster/RapidshareCom.py
@@ -1,4 +1,3 @@
-
#!/usr/bin/env python
# -*- coding: utf-8 -*-
@@ -14,6 +13,7 @@ import re
from module.network.RequestFactory import getURL
from module.plugins.Hoster import Hoster
+
def getInfo(urls):
ids = ""
names = ""
@@ -23,26 +23,29 @@ def getInfo(urls):
for url in urls:
r = p.search(url)
if r.group("name"):
- ids+= ","+r.group("id")
- names+= ","+r.group("name")
+ ids += "," + r.group("id")
+ names += "," + r.group("name")
elif r.group("name_new"):
- ids+= ","+r.group("id_new")
- names+= ","+r.group("name_new")
-
+ ids += "," + r.group("id_new")
+ names += "," + r.group("name_new")
+
url = "http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=checkfiles&files=%s&filenames=%s" % (ids[1:], names[1:])
-
+
api = getURL(url)
result = []
i = 0
for res in api.split():
tmp = res.split(",")
- if tmp[4] in ("0", "4", "5"): status = 1
- elif tmp[4] == "1": status = 2
- else: status = 3
-
- result.append( (tmp[1], tmp[2], status, urls[i]) )
+ if tmp[4] in ("0", "4", "5"):
+ status = 1
+ elif tmp[4] == "1":
+ status = 2
+ else:
+ status = 3
+
+ result.append((tmp[1], tmp[2], status, urls[i]))
i += 1
-
+
yield result
@@ -50,9 +53,11 @@ class RapidshareCom(Hoster):
__name__ = "RapidshareCom"
__type__ = "hoster"
__pattern__ = r"https?://[\w\.]*?rapidshare.com/(?:files/(?P<id>\d*?)/(?P<name>[^?]+)|#!download\|(?:\w+)\|(?P<id_new>\d+)\|(?P<name_new>[^|]+))"
- __version__ = "1.38"
+ __version__ = "1.39"
__description__ = """Rapidshare.com Download Hoster"""
- __config__ = [["server", "Cogent;Deutsche Telekom;Level(3);Level(3) #2;GlobalCrossing;Level(3) #3;Teleglobe;GlobalCrossing #2;TeliaSonera #2;Teleglobe #2;TeliaSonera #3;TeliaSonera", "Preferred Server", "None"]]
+ __config__ = [["server",
+ "Cogent;Deutsche Telekom;Level(3);Level(3) #2;GlobalCrossing;Level(3) #3;Teleglobe;GlobalCrossing #2;TeliaSonera #2;Teleglobe #2;TeliaSonera #3;TeliaSonera",
+ "Preferred Server", "None"]]
__author_name__ = ("spoob", "RaNaN", "mkaay")
__author_mail__ = ("spoob@pyload.org", "ranan@pyload.org", "mkaay@mkaay.de")
@@ -65,14 +70,14 @@ class RapidshareCom(Hoster):
self.id = None
self.name = None
-
- self.chunkLimit = -1 if self.premium else 1
+
+ self.chunkLimit = -1 if self.premium else 1
self.multiDL = self.resumeDownload = self.premium
def process(self, pyfile):
- self.url = self.pyfile.url
+ self.url = self.pyfile.url
self.prepare()
-
+
def prepare(self):
m = re.search(self.__pattern__, self.url)
@@ -93,12 +98,12 @@ class RapidshareCom(Hoster):
self.handleFree()
elif self.api_data["status"] == "2":
- self.log.info(_("Rapidshare: Traffic Share (direct download)"))
+ self.logInfo(_("Rapidshare: Traffic Share (direct download)"))
self.pyfile.name = self.get_file_name()
- self.download(self.pyfile.url, get={"directstart":1})
-
- elif self.api_data["status"] in ("0","4","5"):
+ self.download(self.pyfile.url, get={"directstart": 1})
+
+ elif self.api_data["status"] in ("0", "4", "5"):
self.offline()
elif self.api_data["status"] == "3":
self.tempOffline()
@@ -113,27 +118,26 @@ class RapidshareCom(Hoster):
#tmp = "#!download|%(server)s|%(id)s|%(name)s|%(size)s"
download = "http://%(host)s/cgi-bin/rsapi.cgi?sub=download&editparentlocation=0&bin=1&fileid=%(id)s&filename=%(name)s&dlauth=%(auth)s" % self.dl_dict
- self.log.debug("RS API Request: %s" % download)
+ self.logDebug("RS API Request: %s" % download)
self.download(download, ref=False)
- check = self.checkDownload({"ip" : "You need RapidPro to download more files from your IP address",
- "auth" : "Download auth invalid"})
+ check = self.checkDownload({"ip": "You need RapidPro to download more files from your IP address",
+ "auth": "Download auth invalid"})
if check == "ip":
self.setWait(60)
- self.log.info(_("Already downloading from this ip address, waiting 60 seconds"))
+ self.logInfo(_("Already downloading from this ip address, waiting 60 seconds"))
self.wait()
self.handleFree()
elif check == "auth":
- self.log.info(_("Invalid Auth Code, download will be restarted"))
+ self.logInfo(_("Invalid Auth Code, download will be restarted"))
self.offset += 5
self.handleFree()
def handlePremium(self):
info = self.account.getAccountInfo(self.user, True)
- self.log.debug("%s: Use Premium Account" % self.__name__)
+ self.logDebug("%s: Use Premium Account" % self.__name__)
url = self.api_data["mirror"]
- self.download(url, get={"directstart":1})
-
+ self.download(url, get={"directstart": 1})
def download_api_data(self, force=False):
"""
@@ -144,20 +148,21 @@ class RapidshareCom(Hoster):
api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi"
api_param_file = {"sub": "checkfiles", "incmd5": "1", "files": self.id, "filenames": self.name}
src = self.load(api_url_base, cookies=False, get=api_param_file).strip()
- self.log.debug("RS INFO API: %s" % src)
+ self.logDebug("RS INFO API: %s" % src)
if src.startswith("ERROR"):
return
fields = src.split(",")
- """
- status codes:
- 0=File not found
- 1=File OK (Anonymous downloading)
- 3=Server down
- 4=File marked as illegal
- 5=Anonymous file locked, because it has more than 10 downloads already
- 50+n=File OK (TrafficShare direct download type "n" without any logging.)
- 100+n=File OK (TrafficShare direct download type "n" with logging. Read our privacy policy to see what is logged.)
- """
+
+ # status codes:
+ # 0=File not found
+ # 1=File OK (Anonymous downloading)
+ # 3=Server down
+ # 4=File marked as illegal
+ # 5=Anonymous file locked, because it has more than 10 downloads already
+ # 50+n=File OK (TrafficShare direct download type "n" without any logging.)
+ # 100+n=File OK (TrafficShare direct download type "n" with logging.
+ # Read our privacy policy to see what is logged.)
+
self.api_data = {"fileid": fields[0], "filename": fields[1], "size": int(fields[2]), "serverid": fields[3],
"status": fields[4], "shorthost": fields[5], "checksum": fields[6].strip().lower()}
@@ -166,7 +171,8 @@ class RapidshareCom(Hoster):
elif int(self.api_data["status"]) > 50:
self.api_data["status"] = str(int(self.api_data["status"]) - 50)
- self.api_data["mirror"] = "http://rs%(serverid)s%(shorthost)s.rapidshare.com/files/%(fileid)s/%(filename)s" % self.api_data
+ 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
@@ -176,21 +182,23 @@ class RapidshareCom(Hoster):
id = self.id
name = self.name
- prepare = "https://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=download&fileid=%(id)s&filename=%(name)s&try=1&cbf=RSAPIDispatcher&cbid=1" % {"name": name, "id" : id}
+ prepare = "https://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=download&fileid=%(id)s&filename=%(name)s&try=1&cbf=RSAPIDispatcher&cbid=1" % {
+ "name": name, "id": id}
- self.log.debug("RS API Request: %s" % prepare)
+ self.logDebug("RS API Request: %s" % prepare)
result = self.load(prepare, ref=False)
- self.log.debug("RS API Result: %s" % result)
+ self.logDebug("RS API Result: %s" % result)
between_wait = re.search("You need to wait (\d+) seconds", result)
if "You need RapidPro to download more files from your IP address" in result:
self.setWait(60)
- self.log.info(_("Already downloading from this ip address, waiting 60 seconds"))
+ self.logInfo(_("Already downloading from this ip address, waiting 60 seconds"))
self.wait()
- elif "Too many users downloading from this server right now" in result or "All free download slots are full" in result:
+ elif "Too many users downloading from this server right now" in result or \
+ "All free download slots are full" in result:
self.setWait(120)
- self.log.info(_("RapidShareCom: No free slots"))
+ self.logInfo(_("RapidShareCom: No free slots"))
self.wait()
elif "This file is too big to download it for free" in result:
self.fail(_("You need a premium account for this file"))
@@ -207,19 +215,17 @@ class RapidshareCom(Hoster):
data = info.split(",")
dl_dict = {"id": id,
- "name": name,
- "host": data[0],
- "auth": data[1],
- "server": self.api_data["serverid"],
- "size": self.api_data["size"]
- }
- self.setWait(int(data[2])+2+self.offset)
+ "name": name,
+ "host": data[0],
+ "auth": data[1],
+ "server": self.api_data["serverid"],
+ "size": self.api_data["size"]}
+ self.setWait(int(data[2]) + 2 + self.offset)
self.wait()
return dl_dict
-
def get_file_name(self):
if self.api_data["filename"]:
return self.api_data["filename"]
- return self.url.split("/")[-1] \ No newline at end of file
+ return self.url.split("/")[-1]
diff --git a/module/plugins/hoster/RarefileNet.py b/module/plugins/hoster/RarefileNet.py
index a0f5930b5..1ede51953 100644
--- a/module/plugins/hoster/RarefileNet.py
+++ b/module/plugins/hoster/RarefileNet.py
@@ -27,8 +27,9 @@ class RarefileNet(XFileSharingPro):
captcha_div = re.search(r'<b>Enter code.*?<div.*?>(.*?)</div>', self.html, re.S).group(1)
self.logDebug(captcha_div)
numerals = re.findall('<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div))
- inputs['code'] = "".join([a[1] for a in sorted(numerals, key = lambda num: int(num[0]))])
+ inputs['code'] = "".join([a[1] for a in sorted(numerals, key=lambda num: int(num[0]))])
self.logDebug("CAPTCHA", inputs['code'], numerals)
return 3
+
getInfo = create_getInfo(RarefileNet)
diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py
index ff4843afd..fd91b89b7 100644
--- a/module/plugins/hoster/RealdebridCom.py
+++ b/module/plugins/hoster/RealdebridCom.py
@@ -1,88 +1,90 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import re
-from time import time
-from urllib import quote, unquote
-from random import randrange
-
-from module.utils import parseFileSize, remove_chars
-from module.common.json_layer import json_loads
-from module.plugins.Hoster import Hoster
-
-class RealdebridCom(Hoster):
- __name__ = "RealdebridCom"
- __version__ = "0.49"
- __type__ = "hoster"
-
- __pattern__ = r"https?://.*real-debrid\..*"
- __description__ = """Real-Debrid.com hoster plugin"""
- __author_name__ = ("Devirex, Hazzard")
- __author_mail__ = ("naibaf_11@yahoo.de")
-
- def getFilename(self, url):
- try:
- name = unquote(url.rsplit("/", 1)[1])
- except IndexError:
- name = "Unknown_Filename..."
- if not name or name.endswith(".."): #incomplete filename, append random stuff
- name += "%s.tmp" % randrange(100,999)
- return name
-
- def init(self):
- self.tries = 0
- self.chunkLimit = 3
- self.resumeDownload = True
-
-
- def process(self, pyfile):
- if not self.account:
- self.logError(_("Please enter your Real-debrid account or deactivate this plugin"))
- self.fail("No Real-debrid account provided")
-
- self.log.debug("Real-Debrid: Old URL: %s" % pyfile.url)
- if re.match(self.__pattern__, pyfile.url):
- new_url = pyfile.url
- else:
- password = self.getPassword().splitlines()
- if not password: password = ""
- else: password = password[0]
-
- url = "http://real-debrid.com/ajax/unrestrict.php?lang=en&link=%s&password=%s&time=%s" % (quote(pyfile.url, ""), password, int(time()*1000))
- page = self.load(url)
- data = json_loads(page)
-
- self.logDebug("Returned Data: %s" % data)
-
- if data["error"] != 0:
- if data["message"] == "Your file is unavailable on the hoster.":
- self.offline()
- else:
- self.logWarning(data["message"])
- self.tempOffline()
- else:
- if self.pyfile.name is not None and self.pyfile.name.endswith('.tmp') and data["file_name"]:
- self.pyfile.name = data["file_name"]
- self.pyfile.size = parseFileSize(data["file_size"])
- new_url = data['generated_links'][0][-1]
-
- if self.getConfig("https"):
- new_url = new_url.replace("http://", "https://")
- else:
- new_url = new_url.replace("https://", "http://")
-
- self.log.debug("Real-Debrid: New URL: %s" % new_url)
-
- if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown") or pyfile.name.endswith('..'):
- #only use when name wasnt already set
- pyfile.name = self.getFilename(new_url)
-
- self.download(new_url, disposition=True)
-
- check = self.checkDownload(
- {"error": "<title>An error occured while processing your request</title>"})
-
- if check == "error":
- #usual this download can safely be retried
- self.retry(reason="An error occured while generating link.", wait_time=60)
-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from time import time
+from urllib import quote, unquote
+from random import randrange
+
+from module.utils import parseFileSize
+from module.common.json_layer import json_loads
+from module.plugins.Hoster import Hoster
+
+
+class RealdebridCom(Hoster):
+ __name__ = "RealdebridCom"
+ __version__ = "0.51"
+ __type__ = "hoster"
+
+ __pattern__ = r"https?://.*real-debrid\..*"
+ __description__ = """Real-Debrid.com hoster plugin"""
+ __author_name__ = ("Devirex, Hazzard")
+ __author_mail__ = ("naibaf_11@yahoo.de")
+
+ def getFilename(self, url):
+ try:
+ name = unquote(url.rsplit("/", 1)[1])
+ except IndexError:
+ name = "Unknown_Filename..."
+ if not name or name.endswith(".."): # incomplete filename, append random stuff
+ name += "%s.tmp" % randrange(100, 999)
+ return name
+
+ def init(self):
+ self.tries = 0
+ self.chunkLimit = 3
+ self.resumeDownload = True
+
+ def process(self, pyfile):
+ if not self.account:
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "Real-debrid")
+ self.fail("No Real-debrid account provided")
+
+ self.logDebug("Real-Debrid: Old URL: %s" % pyfile.url)
+ if re.match(self.__pattern__, pyfile.url):
+ new_url = pyfile.url
+ else:
+ password = self.getPassword().splitlines()
+ if not password:
+ password = ""
+ else:
+ password = password[0]
+
+ url = "http://real-debrid.com/ajax/unrestrict.php?lang=en&link=%s&password=%s&time=%s" % (
+ quote(pyfile.url, ""), password, int(time() * 1000))
+ page = self.load(url)
+ data = json_loads(page)
+
+ self.logDebug("Returned Data: %s" % data)
+
+ if data["error"] != 0:
+ if data["message"] == "Your file is unavailable on the hoster.":
+ self.offline()
+ else:
+ self.logWarning(data["message"])
+ self.tempOffline()
+ else:
+ if self.pyfile.name is not None and self.pyfile.name.endswith('.tmp') and data["file_name"]:
+ self.pyfile.name = data["file_name"]
+ self.pyfile.size = parseFileSize(data["file_size"])
+ new_url = data['generated_links'][0][-1]
+
+ if self.getConfig("https"):
+ new_url = new_url.replace("http://", "https://")
+ else:
+ new_url = new_url.replace("https://", "http://")
+
+ self.logDebug("Real-Debrid: New URL: %s" % new_url)
+
+ if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown") or pyfile.name.endswith('..'):
+ #only use when name wasnt already set
+ pyfile.name = self.getFilename(new_url)
+
+ self.download(new_url, disposition=True)
+
+ check = self.checkDownload(
+ {"error": "<title>An error occured while processing your request</title>"})
+
+ if check == "error":
+ #usual this download can safely be retried
+ self.retry(reason="An error occured while generating link.", wait_time=60)
diff --git a/module/plugins/hoster/RedtubeCom.py b/module/plugins/hoster/RedtubeCom.py
index 9ffafd905..caf33eeac 100644
--- a/module/plugins/hoster/RedtubeCom.py
+++ b/module/plugins/hoster/RedtubeCom.py
@@ -1,56 +1,56 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import re
-from module.plugins.Hoster import Hoster
-from module.unescape import unescape
-
-class RedtubeCom(Hoster):
- __name__ = "RedtubeCom"
- __type__ = "hoster"
- __pattern__ = r'http://[\w\.]*?redtube\.com/\d+'
- __version__ = "0.2"
- __description__ = """Redtube.com Download Hoster"""
- __author_name__ = ("jeix")
- __author_mail__ = ("jeix@hasnomail.de")
-
- def process(self, pyfile):
- self.download_html()
- if not self.file_exists():
- self.offline()
-
- 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
- """
- if self.html is None:
- self.download_html()
-
- file_url = unescape(re.search(r'hashlink=(http.*?)"', self.html).group(1))
-
- return file_url
-
- def get_file_name(self):
- if self.html is None:
- self.download_html()
-
- name = re.search('<title>(.*?)- RedTube - Free Porn Videos</title>', self.html).group(1).strip() + ".flv"
- return name
-
- def file_exists(self):
- """ returns True or False
- """
- if self.html is None:
- self.download_html()
-
- if re.search(r'This video has been removed.', self.html) is not None:
- return False
- else:
- return True
-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Hoster import Hoster
+from module.unescape import unescape
+
+
+class RedtubeCom(Hoster):
+ __name__ = "RedtubeCom"
+ __type__ = "hoster"
+ __pattern__ = r'http://[\w\.]*?redtube\.com/\d+'
+ __version__ = "0.2"
+ __description__ = """Redtube.com Download Hoster"""
+ __author_name__ = ("jeix")
+ __author_mail__ = ("jeix@hasnomail.de")
+
+ def process(self, pyfile):
+ self.download_html()
+ if not self.file_exists():
+ self.offline()
+
+ 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
+ """
+ if self.html is None:
+ self.download_html()
+
+ file_url = unescape(re.search(r'hashlink=(http.*?)"', self.html).group(1))
+
+ return file_url
+
+ def get_file_name(self):
+ if self.html is None:
+ self.download_html()
+
+ name = re.search('<title>(.*?)- RedTube - Free Porn Videos</title>', self.html).group(1).strip() + ".flv"
+ return name
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html is None:
+ self.download_html()
+
+ if re.search(r'This video has been removed.', self.html) is not None:
+ return False
+ else:
+ return True
diff --git a/module/plugins/hoster/RehostTo.py b/module/plugins/hoster/RehostTo.py
index 141dcb8c8..bb6110415 100644
--- a/module/plugins/hoster/RehostTo.py
+++ b/module/plugins/hoster/RehostTo.py
@@ -4,9 +4,10 @@
from urllib import quote, unquote
from module.plugins.Hoster import Hoster
+
class RehostTo(Hoster):
__name__ = "RehostTo"
- __version__ = "0.11"
+ __version__ = "0.13"
__type__ = "hoster"
__pattern__ = r"https?://.*rehost.to\..*"
__description__ = """rehost.com hoster plugin"""
@@ -22,16 +23,16 @@ class RehostTo(Hoster):
def process(self, pyfile):
if not self.account:
- self.log.error(_("Please enter your rehost.to account or deactivate this plugin"))
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "rehost.to")
self.fail("No rehost.to account provided")
data = self.account.getAccountInfo(self.user)
long_ses = data["long_ses"]
- self.log.debug("Rehost.to: Old URL: %s" % pyfile.url)
+ self.logDebug("Rehost.to: Old URL: %s" % pyfile.url)
new_url = "http://rehost.to/process_download.php?user=cookie&pass=%s&dl=%s" % (long_ses, quote(pyfile.url, ""))
#raise timeout to 2min
self.req.setOption("timeout", 120)
- self.download(new_url, disposition=True) \ No newline at end of file
+ self.download(new_url, disposition=True)
diff --git a/module/plugins/hoster/ReloadCc.py b/module/plugins/hoster/ReloadCc.py
index 7dc6d9bb6..2295c792a 100644
--- a/module/plugins/hoster/ReloadCc.py
+++ b/module/plugins/hoster/ReloadCc.py
@@ -1,16 +1,18 @@
-from module.plugins.Hoster import Hoster
+from module.plugins.Hoster import Hoster
from module.common.json_layer import json_loads
from module.network.HTTPRequest import BadHeader
+
class ReloadCc(Hoster):
__name__ = "ReloadCc"
- __version__ = "0.4"
+ __version__ = "0.5"
__type__ = "hoster"
__description__ = """Reload.Cc hoster plugin"""
- # Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady create the regex patterns for us using getHosters in our ReloadCc hook.
+ # Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady
+ # create the regex patterns for us using getHosters in our ReloadCc hook.
__pattern__ = None
__author_name__ = ("Reload Team")
@@ -19,11 +21,12 @@ class ReloadCc(Hoster):
def process(self, pyfile):
# Check account
if not self.account or not self.account.canUse():
- self.logError("Please enter a valid reload.cc account or deactivate this plugin")
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "reload.cc")
self.fail("No valid reload.cc account provided")
- # In some cases hostsers do not supply us with a filename at download, so we are going to set a fall back filename (e.g. for freakshare or xfileshare)
- self.pyfile.name = self.pyfile.name.split('/').pop() # Remove everthing before last slash
+ # In some cases hostsers do not supply us with a filename at download, so we
+ # are going to set a fall back filename (e.g. for freakshare or xfileshare)
+ self.pyfile.name = self.pyfile.name.split('/').pop() # Remove everthing before last slash
# Correction for automatic assigned filename: Removing html at end if needed
suffix_to_remove = ["html", "htm", "php", "php3", "asp", "shtm", "shtml", "cfml", "cfm"]
@@ -62,11 +65,15 @@ class ReloadCc(Hoster):
# Wait for 6 hours and retry up to 4 times => one day
self.retry(max_retries=4, wait_time=(3600 * 6), reason="Limited hoster traffic limit exceeded")
elif e.code == 429:
- self.retry(max_retries=5, wait_time=120, reason="Too many concurrent connections") # Too many connections, wait 2 minutes and try again
+ # Too many connections, wait 2 minutes and try again
+ self.retry(max_retries=5, wait_time=120, reason="Too many concurrent connections")
elif e.code == 503:
- self.retry(wait_time=600, reason="Reload.cc is currently in maintenance mode! Please check again later.") # Retry in 10 minutes
+ # Retry in 10 minutes
+ self.retry(wait_time=600,
+ reason="Reload.cc is currently in maintenance mode! Please check again later.")
else:
- self.fail("Internal error within Reload.cc. Please contact the Reload.cc support for further information.")
+ self.fail(
+ "Internal error within Reload.cc. Please contact the Reload.cc support for further information.")
return
data = json_loads(answer)
@@ -95,9 +102,12 @@ class ReloadCc(Hoster):
elif e.code == 417:
self.fail("Password required for file access")
elif e.code == 429:
- self.retry(max_retries=5, wait_time=120, reason="Too many concurrent connections") # Too many connections, wait 2 minutes and try again
+ # Too many connections, wait 2 minutes and try again
+ self.retry(max_retries=5, wait_time=120, reason="Too many concurrent connections")
else:
- self.fail("Internal error within Reload.cc. Please contact the Reload.cc support for further information.")
+ self.fail(
+ "Internal error within Reload.cc. Please contact the Reload.cc support for further information."
+ )
return
else:
self.fail("Internal error within Reload.cc. Please contact the Reload.cc support for further information.")
diff --git a/module/plugins/hoster/RyushareCom.py b/module/plugins/hoster/RyushareCom.py
index 7bfe4e8fe..eff9a6140 100644
--- a/module/plugins/hoster/RyushareCom.py
+++ b/module/plugins/hoster/RyushareCom.py
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
-from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
import re
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
class RyushareCom(XFileSharingPro):
__name__ = "RyushareCom"
@@ -27,10 +28,10 @@ class RyushareCom(XFileSharingPro):
def getDownloadLink(self):
self.html = self.load(self.pyfile.url)
action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")})
- if inputs.has_key('method_premium'):
+ if 'method_premium' in inputs:
del inputs['method_premium']
- self.html = self.load(self.pyfile.url, post = inputs)
+ self.html = self.load(self.pyfile.url, post=inputs)
action, inputs = self.parseHtmlForm('F1')
for i in xrange(10):
@@ -45,11 +46,12 @@ class RyushareCom(XFileSharingPro):
self.setWait(waittime)
self.wait()
- self.html = self.load(self.pyfile.url, post = inputs)
+ self.html = self.load(self.pyfile.url, post=inputs)
if 'Click here to download' in self.html:
m = re.search(self.DIRECT_LINK_PATTERN, self.html)
return m.group(1)
self.parseError('No direct link within 10 retries')
+
getInfo = create_getInfo(RyushareCom)
diff --git a/module/plugins/hoster/SecureUploadEu.py b/module/plugins/hoster/SecureUploadEu.py
index b9a900d96..dc220c508 100644
--- a/module/plugins/hoster/SecureUploadEu.py
+++ b/module/plugins/hoster/SecureUploadEu.py
@@ -15,4 +15,5 @@ class SecureUploadEu(XFileSharingPro):
FILE_INFO_PATTERN = '<h3>Downloading (?P<N>[^<]+) \((?P<S>[^<]+)\)</h3>'
FILE_OFFLINE_PATTERN = 'The file was removed|File Not Found'
+
getInfo = create_getInfo(SecureUploadEu)
diff --git a/module/plugins/hoster/SendmywayCom.py b/module/plugins/hoster/SendmywayCom.py
index fcbac850a..9b4fc14bc 100644
--- a/module/plugins/hoster/SendmywayCom.py
+++ b/module/plugins/hoster/SendmywayCom.py
@@ -15,4 +15,5 @@ class SendmywayCom(XFileSharingPro):
FILE_SIZE_PATTERN = r'<small>\((?P<S>\d+) bytes\)</small>'
HOSTER_NAME = "sendmyway.com"
+
getInfo = create_getInfo(SendmywayCom)
diff --git a/module/plugins/hoster/SendspaceCom.py b/module/plugins/hoster/SendspaceCom.py
index 22abaff56..729ee17bc 100644
--- a/module/plugins/hoster/SendspaceCom.py
+++ b/module/plugins/hoster/SendspaceCom.py
@@ -19,6 +19,7 @@
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
class SendspaceCom(SimpleHoster):
__name__ = "SendspaceCom"
__type__ = "hoster"
@@ -33,35 +34,37 @@ class SendspaceCom(SimpleHoster):
FILE_OFFLINE_PATTERN = r'<div class="msg error" style="cursor: default">Sorry, the file you requested is not available.</div>'
CAPTCHA_PATTERN = r'<td><img src="(/captchas/captcha.php?captcha=([^"]+))"></td>'
USER_CAPTCHA_PATTERN = r'<td><img src="/captchas/captcha.php?user=([^"]+))"></td>'
-
+
def handleFree(self):
params = {}
for i in range(3):
found = re.search(self.DOWNLOAD_URL_PATTERN, self.html)
if found:
- if params.has_key('captcha_hash'): self.correctCaptcha()
+ if 'captcha_hash' in params:
+ self.correctCaptcha()
download_url = found.group(1)
break
found = re.search(self.CAPTCHA_PATTERN, self.html)
if found:
- if params.has_key('captcha_hash'): self.invalidCaptcha()
+ if 'captcha_hash' in params:
+ self.invalidCaptcha()
captcha_url1 = "http://www.sendspace.com/" + found.group(1)
found = re.search(self.USER_CAPTCHA_PATTERN, self.html)
captcha_url2 = "http://www.sendspace.com/" + found.group(1)
- params = {'captcha_hash' : found.group(2),
+ params = {'captcha_hash': found.group(2),
'captcha_submit': 'Verify',
- 'captcha_answer': self.decryptCaptcha(captcha_url1) + " " + self.decryptCaptcha(captcha_url2)
- }
+ 'captcha_answer': self.decryptCaptcha(captcha_url1) + " " + self.decryptCaptcha(captcha_url2)}
else:
params = {'download': "Regular Download"}
self.logDebug(params)
- self.html = self.load(self.pyfile.url, post = params)
+ self.html = self.load(self.pyfile.url, post=params)
else:
self.fail("Download link not found")
self.logDebug("Download URL: %s" % download_url)
self.download(download_url)
-create_getInfo(SendspaceCom) \ No newline at end of file
+
+create_getInfo(SendspaceCom)
diff --git a/module/plugins/hoster/Share4webCom.py b/module/plugins/hoster/Share4webCom.py
index ef9c2acf8..ead808024 100644
--- a/module/plugins/hoster/Share4webCom.py
+++ b/module/plugins/hoster/Share4webCom.py
@@ -3,6 +3,7 @@
from module.plugins.hoster.UnibytesCom import UnibytesCom
from module.plugins.internal.SimpleHoster import create_getInfo
+
class Share4webCom(UnibytesCom):
__name__ = "Share4webCom"
__type__ = "hoster"
@@ -10,7 +11,8 @@ class Share4webCom(UnibytesCom):
__version__ = "0.1"
__description__ = """Share4web.com"""
__author_name__ = ("zoidberg")
-
+
DOMAIN = 'http://www.share4web.com'
-getInfo = create_getInfo(UnibytesCom) \ No newline at end of file
+
+getInfo = create_getInfo(UnibytesCom)
diff --git a/module/plugins/hoster/Share76Com.py b/module/plugins/hoster/Share76Com.py
index db850cb73..aaa8cd950 100644
--- a/module/plugins/hoster/Share76Com.py
+++ b/module/plugins/hoster/Share76Com.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
class Share76Com(XFileSharingPro):
__name__ = "Share76Com"
__type__ = "hoster"
@@ -16,4 +17,5 @@ class Share76Com(XFileSharingPro):
self.resumeDownload = self.multiDL = self.premium
self.chunkLimit = 1
+
getInfo = create_getInfo(Share76Com)
diff --git a/module/plugins/hoster/ShareFilesCo.py b/module/plugins/hoster/ShareFilesCo.py
index ee44b0a1f..245e20ea6 100644
--- a/module/plugins/hoster/ShareFilesCo.py
+++ b/module/plugins/hoster/ShareFilesCo.py
@@ -1,7 +1,9 @@
# -*- coding: utf-8 -*-
-from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
import re
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
+
class ShareFilesCo(XFileSharingPro):
__name__ = "ShareFilesCo"
__type__ = "hoster"
@@ -17,8 +19,10 @@ class ShareFilesCo(XFileSharingPro):
link = link.strip()
if link.startswith('http://adf.ly'):
link = re.sub('http://adf.ly/\d+/', '', link)
- if self.captcha: self.correctCaptcha()
+ if self.captcha:
+ self.correctCaptcha()
self.logDebug('DIRECT LINK: %s' % link)
self.download(link)
+
getInfo = create_getInfo(ShareFilesCo)
diff --git a/module/plugins/hoster/ShareRapidCom.py b/module/plugins/hoster/ShareRapidCom.py
index 5a08fed1f..42bdaa4e3 100644
--- a/module/plugins/hoster/ShareRapidCom.py
+++ b/module/plugins/hoster/ShareRapidCom.py
@@ -8,8 +8,9 @@ from module.network.HTTPRequest import BadHeader
from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
from module.common.json_layer import json_loads
-def checkFile(url):
- response = getURL("http://share-rapid.com/checkfiles.php", post = {"files": url}, decode = True)
+
+def checkFile(url):
+ response = getURL("http://share-rapid.com/checkfiles.php", post={"files": url}, decode=True)
info = json_loads(response)
if "error" in info:
@@ -17,28 +18,30 @@ def checkFile(url):
info['name'] = info['filename']
info['status'] = 2
elif info['msg'] == "Not found":
- info['status'] = 1 #offline
+ info['status'] = 1 # offline
elif info['msg'] == "Service Unavailable":
- info['status'] = 6 #temp.offline
+ info['status'] = 6 # temp.offline
return info
-
+
+
def getInfo(urls):
for url in urls:
info = checkFile(url)
if "filename" in info:
yield info['name'], info['size'], info['status'], url
- else:
+ else:
file_info = (url, 0, 3, url)
h = getRequest()
try:
h.c.setopt(HTTPHEADER, ["Accept: text/html"])
- html = h.load(url, cookies = True, decode = True)
- file_info = parseFileInfo(ShareRapidCom, url, html)
+ html = h.load(url, cookies=True, decode=True)
+ file_info = parseFileInfo(ShareRapidCom, url, html)
finally:
h.close()
yield file_info
+
class ShareRapidCom(SimpleHoster):
__name__ = "ShareRapidCom"
__type__ = "hoster"
@@ -51,11 +54,11 @@ class ShareRapidCom(SimpleHoster):
FILE_NAME_PATTERN = r'<h1[^>]*><span[^>]*>(?:<a[^>]*>)?(?P<N>[^<]+)'
FILE_SIZE_PATTERN = r'<td class="i">Velikost:</td>\s*<td class="h"><strong>\s*(?P<S>[0-9.]+) (?P<U>[kKMG])i?B</strong></td>'
FILE_OFFLINE_PATTERN = ur'Nastala chyba 404|Soubor byl smazán'
-
+
DOWNLOAD_URL_PATTERN = r'<a href="([^"]+)" title="Stahnout">([^<]+)</a>'
ERR_LOGIN_PATTERN = ur'<div class="error_div"><strong>Stahování je přístupné pouze přihlášeným uživatelům'
ERR_CREDIT_PATTERN = ur'<div class="error_div"><strong>Stahování zdarma je možné jen přes náš'
-
+
FILE_URL_REPLACEMENTS = [(__pattern__, r'http://share-rapid.com/stahuj/\1')]
def setup(self):
@@ -63,23 +66,24 @@ class ShareRapidCom(SimpleHoster):
self.resumeDownload = True
def process(self, pyfile):
- if not self.account: self.fail("User not logged in")
-
+ if not self.account:
+ self.fail("User not logged in")
+
self.info = checkFile(pyfile.url)
self.logDebug(self.info)
-
- pyfile.status = self.info['status']
-
+
+ pyfile.status = self.info['status']
+
if pyfile.status == 2:
pyfile.name = self.info['name']
pyfile.size = self.info['size']
- elif pyfile.status == 1:
+ elif pyfile.status == 1:
self.offline()
elif pyfile.status == 6:
self.tempOffline()
else:
self.fail("Unexpected file status")
-
+
url = "http://share-rapid.com/stahuj/%s" % self.info['filepath']
try:
self.html = self.load(url, decode=True)
@@ -89,15 +93,15 @@ class ShareRapidCom(SimpleHoster):
found = re.search(self.DOWNLOAD_URL_PATTERN, self.html)
if found is not None:
- link = found.group(1)
+ link = found.group(1)
self.logDebug("Premium link: %s" % link)
-
+
self.check_data = {"size": pyfile.size}
self.download(link)
else:
if re.search(self.ERR_LOGIN_PATTERN, self.html):
self.relogin(self.user)
- self.retry(3,0,"User login failed")
+ self.retry(3, 0, "User login failed")
elif re.search(self.ERR_CREDIT_PATTERN, self.html):
self.fail("Not enough credit left")
else:
diff --git a/module/plugins/hoster/SharebeesCom.py b/module/plugins/hoster/SharebeesCom.py
index f5bacc5b0..cc1173fea 100644
--- a/module/plugins/hoster/SharebeesCom.py
+++ b/module/plugins/hoster/SharebeesCom.py
@@ -16,4 +16,5 @@ class SharebeesCom(XFileSharingPro):
FORM_PATTERN = 'F1'
HOSTER_NAME = "sharebees.com"
+
getInfo = create_getInfo(SharebeesCom)
diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py
index e1867168b..7c0f9c069 100644
--- a/module/plugins/hoster/ShareonlineBiz.py
+++ b/module/plugins/hoster/ShareonlineBiz.py
@@ -10,34 +10,39 @@ from time import time, sleep
from module.plugins.Hoster import Hoster
from module.network.RequestFactory import getURL
from module.plugins.Plugin import chunks
-from module.plugins.ReCaptcha import ReCaptcha as _ReCaptcha
-
+from module.plugins.internal.CaptchaService import ReCaptcha as _ReCaptcha
+
+
def getInfo(urls):
api_url_base = "http://api.share-online.biz/linkcheck.php"
-
+
for chunk in chunks(urls, 90):
- api_param_file = {"links": "\n".join(x.replace("http://www.share-online.biz/dl/","").rstrip("/") for x in chunk)} #api only supports old style links
+ api_param_file = {"links": "\n".join(x.replace("http://www.share-online.biz/dl/", "").rstrip("/") for x in
+ chunk)} # api only supports old style links
src = getURL(api_url_base, post=api_param_file, decode=True)
result = []
for i, res in enumerate(src.split("\n")):
if not res:
continue
fields = res.split(";")
-
+
if fields[1] == "OK":
status = 2
elif fields[1] in ("DELETED", "NOT FOUND"):
status = 1
else:
status = 3
-
+
result.append((fields[2], int(fields[3]), status, chunk[i]))
yield result
+
#suppress ocr plugin
class ReCaptcha(_ReCaptcha):
def result(self, server, challenge):
- return self.plugin.decryptCaptcha("%simage"%server, get={"c":challenge}, cookies=True, forceUser=True, imgtype="jpg")
+ return self.plugin.decryptCaptcha("%simage" % server, get={"c": challenge},
+ cookies=True, forceUser=True, imgtype="jpg")
+
class ShareonlineBiz(Hoster):
__name__ = "ShareonlineBiz"
@@ -47,7 +52,7 @@ class ShareonlineBiz(Hoster):
__description__ = """Shareonline.biz Download Hoster"""
__author_name__ = ("spoob", "mkaay", "zoidberg")
__author_mail__ = ("spoob@pyload.org", "mkaay@mkaay.de", "zoidberg@mujmail.cz")
-
+
ERROR_INFO_PATTERN = r'<p class="b">Information:</p>\s*<div>\s*<strong>(.*?)</strong>'
def setup(self):
@@ -60,133 +65,134 @@ class ShareonlineBiz(Hoster):
self.resumeDownload = self.premium
self.multiDL = False
#self.chunkLimit = 1
-
+
self.check_data = None
- def process(self, pyfile):
+ def process(self, pyfile):
if self.premium:
self.handleAPIPremium()
#web-download fallback removed - didn't work anyway
else:
self.handleFree()
-
- """
- check = self.checkDownload({"failure": re.compile(self.ERROR_INFO_PATTERN)})
- if check == "failure":
- try:
- self.retry(reason = self.lastCheck.group(1).decode("utf8"))
- except:
- self.retry(reason = "Unknown error")
- """
-
- if self.api_data:
+
+ # check = self.checkDownload({"failure": re.compile(self.ERROR_INFO_PATTERN)})
+ # if check == "failure":
+ # try:
+ # self.retry(reason = self.lastCheck.group(1).decode("utf8"))
+ # except:
+ # self.retry(reason = "Unknown error")
+
+ if self.api_data:
self.check_data = {"size": int(self.api_data['size']), "md5": self.api_data['md5']}
def downloadAPIData(self):
api_url_base = "http://api.share-online.biz/linkcheck.php?md5=1"
- api_param_file = {"links": self.pyfile.url.replace("http://www.share-online.biz/dl/","")} #api only supports old style links
+ api_param_file = {"links": self.pyfile.url.replace(
+ "http://www.share-online.biz/dl/", "")} # api only supports old style links
src = self.load(api_url_base, cookies=False, post=api_param_file, decode=True)
-
+
fields = src.split(";")
self.api_data = {"fileid": fields[0],
"status": fields[1]}
if not self.api_data["status"] == "OK":
self.offline()
self.api_data["filename"] = fields[2]
- self.api_data["size"] = fields[3] # in bytes
- self.api_data["md5"] = fields[4].strip().lower().replace("\n\n", "") # md5
+ self.api_data["size"] = fields[3] # in bytes
+ self.api_data["md5"] = fields[4].strip().lower().replace("\n\n", "") # md5
- def handleFree(self):
+ def handleFree(self):
self.downloadAPIData()
self.pyfile.name = self.api_data["filename"]
self.pyfile.size = int(self.api_data["size"])
-
- self.html = self.load(self.pyfile.url, cookies = True) #refer, stuff
+
+ self.html = self.load(self.pyfile.url, cookies=True) # refer, stuff
self.setWait(3)
self.wait()
-
- self.html = self.load("%s/free/" % self.pyfile.url, post={"dl_free":"1", "choice": "free"}, decode = True)
+
+ self.html = self.load("%s/free/" % self.pyfile.url, post={"dl_free": "1", "choice": "free"}, decode=True)
self.checkErrors()
-
- found = re.search(r'var wait=(\d+);', self.html)
-
+
+ found = re.search(r'var wait=(\d+);', self.html)
+
recaptcha = ReCaptcha(self)
- for i in range(5):
- challenge, response = recaptcha.challenge("6LdatrsSAAAAAHZrB70txiV5p-8Iv8BtVxlTtjKX")
- self.setWait(int(found.group(1)) if found else 30)
- response = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time() * 1000)), post = {
+ for i in range(5):
+ challenge, response = recaptcha.challenge("6LdatrsSAAAAAHZrB70txiV5p-8Iv8BtVxlTtjKX")
+ self.setWait(int(found.group(1)) if found else 30)
+ response = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time() * 1000)), post={
'dl_free': '1',
'recaptcha_challenge_field': challenge,
'recaptcha_response_field': response})
-
+
if not response == '0':
break
- else: self.fail("No valid captcha solution received")
-
+ else:
+ self.fail("No valid captcha solution received")
+
download_url = response.decode("base64")
self.logDebug(download_url)
if not download_url.startswith("http://"):
self.parseError("download url")
-
- self.wait()
+
+ self.wait()
self.download(download_url)
# check download
check = self.checkDownload({
"cookie": re.compile(r'<div id="dl_failure"'),
"fail": re.compile(r"<title>Share-Online")
- })
+ })
if check == "cookie":
self.retry(5, 60, "Cookie failure")
elif check == "fail":
self.retry(5, 300, "Download failed")
-
+
def checkErrors(self):
found = re.search(r"/failure/(.*?)/1", self.req.lastEffectiveURL)
if found:
err = found.group(1)
found = re.search(self.ERROR_INFO_PATTERN, self.html)
msg = found.group(1) if found else ""
- self.logError(err, msg or "Unknown error occurred")
-
+ self.logError(err, msg or "Unknown error occurred")
+
if err in ('freelimit', 'size', 'proxy'):
self.fail(msg or "Premium account needed")
- if err in ('invalid'):
+ if err in 'invalid':
self.fail(msg or "File not available")
- elif err in ('server'):
+ elif err in 'server':
self.setWait(600, False)
- elif err in ('expired'):
+ elif err in 'expired':
self.setWait(30, False)
- else:
+ else:
self.setWait(300, True)
-
+
self.wait()
- self.retry(max_tries=25, reason = msg)
-
- def handleAPIPremium(self): #should be working better
+ self.retry(max_tries=25, reason=msg)
+
+ def handleAPIPremium(self): # should be working better
self.account.getAccountInfo(self.user, True)
src = self.load("http://api.share-online.biz/account.php",
- {"username": self.user, "password": self.account.accounts[self.user]["password"], "act": "download", "lid": self.file_id})
+ {"username": self.user, "password": self.account.accounts[self.user]["password"],
+ "act": "download", "lid": self.file_id})
self.api_data = dlinfo = {}
for line in src.splitlines():
key, value = line.split(": ")
dlinfo[key.lower()] = value
-
+
self.logDebug(dlinfo)
if not dlinfo["status"] == "online":
self.offline()
-
+
self.pyfile.name = dlinfo["name"]
self.pyfile.size = int(dlinfo["size"])
-
+
dlLink = dlinfo["url"]
if dlLink == "server_under_maintenance":
self.tempoffline()
else:
self.multiDL = True
self.download(dlLink)
-
+
def checksum(self, local_file):
if self.api_data and "md5" in self.api_data and self.api_data["md5"]:
h = hashlib.md5()
diff --git a/module/plugins/hoster/ShareplaceCom.py b/module/plugins/hoster/ShareplaceCom.py
index 7f0dee0e5..5f23f9708 100644
--- a/module/plugins/hoster/ShareplaceCom.py
+++ b/module/plugins/hoster/ShareplaceCom.py
@@ -1,84 +1,84 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import re
-import urllib
-from module.plugins.Hoster import Hoster
-
-class ShareplaceCom(Hoster):
- __name__ = "ShareplaceCom"
- __type__ = "hoster"
- __pattern__ = r"(http://)?(www\.)?shareplace\.(com|org)/\?[a-zA-Z0-9]+"
- __version__ = "0.1"
- __description__ = """Shareplace.com Download Hoster"""
- __author_name__ = ("ACCakut, based on YourfilesTo by jeix and skydancer")
- __author_mail__ = ("none")
-
- def setup(self):
- self.html = None
- self.multiDL = True
-
- def process(self,pyfile):
- self.pyfile = pyfile
- self.prepare()
- self.download(self.get_file_url())
-
- def prepare(self):
- if not self.file_exists():
- self.offline()
-
- self.pyfile.name = self.get_file_name()
-
- wait_time = self.get_waiting_time()
- self.setWait(wait_time)
- self.log.debug("%s: Waiting %d seconds." % (self.__name__,wait_time))
- self.wait()
-
- def get_waiting_time(self):
- if self.html is None:
- self.download_html()
-
- #var zzipitime = 15;
- m = re.search(r'var zzipitime = (\d+);', self.html)
- if m:
- sec = int(m.group(1))
- else:
- sec = 0
-
- 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
- """
- url = re.search(r"var beer = '(.*?)';", self.html)
- if url:
- url = url.group(1)
- url = urllib.unquote(url.replace("http://http:/", "").replace("vvvvvvvvv", "").replace("lllllllll", "").replace("teletubbies", ""))
- self.logDebug("URL: %s" % url)
- return url
- else:
- self.fail("absolute filepath could not be found. offline? ")
-
- def get_file_name(self):
- if self.html is None:
- self.download_html()
-
- return re.search("<title>\s*(.*?)\s*</title>", self.html).group(1)
-
- def file_exists(self):
- """ returns True or False
- """
- if self.html is None:
- self.download_html()
-
- if re.search(r"HTTP Status 404", self.html) is not None:
- return False
- else:
- return True
-
-
-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+import urllib
+from module.plugins.Hoster import Hoster
+
+
+class ShareplaceCom(Hoster):
+ __name__ = "ShareplaceCom"
+ __type__ = "hoster"
+ __pattern__ = r"(http://)?(www\.)?shareplace\.(com|org)/\?[a-zA-Z0-9]+"
+ __version__ = "0.11"
+ __description__ = """Shareplace.com Download Hoster"""
+ __author_name__ = ("ACCakut, based on YourfilesTo by jeix and skydancer")
+ __author_mail__ = ("none")
+
+ def setup(self):
+ self.html = None
+ self.multiDL = True
+
+ def process(self, pyfile):
+ self.pyfile = pyfile
+ self.prepare()
+ self.download(self.get_file_url())
+
+ def prepare(self):
+ if not self.file_exists():
+ self.offline()
+
+ self.pyfile.name = self.get_file_name()
+
+ wait_time = self.get_waiting_time()
+ self.setWait(wait_time)
+ self.logDebug("%s: Waiting %d seconds." % (self.__name__, wait_time))
+ self.wait()
+
+ def get_waiting_time(self):
+ if self.html is None:
+ self.download_html()
+
+ #var zzipitime = 15;
+ m = re.search(r'var zzipitime = (\d+);', self.html)
+ if m:
+ sec = int(m.group(1))
+ else:
+ sec = 0
+
+ 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
+ """
+ url = re.search(r"var beer = '(.*?)';", self.html)
+ if url:
+ url = url.group(1)
+ url = urllib.unquote(
+ url.replace("http://http:/", "").replace("vvvvvvvvv", "").replace("lllllllll", "").replace(
+ "teletubbies", ""))
+ self.logDebug("URL: %s" % url)
+ return url
+ else:
+ self.fail("absolute filepath could not be found. offline? ")
+
+ def get_file_name(self):
+ if self.html is None:
+ self.download_html()
+
+ return re.search("<title>\s*(.*?)\s*</title>", self.html).group(1)
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html is None:
+ self.download_html()
+
+ if re.search(r"HTTP Status 404", self.html) is not None:
+ return False
+ else:
+ return True
diff --git a/module/plugins/hoster/ShragleCom.py b/module/plugins/hoster/ShragleCom.py
index 99f9f2366..2a2738974 100644
--- a/module/plugins/hoster/ShragleCom.py
+++ b/module/plugins/hoster/ShragleCom.py
@@ -6,34 +6,35 @@ from pycurl import FOLLOWLOCATION
from module.plugins.Hoster import Hoster
from module.plugins.internal.SimpleHoster import parseHtmlForm
-from module.plugins.ReCaptcha import ReCaptcha
+from module.plugins.internal.CaptchaService import ReCaptcha
from module.network.RequestFactory import getURL
API_KEY = "078e5ca290d728fd874121030efb4a0d"
+
def parseFileInfo(self, url):
file_id = re.match(self.__pattern__, url).group('ID')
-
- data = getURL(
- "http://www.cloudnator.com/api.php?key=%s&action=getStatus&fileID=%s" % (API_KEY, file_id),
- decode = True
- ).split()
-
+
+ data = getURL("http://www.cloudnator.com/api.php?key=%s&action=getStatus&fileID=%s" % (API_KEY, file_id),
+ decode=True).split()
+
if len(data) == 4:
name, size, md5, status = data
size = int(size)
-
+
if hasattr(self, "check_data"):
- self.checkdata = {"size": size, "md5": md5}
-
+ self.checkdata = {"size": size, "md5": md5}
+
return name, size, 2 if status == "0" else 1, url
else:
return url, 0, 1, url
+
def getInfo(urls):
for url in urls:
file_info = parseFileInfo(ShragleCom, url)
- yield file_info
+ yield file_info
+
class ShragleCom(Hoster):
__name__ = "ShragleCom"
@@ -48,38 +49,38 @@ class ShragleCom(Hoster):
self.html = None
self.multiDL = False
self.check_data = None
-
+
def process(self, pyfile):
#get file status and info
self.pyfile.name, self.pyfile.size, status = parseFileInfo(self, pyfile.url)[:3]
- if status != 2:
+ if status != 2:
self.offline()
-
+
self.handleFree()
-
+
def handleFree(self):
self.html = self.load(self.pyfile.url)
-
+
#get wait time
found = re.search('\s*var\sdownloadWait\s=\s(\d+);', self.html)
self.setWait(int(found.group(1)) if found else 30)
-
+
#parse download form
action, inputs = parseHtmlForm('id="download', self.html)
-
+
#solve captcha
found = re.search('recaptcha/api/(?:challenge|noscript)?k=(.+?)', self.html)
captcha_key = found.group(1) if found else "6LdEFb0SAAAAAAwM70vnYo2AkiVkCx-xmfniatHz"
-
+
recaptcha = ReCaptcha(self)
-
+
inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key)
self.wait()
-
+
#validate
self.req.http.c.setopt(FOLLOWLOCATION, 0)
- self.html = self.load(action, post = inputs)
-
+ self.html = self.load(action, post=inputs)
+
found = re.search(r"Location\s*:\s*(\S*)", self.req.http.header, re.I)
if found:
self.correctCaptcha()
@@ -87,20 +88,18 @@ class ShragleCom(Hoster):
else:
if "Sicherheitscode falsch" in self.html:
self.invalidCaptcha()
- self.retry(max_tries = 5, reason = "Invalid captcha")
+ self.retry(max_tries=5, reason="Invalid captcha")
else:
self.fail("Invalid session")
-
+
#download
self.req.http.c.setopt(FOLLOWLOCATION, 1)
self.download(download_url)
-
+
check = self.checkDownload({
"ip_blocked": re.compile(r'<div class="error".*IP.*loading')
- })
+ })
if check == "ip_blocked":
self.setWait(1800, True)
self.wait()
self.retry()
-
-
diff --git a/module/plugins/hoster/SpeedLoadOrg.py b/module/plugins/hoster/SpeedLoadOrg.py
index 32e7baf13..17354864f 100644
--- a/module/plugins/hoster/SpeedLoadOrg.py
+++ b/module/plugins/hoster/SpeedLoadOrg.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
class SpeedLoadOrg(XFileSharingPro):
__name__ = "SpeedLoadOrg"
__type__ = "hoster"
@@ -16,6 +17,7 @@ class SpeedLoadOrg(XFileSharingPro):
HOSTER_NAME = "speedload.org"
def handlePremium(self):
- self.download(self.pyfile.url, post = self.getPostParameters())
+ self.download(self.pyfile.url, post=self.getPostParameters())
+
getInfo = create_getInfo(SpeedLoadOrg)
diff --git a/module/plugins/hoster/SpeedfileCz.py b/module/plugins/hoster/SpeedfileCz.py
index bfd316dfa..3475ea29e 100644
--- a/module/plugins/hoster/SpeedfileCz.py
+++ b/module/plugins/hoster/SpeedfileCz.py
@@ -19,6 +19,7 @@
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
class SpeedfileCz(SimpleHoster):
__name__ = "SpeedFileCz"
__type__ = "hoster"
@@ -60,6 +61,7 @@ class SpeedfileCz(SimpleHoster):
self.setWait(int(found.group(2)) - int(found.group(1)))
self.wait()
- self.download(download_url)
+ self.download(download_url)
+
-create_getInfo(SpeedfileCz) \ No newline at end of file
+create_getInfo(SpeedfileCz)
diff --git a/module/plugins/hoster/StreamCz.py b/module/plugins/hoster/StreamCz.py
index ca1033502..a575b205e 100644
--- a/module/plugins/hoster/StreamCz.py
+++ b/module/plugins/hoster/StreamCz.py
@@ -20,19 +20,21 @@ import re
from module.plugins.Hoster import Hoster
from module.network.RequestFactory import getURL
+
def getInfo(urls):
result = []
-
+
for url in urls:
-
+
html = getURL(url)
if re.search(StreamCz.FILE_OFFLINE_PATTERN, html):
# File offline
result.append((url, 0, 1, url))
else:
- result.append((url, 0, 2, url))
+ result.append((url, 0, 2, url))
yield result
-
+
+
class StreamCz(Hoster):
__name__ = "StreamCz"
__type__ = "hoster"
@@ -40,7 +42,7 @@ class StreamCz(Hoster):
__version__ = "0.1"
__description__ = """stream.cz"""
__author_name__ = ("zoidberg")
-
+
FILE_OFFLINE_PATTERN = r'<h1 class="commonTitle">Str.nku nebylo mo.n. nal.zt \(404\)</h1>'
FILE_NAME_PATTERN = r'<link rel="video_src" href="http://www.stream.cz/\w+/(\d+)-([^"]+)" />'
CDN_PATTERN = r'<param name="flashvars" value="[^"]*&id=(?P<ID>\d+)(?:&cdnLQ=(?P<cdnLQ>\d*))?(?:&cdnHQ=(?P<cdnHQ>\d*))?(?:&cdnHD=(?P<cdnHD>\d*))?&'
@@ -49,28 +51,30 @@ 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.FILE_OFFLINE_PATTERN, self.html):
+
+ if re.search(self.FILE_OFFLINE_PATTERN, self.html):
self.offline()
-
+
found = re.search(self.CDN_PATTERN, self.html)
- if found is None: self.fail("Parse error (CDN)")
+ if found is None:
+ self.fail("Parse error (CDN)")
cdn = found.groupdict()
self.logDebug(cdn)
for cdnkey in ("cdnHD", "cdnHQ", "cdnLQ"):
- if cdn.has_key(cdnkey) and cdn[cdnkey] > '':
+ if cdnkey in cdn and cdn[cdnkey] > '':
cdnid = cdn[cdnkey]
break
- else:
+ else:
self.fail("Stream URL not found")
-
+
found = re.search(self.FILE_NAME_PATTERN, self.html)
- if found is None: self.fail("Parse error (NAME)")
+ if found is None:
+ self.fail("Parse error (NAME)")
pyfile.name = "%s-%s.%s.mp4" % (found.group(2), found.group(1), cdnkey[-2:])
-
+
download_url = "http://cdn-dispatcher.stream.cz/?id=" + cdnid
self.logInfo("STREAM (%s): %s" % (cdnkey[-2:], download_url))
self.download(download_url)
diff --git a/module/plugins/hoster/StreamcloudEu.py b/module/plugins/hoster/StreamcloudEu.py
index 73c0465f8..dd9bf9429 100644
--- a/module/plugins/hoster/StreamcloudEu.py
+++ b/module/plugins/hoster/StreamcloudEu.py
@@ -1,9 +1,11 @@
# -*- coding: utf-8 -*-
-from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
-from module.network.HTTPRequest import HTTPRequest
from time import sleep
import re
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+from module.network.HTTPRequest import HTTPRequest
+
+
class StreamcloudEu(XFileSharingPro):
__name__ = "StreamcloudEu"
__type__ = "hoster"
@@ -31,7 +33,7 @@ class StreamcloudEu(XFileSharingPro):
httpRequest = HTTPRequest(options=self.req.options)
httpRequest.cj = self.req.cj
sleep(10)
- self.html = httpRequest.load(self.pyfile.url, post = data, referer=False, cookies=True, decode = True)
+ self.html = httpRequest.load(self.pyfile.url, post=data, referer=False, cookies=True, decode=True)
self.header = httpRequest.header
found = re.search("Location\s*:\s*(.*)", self.header, re.I)
@@ -52,9 +54,10 @@ class StreamcloudEu(XFileSharingPro):
def getPostParameters(self):
for i in range(3):
- if not self.errmsg: self.checkErrors()
+ if not self.errmsg:
+ self.checkErrors()
- if hasattr(self,"FORM_PATTERN"):
+ if hasattr(self, "FORM_PATTERN"):
action, inputs = self.parseHtmlForm(self.FORM_PATTERN)
else:
action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")})
@@ -86,7 +89,8 @@ class StreamcloudEu(XFileSharingPro):
self.captcha = self.handleCaptcha(inputs)
- if wait_time: self.wait()
+ if wait_time:
+ self.wait()
self.errmsg = None
self.logDebug("getPostParameters {0}".format(i))
@@ -97,15 +101,18 @@ class StreamcloudEu(XFileSharingPro):
if self.premium:
inputs['method_premium'] = "Premium Download"
- if 'method_free' in inputs: del inputs['method_free']
+ if 'method_free' in inputs:
+ del inputs['method_free']
else:
inputs['method_free'] = "Free Download"
- if 'method_premium' in inputs: del inputs['method_premium']
+ if 'method_premium' in inputs:
+ del inputs['method_premium']
- self.html = self.load(self.pyfile.url, post = inputs, ref = False)
+ self.html = self.load(self.pyfile.url, post=inputs, ref=False)
self.errmsg = None
- else: self.parseError('FORM: %s' % (inputs['op'] if 'op' in inputs else 'UNKNOWN'))
+ else:
+ self.parseError('FORM: %s' % (inputs['op'] if 'op' in inputs else 'UNKNOWN'))
getInfo = create_getInfo(StreamcloudEu)
diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py
index 09ce46a31..5fe42bba7 100644
--- a/module/plugins/hoster/TurbobitNet.py
+++ b/module/plugins/hoster/TurbobitNet.py
@@ -23,14 +23,14 @@ import re
import random
from urllib import quote
from binascii import hexlify, unhexlify
-from Crypto.Cipher import ARC4
import time
+from pycurl import HTTPHEADER
+from Crypto.Cipher import ARC4
from module.network.RequestFactory import getURL
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp
-from module.plugins.ReCaptcha import ReCaptcha
+from module.plugins.internal.CaptchaService import ReCaptcha
-from pycurl import HTTPHEADER
class TurbobitNet(SimpleHoster):
__name__ = "TurbobitNet"
@@ -41,10 +41,12 @@ class TurbobitNet(SimpleHoster):
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
- FILE_INFO_PATTERN = r"<span class='file-icon1[^>]*>(?P<N>[^<]+)</span>\s*\((?P<S>[^\)]+)\)\s*</h1>" #long filenames are shortened
- FILE_NAME_PATTERN = r'<meta name="keywords" content="\s+(?P<N>[^,]+)' #full name but missing on page2
+ # long filenames are shortened
+ FILE_INFO_PATTERN = r"<span class='file-icon1[^>]*>(?P<N>[^<]+)</span>\s*\((?P<S>[^\)]+)\)\s*</h1>"
+ FILE_NAME_PATTERN = r'<meta name="keywords" content="\s+(?P<N>[^,]+)' # full name but missing on page2
FILE_OFFLINE_PATTERN = r'<h2>File Not Found</h2>|html\(\'File (?:was )?not found'
- FILE_URL_REPLACEMENTS = [(r"http://(?:\w*\.)?(turbobit.net|unextfiles.com)/(?:download/free/)?(?P<ID>\w+).*", "http://turbobit.net/\g<ID>.html")]
+ FILE_URL_REPLACEMENTS = [(r"http://(?:\w*\.)?(turbobit.net|unextfiles.com)/(?:download/free/)?(?P<ID>\w+).*",
+ "http://turbobit.net/\g<ID>.html")]
SH_COOKIES = [("turbobit.net", "user_lang", "en")]
CAPTCHA_KEY_PATTERN = r'src="http://api\.recaptcha\.net/challenge\?k=([^"]+)"'
@@ -59,7 +61,7 @@ class TurbobitNet(SimpleHoster):
rtUpdate = self.getRtUpdate()
self.solveCaptcha()
- self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
+ self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
self.url = self.getDownloadUrl(rtUpdate)
self.wait()
@@ -67,7 +69,7 @@ class TurbobitNet(SimpleHoster):
self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With:"])
self.downloadFile()
- def solveCaptcha(self):
+ def solveCaptcha(self):
for i in range(5):
found = re.search(self.LIMIT_WAIT_PATTERN, self.html)
if found:
@@ -77,41 +79,47 @@ class TurbobitNet(SimpleHoster):
self.retry()
action, inputs = self.parseHtmlForm("action='#'")
- if not inputs: self.parseError("captcha form")
+ if not inputs:
+ self.parseError("captcha form")
self.logDebug(inputs)
if inputs['captcha_type'] == 'recaptcha':
recaptcha = ReCaptcha(self)
found = re.search(self.CAPTCHA_KEY_PATTERN, self.html)
captcha_key = found.group(1) if found else '6LcTGLoSAAAAAHCWY9TTIrQfjUlxu6kZlTYP50_c'
- inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key)
+ inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(
+ captcha_key)
else:
found = re.search(self.CAPTCHA_SRC_PATTERN, self.html)
- if not found: self.parseError('captcha')
+ if not found:
+ self.parseError('captcha')
captcha_url = found.group(1)
inputs['captcha_response'] = self.decryptCaptcha(captcha_url)
self.logDebug(inputs)
- self.html = self.load(self.url, post = inputs)
+ self.html = self.load(self.url, post=inputs)
if not "<div class='download-timer-header'>" in self.html:
self.invalidCaptcha()
else:
self.correctCaptcha()
break
- else: self.fail("Invalid captcha")
+ else:
+ self.fail("Invalid captcha")
def getRtUpdate(self):
rtUpdate = self.getStorage("rtUpdate")
if not rtUpdate:
- if self.getStorage("version") != self.__version__ or int(self.getStorage("timestamp", 0)) + 86400000 < timestamp():
+ if self.getStorage("version") != self.__version__ or int(
+ self.getStorage("timestamp", 0)) + 86400000 < timestamp():
# that's right, we are even using jdownloader updates
rtUpdate = getURL("http://update0.jdownloader.org/pluginstuff/tbupdate.js")
rtUpdate = self.decrypt(rtUpdate.splitlines()[1])
# but we still need to fix the syntax to work with other engines than rhino
- rtUpdate = re.sub(r'for each\(var (\w+) in(\[[^\]]+\])\)\{',r'zza=\2;for(var zzi=0;zzi<zza.length;zzi++){\1=zza[zzi];',rtUpdate)
- rtUpdate = re.sub(r"for\((\w+)=",r"for(var \1=", rtUpdate)
-
+ rtUpdate = re.sub(r'for each\(var (\w+) in(\[[^\]]+\])\)\{',
+ r'zza=\2;for(var zzi=0;zzi<zza.length;zzi++){\1=zza[zzi];', rtUpdate)
+ rtUpdate = re.sub(r"for\((\w+)=", r"for(var \1=", rtUpdate)
+
self.logDebug("rtUpdate")
self.setStorage("rtUpdate", rtUpdate)
self.setStorage("timestamp", timestamp())
@@ -126,14 +134,16 @@ class TurbobitNet(SimpleHoster):
self.req.http.lastURL = self.url
found = re.search("(/\w+/timeout\.js\?\w+=)([^\"\'<>]+)", self.html)
- url = "http://turbobit.net%s%s" % (found.groups() if found else ('/files/timeout.js?ver=', ''.join(random.choice('0123456789ABCDEF') for x in range(32))))
+ url = "http://turbobit.net%s%s" % (found.groups() if found else (
+ '/files/timeout.js?ver=', ''.join(random.choice('0123456789ABCDEF') for x in range(32))))
fun = self.load(url)
self.setWait(65, False)
- for b in [1,3]:
- self.jscode = "var id = \'%s\';var b = %d;var inn = \'%s\';%sout" % (self.file_info['ID'], b, quote(fun), rtUpdate)
-
+ for b in [1, 3]:
+ self.jscode = "var id = \'%s\';var b = %d;var inn = \'%s\';%sout" % (
+ self.file_info['ID'], b, quote(fun), rtUpdate)
+
try:
out = self.js.eval(self.jscode)
self.logDebug("URL", self.js.engine, out)
@@ -150,11 +160,11 @@ class TurbobitNet(SimpleHoster):
def decrypt(self, data):
cipher = ARC4.new(hexlify('E\x15\xa1\x9e\xa3M\xa0\xc6\xa0\x84\xb6H\x83\xa8o\xa0'))
return unhexlify(cipher.encrypt(unhexlify(data)))
-
+
def getLocalTimeString(self):
lt = time.localtime()
- tz = time.altzone if lt.tm_isdst else time.timezone
- return "%s GMT%+03d%02d" % (time.strftime("%a %b %d %Y %H:%M:%S", lt), -tz // 3600, tz % 3600)
+ tz = time.altzone if lt.tm_isdst else time.timezone
+ return "%s GMT%+03d%02d" % (time.strftime("%a %b %d %Y %H:%M:%S", lt), -tz // 3600, tz % 3600)
def handlePremium(self):
self.logDebug("Premium download as user %s" % self.user)
@@ -162,9 +172,11 @@ class TurbobitNet(SimpleHoster):
def downloadFile(self):
found = re.search(self.DOWNLOAD_URL_PATTERN, self.html)
- if not found: self.parseError("download link")
+ if not found:
+ self.parseError("download link")
self.url = "http://turbobit.net" + found.group('url')
self.logDebug(self.url)
self.download(self.url)
+
getInfo = create_getInfo(TurbobitNet)
diff --git a/module/plugins/hoster/TurbouploadCom.py b/module/plugins/hoster/TurbouploadCom.py
index 6e81c6319..12dad7906 100644
--- a/module/plugins/hoster/TurbouploadCom.py
+++ b/module/plugins/hoster/TurbouploadCom.py
@@ -18,8 +18,7 @@
import re
from module.plugins.internal.DeadHoster import DeadHoster as EasybytezCom, create_getInfo
-#from module.plugins.internal.SimpleHoster import create_getInfo
-#from module.plugins.hoster.EasybytezCom import EasybytezCom
+
class TurbouploadCom(EasybytezCom):
__name__ = "TurbouploadCom"
@@ -29,17 +28,19 @@ class TurbouploadCom(EasybytezCom):
__description__ = """turboupload.com"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
-
+
# shares code with EasybytezCom
-
+
DIRECT_LINK_PATTERN = r'<a href="(http://turboupload.com/files/[^"]+)">\1</a>'
def handleFree(self):
- self.html = self.load(self.pyfile.url, post = self.getPostParameters(), ref = True, cookies = True)
+ self.html = self.load(self.pyfile.url, post=self.getPostParameters(), ref=True, cookies=True)
found = re.search(self.DIRECT_LINK_PATTERN, self.html)
- if not found: self.parseError('Download Link')
+ if not found:
+ self.parseError('Download Link')
url = found.group(1)
self.logDebug('URL: ' + url)
self.download(url)
-getInfo = create_getInfo(TurbouploadCom) \ No newline at end of file
+
+getInfo = create_getInfo(TurbouploadCom)
diff --git a/module/plugins/hoster/TusfilesNet.py b/module/plugins/hoster/TusfilesNet.py
index 517df8561..a155439b2 100644
--- a/module/plugins/hoster/TusfilesNet.py
+++ b/module/plugins/hoster/TusfilesNet.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
class TusfilesNet(XFileSharingPro):
__name__ = "TusfilesNet"
__type__ = "hoster"
@@ -15,4 +16,5 @@ class TusfilesNet(XFileSharingPro):
HOSTER_NAME = "tusfiles.net"
+
getInfo = create_getInfo(TusfilesNet)
diff --git a/module/plugins/hoster/TwoSharedCom.py b/module/plugins/hoster/TwoSharedCom.py
index 8401e0cb0..5d1cd835b 100644
--- a/module/plugins/hoster/TwoSharedCom.py
+++ b/module/plugins/hoster/TwoSharedCom.py
@@ -1,9 +1,11 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
class TwoSharedCom(SimpleHoster):
__name__ = "TwoSharedCom"
__type__ = "hoster"
@@ -17,17 +19,18 @@ class TwoSharedCom(SimpleHoster):
FILE_SIZE_PATTERN = r'<span class="dtitle">File size:</span>\s*(?P<S>[0-9,.]+) (?P<U>[kKMG])i?B'
FILE_OFFLINE_PATTERN = r'The file link that you requested is not valid\.|This file was deleted\.'
DOWNLOAD_URL_PATTERN = r"window.location ='([^']+)';"
-
+
def setup(self):
self.resumeDownload = self.multiDL = True
- def handleFree(self):
+ def handleFree(self):
found = re.search(self.DOWNLOAD_URL_PATTERN, self.html)
- if not found: self.parseError('Download link')
+ if not found:
+ self.parseError('Download link')
link = found.group(1)
self.logDebug("Download URL %s" % link)
-
+
self.download(link)
+
getInfo = create_getInfo(TwoSharedCom)
- \ No newline at end of file
diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py
index 5c38fdaad..fe0bc671e 100644
--- a/module/plugins/hoster/UlozTo.py
+++ b/module/plugins/hoster/UlozTo.py
@@ -19,15 +19,17 @@
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
def convertDecimalPrefix(m):
# decimal prefixes used in filesize and traffic
- return ("%%.%df" % {'k':3,'M':6,'G':9}[m.group(2)] % float(m.group(1))).replace('.','')
+ return ("%%.%df" % {'k': 3, 'M': 6, 'G': 9}[m.group(2)] % float(m.group(1))).replace('.', '')
+
class UlozTo(SimpleHoster):
__name__ = "UlozTo"
__type__ = "hoster"
__pattern__ = r"http://(\w*\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj.cz|zachowajto.pl)/(?:live/)?(?P<id>\w+/[^/?]*)"
- __version__ = "0.92"
+ __version__ = "0.93"
__description__ = """uloz.to"""
__author_name__ = ("zoidberg")
@@ -44,20 +46,20 @@ class UlozTo(SimpleHoster):
PREMIUM_URL_PATTERN = r'<div class="downloadForm"><form action="([^"]+)"'
def setup(self):
- self.multiDL = self.premium
+ 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)
+ self.html = self.load(pyfile.url, decode=True, cookies=True)
passwords = self.getPassword().splitlines()
while self.PASSWD_PATTERN in self.html:
if passwords:
password = passwords.pop(0)
self.logInfo("Password protected link, trying " + password)
- self.html = self.load(pyfile.url, get = {"do": "passwordProtectedForm-submit"},
- post={"password": password, "password_send": 'Send'}, cookies=True)
+ self.html = self.load(pyfile.url, get={"do": "passwordProtectedForm-submit"},
+ post={"password": password, "password_send": 'Send'}, cookies=True)
else:
self.fail("No or incorrect password")
@@ -70,47 +72,45 @@ class UlozTo(SimpleHoster):
self.handlePremium()
else:
self.handleFree()
-
+
self.doCheckDownload()
def handleFree(self):
action, inputs = self.parseHtmlForm('id="frm-downloadDialog-freeDownloadForm"')
if not action or not inputs:
- self.parseError("free download form")
-
+ self.parseError("free download form")
+
# get and decrypt captcha
captcha_id_field = captcha_text_field = None
-
- for key in inputs.keys():
+
+ for key in inputs.keys():
found = re.match("captcha.*(id|text|value)", key)
if found:
if found.group(1) == "id":
captcha_id_field = key
else:
captcha_text_field = key
-
+
if not captcha_id_field or not captcha_text_field:
- self.parseError("CAPTCHA form changed")
-
- """
- captcha_id = self.getStorage("captcha_id")
- captcha_text = self.getStorage("captcha_text")
-
- if not captcha_id or not captcha_text:
- """
+ self.parseError("CAPTCHA form changed")
+
+ # captcha_id = self.getStorage("captcha_id")
+ # captcha_text = self.getStorage("captcha_text")
+ #
+ # if not captcha_id or not captcha_text:
+
captcha_id = inputs[captcha_id_field]
captcha_text = self.decryptCaptcha("http://img.uloz.to/captcha/%s.png" % captcha_id)
- self.log.debug(' CAPTCHA ID:' + captcha_id + ' CAPTCHA TEXT:' + captcha_text)
-
- """
- self.setStorage("captcha_id", captcha_id)
- self.setStorage("captcha_text", captcha_text)
- """
+ self.logDebug(' CAPTCHA ID:' + captcha_id + ' CAPTCHA TEXT:' + captcha_text)
+
+ # self.setStorage("captcha_id", captcha_id)
+ # self.setStorage("captcha_text", captcha_text)
+
self.multiDL = True
inputs.update({captcha_id_field: captcha_id, captcha_text_field: captcha_text})
-
+
self.download("http://www.ulozto.net" + action, post=inputs, cookies=True, disposition=True)
def handlePremium(self):
@@ -121,7 +121,8 @@ class UlozTo(SimpleHoster):
def findDownloadURL(self, premium=False):
msg = "%s link" % ("Premium" if premium else "Free")
found = re.search(self.PREMIUM_URL_PATTERN if premium else self.FREE_URL_PATTERN, self.html)
- if not found: self.parseError(msg)
+ if not found:
+ self.parseError(msg)
parsed_url = "http://www.ulozto.net" + found.group(1)
self.logDebug("%s: %s" % (msg, parsed_url))
return parsed_url
@@ -131,7 +132,7 @@ class UlozTo(SimpleHoster):
"wrong_captcha": re.compile(r'<ul class="error">\s*<li>Error rewriting the text.</li>'),
"offline": re.compile(self.FILE_OFFLINE_PATTERN),
"passwd": self.PASSWD_PATTERN,
- "server_error": 'src="http://img.ulozto.cz/error403/vykricnik.jpg"', #paralell dl, server overload etc.
+ "server_error": 'src="http://img.ulozto.cz/error403/vykricnik.jpg"', # paralell dl, server overload etc.
"not_found": "<title>Ulož.to</title>"
})
@@ -153,4 +154,5 @@ class UlozTo(SimpleHoster):
elif check == "not_found":
self.fail("Server error - file not downloadable")
+
getInfo = create_getInfo(UlozTo)
diff --git a/module/plugins/hoster/UloziskoSk.py b/module/plugins/hoster/UloziskoSk.py
index c607e7a5b..7060dff65 100644
--- a/module/plugins/hoster/UloziskoSk.py
+++ b/module/plugins/hoster/UloziskoSk.py
@@ -19,6 +19,7 @@
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError
+
class UloziskoSk(SimpleHoster):
__name__ = "UloziskoSk"
__type__ = "hoster"
@@ -38,7 +39,7 @@ class UloziskoSk(SimpleHoster):
def process(self, pyfile):
self.html = self.load(pyfile.url, decode=True)
self.getFileInfo()
-
+
found = re.search(self.IMG_PATTERN, self.html)
if found:
url = "http://ulozisko.sk" + found.group(1)
@@ -48,17 +49,20 @@ class UloziskoSk(SimpleHoster):
def handleFree(self):
found = re.search(self.URL_PATTERN, self.html)
- if found is None: raise PluginParseError('URL')
+ if found is None:
+ raise PluginParseError('URL')
parsed_url = 'http://www.ulozisko.sk' + found.group(1)
found = re.search(self.ID_PATTERN, self.html)
- if found is None: raise PluginParseError('ID')
+ if found is None:
+ raise PluginParseError('ID')
id = found.group(1)
self.logDebug('URL:' + parsed_url + ' ID:' + id)
found = re.search(self.CAPTCHA_PATTERN, self.html)
- if found is None: raise PluginParseError('CAPTCHA')
+ if found is None:
+ raise PluginParseError('CAPTCHA')
captcha_url = 'http://www.ulozisko.sk' + found.group(1)
captcha = self.decryptCaptcha(captcha_url, cookies=True)
@@ -72,4 +76,5 @@ class UloziskoSk(SimpleHoster):
"but": "++++STIAHNI+S%DABOR++++"
})
+
getInfo = create_getInfo(UloziskoSk)
diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py
index 3c8552271..d13f01ef3 100644
--- a/module/plugins/hoster/UnibytesCom.py
+++ b/module/plugins/hoster/UnibytesCom.py
@@ -20,6 +20,7 @@ import re
from pycurl import FOLLOWLOCATION
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
class UnibytesCom(SimpleHoster):
__name__ = "UnibytesCom"
__type__ = "hoster"
@@ -30,28 +31,28 @@ class UnibytesCom(SimpleHoster):
FILE_INFO_PATTERN = r'<span[^>]*?id="fileName"[^>]*>(?P<N>[^>]+)</span>\s*\((?P<S>\d.*?)\)'
DOMAIN = 'http://www.unibytes.com'
-
+
WAIT_PATTERN = r'Wait for <span id="slowRest">(\d+)</span> sec'
DOWNLOAD_LINK_PATTERN = r'<a href="([^"]+)">Download</a>'
def handleFree(self):
- action, post_data = self.parseHtmlForm('id="startForm"')
+ action, post_data = self.parseHtmlForm('id="startForm"')
self.req.http.c.setopt(FOLLOWLOCATION, 0)
-
+
for i in range(8):
self.logDebug(action, post_data)
- self.html = self.load(self.DOMAIN + action, post = post_data)
-
+ self.html = self.load(self.DOMAIN + action, post=post_data)
+
found = re.search(r'location:\s*(\S+)', self.req.http.header, re.I)
if found:
url = found.group(1)
break
-
- if '>Somebody else is already downloading using your IP-address<' in self.html:
+
+ if '>Somebody else is already downloading using your IP-address<' in self.html:
self.setWait(600, True)
self.wait()
self.retry()
-
+
if post_data['step'] == 'last':
found = re.search(self.DOWNLOAD_LINK_PATTERN, self.html)
if found:
@@ -60,21 +61,22 @@ class UnibytesCom(SimpleHoster):
break
else:
self.invalidCaptcha()
-
- last_step = post_data['step']
+
+ last_step = post_data['step']
action, post_data = self.parseHtmlForm('id="stepForm"')
-
- if last_step == 'timer':
+
+ if last_step == 'timer':
found = re.search(self.WAIT_PATTERN, self.html)
self.setWait(int(found.group(1)) if found else 60, False)
- self.wait()
+ self.wait()
elif last_step in ('captcha', 'last'):
post_data['captcha'] = self.decryptCaptcha(self.DOMAIN + '/captcha.jpg')
else:
- self.fail("No valid captcha code entered")
-
+ self.fail("No valid captcha code entered")
+
self.logDebug('Download link: ' + url)
- self.req.http.c.setopt(FOLLOWLOCATION, 1)
- self.download(url)
+ self.req.http.c.setopt(FOLLOWLOCATION, 1)
+ self.download(url)
+
-getInfo = create_getInfo(UnibytesCom) \ No newline at end of file
+getInfo = create_getInfo(UnibytesCom)
diff --git a/module/plugins/hoster/UnrestrictLi.py b/module/plugins/hoster/UnrestrictLi.py
index e866a9269..358e493b1 100644
--- a/module/plugins/hoster/UnrestrictLi.py
+++ b/module/plugins/hoster/UnrestrictLi.py
@@ -35,7 +35,7 @@ def secondsToMidnight():
class UnrestrictLi(Hoster):
__name__ = "UnrestrictLi"
- __version__ = "0.03"
+ __version__ = "0.09"
__type__ = "hoster"
__pattern__ = r"https?://.*(unrestrict|unr)\.li"
__description__ = """Unrestrict.li hoster plugin"""
@@ -43,12 +43,12 @@ class UnrestrictLi(Hoster):
__author_mail__ = ("l.stickell@yahoo.it")
def init(self):
- self.chunkLimit = -1
+ self.chunkLimit = 16
self.resumeDownload = True
def process(self, pyfile):
if not self.account:
- self.logError("Please enter your Unrestrict.li account or deactivate this plugin")
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "Unrestrict.li")
self.fail("No Unrestrict.li account provided")
self.logDebug("Old URL: %s" % pyfile.url)
@@ -61,7 +61,12 @@ class UnrestrictLi(Hoster):
self.logDebug("JSON data: " + page)
if page != '':
break
- if "You are not allowed to download from this host" in page:
+ if "File offline" in page:
+ self.offline()
+ elif "ERROR_HOSTER_TEMPORARILY_UNAVAILABLE" in page:
+ self.logInfo("Hoster temporarily unavailable, waiting 1 minute and retry")
+ self.retry(5, 60, "Hoster is temporarily unavailable")
+ elif "You are not allowed to download from this host" in page:
self.fail("You are not allowed to download from this host")
elif "You have reached your daily limit for this host" in page:
self.logInfo("Reached daily limit for this host. Waiting until 00:10 GMT+2")
@@ -72,8 +77,17 @@ class UnrestrictLi(Hoster):
self.logDebug("New URL: " + new_url)
+ if hasattr(self, 'api_data'):
+ self.setNameSize()
+
self.download(new_url, disposition=True)
if self.getConfig("history"):
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']
+ if 'size' in self.api_data:
+ self.pyfile.size = self.api_data['size']
diff --git a/module/plugins/hoster/UploadStationCom.py b/module/plugins/hoster/UploadStationCom.py
index d24682e4d..2831facac 100644
--- a/module/plugins/hoster/UploadStationCom.py
+++ b/module/plugins/hoster/UploadStationCom.py
@@ -1,21 +1,25 @@
-# -*- coding: utf-8 -*-
-from module.plugins.hoster.FileserveCom import FileserveCom, checkFile
-from module.plugins.Plugin import chunks
-
-class UploadStationCom(FileserveCom):
- __name__ = "UploadStationCom"
- __type__ = "hoster"
- __pattern__ = r"http://(?:www\.)?uploadstation\.com/file/(?P<id>[A-Za-z0-9]+)"
- __version__ = "0.51"
- __description__ = """UploadStation.Com File Download Hoster"""
- __author_name__ = ("fragonib", "zoidberg")
- __author_mail__ = ("fragonib[AT]yahoo[DOT]es", "zoidberg@mujmail.cz")
-
- URLS = ['http://www.uploadstation.com/file/', 'http://www.uploadstation.com/check-links.php', 'http://www.uploadstation.com/checkReCaptcha.php']
- LINKCHECK_TR = r'<div class="details (?:white|grey)">(.*?)\t{9}</div>'
- LINKCHECK_TD = r'<div class="(?:col )?col\d">(?:<[^>]*>|&nbsp;)*([^<]*)'
-
- LONG_WAIT_PATTERN = r'<h1>You have to wait (\d+) (\w+) to download the next file\.</h1>'
-
-def getInfo(urls):
- for chunk in chunks(urls, 100): yield checkFile(UploadStationCom, chunk) \ No newline at end of file
+# -*- coding: utf-8 -*-
+from module.plugins.hoster.FileserveCom import FileserveCom, checkFile
+from module.plugins.Plugin import chunks
+
+
+class UploadStationCom(FileserveCom):
+ __name__ = "UploadStationCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?uploadstation\.com/file/(?P<id>[A-Za-z0-9]+)"
+ __version__ = "0.51"
+ __description__ = """UploadStation.Com File Download Hoster"""
+ __author_name__ = ("fragonib", "zoidberg")
+ __author_mail__ = ("fragonib[AT]yahoo[DOT]es", "zoidberg@mujmail.cz")
+
+ URLS = ['http://www.uploadstation.com/file/', 'http://www.uploadstation.com/check-links.php',
+ 'http://www.uploadstation.com/checkReCaptcha.php']
+ LINKCHECK_TR = r'<div class="details (?:white|grey)">(.*?)\t{9}</div>'
+ LINKCHECK_TD = r'<div class="(?:col )?col\d">(?:<[^>]*>|&nbsp;)*([^<]*)'
+
+ LONG_WAIT_PATTERN = r'<h1>You have to wait (\d+) (\w+) to download the next file\.</h1>'
+
+
+def getInfo(urls):
+ for chunk in chunks(urls, 100):
+ yield checkFile(UploadStationCom, chunk)
diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py
index 21a9812ab..6ac3320c0 100644
--- a/module/plugins/hoster/UploadedTo.py
+++ b/module/plugins/hoster/UploadedTo.py
@@ -12,7 +12,7 @@ from module.utils import html_unescape, parseFileSize
from module.plugins.Hoster import Hoster
from module.network.RequestFactory import getURL
from module.plugins.Plugin import chunks
-from module.plugins.ReCaptcha import ReCaptcha
+from module.plugins.internal.CaptchaService import ReCaptcha
key = "bGhGMkllZXByd2VEZnU5Y2NXbHhYVlZ5cEE1bkEzRUw=".decode('base64')
@@ -52,7 +52,8 @@ def getAPIData(urls):
def parseFileInfo(self, url='', html=''):
- if not html and hasattr(self, "html"): html = self.html
+ if not html and hasattr(self, "html"):
+ html = self.html
name, size, status, found, fileid = url, 0, 3, None, None
if re.search(self.FILE_OFFLINE_PATTERN, html):
@@ -88,10 +89,11 @@ class UploadedTo(Hoster):
__name__ = "UploadedTo"
__type__ = "hoster"
__pattern__ = r"https?://[\w\.-]*?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P<ID>\w+)"
- __version__ = "0.70"
+ __version__ = "0.71"
__description__ = """Uploaded.net Download Hoster"""
__author_name__ = ("spoob", "mkaay", "zoidberg", "netpok", "stickell")
- __author_mail__ = ("spoob@pyload.org", "mkaay@mkaay.de", "zoidberg@mujmail.cz", "netpok@gmail.com", "l.stickell@yahoo.it")
+ __author_mail__ = ("spoob@pyload.org", "mkaay@mkaay.de", "zoidberg@mujmail.cz",
+ "netpok@gmail.com", "l.stickell@yahoo.it")
FILE_INFO_PATTERN = r'<a href="file/(?P<ID>\w+)" id="filename">(?P<N>[^<]+)</a> &nbsp;\s*<small[^>]*>(?P<S>[^<]+)</small>'
FILE_OFFLINE_PATTERN = r'<small class="cL">Error: 404</small>'
@@ -151,13 +153,12 @@ class UploadedTo(Hoster):
else:
self.handleFree()
-
def handlePremium(self):
info = self.account.getAccountInfo(self.user, True)
- self.log.debug("%(name)s: Use Premium Account (%(left)sGB left)" % {"name": self.__name__,
- "left": info["trafficleft"] / 1024 / 1024})
+ self.logDebug("%(name)s: Use Premium Account (%(left)sGB left)" % {"name": self.__name__,
+ "left": info["trafficleft"] / 1024 / 1024})
if int(self.data[1]) / 1024 > info["trafficleft"]:
- self.log.info(_("%s: Not enough traffic left" % self.__name__))
+ self.logInfo(_("%s: Not enough traffic left" % self.__name__))
self.account.empty(self.user)
self.resetAccount()
self.fail(_("Traffic exceeded"))
diff --git a/module/plugins/hoster/UploadheroCom.py b/module/plugins/hoster/UploadheroCom.py
index a2348b9f9..79bca748e 100644
--- a/module/plugins/hoster/UploadheroCom.py
+++ b/module/plugins/hoster/UploadheroCom.py
@@ -22,11 +22,12 @@
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
class UploadheroCom(SimpleHoster):
__name__ = "UploadheroCom"
__type__ = "hoster"
__pattern__ = r"http://(?:www\.)?uploadhero\.com?/dl/\w+"
- __version__ = "0.13"
+ __version__ = "0.14"
__description__ = """UploadHero.com plugin"""
__author_name__ = ("mcmyst", "zoidberg")
__author_mail__ = ("mcmyst@hotmail.fr", "zoidberg@mujmail.cz")
@@ -35,26 +36,27 @@ class UploadheroCom(SimpleHoster):
FILE_NAME_PATTERN = r'<div class="nom_de_fichier">(?P<N>.*?)</div>'
FILE_SIZE_PATTERN = r'Taille du fichier : </span><strong>(?P<S>.*?)</strong>'
FILE_OFFLINE_PATTERN = r'<p class="titre_dl_2">|<div class="raison"><strong>Le lien du fichier ci-dessus n\'existe plus.'
-
+
DOWNLOAD_URL_PATTERN = r'<a href="([^"]+)" id="downloadnow"'
-
+
IP_BLOCKED_PATTERN = r'href="(/lightbox_block_download.php\?min=.*?)"'
IP_WAIT_PATTERN = r'<span id="minutes">(\d+)</span>.*\s*<span id="seconds">(\d+)</span>'
CAPTCHA_PATTERN = r'"(/captchadl\.php\?[a-z0-9]+)"'
FREE_URL_PATTERN = r'var magicomfg = \'<a href="(http://[^<>"]*?)"|"(http://storage\d+\.uploadhero\.com/\?d=[A-Za-z0-9]+/[^<>"/]+)"'
-
+
def handleFree(self):
- self.checkErrors()
-
+ self.checkErrors()
+
found = re.search(self.CAPTCHA_PATTERN, self.html)
- if not found: self.parseError("Captcha URL")
+ if not found:
+ self.parseError("Captcha URL")
captcha_url = "http://uploadhero.com" + found.group(1)
-
+
for i in range(5):
- captcha = self.decryptCaptcha(captcha_url)
- self.html = self.load(self.pyfile.url, get = {"code": captcha})
- found = re.search(self.FREE_URL_PATTERN, self.html)
+ captcha = self.decryptCaptcha(captcha_url)
+ self.html = self.load(self.pyfile.url, get={"code": captcha})
+ found = re.search(self.FREE_URL_PATTERN, self.html)
if found:
self.correctCaptcha()
download_url = found.group(1) or found.group(2)
@@ -62,26 +64,27 @@ class UploadheroCom(SimpleHoster):
else:
self.invalidCaptcha()
else:
- self.fail("No valid captcha code entered")
-
+ self.fail("No valid captcha code entered")
+
self.download(download_url)
-
+
def handlePremium(self):
- self.log.debug("%s: Use Premium Account" % self.__name__)
+ self.logDebug("%s: Use Premium Account" % self.__name__)
self.html = self.load(self.pyfile.url)
link = re.search(self.DOWNLOAD_URL_PATTERN, self.html).group(1)
- self.log.debug("Downloading link : '%s'" % link)
- self.download(link)
-
+ self.logDebug("Downloading link : '%s'" % link)
+ self.download(link)
+
def checkErrors(self):
found = re.search(self.IP_BLOCKED_PATTERN, self.html)
if found:
self.html = self.load("http://uploadhero.com%s" % found.group(1))
-
+
found = re.search(self.IP_WAIT_PATTERN, self.html)
wait_time = (int(found.group(1)) * 60 + int(found.group(2))) if found else 300
self.setWait(wait_time, True)
self.wait()
self.retry()
-
+
+
getInfo = create_getInfo(UploadheroCom)
diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py
index 4a157a787..1da571460 100644
--- a/module/plugins/hoster/UploadingCom.py
+++ b/module/plugins/hoster/UploadingCom.py
@@ -1,110 +1,113 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-"""
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License,
- or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>.
-
- @author: jeix
-"""
-
-import re
-from pycurl import HTTPHEADER
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp
-from module.common.json_layer import json_loads
-
-class UploadingCom(SimpleHoster):
- __name__ = "UploadingCom"
- __type__ = "hoster"
- __pattern__ = r"http://(?:www\.)?uploading\.com/files/(?:get/)?(?P<ID>[\w\d]+)"
- __version__ = "0.32"
- __description__ = """Uploading.Com File Download Hoster"""
- __author_name__ = ("jeix", "mkaay", "zoidberg")
- __author_mail__ = ("jeix@hasnomail.de", "mkaay@mkaay.de", "zoidberg@mujmail.cz")
-
- FILE_NAME_PATTERN = r'<title>Download (?P<N>.*?) for free on uploading.com</title>'
- FILE_SIZE_PATTERN = r'<span>File size: (?P<S>.*?)</span>'
- FILE_OFFLINE_PATTERN = r'<h2.*?>The requested file is not found</h2>'
-
- def process(self, pyfile):
- # set lang to english
- self.req.cj.setCookie("uploading.com", "lang", "1")
- self.req.cj.setCookie("uploading.com", "language", "1")
- self.req.cj.setCookie("uploading.com", "setlang", "en")
- self.req.cj.setCookie("uploading.com", "_lang", "en")
-
- if not "/get/" in self.pyfile.url:
- self.pyfile.url = self.pyfile.url.replace("/files", "/files/get")
-
- self.html = self.load(pyfile.url, decode = True)
- self.file_info = self.getFileInfo()
-
- if self.premium:
- self.handlePremium()
- else:
- self.handleFree()
-
- def handlePremium(self):
- postData = {'action': 'get_link',
- 'code': self.file_info['ID'],
- 'pass': 'undefined'}
-
- self.html = self.load('http://uploading.com/files/get/?JsHttpRequest=%d-xml' % timestamp(), post=postData)
- url = re.search(r'"link"\s*:\s*"(.*?)"', self.html)
- if url:
- url = url.group(1).replace("\\/", "/")
- self.download(url)
-
- raise Exception("Plugin defect.")
-
- def handleFree(self):
- found = re.search('<h2>((Daily )?Download Limit)</h2>', self.html)
- if found:
- self.pyfile.error = found.group(1)
- self.logWarning(self.pyfile.error)
- self.retry(max_tries=6, wait_time = 21600 if found.group(2) else 900, reason = self.pyfile.error)
-
- ajax_url = "http://uploading.com/files/get/?ajax"
- self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
- self.req.http.lastURL = self.pyfile.url
-
- response = json_loads(self.load(ajax_url, post = {'action': 'second_page', 'code': self.file_info['ID']}))
- if 'answer' in response and 'wait_time' in response['answer']:
- wait_time = int(response['answer']['wait_time'])
- self.log.info("%s: Waiting %d seconds." % (self.__name__, wait_time))
- self.setWait(wait_time)
- self.wait()
- else:
- self.pluginParseError("AJAX/WAIT")
-
- response = json_loads(self.load(ajax_url, post = {'action': 'get_link', 'code': self.file_info['ID'], 'pass': 'false'}))
- if 'answer' in response and 'link' in response['answer']:
- url = response['answer']['link']
- else:
- self.pluginParseError("AJAX/URL")
-
- self.html = self.load(url)
- found = re.search(r'<form id="file_form" action="(.*?)"', self.html)
- if found:
- url = found.group(1)
- else:
- self.pluginParseError("URL")
-
- self.download(url)
-
- check = self.checkDownload({"html" : re.compile("\A<!DOCTYPE html PUBLIC")})
- if check == "html":
- self.logWarning("Redirected to a HTML page, wait 10 minutes and retry")
- self.setWait(600, True)
- self.wait()
-
-getInfo = create_getInfo(UploadingCom) \ No newline at end of file
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: jeix
+"""
+
+import re
+from pycurl import HTTPHEADER
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp
+from module.common.json_layer import json_loads
+
+
+class UploadingCom(SimpleHoster):
+ __name__ = "UploadingCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?uploading\.com/files/(?:get/)?(?P<ID>[\w\d]+)"
+ __version__ = "0.33"
+ __description__ = """Uploading.Com File Download Hoster"""
+ __author_name__ = ("jeix", "mkaay", "zoidberg")
+ __author_mail__ = ("jeix@hasnomail.de", "mkaay@mkaay.de", "zoidberg@mujmail.cz")
+
+ FILE_NAME_PATTERN = r'<title>Download (?P<N>.*?) for free on uploading.com</title>'
+ FILE_SIZE_PATTERN = r'<span>File size: (?P<S>.*?)</span>'
+ FILE_OFFLINE_PATTERN = r'<h2.*?>The requested file is not found</h2>'
+
+ def process(self, pyfile):
+ # set lang to english
+ self.req.cj.setCookie("uploading.com", "lang", "1")
+ self.req.cj.setCookie("uploading.com", "language", "1")
+ self.req.cj.setCookie("uploading.com", "setlang", "en")
+ self.req.cj.setCookie("uploading.com", "_lang", "en")
+
+ if not "/get/" in self.pyfile.url:
+ self.pyfile.url = self.pyfile.url.replace("/files", "/files/get")
+
+ self.html = self.load(pyfile.url, decode=True)
+ self.file_info = self.getFileInfo()
+
+ if self.premium:
+ self.handlePremium()
+ else:
+ self.handleFree()
+
+ def handlePremium(self):
+ postData = {'action': 'get_link',
+ 'code': self.file_info['ID'],
+ 'pass': 'undefined'}
+
+ self.html = self.load('http://uploading.com/files/get/?JsHttpRequest=%d-xml' % timestamp(), post=postData)
+ url = re.search(r'"link"\s*:\s*"(.*?)"', self.html)
+ if url:
+ url = url.group(1).replace("\\/", "/")
+ self.download(url)
+
+ raise Exception("Plugin defect.")
+
+ def handleFree(self):
+ found = re.search('<h2>((Daily )?Download Limit)</h2>', self.html)
+ if found:
+ self.pyfile.error = found.group(1)
+ self.logWarning(self.pyfile.error)
+ self.retry(max_tries=6, wait_time=21600 if found.group(2) else 900, reason=self.pyfile.error)
+
+ ajax_url = "http://uploading.com/files/get/?ajax"
+ self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
+ self.req.http.lastURL = self.pyfile.url
+
+ response = json_loads(self.load(ajax_url, post={'action': 'second_page', 'code': self.file_info['ID']}))
+ if 'answer' in response and 'wait_time' in response['answer']:
+ wait_time = int(response['answer']['wait_time'])
+ self.logInfo("%s: Waiting %d seconds." % (self.__name__, wait_time))
+ self.setWait(wait_time)
+ self.wait()
+ else:
+ self.pluginParseError("AJAX/WAIT")
+
+ response = json_loads(
+ self.load(ajax_url, post={'action': 'get_link', 'code': self.file_info['ID'], 'pass': 'false'}))
+ if 'answer' in response and 'link' in response['answer']:
+ url = response['answer']['link']
+ else:
+ self.pluginParseError("AJAX/URL")
+
+ self.html = self.load(url)
+ found = re.search(r'<form id="file_form" action="(.*?)"', self.html)
+ if found:
+ url = found.group(1)
+ else:
+ self.pluginParseError("URL")
+
+ self.download(url)
+
+ check = self.checkDownload({"html": re.compile("\A<!DOCTYPE html PUBLIC")})
+ if check == "html":
+ self.logWarning("Redirected to a HTML page, wait 10 minutes and retry")
+ self.setWait(600, True)
+ self.wait()
+
+
+getInfo = create_getInfo(UploadingCom)
diff --git a/module/plugins/hoster/UptoboxCom.py b/module/plugins/hoster/UptoboxCom.py
index 60a93c1e5..e0d4ce7f4 100644
--- a/module/plugins/hoster/UptoboxCom.py
+++ b/module/plugins/hoster/UptoboxCom.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
class UptoboxCom(XFileSharingPro):
__name__ = "UptoboxCom"
__type__ = "hoster"
@@ -9,13 +10,14 @@ class UptoboxCom(XFileSharingPro):
__description__ = """Uptobox.com hoster plugin"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
-
+
FILE_INFO_PATTERN = r'<h2>\s*Download File\s*<span[^>]*>(?P<N>[^>]+)</span></h2>\s*[^\(]*\((?P<S>[^\)]+)\)</h2>'
FILE_OFFLINE_PATTERN = r'<center>File Not Found</center>'
HOSTER_NAME = "uptobox.com"
-
+
def setup(self):
- self.resumeDownload = self.multiDL = self.premium
+ self.resumeDownload = self.multiDL = self.premium
self.chunkLimit = 1
-getInfo = create_getInfo(UptoboxCom) \ No newline at end of file
+
+getInfo = create_getInfo(UptoboxCom)
diff --git a/module/plugins/hoster/VeehdCom.py b/module/plugins/hoster/VeehdCom.py
index d4422afc3..88bcb20ad 100644
--- a/module/plugins/hoster/VeehdCom.py
+++ b/module/plugins/hoster/VeehdCom.py
@@ -3,6 +3,7 @@
import re
from module.plugins.Hoster import Hoster
+
class VeehdCom(Hoster):
__name__ = 'VeehdCom'
__type__ = 'hoster'
@@ -11,14 +12,14 @@ class VeehdCom(Hoster):
('filename_spaces', 'bool', "Allow spaces in filename", 'False'),
('replacement_char', 'str', "Filename replacement character", '_'),
]
- __version__ = '0.21'
+ __version__ = '0.23'
__description__ = """Veehd.com Download Hoster"""
__author_name__ = ('cat')
__author_mail__ = ('cat@pyload')
-
+
def _debug(self, msg):
- self.log.debug('[%s] %s' % (self.__name__, msg))
-
+ self.logDebug('[%s] %s' % (self.__name__, msg))
+
def setup(self):
self.html = None
self.multiDL = True
@@ -28,51 +29,50 @@ class VeehdCom(Hoster):
self.download_html()
if not self.file_exists():
self.offline()
-
+
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 self.html is None:
self.download_html()
-
+
if '<title>Veehd</title>' in self.html:
return False
return True
-
+
def get_file_name(self):
if self.html is None:
self.download_html()
-
+
match = re.search(r'<title[^>]*>([^<]+) on Veehd</title>', self.html)
if not match:
self.fail("video title not found")
name = match.group(1)
-
+
# replace unwanted characters in filename
if self.getConfig('filename_spaces'):
pattern = '[^0-9A-Za-z\.\ ]+'
else:
pattern = '[^0-9A-Za-z\.]+'
-
+
name = re.sub(pattern, self.getConfig('replacement_char'),
- name)
+ name)
return name + '.avi'
def get_file_url(self):
""" returns the absolute downloadable filepath
- """
+ """
if self.html is None:
self.download_html()
- match = re.search(r'<embed type="video/divx" '
- r'src="(http://([^/]*\.)?veehd\.com/dl/[^"]+)"',
- self.html)
+ match = re.search(r'<embed type="video/divx" src="(http://([^/]*\.)?veehd\.com/dl/[^"]+)"',
+ self.html)
if not match:
self.fail("embedded video url not found")
file_url = match.group(1)
diff --git a/module/plugins/hoster/WarserverCz.py b/module/plugins/hoster/WarserverCz.py
index b256f8d1b..ee580fbdd 100644
--- a/module/plugins/hoster/WarserverCz.py
+++ b/module/plugins/hoster/WarserverCz.py
@@ -23,6 +23,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.network.HTTPRequest import BadHeader
from module.utils import html_unescape
+
class WarserverCz(SimpleHoster):
__name__ = "WarserverCz"
__type__ = "hoster"
@@ -30,41 +31,45 @@ class WarserverCz(SimpleHoster):
__version__ = "0.12"
__description__ = """Warserver.cz"""
__author_name__ = ("zoidberg")
-
+
FILE_NAME_PATTERN = r'<h1.*?>(?P<N>[^<]+)</h1>'
FILE_SIZE_PATTERN = r'<li>Velikost: <strong>(?P<S>[^<]+)</strong>'
FILE_OFFLINE_PATTERN = r'<h1>Soubor nenalezen</h1>'
-
+
PREMIUM_URL_PATTERN = r'href="(http://[^/]+/dwn-premium.php.*?)"'
DOMAIN = "http://csd01.coolshare.cz"
-
- DOMAIN = "http://s01.warserver.cz"
-
+
+ DOMAIN = "http://s01.warserver.cz"
+
def handleFree(self):
- try:
- self.download("%s/dwn-free.php?fid=%s" % (self.DOMAIN, self.file_info['ID']))
+ try:
+ self.download("%s/dwn-free.php?fid=%s" % (self.DOMAIN, self.file_info['ID']))
except BadHeader, e:
self.logError(e)
if e.code == 403:
- self.longWait(60,60)
- else: raise
+ self.longWait(60, 60)
+ else:
+ raise
self.checkDownloadedFile()
-
+
def handlePremium(self):
found = re.search(self.PREMIUM_URL_PATTERN, self.html)
- if not found: self.parseError("Premium URL")
+ if not found:
+ self.parseError("Premium URL")
url = html_unescape(found.group(1))
- self.logDebug("Premium URL: " + url)
- if not url.startswith("http://"): self.resetAccount()
+ self.logDebug("Premium URL: " + url)
+ if not url.startswith("http://"):
+ self.resetAccount()
self.download(url)
- self.checkDownloadedFile()
-
+ self.checkDownloadedFile()
+
def checkDownloadedFile(self):
check = self.checkDownload({
"offline": ">404 Not Found<"
- })
+ })
if check == "offline":
- self.offline()
+ self.offline()
+
-getInfo = create_getInfo(WarserverCz) \ No newline at end of file
+getInfo = create_getInfo(WarserverCz)
diff --git a/module/plugins/hoster/WebshareCz.py b/module/plugins/hoster/WebshareCz.py
index 195e65a93..10a8078c5 100644
--- a/module/plugins/hoster/WebshareCz.py
+++ b/module/plugins/hoster/WebshareCz.py
@@ -18,7 +18,7 @@
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-from module.network.HTTPRequest import BadHeader
+
class WebshareCz(SimpleHoster):
__name__ = "WebshareCz"
@@ -31,18 +31,19 @@ class WebshareCz(SimpleHoster):
FILE_NAME_PATTERN = r'<h3>Stahujete soubor: </h3>\s*<div class="textbox">(?P<N>[^<]+)</div>'
FILE_SIZE_PATTERN = r'<h3>Velikost souboru je: </h3>\s*<div class="textbox">(?P<S>[^<]+)</div>'
FILE_OFFLINE_PATTERN = r'<h3>Soubor ".*?" nebyl nalezen.</h3>'
-
+
DOWNLOAD_LINK_PATTERN = r'id="download_link" href="(?P<url>.*?)"'
-
+
def setup(self):
self.multiDL = True
def handleFree(self):
url_a = re.search(r"(var l.*)", self.html).group(1)
- url_b = re.search(r"(var keyStr.*)", self.html).group(1)
+ url_b = re.search(r"(var keyStr.*)", self.html).group(1)
url = self.js.eval("%s\n%s\ndec(l)" % (url_a, url_b))
-
+
self.logDebug('Download link: ' + url)
- self.download(url)
+ self.download(url)
+
-getInfo = create_getInfo(WebshareCz) \ No newline at end of file
+getInfo = create_getInfo(WebshareCz)
diff --git a/module/plugins/hoster/WrzucTo.py b/module/plugins/hoster/WrzucTo.py
index 4a5e89f22..861e7f11e 100644
--- a/module/plugins/hoster/WrzucTo.py
+++ b/module/plugins/hoster/WrzucTo.py
@@ -17,9 +17,11 @@
"""
import re
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from pycurl import HTTPHEADER
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
class WrzucTo(SimpleHoster):
__name__ = "WrzucTo"
__type__ = "hoster"
@@ -29,30 +31,32 @@ class WrzucTo(SimpleHoster):
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
- SH_COOKIES = [("http://www.wrzuc.to", "language", "en")]
+ SH_COOKIES = [("http://www.wrzuc.to", "language", "en")]
FILE_SIZE_PATTERN = r'class="info">\s*<tr>\s*<td>(?P<S>.*?)</td>'
FILE_NAME_PATTERN = r'id="file_info">\s*<strong>(?P<N>.*?)</strong>'
-
+
def setup(self):
- self.multiDL = True
-
+ self.multiDL = True
+
def handleFree(self):
data = dict(re.findall(r'(md5|file): "(.*?)"', self.html))
- if len(data) != 2: self.parseError('File ID')
-
+ if len(data) != 2:
+ self.parseError('File ID')
+
self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
self.req.http.lastURL = self.pyfile.url
- self.load("http://www.wrzuc.to/ajax/server/prepair", post = {"md5": data['md5']})
-
+ self.load("http://www.wrzuc.to/ajax/server/prepair", post={"md5": data['md5']})
+
self.req.http.lastURL = self.pyfile.url
- self.html = self.load("http://www.wrzuc.to/ajax/server/download_link", post = {"file": data['file']})
-
+ self.html = self.load("http://www.wrzuc.to/ajax/server/download_link", post={"file": data['file']})
+
data.update(re.findall(r'"(download_link|server_id)":"(.*?)"', self.html))
- if len(data) != 4: self.parseError('Download URL')
-
- download_url = "http://%s.wrzuc.to/pobierz/%s" % (data['server_id'], data['download_link'])
- self.logDebug("Download URL: %s" % download_url)
+ if len(data) != 4:
+ self.parseError('Download URL')
+
+ download_url = "http://%s.wrzuc.to/pobierz/%s" % (data['server_id'], data['download_link'])
+ self.logDebug("Download URL: %s" % download_url)
self.download(download_url)
-
-getInfo = create_getInfo(WrzucTo)
+
+getInfo = create_getInfo(WrzucTo)
diff --git a/module/plugins/hoster/WuploadCom.py b/module/plugins/hoster/WuploadCom.py
index 1a0eb442b..3dab1b1bb 100644
--- a/module/plugins/hoster/WuploadCom.py
+++ b/module/plugins/hoster/WuploadCom.py
@@ -6,7 +6,7 @@ import string
from urllib import unquote
from module.plugins.Hoster import Hoster
-from module.plugins.ReCaptcha import ReCaptcha
+from module.plugins.internal.CaptchaService import ReCaptcha
from module.plugins.Plugin import chunks
from module.network.RequestFactory import getURL
@@ -47,7 +47,7 @@ class WuploadCom(Hoster):
__name__ = "WuploadCom"
__type__ = "hoster"
__pattern__ = r"http://[\w\.]*?wupload\..*?/file/(([a-z][0-9]+/)?[0-9]+)(/.*)?"
- __version__ = "0.20"
+ __version__ = "0.21"
__description__ = """Wupload com"""
__author_name__ = ("jeix", "paulking")
__author_mail__ = ("jeix@hasnomail.de", "")
@@ -113,7 +113,7 @@ class WuploadCom(Hoster):
def getDomain(self):
result = json_loads(
self.load(self.API_ADDRESS + "/utility?method=getWuploadDomainForCurrentIp&format=json", decode=True))
- self.log.debug("%s: response to get domain %s" % (self.__name__, result))
+ self.logDebug("%s: response to get domain %s" % (self.__name__, result))
return result["FSApi_Utility"]["getWuploadDomainForCurrentIp"]["response"]
def downloadPremium(self):
diff --git a/module/plugins/hoster/X7To.py b/module/plugins/hoster/X7To.py
index 79adf2a3f..24d1643f3 100644
--- a/module/plugins/hoster/X7To.py
+++ b/module/plugins/hoster/X7To.py
@@ -1,93 +1,92 @@
-# -*- coding: utf-8 -*-
-import re
-
-from module.plugins.Hoster import Hoster
-
-from module.network.RequestFactory import getURL
-
-def getInfo(urls):
- yield [(url, 0, 1, url) for url in urls]
-
-
-class X7To(Hoster):
- __name__ = "X7To"
- __type__ = "hoster"
- __pattern__ = r"http://(?:www.)?x7.to/"
- __version__ = "0.3"
- __description__ = """X7.To File Download Hoster"""
- __author_name__ = ("ernieb")
- __author_mail__ = ("ernieb")
-
- FILE_INFO_PATTERN=r'<meta name="description" content="Download: (.*?) \(([0-9,.]+) (KB|MB|GB)\)'
-
- def init(self):
- if self.premium:
- self.multiDL = False
- self.resumeDownload = False
- self.chunkLimit = 1
- else:
- self.multiDL = False
-
- self.file_id = re.search(r"http://x7.to/([a-zA-Z0-9]+)", self.pyfile.url).group(1)
- self.logDebug("file id is %s" % self.file_id)
- self.pyfile.url = "http://x7.to/" + self.file_id
-
- def process(self, pyfile):
- self.fail("Hoster not longer available")
-
- def handlePremium(self):
- # check if over limit first
- overLimit = re.search(r'<a onClick="cUser.buyTraffic\(\)" id="DL">', self.html)
- if overLimit:
- self.logDebug("over limit, falling back to free")
- self.handleFree()
- else:
- realurl = re.search(r'<a href="(http://stor.*?)" id="DL">', self.html)
- if realurl:
- realurl = realurl.group(1)
- self.logDebug("premium url found %s" % realurl)
- else:
- self.logDebug("premium link not found")
- self.download(realurl)
-
- def handleFree(self):
- # find file id
- file_id = re.search(r"var dlID = '(.*?)'", self.html)
- if not file_id:
- self.fail("Free download id not found")
-
- file_url = "http://x7.to/james/ticket/dl/" + file_id.group(1)
- self.logDebug("download id %s" % file_id.group(1))
-
- self.html = self.load(file_url, ref=False, decode=True)
-
- # deal with errors
- if "limit-dl" in self.html:
- self.logDebug("Limit reached ... waiting")
- self.setWait(900,True)
- self.wait()
- self.retry()
-
- if "limit-parallel" in self.html:
- self.fail("Cannot download in parallel")
-
- # no waiting required, go to download
- waitCheck = re.search(r"wait:(\d*),", self.html)
- if waitCheck:
- waitCheck = int(waitCheck.group(1))
- self.setWait(waitCheck)
- self.wait()
-
- urlCheck = re.search(r"url:'(.*?)'", self.html)
- url = None
- if urlCheck:
- url = urlCheck.group(1)
- self.logDebug("free url found %s" % url)
-
- if url:
- try:
- self.download(url)
- except:
- self.logDebug("downloading url failed: %s" % url)
- else:
- self.fail("Free download url found")
+# -*- coding: utf-8 -*-
+import re
+
+from module.plugins.Hoster import Hoster
+
+
+def getInfo(urls):
+ yield [(url, 0, 1, url) for url in urls]
+
+
+class X7To(Hoster):
+ __name__ = "X7To"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www.)?x7.to/"
+ __version__ = "0.3"
+ __description__ = """X7.To File Download Hoster"""
+ __author_name__ = ("ernieb")
+ __author_mail__ = ("ernieb")
+
+ FILE_INFO_PATTERN = r'<meta name="description" content="Download: (.*?) \(([0-9,.]+) (KB|MB|GB)\)'
+
+ def init(self):
+ if self.premium:
+ self.multiDL = False
+ self.resumeDownload = False
+ self.chunkLimit = 1
+ else:
+ self.multiDL = False
+
+ self.file_id = re.search(r"http://x7.to/([a-zA-Z0-9]+)", self.pyfile.url).group(1)
+ self.logDebug("file id is %s" % self.file_id)
+ self.pyfile.url = "http://x7.to/" + self.file_id
+
+ def process(self, pyfile):
+ self.fail("Hoster not longer available")
+
+ def handlePremium(self):
+ # check if over limit first
+ overLimit = re.search(r'<a onClick="cUser.buyTraffic\(\)" id="DL">', self.html)
+ if overLimit:
+ self.logDebug("over limit, falling back to free")
+ self.handleFree()
+ else:
+ realurl = re.search(r'<a href="(http://stor.*?)" id="DL">', self.html)
+ if realurl:
+ realurl = realurl.group(1)
+ self.logDebug("premium url found %s" % realurl)
+ else:
+ self.logDebug("premium link not found")
+ self.download(realurl)
+
+ def handleFree(self):
+ # find file id
+ file_id = re.search(r"var dlID = '(.*?)'", self.html)
+ if not file_id:
+ self.fail("Free download id not found")
+
+ file_url = "http://x7.to/james/ticket/dl/" + file_id.group(1)
+ self.logDebug("download id %s" % file_id.group(1))
+
+ self.html = self.load(file_url, ref=False, decode=True)
+
+ # deal with errors
+ if "limit-dl" in self.html:
+ self.logDebug("Limit reached ... waiting")
+ self.setWait(900, True)
+ self.wait()
+ self.retry()
+
+ if "limit-parallel" in self.html:
+ self.fail("Cannot download in parallel")
+
+ # no waiting required, go to download
+ waitCheck = re.search(r"wait:(\d*),", self.html)
+ if waitCheck:
+ waitCheck = int(waitCheck.group(1))
+ self.setWait(waitCheck)
+ self.wait()
+
+ urlCheck = re.search(r"url:'(.*?)'", self.html)
+ url = None
+ if urlCheck:
+ url = urlCheck.group(1)
+ self.logDebug("free url found %s" % url)
+
+ if url:
+ try:
+ self.download(url)
+ except:
+ self.logDebug("downloading url failed: %s" % url)
+ else:
+ self.fail("Free download url found")
diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py
index 2103b0c20..9df843678 100644
--- a/module/plugins/hoster/XFileSharingPro.py
+++ b/module/plugins/hoster/XFileSharingPro.py
@@ -22,10 +22,10 @@ from urllib import unquote
from urlparse import urlparse
from pycurl import FOLLOWLOCATION, LOW_SPEED_TIME
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError
-from module.plugins.ReCaptcha import ReCaptcha
-from module.plugins.internal.CaptchaService import SolveMedia
+from module.plugins.internal.CaptchaService import ReCaptcha, SolveMedia
from module.utils import html_unescape
+
class XFileSharingPro(SimpleHoster):
"""
Common base for XFileSharingPro hosters like EasybytezCom, CramitIn, FiledinoCom...
@@ -74,7 +74,7 @@ class XFileSharingPro(SimpleHoster):
self.fail("Only premium users can download from other hosters with %s" % self.HOSTER_NAME)
else:
try:
- self.html = self.load(pyfile.url, cookies = False, decode = True)
+ self.html = self.load(pyfile.url, cookies=False, decode=True)
self.file_info = self.getFileInfo()
except PluginParseError:
self.file_info = None
@@ -82,7 +82,8 @@ class XFileSharingPro(SimpleHoster):
self.location = self.getDirectDownloadLink()
if not self.file_info:
- pyfile.name = html_unescape(unquote(urlparse(self.location if self.location else pyfile.url).path.split("/")[-1]))
+ pyfile.name = html_unescape(unquote(urlparse(
+ self.location if self.location else pyfile.url).path.split("/")[-1]))
if self.location:
self.startDownload(self.location)
@@ -106,12 +107,12 @@ class XFileSharingPro(SimpleHoster):
self.req.http.lastURL = self.pyfile.url
self.req.http.c.setopt(FOLLOWLOCATION, 0)
- self.html = self.load(self.pyfile.url, cookies = True, decode = True)
+ self.html = self.load(self.pyfile.url, cookies=True, decode=True)
self.header = self.req.http.header
self.req.http.c.setopt(FOLLOWLOCATION, 1)
location = None
- found = re.search("Location\s*:\s*(.*)", self.header, re.I)
+ found = re.search(r"Location\s*:\s*(.*)", self.header, re.I)
if found and re.match(self.DIRECT_LINK_PATTERN, found.group(1)):
location = found.group(1).strip()
@@ -128,11 +129,11 @@ class XFileSharingPro(SimpleHoster):
data = self.getPostParameters()
self.req.http.c.setopt(FOLLOWLOCATION, 0)
- self.html = self.load(self.pyfile.url, post = data, ref = True, decode = True)
+ self.html = self.load(self.pyfile.url, post=data, ref=True, decode=True)
self.header = self.req.http.header
self.req.http.c.setopt(FOLLOWLOCATION, 1)
- found = re.search("Location\s*:\s*(.*)", self.header, re.I)
+ found = re.search(r"Location\s*:\s*(.*)", self.header, re.I)
if found:
break
@@ -149,7 +150,7 @@ class XFileSharingPro(SimpleHoster):
return found.group(1)
def handlePremium(self):
- self.html = self.load(self.pyfile.url, post = self.getPostParameters())
+ self.html = self.load(self.pyfile.url, post=self.getPostParameters())
found = re.search(self.DIRECT_LINK_PATTERN, self.html)
if not found:
self.parseError('DIRECT LINK')
@@ -158,8 +159,8 @@ class XFileSharingPro(SimpleHoster):
def handleOverriden(self):
#only tested with easybytez.com
self.html = self.load("http://www.%s/" % self.HOSTER_NAME)
- action, inputs = self.parseHtmlForm('')
- upload_id = "%012d" % int(random()*10**12)
+ action, inputs = self.parseHtmlForm('')
+ upload_id = "%012d" % int(random() * 10 ** 12)
action += upload_id + "&js_on=1&utype=prem&upload_type=url"
inputs['tos'] = '1'
inputs['url_mass'] = self.pyfile.url
@@ -168,13 +169,14 @@ class XFileSharingPro(SimpleHoster):
self.logDebug(self.HOSTER_NAME, action, inputs)
#wait for file to upload to easybytez.com
self.req.http.c.setopt(LOW_SPEED_TIME, 600)
- self.html = self.load(action, post = inputs)
+ self.html = self.load(action, post=inputs)
action, inputs = self.parseHtmlForm('F1')
- if not inputs: self.parseError('TEXTAREA')
+ if not inputs:
+ self.parseError('TEXTAREA')
self.logDebug(self.HOSTER_NAME, inputs)
if inputs['st'] == 'OK':
- self.html = self.load(action, post = inputs)
+ self.html = self.load(action, post=inputs)
elif inputs['st'] == 'Can not leech file':
self.retry(max_tries=20, wait_time=180, reason=inputs['st'])
else:
@@ -182,7 +184,8 @@ class XFileSharingPro(SimpleHoster):
#get easybytez.com link for uploaded file
found = re.search(self.OVR_DOWNLOAD_LINK_PATTERN, self.html)
- if not found: self.parseError('DIRECT LINK (OVR)')
+ if not found:
+ self.parseError('DIRECT LINK (OVR)')
self.pyfile.url = found.group(1)
header = self.load(self.pyfile.url, just_header=True)
if 'location' in header: # Direct link
@@ -192,7 +195,8 @@ class XFileSharingPro(SimpleHoster):
def startDownload(self, link):
link = link.strip()
- if self.captcha: self.correctCaptcha()
+ if self.captcha:
+ self.correctCaptcha()
self.logDebug('DIRECT LINK: %s' % link)
self.download(link, disposition=True)
@@ -200,10 +204,11 @@ class XFileSharingPro(SimpleHoster):
found = re.search(self.ERROR_PATTERN, self.html)
if found:
self.errmsg = found.group(1)
- self.logWarning(re.sub(r"<.*?>"," ",self.errmsg))
+ self.logWarning(re.sub(r"<.*?>", " ", self.errmsg))
if 'wait' in self.errmsg:
- wait_time = sum([int(v) * {"hour": 3600, "minute": 60, "second": 1}[u] for v, u in re.findall('(\d+)\s*(hour|minute|second)?', self.errmsg)])
+ wait_time = sum([int(v) * {"hour": 3600, "minute": 60, "second": 1}[u] for v, u in
+ re.findall(r'(\d+)\s*(hour|minute|second)?', self.errmsg)])
self.setWait(wait_time, True)
self.wait()
elif 'captcha' in self.errmsg:
@@ -229,10 +234,11 @@ class XFileSharingPro(SimpleHoster):
return self.errmsg
def getPostParameters(self):
- for i in range(3):
- if not self.errmsg: self.checkErrors()
+ for _ in range(3):
+ if not self.errmsg:
+ self.checkErrors()
- if hasattr(self,"FORM_PATTERN"):
+ if hasattr(self, "FORM_PATTERN"):
action, inputs = self.parseHtmlForm(self.FORM_PATTERN)
else:
action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")})
@@ -264,7 +270,8 @@ class XFileSharingPro(SimpleHoster):
self.captcha = self.handleCaptcha(inputs)
- if wait_time: self.wait()
+ if wait_time:
+ self.wait()
self.errmsg = None
return inputs
@@ -274,15 +281,18 @@ class XFileSharingPro(SimpleHoster):
if self.premium:
inputs['method_premium'] = "Premium Download"
- if 'method_free' in inputs: del inputs['method_free']
+ if 'method_free' in inputs:
+ del inputs['method_free']
else:
inputs['method_free'] = "Free Download"
- if 'method_premium' in inputs: del inputs['method_premium']
+ if 'method_premium' in inputs:
+ del inputs['method_premium']
- self.html = self.load(self.pyfile.url, post = inputs, ref = True)
+ self.html = self.load(self.pyfile.url, post=inputs, ref=True)
self.errmsg = None
- else: self.parseError('FORM: %s' % (inputs['op'] if 'op' in inputs else 'UNKNOWN'))
+ else:
+ self.parseError('FORM: %s' % (inputs['op'] if 'op' in inputs else 'UNKNOWN'))
def handleCaptcha(self, inputs):
found = re.search(self.RECAPTCHA_URL_PATTERN, self.html)
@@ -303,8 +313,8 @@ class XFileSharingPro(SimpleHoster):
if found:
captcha_div = found.group(1)
self.logDebug(captcha_div)
- numerals = re.findall('<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div))
- inputs['code'] = "".join([a[1] for a in sorted(numerals, key = lambda num: int(num[0]))])
+ numerals = re.findall(r'<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div))
+ inputs['code'] = "".join([a[1] for a in sorted(numerals, key=lambda num: int(num[0]))])
self.logDebug("CAPTCHA", inputs['code'], numerals)
return 3
else:
@@ -316,4 +326,5 @@ class XFileSharingPro(SimpleHoster):
return 4
return 0
+
getInfo = create_getInfo(XFileSharingPro)
diff --git a/module/plugins/hoster/XHamsterCom.py b/module/plugins/hoster/XHamsterCom.py
index 866c5da45..cbdd818c7 100644
--- a/module/plugins/hoster/XHamsterCom.py
+++ b/module/plugins/hoster/XHamsterCom.py
@@ -2,17 +2,20 @@
# -*- coding: utf-8 -*-
import re
-from module.plugins.Hoster import Hoster
from urllib import unquote
+
+from module.plugins.Hoster import Hoster
from module.common.json_layer import json_loads
+
def clean_json(json_expr):
json_expr = re.sub('[\n\r]', '', json_expr)
json_expr = re.sub(' +', '', json_expr)
- json_expr = re.sub('\'','"', json_expr)
+ json_expr = re.sub('\'', '"', json_expr)
return json_expr
-
+
+
class XHamsterCom(Hoster):
__name__ = "XHamsterCom"
__type__ = "hoster"
@@ -23,16 +26,16 @@ class XHamsterCom(Hoster):
def setup(self):
self.html = None
-
+
def process(self, pyfile):
self.pyfile = pyfile
-
+
if not self.file_exists():
self.offline()
if self.getConfig("type"):
- self.desired_fmt = self.getConfig("type")
-
+ self.desired_fmt = self.getConfig("type")
+
self.pyfile.name = self.get_file_name() + self.desired_fmt
self.download(self.get_file_url())
@@ -45,32 +48,31 @@ class XHamsterCom(Hoster):
"""
if self.html is None:
self.download_html()
-
+
flashvar_pattern = re.compile('flashvars = ({.*?});', re.DOTALL)
- json_flashvar=flashvar_pattern.search(self.html)
+ json_flashvar = flashvar_pattern.search(self.html)
if json_flashvar is None:
self.fail("Parse error (flashvars)")
j = clean_json(json_flashvar.group(1))
flashvars = json_loads(j)
-
+
if flashvars["srv"]:
- srv_url = flashvars["srv"] + '/'
+ srv_url = flashvars["srv"] + '/'
else:
self.fail("Parse error (srv_url)")
-
+
if flashvars["url_mode"]:
- url_mode = flashvars["url_mode"]
+ url_mode = flashvars["url_mode"]
else:
self.fail("Parse error (url_mode)")
-
if self.desired_fmt == ".mp4":
file_url = re.search(r"<a href=\"" + srv_url + "(.+?)\"", self.html)
if file_url is None:
self.fail("Parse error (file_url)")
- file_url=file_url.group(1)
+ file_url = file_url.group(1)
long_url = srv_url + file_url
self.logDebug(_("long_url: %s") % long_url)
else:
@@ -79,15 +81,14 @@ class XHamsterCom(Hoster):
else:
self.fail("Parse error (file_url)")
- if url_mode=='3':
+ if url_mode == '3':
long_url = file_url
self.logDebug(_("long_url: %s") % long_url)
- else:
+ else:
long_url = srv_url + "key=" + file_url
self.logDebug(_("long_url: %s") % long_url)
-
+
return long_url
-
def get_file_name(self):
if self.html is None:
diff --git a/module/plugins/hoster/XVideosCom.py b/module/plugins/hoster/XVideosCom.py
index b7f3f7b58..48a1f934d 100644
--- a/module/plugins/hoster/XVideosCom.py
+++ b/module/plugins/hoster/XVideosCom.py
@@ -1,9 +1,9 @@
-
import re
import urllib
from module.plugins.Hoster import Hoster
+
class XVideosCom(Hoster):
__name__ = "XVideos.com"
__version__ = "0.1"
@@ -12,7 +12,7 @@ class XVideosCom(Hoster):
def process(self, pyfile):
site = self.load(pyfile.url)
- pyfile.name = "%s (%s).flv" %(
+ pyfile.name = "%s (%s).flv" % (
re.search(r"<h2>([^<]+)<span", site).group(1),
re.search(self.__pattern__, pyfile.url).group(1),
)
diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py
index 3e66b966a..bd8c6025a 100644
--- a/module/plugins/hoster/Xdcc.py
+++ b/module/plugins/hoster/Xdcc.py
@@ -1,229 +1,224 @@
-# -*- coding: utf-8 -*-
-
-"""
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License,
- or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>.
-
- @author: jeix
-"""
-
-from os.path import join
-from os.path import exists
-from os import makedirs
-import re
-import sys
-import time
-import socket, struct
-from select import select
-from module.utils import save_join
-
-from module.plugins.Hoster import Hoster
-
-
-class Xdcc(Hoster):
- __name__ = "Xdcc"
- __version__ = "0.31"
- __pattern__ = r'xdcc://.*?(/#?.*?)?/.*?/#?\d+/?' # xdcc://irc.Abjects.net/#channel/[XDCC]|Shit/#0004/
- __type__ = "hoster"
- __config__ = [
- ("nick", "str", "Nickname", "pyload"),
- ("ident", "str", "Ident", "pyloadident"),
- ("realname", "str", "Realname", "pyloadreal")
- ]
- __description__ = """A Plugin that allows you to download from an IRC XDCC bot"""
- __author_name__ = ("jeix")
- __author_mail__ = ("jeix@hasnomail.com")
-
- def setup(self):
- self.debug = 0 #0,1,2
- self.timeout = 30
- self.multiDL = False
-
-
-
- def process(self, pyfile):
- # change request type
- self.req = pyfile.m.core.requestFactory.getRequest(self.__name__, type="XDCC")
-
- self.pyfile = pyfile
- for i in range(0,3):
- try:
- nmn = self.doDownload(pyfile.url)
- self.log.debug("%s: Download of %s finished." % (self.__name__, nmn))
- return
- except socket.error, e:
- if hasattr(e, "errno"):
- errno = e.errno
- else:
- errno = e.args[0]
-
- if errno in (10054,):
- self.log.debug("XDCC: Server blocked our ip, retry in 5 min")
- self.setWait(300)
- self.wait()
- continue
-
- self.fail("Failed due to socket errors. Code: %d" % errno)
-
- self.fail("Server blocked our ip, retry again later manually")
-
-
- def doDownload(self, url):
- self.pyfile.setStatus("waiting") # real link
-
- download_folder = self.config['general']['download_folder']
- location = join(download_folder, self.pyfile.package().folder.decode(sys.getfilesystemencoding()))
- if not exists(location):
- makedirs(location)
-
- m = re.search(r'xdcc://(.*?)/#?(.*?)/(.*?)/#?(\d+)/?', url)
- server = m.group(1)
- chan = m.group(2)
- bot = m.group(3)
- pack = m.group(4)
- nick = self.getConfig('nick')
- ident = self.getConfig('ident')
- real = self.getConfig('realname')
-
- temp = server.split(':')
- ln = len(temp)
- if ln == 2:
- host, port = temp
- elif ln == 1:
- host, port = temp[0], 6667
- else:
- self.fail("Invalid hostname for IRC Server (%s)" % server)
-
-
- #######################
- # CONNECT TO IRC AND IDLE FOR REAL LINK
- dl_time = time.time()
-
- sock = socket.socket()
- sock.connect((host, int(port)))
- if nick == "pyload":
- nick = "pyload-%d" % (time.time() % 1000) # last 3 digits
- sock.send("NICK %s\r\n" % nick)
- sock.send("USER %s %s bla :%s\r\n" % (ident, host, real))
- time.sleep(3)
- sock.send("JOIN #%s\r\n" % chan)
- sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack))
-
- # IRC recv loop
- readbuffer = ""
- done = False
- retry = None
- m = None
- while True:
-
- # done is set if we got our real link
- if done:
- break
-
- if retry:
- if time.time() > retry:
- retry = None
- dl_time = time.time()
- sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack))
-
- else:
- if (dl_time + self.timeout) < time.time(): # todo: add in config
- sock.send("QUIT :byebye\r\n")
- sock.close()
- self.fail("XDCC Bot did not answer")
-
-
- fdset = select([sock], [], [], 0)
- if sock not in fdset[0]:
- continue
-
- readbuffer += sock.recv(1024)
- temp = readbuffer.split("\n")
- readbuffer = temp.pop()
-
- for line in temp:
- if self.debug is 2: print "*> " + unicode(line, errors='ignore')
- line = line.rstrip()
- first = line.split()
-
- if first[0] == "PING":
- sock.send("PONG %s\r\n" % first[1])
-
- if first[0] == "ERROR":
- self.fail("IRC-Error: %s" % line)
-
- msg = line.split(None, 3)
- if len(msg) != 4:
- continue
-
- msg = { \
- "origin":msg[0][1:], \
- "action":msg[1], \
- "target":msg[2], \
- "text" :msg[3][1:] \
- }
-
-
- if nick == msg["target"][0:len(nick)] and "PRIVMSG" == msg["action"]:
- if msg["text"] == "\x01VERSION\x01":
- self.log.debug("XDCC: Sending CTCP VERSION.")
- sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface"))
- elif msg["text"] == "\x01TIME\x01":
- self.log.debug("Sending CTCP TIME.")
- sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time()))
- elif msg["text"] == "\x01LAG\x01":
- pass # don't know how to answer
-
- if not (bot == msg["origin"][0:len(bot)]
- and nick == msg["target"][0:len(nick)]
- and msg["action"] in ("PRIVMSG", "NOTICE")):
- continue
-
- if self.debug is 1:
- print "%s: %s" % (msg["origin"], msg["text"])
-
- if "You already requested that pack" in msg["text"]:
- retry = time.time() + 300
-
- if "you must be on a known channel to request a pack" in msg["text"]:
- self.fail("Wrong channel")
-
- m = re.match('\x01DCC SEND (.*?) (\d+) (\d+)(?: (\d+))?\x01', msg["text"])
- if m:
- done = True
-
- # get connection data
- ip = socket.inet_ntoa(struct.pack('L', socket.ntohl(int(m.group(2)))))
- port = int(m.group(3))
- packname = m.group(1)
-
- if len(m.groups()) > 3:
- self.req.filesize = int(m.group(4))
-
- self.pyfile.name = packname
- filename = save_join(location, packname)
- self.log.info("XDCC: Downloading %s from %s:%d" % (packname, ip, port))
-
- self.pyfile.setStatus("downloading")
- newname = self.req.download(ip, port, filename, sock, self.pyfile.setProgress)
- if newname and newname != filename:
- self.log.info("%(name)s saved as %(newname)s" % {"name": self.pyfile.name, "newname": newname})
- filename = newname
-
- # kill IRC socket
- # sock.send("QUIT :byebye\r\n")
- sock.close()
-
- self.lastDownload = filename
- return self.lastDownload
-
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: jeix
+"""
+
+from os.path import join
+from os.path import exists
+from os import makedirs
+import re
+import sys
+import time
+import socket
+import struct
+from select import select
+
+from module.utils import save_join
+from module.plugins.Hoster import Hoster
+
+
+class Xdcc(Hoster):
+ __name__ = "Xdcc"
+ __version__ = "0.32"
+ __pattern__ = r'xdcc://.*?(/#?.*?)?/.*?/#?\d+/?' # xdcc://irc.Abjects.net/#channel/[XDCC]|Shit/#0004/
+ __type__ = "hoster"
+ __config__ = [
+ ("nick", "str", "Nickname", "pyload"),
+ ("ident", "str", "Ident", "pyloadident"),
+ ("realname", "str", "Realname", "pyloadreal")
+ ]
+ __description__ = """A Plugin that allows you to download from an IRC XDCC bot"""
+ __author_name__ = ("jeix")
+ __author_mail__ = ("jeix@hasnomail.com")
+
+ def setup(self):
+ self.debug = 0 # 0,1,2
+ self.timeout = 30
+ self.multiDL = False
+
+ def process(self, pyfile):
+ # change request type
+ self.req = pyfile.m.core.requestFactory.getRequest(self.__name__, type="XDCC")
+
+ self.pyfile = pyfile
+ for i in range(0, 3):
+ try:
+ nmn = self.doDownload(pyfile.url)
+ self.logDebug("%s: Download of %s finished." % (self.__name__, nmn))
+ return
+ except socket.error, e:
+ if hasattr(e, "errno"):
+ errno = e.errno
+ else:
+ errno = e.args[0]
+
+ if errno in (10054,):
+ self.logDebug("XDCC: Server blocked our ip, retry in 5 min")
+ self.setWait(300)
+ self.wait()
+ continue
+
+ self.fail("Failed due to socket errors. Code: %d" % errno)
+
+ self.fail("Server blocked our ip, retry again later manually")
+
+ def doDownload(self, url):
+ self.pyfile.setStatus("waiting") # real link
+
+ download_folder = self.config['general']['download_folder']
+ location = join(download_folder, self.pyfile.package().folder.decode(sys.getfilesystemencoding()))
+ if not exists(location):
+ makedirs(location)
+
+ m = re.search(r'xdcc://(.*?)/#?(.*?)/(.*?)/#?(\d+)/?', url)
+ server = m.group(1)
+ chan = m.group(2)
+ bot = m.group(3)
+ pack = m.group(4)
+ nick = self.getConfig('nick')
+ ident = self.getConfig('ident')
+ real = self.getConfig('realname')
+
+ temp = server.split(':')
+ ln = len(temp)
+ if ln == 2:
+ host, port = temp
+ elif ln == 1:
+ host, port = temp[0], 6667
+ else:
+ self.fail("Invalid hostname for IRC Server (%s)" % server)
+
+ #######################
+ # CONNECT TO IRC AND IDLE FOR REAL LINK
+ dl_time = time.time()
+
+ sock = socket.socket()
+ sock.connect((host, int(port)))
+ if nick == "pyload":
+ nick = "pyload-%d" % (time.time() % 1000) # last 3 digits
+ sock.send("NICK %s\r\n" % nick)
+ sock.send("USER %s %s bla :%s\r\n" % (ident, host, real))
+ time.sleep(3)
+ sock.send("JOIN #%s\r\n" % chan)
+ sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack))
+
+ # IRC recv loop
+ readbuffer = ""
+ done = False
+ retry = None
+ m = None
+ while True:
+
+ # done is set if we got our real link
+ if done:
+ break
+
+ if retry:
+ if time.time() > retry:
+ retry = None
+ dl_time = time.time()
+ sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack))
+
+ else:
+ if (dl_time + self.timeout) < time.time(): # todo: add in config
+ sock.send("QUIT :byebye\r\n")
+ sock.close()
+ self.fail("XDCC Bot did not answer")
+
+ fdset = select([sock], [], [], 0)
+ if sock not in fdset[0]:
+ continue
+
+ readbuffer += sock.recv(1024)
+ temp = readbuffer.split("\n")
+ readbuffer = temp.pop()
+
+ for line in temp:
+ if self.debug is 2:
+ print "*> " + unicode(line, errors='ignore')
+ line = line.rstrip()
+ first = line.split()
+
+ if first[0] == "PING":
+ sock.send("PONG %s\r\n" % first[1])
+
+ if first[0] == "ERROR":
+ self.fail("IRC-Error: %s" % line)
+
+ msg = line.split(None, 3)
+ if len(msg) != 4:
+ continue
+
+ msg = {
+ "origin": msg[0][1:],
+ "action": msg[1],
+ "target": msg[2],
+ "text": msg[3][1:]
+ }
+
+ if nick == msg["target"][0:len(nick)] and "PRIVMSG" == msg["action"]:
+ if msg["text"] == "\x01VERSION\x01":
+ self.logDebug("XDCC: Sending CTCP VERSION.")
+ sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface"))
+ elif msg["text"] == "\x01TIME\x01":
+ self.logDebug("Sending CTCP TIME.")
+ sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time()))
+ elif msg["text"] == "\x01LAG\x01":
+ pass # don't know how to answer
+
+ if not (bot == msg["origin"][0:len(bot)]
+ and nick == msg["target"][0:len(nick)]
+ and msg["action"] in ("PRIVMSG", "NOTICE")):
+ continue
+
+ if self.debug is 1:
+ print "%s: %s" % (msg["origin"], msg["text"])
+
+ if "You already requested that pack" in msg["text"]:
+ retry = time.time() + 300
+
+ if "you must be on a known channel to request a pack" in msg["text"]:
+ self.fail("Wrong channel")
+
+ m = re.match('\x01DCC SEND (.*?) (\d+) (\d+)(?: (\d+))?\x01', msg["text"])
+ if m:
+ done = True
+
+ # get connection data
+ ip = socket.inet_ntoa(struct.pack('L', socket.ntohl(int(m.group(2)))))
+ port = int(m.group(3))
+ packname = m.group(1)
+
+ if len(m.groups()) > 3:
+ self.req.filesize = int(m.group(4))
+
+ self.pyfile.name = packname
+ filename = save_join(location, packname)
+ self.logInfo("XDCC: Downloading %s from %s:%d" % (packname, ip, port))
+
+ self.pyfile.setStatus("downloading")
+ newname = self.req.download(ip, port, filename, sock, self.pyfile.setProgress)
+ if newname and newname != filename:
+ self.logInfo("%(name)s saved as %(newname)s" % {"name": self.pyfile.name, "newname": newname})
+ filename = newname
+
+ # kill IRC socket
+ # sock.send("QUIT :byebye\r\n")
+ sock.close()
+
+ self.lastDownload = filename
+ return self.lastDownload
diff --git a/module/plugins/hoster/YibaishiwuCom.py b/module/plugins/hoster/YibaishiwuCom.py
index 901225944..37eaa17e5 100644
--- a/module/plugins/hoster/YibaishiwuCom.py
+++ b/module/plugins/hoster/YibaishiwuCom.py
@@ -20,6 +20,7 @@ import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.common.json_layer import json_loads
+
class YibaishiwuCom(SimpleHoster):
__name__ = "YibaishiwuCom"
__type__ = "hoster"
@@ -31,24 +32,27 @@ class YibaishiwuCom(SimpleHoster):
FILE_NAME_PATTERN = r"file_name: '(?P<N>[^']+)'"
FILE_SIZE_PATTERN = r"file_size: '(?P<S>[^']+)'"
FILE_OFFLINE_PATTERN = ur'<h3><i style="color:red;">哎呀!提取码不存在!不妨搜搜看吧!</i></h3>'
-
- AJAX_URL_PATTERN = r'(/\?ct=(pickcode|download)[^"\']+)'
-
+
+ AJAX_URL_PATTERN = r'(/\?ct=(pickcode|download)[^"\']+)'
+
def handleFree(self):
found = re.search(self.AJAX_URL_PATTERN, self.html)
- if not found: self.parseError("AJAX URL")
+ if not found:
+ self.parseError("AJAX URL")
url = found.group(1)
self.logDebug(('FREEUSER' if found.group(2) == 'download' else 'GUEST') + ' URL', url)
-
- response = json_loads(self.load("http://115.com" + url, decode = False))
- for mirror in (response['urls'] if 'urls' in response else response['data'] if 'data' in response else []):
+
+ response = json_loads(self.load("http://115.com" + url, decode=False))
+ for mirror in (response['urls'] if 'urls' in response else response['data'] if 'data' in response else []):
try:
- url = mirror['url'].replace('\\','')
+ url = mirror['url'].replace('\\', '')
self.logDebug("Trying URL: " + url)
self.download(url)
break
except:
continue
- else: self.fail('No working link found')
+ else:
+ self.fail('No working link found')
+
getInfo = create_getInfo(YibaishiwuCom)
diff --git a/module/plugins/hoster/YoupornCom.py b/module/plugins/hoster/YoupornCom.py
index b17a4ef80..d029db7ba 100644
--- a/module/plugins/hoster/YoupornCom.py
+++ b/module/plugins/hoster/YoupornCom.py
@@ -4,6 +4,7 @@
import re
from module.plugins.Hoster import Hoster
+
class YoupornCom(Hoster):
__name__ = "YoupornCom"
__type__ = "hoster"
@@ -15,19 +16,19 @@ class YoupornCom(Hoster):
def setup(self):
self.html = None
-
+
def process(self, pyfile):
self.pyfile = pyfile
-
+
if not self.file_exists():
self.offline()
-
+
self.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)
+ self.html = self.load(url, post={"user_choice": "Enter"}, cookies=False)
def get_file_url(self):
""" returns the absolute downloadable filepath
@@ -43,7 +44,7 @@ class YoupornCom(Hoster):
self.download_html()
file_name_pattern = r"<title>(.*) - Free Porn Videos - YouPorn</title>"
- return re.search(file_name_pattern, self.html).group(1).replace("&amp;", "&").replace("/","") + '.flv'
+ return re.search(file_name_pattern, self.html).group(1).replace("&amp;", "&").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 b67ccb68d..8c0784205 100644
--- a/module/plugins/hoster/YourfilesTo.py
+++ b/module/plugins/hoster/YourfilesTo.py
@@ -1,83 +1,81 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import re
-import urllib
-from module.plugins.Hoster import Hoster
-
-class YourfilesTo(Hoster):
- __name__ = "YourfilesTo"
- __type__ = "hoster"
- __pattern__ = r"(http://)?(www\.)?yourfiles\.(to|biz)/\?d=[a-zA-Z0-9]+"
- __version__ = "0.2"
- __description__ = """Youfiles.to Download Hoster"""
- __author_name__ = ("jeix", "skydancer")
- __author_mail__ = ("jeix@hasnomail.de", "skydancer@hasnomail.de")
-
- def setup(self):
- self.html = None
- self.multiDL = True
-
- def process(self,pyfile):
- self.pyfile = pyfile
- self.prepare()
- self.download(self.get_file_url())
-
- def prepare(self):
- if not self.file_exists():
- self.offline()
-
- self.pyfile.name = self.get_file_name()
-
- wait_time = self.get_waiting_time()
- self.setWait(wait_time)
- self.log.debug("%s: Waiting %d seconds." % (self.__name__,wait_time))
- self.wait()
-
- def get_waiting_time(self):
- if self.html is None:
- self.download_html()
-
- #var zzipitime = 15;
- m = re.search(r'var zzipitime = (\d+);', self.html)
- if m:
- sec = int(m.group(1))
- else:
- sec = 0
-
- 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
- """
- url = re.search(r"var bla = '(.*?)';", self.html)
- if url:
- url = url.group(1)
- url = urllib.unquote(url.replace("http://http:/http://", "http://").replace("dumdidum", ""))
- return url
- else:
- self.fail("absolute filepath could not be found. offline? ")
-
- def get_file_name(self):
- if self.html is None:
- self.download_html()
-
- return re.search("<title>(.*)</title>", self.html).group(1)
-
- def file_exists(self):
- """ returns True or False
- """
- if self.html is None:
- self.download_html()
-
- if re.search(r"HTTP Status 404", self.html) is not None:
- return False
- else:
- return True
-
-
-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+import urllib
+from module.plugins.Hoster import Hoster
+
+
+class YourfilesTo(Hoster):
+ __name__ = "YourfilesTo"
+ __type__ = "hoster"
+ __pattern__ = r"(http://)?(www\.)?yourfiles\.(to|biz)/\?d=[a-zA-Z0-9]+"
+ __version__ = "0.21"
+ __description__ = """Youfiles.to Download Hoster"""
+ __author_name__ = ("jeix", "skydancer")
+ __author_mail__ = ("jeix@hasnomail.de", "skydancer@hasnomail.de")
+
+ def setup(self):
+ self.html = None
+ self.multiDL = True
+
+ def process(self, pyfile):
+ self.pyfile = pyfile
+ self.prepare()
+ self.download(self.get_file_url())
+
+ def prepare(self):
+ if not self.file_exists():
+ self.offline()
+
+ self.pyfile.name = self.get_file_name()
+
+ wait_time = self.get_waiting_time()
+ self.setWait(wait_time)
+ self.logDebug("%s: Waiting %d seconds." % (self.__name__, wait_time))
+ self.wait()
+
+ def get_waiting_time(self):
+ if self.html is None:
+ self.download_html()
+
+ #var zzipitime = 15;
+ m = re.search(r'var zzipitime = (\d+);', self.html)
+ if m:
+ sec = int(m.group(1))
+ else:
+ sec = 0
+
+ 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
+ """
+ url = re.search(r"var bla = '(.*?)';", self.html)
+ if url:
+ url = url.group(1)
+ url = urllib.unquote(url.replace("http://http:/http://", "http://").replace("dumdidum", ""))
+ return url
+ else:
+ self.fail("absolute filepath could not be found. offline? ")
+
+ def get_file_name(self):
+ if self.html is None:
+ self.download_html()
+
+ return re.search("<title>(.*)</title>", self.html).group(1)
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html is None:
+ self.download_html()
+
+ if re.search(r"HTTP Status 404", self.html) is not None:
+ return False
+ else:
+ return True
diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py
index 129b948bf..1db5fc0a4 100644
--- a/module/plugins/hoster/YoutubeCom.py
+++ b/module/plugins/hoster/YoutubeCom.py
@@ -10,10 +10,12 @@ from urllib import unquote
from module.utils import html_unescape
from module.plugins.Hoster import Hoster
+
def which(program):
"""Works exactly like the unix command which
Courtesy of http://stackoverflow.com/a/377028/675646"""
+
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
@@ -30,45 +32,45 @@ def which(program):
return None
+
class YoutubeCom(Hoster):
__name__ = "YoutubeCom"
__type__ = "hoster"
__pattern__ = r"https?://(?:[^/]*?)youtube\.com/watch.*?[?&]v=.*"
__version__ = "0.34"
__config__ = [("quality", "sd;hd;fullhd;240p;360p;480p;720p;1080p;3072p", "Quality Setting", "hd"),
- ("fmt", "int", "FMT/ITAG Number (5-102, 0 for auto)", 0),
- (".mp4", "bool", "Allow .mp4", True),
- (".flv", "bool", "Allow .flv", True),
- (".webm", "bool", "Allow .webm", False),
- (".3gp", "bool", "Allow .3gp", False),
- ("3d", "bool", "Prefer 3D", False)]
+ ("fmt", "int", "FMT/ITAG Number (5-102, 0 for auto)", 0),
+ (".mp4", "bool", "Allow .mp4", True),
+ (".flv", "bool", "Allow .flv", True),
+ (".webm", "bool", "Allow .webm", False),
+ (".3gp", "bool", "Allow .3gp", False),
+ ("3d", "bool", "Prefer 3D", False)]
__description__ = """Youtube.com Video Download Hoster"""
__author_name__ = ("spoob", "zoidberg")
__author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz")
# name, width, height, quality ranking, 3D
formats = {5: (".flv", 400, 240, 1, False),
- 6: (".flv", 640, 400, 4, False),
+ 6: (".flv", 640, 400, 4, False),
17: (".3gp", 176, 144, 0, False),
18: (".mp4", 480, 360, 2, False),
22: (".mp4", 1280, 720, 8, False),
43: (".webm", 640, 360, 3, False),
34: (".flv", 640, 360, 4, False),
35: (".flv", 854, 480, 6, False),
- 36: (".3gp", 400, 240, 1, False),
+ 36: (".3gp", 400, 240, 1, False),
37: (".mp4", 1920, 1080, 9, False),
38: (".mp4", 4096, 3072, 10, False),
44: (".webm", 854, 480, 5, False),
45: (".webm", 1280, 720, 7, False),
- 46: (".webm", 1920, 1080, 9, False),
- 82: (".mp4", 640, 360, 3, True),
- 83: (".mp4", 400, 240, 1, True),
- 84: (".mp4", 1280, 720, 8, True),
- 85: (".mp4", 1920, 1080, 9, True),
- 100: (".webm", 640, 360, 3, True),
- 101: (".webm", 640, 360, 4, True),
- 102: (".webm", 1280, 720, 8, True)
- }
+ 46: (".webm", 1920, 1080, 9, False),
+ 82: (".mp4", 640, 360, 3, True),
+ 83: (".mp4", 400, 240, 1, True),
+ 84: (".mp4", 1280, 720, 8, True),
+ 85: (".mp4", 1920, 1080, 9, True),
+ 100: (".webm", 640, 360, 3, True),
+ 101: (".webm", 640, 360, 4, True),
+ 102: (".webm", 1280, 720, 8, True)}
def setup(self):
self.resumeDownload = self.multiDL = True
@@ -85,9 +87,11 @@ class YoutubeCom(Hoster):
#get config
use3d = self.getConfig("3d")
if use3d:
- quality = {"sd":82,"hd":84,"fullhd":85,"240p":83,"360p":82,"480p":82,"720p":84,"1080p":85,"3072p":85}
+ quality = {"sd": 82, "hd": 84, "fullhd": 85, "240p": 83, "360p": 82,
+ "480p": 82, "720p": 84, "1080p": 85, "3072p": 85}
else:
- quality = {"sd":18,"hd":22,"fullhd":37,"240p":5,"360p":18,"480p":35,"720p":22,"1080p":37,"3072p":38}
+ quality = {"sd": 18, "hd": 22, "fullhd": 37, "240p": 5, "360p": 18,
+ "480p": 35, "720p": 22, "1080p": 37, "3072p": 38}
desired_fmt = self.getConfig("fmt")
if desired_fmt and desired_fmt not in self.formats:
self.logWarning("FMT %d unknown - using default." % desired_fmt)
@@ -98,7 +102,7 @@ class YoutubeCom(Hoster):
#parse available streams
streams = re.search(r'"url_encoded_fmt_stream_map": "(.*?)",', html).group(1)
streams = [x.split('\u0026') for x in streams.split(',')]
- streams = [dict((y.split('=',1)) for y in x) for x in streams]
+ streams = [dict((y.split('=', 1)) for y in x) for x in streams]
streams = [(int(x['itag']), "%s&signature=%s" % (unquote(x['url']), x['sig'])) for x in streams]
#self.logDebug("Found links: %s" % streams)
self.logDebug("AVAILABLE STREAMS: %s" % [x[0] for x in streams])
@@ -111,22 +115,19 @@ class YoutubeCom(Hoster):
fmt_dict = dict([x for x in streams if self.formats[x[0]][4] == use3d] or streams)
self.logDebug("DESIRED STREAM: ITAG:%d (%s) %sfound, %sallowed" %
- (desired_fmt,
- "%s %dx%d Q:%d 3D:%s" % self.formats[desired_fmt],
- "" if desired_fmt in fmt_dict else "NOT ",
- "" if allowed(desired_fmt) else "NOT ")
- )
+ (desired_fmt, "%s %dx%d Q:%d 3D:%s" % self.formats[desired_fmt],
+ "" if desired_fmt in fmt_dict else "NOT ", "" if allowed(desired_fmt) else "NOT "))
#return fmt nearest to quality index
if desired_fmt in fmt_dict and allowed(desired_fmt):
fmt = desired_fmt
else:
- sel = lambda x: self.formats[x][3] #select quality index
+ sel = lambda x: self.formats[x][3] # select quality index
comp = lambda x, y: abs(sel(x) - sel(y))
self.logDebug("Choosing nearest fmt: %s" % [(x, allowed(x), comp(x, desired_fmt)) for x in fmt_dict.keys()])
fmt = reduce(lambda x, y: x if comp(x, desired_fmt) <= comp(y, desired_fmt) and
- sel(x) > sel(y) else y, fmt_dict.keys())
+ sel(x) > sel(y) else y, fmt_dict.keys())
self.logDebug("Chosen fmt: %s" % fmt)
url = fmt_dict[fmt]
diff --git a/module/plugins/hoster/ZDF.py b/module/plugins/hoster/ZDF.py
index ea45f4fd8..9940fd078 100644
--- a/module/plugins/hoster/ZDF.py
+++ b/module/plugins/hoster/ZDF.py
@@ -1,4 +1,3 @@
-
import re
from xml.etree.ElementTree import fromstring
@@ -6,6 +5,7 @@ from module.plugins.Hoster import Hoster
XML_API = "http://www.zdf.de/ZDFmediathek/xmlservice/web/beitragsDetails?id=%i"
+
class ZDF(Hoster):
# Based on zdfm by Roland Beermann
# http://github.com/enkore/zdfm/
@@ -23,7 +23,7 @@ class ZDF(Hoster):
@staticmethod
def video_valid(video):
- return (video.findtext("url").startswith("http") and video.findtext("url").endswith(".mp4"))
+ return video.findtext("url").startswith("http") and video.findtext("url").endswith(".mp4")
@staticmethod
def get_id(url):
@@ -40,7 +40,8 @@ class ZDF(Hoster):
title = video.findtext("information/title")
pyfile.name = title
-
- target_url = sorted((v for v in video.iter("formitaet") if self.video_valid(v)), key=self.video_key)[-1].findtext("url")
+
+ target_url = sorted((v for v in video.iter("formitaet") if self.video_valid(v)),
+ key=self.video_key)[-1].findtext("url")
self.download(target_url)
diff --git a/module/plugins/hoster/ZeveraCom.py b/module/plugins/hoster/ZeveraCom.py
index cbedfcb68..e8b832a13 100644
--- a/module/plugins/hoster/ZeveraCom.py
+++ b/module/plugins/hoster/ZeveraCom.py
@@ -1,108 +1,106 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-from module.plugins.Hoster import Hoster
-from module.utils import html_unescape
-from urllib import quote, unquote
-from time import sleep
-
-class ZeveraCom(Hoster):
- __name__ = "ZeveraCom"
- __version__ = "0.20"
- __type__ = "hoster"
- __pattern__ = r"http://zevera.com/.*"
- __description__ = """zevera.com hoster plugin"""
- __author_name__ = ("zoidberg")
- __author_mail__ = ("zoidberg@mujmail.cz")
-
- def setup(self):
- self.resumeDownload = self.multiDL = True
- self.chunkLimit = 1
-
- def process(self, pyfile):
- if not self.account:
- self.logError(_("Please enter your zevera.com account or deactivate this plugin"))
- self.fail("No zevera.com account provided")
-
- self.logDebug("zevera.com: Old URL: %s" % pyfile.url)
-
- if self.account.getAPIData(self.req, cmd = "checklink", olink = pyfile.url) != "Alive":
- self.fail("Offline or not downloadable - contact Zevera support")
-
- header = self.account.getAPIData(self.req, just_header = True, cmd="generatedownloaddirect", olink = pyfile.url)
- if not "location" in header:
- self.fail("Unable to initialize download - contact Zevera support")
-
- self.download(header['location'], disposition = True)
-
- check = self.checkDownload({"error" : 'action="ErrorDownload.aspx'})
- if check == "error":
- self.fail("Error response received - contact Zevera support")
-
- """
- # BitAPI not used - defunct, probably abandoned by Zevera
-
- api_url = "http://zevera.com/API.ashx"
-
- def process(self, pyfile):
- if not self.account:
- self.logError(_("Please enter your zevera.com account or deactivate this plugin"))
- self.fail("No zevera.com account provided")
-
- self.logDebug("zevera.com: Old URL: %s" % pyfile.url)
-
- last_size = retries = 0
- olink = self.pyfile.url #quote(self.pyfile.url.encode('utf_8'))
-
- for i in range(100):
- self.retData = self.account.loadAPIRequest(self.req, cmd = 'download_request', olink = olink)
- self.checkAPIErrors(self.retData)
-
- if self.retData['FileInfo']['StatusID'] == 100:
- break
- elif self.retData['FileInfo']['StatusID'] == 99:
- self.fail('Failed to initialize download (99)')
- else:
- if self.retData['FileInfo']['Progress']['BytesReceived'] <= last_size:
- if retries >= 6:
- self.fail('Failed to initialize download (%d)' % self.retData['FileInfo']['StatusID'] )
- retries += 1
- else:
- retries = 0
-
- last_size = self.retData['FileInfo']['Progress']['BytesReceived']
-
- self.setWait(self.retData['Update_Wait'])
- self.wait()
-
- pyfile.name = self.retData['FileInfo']['RealFileName']
- pyfile.size = self.retData['FileInfo']['FileSizeInBytes']
-
- self.retData = self.account.loadAPIRequest(self.req, cmd = 'download_start', FileID = self.retData['FileInfo']['FileID'])
- self.checkAPIErrors(self.retData)
-
- self.download(self.api_url, get = {
- 'cmd': "open_stream",
- 'login': self.account.loginname,
- 'pass': self.account.password,
- 'FileID': self.retData['FileInfo']['FileID'],
- 'startBytes': 0
- }
- )
-
- def checkAPIErrors(self, retData):
- if not retData:
- self.fail('Unknown API response')
-
- if retData['ErrorCode']:
- self.logError(retData['ErrorCode'], retData['ErrorMessage'])
- #self.fail('ERROR: ' + retData['ErrorMessage'])
-
- if self.pyfile.size / 1024000 > retData['AccountInfo']['AvailableTODAYTrafficForUseInMBytes']:
- self.logWarning("Not enough data left to download the file")
-
- def crazyDecode(self, ustring):
- # accepts decoded ie. unicode string - API response is double-quoted, double-utf8-encoded
- # no idea what the proper order of calling these functions would be :-/
- return html_unescape(unquote(unquote(ustring.replace('@DELIMITER@','#'))).encode('raw_unicode_escape').decode('utf-8'))
- """ \ No newline at end of file
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from module.plugins.Hoster import Hoster
+
+
+class ZeveraCom(Hoster):
+ __name__ = "ZeveraCom"
+ __version__ = "0.21"
+ __type__ = "hoster"
+ __pattern__ = r"http://zevera.com/.*"
+ __description__ = """zevera.com hoster plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ def setup(self):
+ 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")
+ self.fail("No zevera.com account provided")
+
+ self.logDebug("zevera.com: Old URL: %s" % pyfile.url)
+
+ if self.account.getAPIData(self.req, cmd="checklink", olink=pyfile.url) != "Alive":
+ self.fail("Offline or not downloadable - contact Zevera support")
+
+ header = self.account.getAPIData(self.req, just_header=True, cmd="generatedownloaddirect", olink=pyfile.url)
+ if not "location" in header:
+ self.fail("Unable to initialize download - contact Zevera support")
+
+ self.download(header['location'], disposition=True)
+
+ check = self.checkDownload({"error": 'action="ErrorDownload.aspx'})
+ if check == "error":
+ self.fail("Error response received - contact Zevera support")
+
+ # BitAPI not used - defunct, probably abandoned by Zevera
+ #
+ # api_url = "http://zevera.com/API.ashx"
+ #
+ # def process(self, pyfile):
+ # if not self.account:
+ # self.logError(_("Please enter your zevera.com account or deactivate this plugin"))
+ # self.fail("No zevera.com account provided")
+ #
+ # self.logDebug("zevera.com: Old URL: %s" % pyfile.url)
+ #
+ # last_size = retries = 0
+ # olink = self.pyfile.url #quote(self.pyfile.url.encode('utf_8'))
+ #
+ # for i in range(100):
+ # self.retData = self.account.loadAPIRequest(self.req, cmd = 'download_request', olink = olink)
+ # self.checkAPIErrors(self.retData)
+ #
+ # if self.retData['FileInfo']['StatusID'] == 100:
+ # break
+ # elif self.retData['FileInfo']['StatusID'] == 99:
+ # self.fail('Failed to initialize download (99)')
+ # else:
+ # if self.retData['FileInfo']['Progress']['BytesReceived'] <= last_size:
+ # if retries >= 6:
+ # self.fail('Failed to initialize download (%d)' % self.retData['FileInfo']['StatusID'] )
+ # retries += 1
+ # else:
+ # retries = 0
+ #
+ # last_size = self.retData['FileInfo']['Progress']['BytesReceived']
+ #
+ # self.setWait(self.retData['Update_Wait'])
+ # self.wait()
+ #
+ # pyfile.name = self.retData['FileInfo']['RealFileName']
+ # pyfile.size = self.retData['FileInfo']['FileSizeInBytes']
+ #
+ # self.retData = self.account.loadAPIRequest(self.req, cmd = 'download_start',
+ # FileID = self.retData['FileInfo']['FileID'])
+ # self.checkAPIErrors(self.retData)
+ #
+ # self.download(self.api_url, get = {
+ # 'cmd': "open_stream",
+ # 'login': self.account.loginname,
+ # 'pass': self.account.password,
+ # 'FileID': self.retData['FileInfo']['FileID'],
+ # 'startBytes': 0
+ # }
+ # )
+ #
+ # def checkAPIErrors(self, retData):
+ # if not retData:
+ # self.fail('Unknown API response')
+ #
+ # if retData['ErrorCode']:
+ # self.logError(retData['ErrorCode'], retData['ErrorMessage'])
+ # #self.fail('ERROR: ' + retData['ErrorMessage'])
+ #
+ # if self.pyfile.size / 1024000 > retData['AccountInfo']['AvailableTODAYTrafficForUseInMBytes']:
+ # self.logWarning("Not enough data left to download the file")
+ #
+ # def crazyDecode(self, ustring):
+ # # accepts decoded ie. unicode string - API response is double-quoted, double-utf8-encoded
+ # # no idea what the proper order of calling these functions would be :-/
+ # return html_unescape(unquote(unquote(ustring.replace(
+ # '@DELIMITER@','#'))).encode('raw_unicode_escape').decode('utf-8'))
diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py
index 756a92ef3..3c7b68bb6 100644
--- a/module/plugins/hoster/ZippyshareCom.py
+++ b/module/plugins/hoster/ZippyshareCom.py
@@ -1,21 +1,26 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-import re, subprocess, tempfile, os
+import re
+import subprocess
+import tempfile
+import os
+
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp
-from module.plugins.ReCaptcha import ReCaptcha
+from module.plugins.internal.CaptchaService import ReCaptcha
from module.common.json_layer import json_loads
+
class ZippyshareCom(SimpleHoster):
__name__ = "ZippyshareCom"
__type__ = "hoster"
__pattern__ = r"(?P<HOST>http://www\d{0,2}\.zippyshare.com)/v(?:/|iew.jsp.*key=)(?P<KEY>\d+)"
- __version__ = "0.38"
+ __version__ = "0.39"
__description__ = """Zippyshare.com Download Hoster"""
__author_name__ = ("spoob", "zoidberg", "stickell")
__author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz", "l.stickell@yahoo.it")
__config__ = [("swfdump_path", "string", "Path to swfdump", "")]
-
+
FILE_NAME_PATTERN = r'>Name:</font>\s*<font [^>]*>(?P<N>[^<]+)</font><br />'
FILE_SIZE_PATTERN = r'>Size:</font>\s*<font [^>]*>(?P<S>[0-9.,]+) (?P<U>[kKMG]+)i?B</font><br />'
FILE_INFO_PATTERN = r'document\.getElementById\(\'dlbutton\'\)\.href = "[^;]*/(?P<N>[^"]+)";'
@@ -26,34 +31,35 @@ class ZippyshareCom(SimpleHoster):
CAPTCHA_KEY_PATTERN = r'Recaptcha.create\("([^"]+)"'
CAPTCHA_SHORTENCODE_PATTERN = r"shortencode: '([^']+)'"
CAPTCHA_DOWNLOAD_PATTERN = r"document.location = '([^']+)'"
-
- LAST_KNOWN_VALUES = (9, 2374755) #time = (seed * multiply) % modulo
+
+ LAST_KNOWN_VALUES = (9, 2374755) # time = (seed * multiply) % modulo
def setup(self):
self.html = None
self.wantReconnect = False
self.multiDL = True
- def handleFree(self):
+ def handleFree(self):
url = self.get_file_url()
- if not url: self.fail("Download URL not found.")
+ if not url:
+ self.fail("Download URL not found.")
self.logDebug("Download URL %s" % url)
- self.download(url, cookies = True)
-
+ self.download(url, cookies=True)
+
check = self.checkDownload({
"swf_values": re.compile(self.SEED_PATTERN)
})
if check == "swf_values":
- swf_sts = self.getStorage("swf_sts")
+ swf_sts = self.getStorage("swf_sts")
if not swf_sts:
self.setStorage("swf_sts", 2)
self.setStorage("swf_stamp", 0)
elif swf_sts == '1':
self.setStorage("swf_sts", 2)
-
- self.retry(max_tries = 1)
-
+
+ self.retry(max_tries=1)
+
def get_file_url(self):
""" returns the absolute downloadable filepath
"""
@@ -73,54 +79,55 @@ class ZippyshareCom(SimpleHoster):
seed_search = re.search(self.SEED_PATTERN, self.html)
if seed_search:
swf_url, file_seed = seed_search.groups()
-
+
swf_sts = self.getStorage("swf_sts")
swf_stamp = int(self.getStorage("swf_stamp") or 0)
swf_version = self.getStorage("version")
self.logDebug("SWF", swf_sts, swf_stamp, swf_version)
-
- if not swf_sts:
+
+ if not swf_sts:
self.logDebug('Using default values')
multiply, modulo = self.LAST_KNOWN_VALUES
elif swf_sts == "1":
- self.logDebug('Using stored values')
+ self.logDebug('Using stored values')
multiply = self.getStorage("multiply")
modulo = self.getStorage("modulo")
- elif swf_sts == "2":
+ elif swf_sts == "2":
if swf_version < self.__version__:
- self.logDebug('Reverting to default values')
+ self.logDebug('Reverting to default values')
self.setStorage("swf_sts", "")
self.setStorage("version", self.__version__)
- multiply, modulo = self.LAST_KNOWN_VALUES
+ multiply, modulo = self.LAST_KNOWN_VALUES
elif (swf_stamp + 3600000) < timestamp():
swfdump = self.get_swfdump_path()
- if swfdump:
+ if swfdump:
multiply, modulo = self.get_swf_values(self.file_info['HOST'] + swf_url, swfdump)
else:
- self.logWarning("Swfdump not found. Install swftools to bypass captcha.")
-
+ self.logWarning("Swfdump not found. Install swftools to bypass captcha.")
+
if multiply and modulo:
- self.logDebug("TIME = (%s * %s) %s" % (file_seed, multiply, modulo))
- url = "/download?key=%s&time=%d" % (self.file_info['KEY'], (int(file_seed) * int(multiply)) % int(modulo))
-
+ self.logDebug("TIME = (%s * %s) %s" % (file_seed, multiply, modulo))
+ url = "/download?key=%s&time=%d" % (self.file_info['KEY'],
+ (int(file_seed) * int(multiply)) % int(modulo))
+
if not url:
#Method #3: Captcha
url = self.do_recaptcha()
-
+
return self.file_info['HOST'] + url
-
+
def get_swf_values(self, swf_url, swfdump):
self.logDebug('Parsing values from %s' % swf_url)
- multiply = modulo = None
-
+ multiply = modulo = None
+
fd, fpath = tempfile.mkstemp()
try:
swf_data = self.load(swf_url)
os.write(fd, swf_data)
-
+
p = subprocess.Popen([swfdump, '-a', fpath], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
-
+
if err:
self.logError(err)
else:
@@ -128,9 +135,9 @@ class ZippyshareCom(SimpleHoster):
multiply = re.search(r'pushbyte (\d+)', m_str).group(1)
modulo = re.search(r'pushint (\d+)', m_str).group(1)
finally:
- os.close(fd)
+ os.close(fd)
os.remove(fpath)
-
+
if multiply and modulo:
self.setStorage("multiply", multiply)
self.setStorage("modulo", modulo)
@@ -139,16 +146,16 @@ class ZippyshareCom(SimpleHoster):
else:
self.logError("Parsing SWF failed: swfdump not installed or plugin out of date")
self.setStorage("swf_sts", 2)
-
- self.setStorage("swf_stamp", timestamp())
-
+
+ self.setStorage("swf_stamp", timestamp())
+
return multiply, modulo
-
+
def get_swfdump_path(self):
# used for detecting if swfdump is installed
def is_exe(ppath):
return os.path.isfile(ppath) and os.access(ppath, os.X_OK)
-
+
program = self.getConfig("swfdump_path") or "swfdump"
swfdump = None
ppath, pname = os.path.split(program)
@@ -160,33 +167,35 @@ class ZippyshareCom(SimpleHoster):
exe_file = os.path.join(ppath, program)
if is_exe(exe_file):
swfdump = exe_file
-
+
# return path to the executable or None if not found
return swfdump
-
+
def do_recaptcha(self):
self.logDebug('Trying to solve captcha')
captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group(1)
shortencode = re.search(self.CAPTCHA_SHORTENCODE_PATTERN, self.html).group(1)
- url = re.search(self.CAPTCHA_DOWNLOAD_PATTERN, self.html).group(1)
-
+ url = re.search(self.CAPTCHA_DOWNLOAD_PATTERN, self.html).group(1)
+
recaptcha = ReCaptcha(self)
for i in range(5):
challenge, code = recaptcha.challenge(captcha_key)
response = json_loads(self.load(self.file_info['HOST'] + '/rest/captcha/test',
- post={'challenge': challenge,
- 'response': code,
- 'shortencode': shortencode}))
+ post={'challenge': challenge,
+ 'response': code,
+ 'shortencode': shortencode}))
self.logDebug("reCaptcha response : %s" % response)
if response == True:
- self.correctCaptcha
+ self.correctCaptcha()
break
else:
self.invalidCaptcha()
- else: self.fail("Invalid captcha")
-
- return url
+ else:
+ self.fail("Invalid captcha")
+
+ return url
+
-getInfo = create_getInfo(ZippyshareCom) \ No newline at end of file
+getInfo = create_getInfo(ZippyshareCom)