summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-01-12 17:10:25 +0100
committerGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-01-12 17:10:25 +0100
commit0715dcafc11567e07b8f1c252bbd2b86065ae760 (patch)
treedbb00ef45362bb0f9fb0ae5cb3b1e7d65536a348 /module/plugins
parentUnrar fix (diff)
downloadpyload-0715dcafc11567e07b8f1c252bbd2b86065ae760.tar.xz
linkdecrypter api (thx flowlee), fix uloz.to, 1fichier - closed #493, #494, #496
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/crypter/LinkdecrypterCom.py109
-rw-r--r--module/plugins/hoster/DlFreeFr.py73
-rw-r--r--module/plugins/hoster/OneFichierCom.py130
-rw-r--r--module/plugins/hoster/UlozTo.py14
-rw-r--r--module/plugins/internal/SimpleHoster.py17
5 files changed, 105 insertions, 238 deletions
diff --git a/module/plugins/crypter/LinkdecrypterCom.py b/module/plugins/crypter/LinkdecrypterCom.py
index 93c08a5b2..83c74188d 100644
--- a/module/plugins/crypter/LinkdecrypterCom.py
+++ b/module/plugins/crypter/LinkdecrypterCom.py
@@ -22,63 +22,74 @@ from module.plugins.Crypter import Crypter
class LinkdecrypterCom(Crypter):
__name__ = "LinkdecrypterCom"
__type__ = "crypter"
- __pattern__ = r"http://(\w*\.)?(10001mb\.com|123link\.it|1cl\.in|1kh\.de|1zh\.us|2joy\.de|2so\.be|3\.ly|5\.gp|6nc\.net|7li\.in|9\.bb|adf\.ly|adflav\.com|adfoc\.us|allanalpass\.com|alturl\.com|amy\.gs|any\.gs|apurl\.ru|aurl\.es|b23\.ru|baberepublic\.com|bat5\.com|bax\.li|beam\.to|bit\.ly|blu\.cc|c\.ly|capourl\.com|cc\.st|cd\.vg|cloneurl\.com|convertircodigo\.com|crypt-it\.com|crypt\.to|cryptlink\.ws|deb\.gs|digzip\.com|djurl\.com|dl-protect\.com|doiop\.com|ehe\.me|encript\.in|encurtador\.com|enlacs\.com|evg\.in|extreme-protect\.com|fa\.by|faja\.me|fapoff\.com|fdnlinks\.com|fea\.me|fff\.to|filedeck\.net|filemirrorupload\.com|fileupster\.com|flameupload\.com|freetexthost\.com|fwd4\.me|fyad\.org|goandgrab\.info|goblig\.com|goo\.gl|h-url\.in|hasurl\.co\.cc|hide-url\.net|hidemyass\.com|hides\.at|hideurl\.biz|ho\.io|hornywood\.tv|href\.hu|id2\.tryjav\.com|ilix\.in|ily\.me|ino\.me|interupload\.com|is\.gd|ivpaste\.com|j\.mp|je\.pl|jheberg\.com|just\.as|kickupload\.com|klnk\.de|knoffl\.com|kodo\.ameoto\.com|ks\.gs|latwy\.pl|link-go\.info|link-protector\.com|link-safe\.net|link4jo\.com|linkanonimo\.com|linkbabes\.com|linkbank\.eu|linkbee\.com|linkblur\.com|linkbucks\.com|linkcrypt\.com|linkcrypt\.ws|linkencrypter\.com|linkhide\.com\.ar|linkhide\.in|linkoculto\.net|linkok\.org|linkprivado\.com|linkprivate\.net|linkprotect\.in|links-protect\.com|links-protect\.info|links\.tc|linksafe\.me|linksaver\.info|linkse\.info|linkseguro\.com\.ar|linkseguro\.org|linksole\.com|linksprotegidos\.info|linkto\.net|linkweb\.dk|linkx\.in|linkzip\.net|listedfiles\.com|littleurl\.net|lixk\.me|ljv2\.com|ll11\.org|lnk\.cm|lnk\.co|longr\.us|lovelink\.in|mcaf\.ee|megaline\.co|megaupper\.com|mhz\.me|migre\.me|miniurls\.co|minu\.me|mir\.cr|mirrorcreator\.com|mo\.by|multi-uploadeur\.com|murl\.kz|musicalmente\.info|mypaqe\.com|mypl\.us|myrapidlinks\.com|myref\.de|myurl\.in|nbanews\.us|okconsolas\.com|oneddl\.canhaz\.it|ow\.ly|p4p\.com\.es|p6l\.org|paste\.frubar\.net|paste\.hotfile-bb\.com|paste\.ubuntu\.com|paste2\.org|paste21\.info|pastebin\.com|paylesssofts\.net|poontown\.net|pqueno\.com|priva\.us|protec-link\.com|protect-ddl\.com|protect-my-links\.com|protected\.socadvnet\.com|protectlinks\.com|protectlinks\.net|protectlk\.com|protege-mes-liens\.com|ptl\.li|qooy\.com|qqc\.co|qvvo\.com|rapidfolder\.com|rapidsafe\.de|rapidsafe\.org|rapidshare\.mu|realfiles\.net|redir\.ec|ref\.so|relinka\.net|rexwo\.com|rqq\.co|rs-layer\.com|rsmonkey\.com|s2l\.biz|saf\.li|safe\.mn|safelinking\.net|saferlinks\.com|sealed\.in|seclnk\.in|seriousfiles\.com|sharebee\.com|short-link\.fr|shortlink\.ca|shorturlscript\.net|simurl\.com|sinl\.es|skroc\.pl|slexy\.org|slnky\.net|smsdl\.com|sn\.im|sonofertas\.es|spedr\.com|spreadlink\.us|star-cyber\.com|subedlc\.com|subirfacil\.com|syl\.me|szort\.pl|takemyfile\.com|takemylinks\.com|textsnip\.com|thecow\.me|thesefiles\.com|tilien\.net|tiny\.cc|tiny\.lt|tinylinks\.co|tinypaste\.com|tinyurl\.com|tinyurlscript\.info|tmf\.myegy\.com|togoto\.us|tot\.to|tra\.kz|u\.to|uberpicz\.com|ulinks\.net|ultra-protect\.com|ultrafiles\.net|undeadlink\.com|uploadjockey\.com|uploadmirrors\.com|uploadonall\.com|upmirror\.com|upsafe\.org|ur\.ly|url-go\.com|url-site\.com|url4t\.com|urla\.in|urlbeat\.net|urlcash\.net|urlcrypt\.com|urlcut\.com|urlcut\.in|urldefender\.com|urln\.tk|urlpulse\.net|urlspy\.co\.cc|urwij|uselink\.info|uucc\.cc|uze\.in|wcrypt\.in|webtooljungle\.com|weepax\.com|whackyvidz\.com|x-ls\.ru|x\.co|xa\.ly|xc\.io|xr\.com|xtreemhost\.com|xurl\.cn|xxs\.ru|ysu\.me|yyv\.co|zff\.co|zio\.in|zpag\.es)/.*"
- __version__ = "0.22"
+ #excluded: "1kh\.de|crypt-it\.com|linksave\.in|lix\.in|lof\.cc|multiload\.cz|multiupload\.com|ncrypt\.in|relink\.us|rs-layer\.com|secured\.in|stealth\.to"
+ __pattern__ = r"http://(\w*\.)?(00\.uz|10001mb\.com|123link\.it|123url\.org|1cl\.in|1tool\.biz|1zh\.us|2joy\.de|2so\.be|3\.ly|5\.gp|6nc\.net|7li\.in|9\.bb|adf\.ly|adflav\.com|adfoc\.us|allanalpass\.com|alturl\.com|amy\.gs|any\.gs|apurl\.ru|aurl\.es|b23\.ru|baberepublic\.com|bai\.lu|bat5\.com|bax\.li|bc\.vc|beam\.to|birurl\.com|bit\.ly|blu\.cc|bofh\.us|boo\.io|c\.ly|capourl\.com|cash4links\.co|cc\.st|cd\.vg|cl\.lk|cli\.gs|cloneurl\.com|convertircodigo\.com|crypt\.to|crypt2\.be|cryptlink\.ws|ddl-warez\.in|deb\.gs|deurl\.me|digzip\.com|djurl\.com|dl-protect\.com|dl\.dropbox\.com|doiop\.com|ehe\.me|embedupload\.com|encript\.in|encurtador\.com|enlacs\.com|evg\.in|extreme-protect\.com|fa\.by|faja\.me|fapoff\.com|fdnlinks\.com|fea\.me|fff\.to|filedeck\.net|filemirrorupload\.com|filesonthe\.net|fileupster\.com|flameupload\.com|freetexthost\.com|fwd4\.me|fyad\.org|galleries\.bz|goandgrab\.info|goblig\.com|goo\.gl|guardlink\.org|h-url\.in|hasurl\.co\.cc|hide-url\.net|hidemyass\.com|hides\.at|hideurl\.biz|ho\.io|hornywood\.tv|href\.hu|id2\.tryjav\.com|ilii\.in|ilix\.in|ily\.me|ino\.me|interupload\.com|is\.gd|ivpaste\.com|j\.mp|j7\.se|je\.pl|jheberg\.com|just\.as|kickupload\.com|klnk\.de|knoffl\.com|kodo\.ameoto\.com|ks\.gs|latwy\.pl|li\.co\.ve|link-go\.info|link-protector\.com|link-safe\.net|link\.file-up\.ru|link4jo\.com|linkanonimo\.com|linkbabes\.com|linkbank\.eu|linkbee\.com|linkblur\.com|linkbucks\.com|linkbun\.ch|linkcrypt\.com|linkcrypt\.ws|linkencrypter\.com|linkhide\.com\.ar|linkhide\.in|linkoculto\.net|linkok\.org|linkprivado\.com|linkprivate\.net|linkprotect\.in|links-protect\.com|links-protect\.info|links-protection\.com|links\.tc|linksafe\.me|linksaver\.info|linkse\.info|linkseguro\.com\.ar|linkseguro\.org|linksole\.com|linksprotec\.com|linksprotegidos\.info|linkssafe\.com|linkto\.net|linkweb\.dk|linkx\.in|linkzip\.net|listedfiles\.com|littleurl\.net|lixk\.me|lixxin\.com|ljv2\.com|lkt\.es|ll11\.org|lnk\.cm|lnk\.co|longr\.us|lovelink\.in|madlink\.sk|maxi-upload\.com|mcaf\.ee|mediahide\.com|megaline\.co|megalinks\.es|megaupper\.com|mf1\.jp|mhz\.me|migre\.me|miniurl\.com|miniurl\.es|miniurl\.org|miniurls\.co|minu\.me|mir\.cr|mirrorcreator\.com|mo\.by|multi-uploadeur\.com|murl\.kz|musicalmente\.info|myooo\.info|mypaqe\.com|mypl\.us|myrapidlinks\.com|myref\.de|myurl\.in|nbanews\.us|nov\.io|okconsolas\.com|oneddl\.canhaz\.it|ow\.ly|p4p\.com\.es|p6l\.org|paste\.frubar\.net|paste\.hotfile-bb\.com|paste\.to|paste\.ubuntu\.com|paste2\.org|paste21\.info|pastebin\.com|paylesssofts\.net|poontown\.net|pqueno\.com|priva\.us|protec-link\.com|protect-ddl\.com|protect-my-links\.com|protected\.socadvnet\.com|protectlinks\.com|protectlinks\.net|protectlk\.com|protege-mes-liens\.com|ptl\.li|qooy\.com|qqc\.co|qvvo\.com|rapidfolder\.com|rapidsafe\.de|rapidsafe\.org|rapidshare\.mu|realfiles\.net|redir\.ec|ref\.so|relinka\.net|rexwo\.com|rqq\.co|rsmonkey\.com|rurls\.ru|s2l\.biz|saf\.li|safe\.mn|safelinking\.net|saferlinks\.com|scut\.ly|sealed\.in|seclnk\.in|seriousfiles\.com|share-links\.biz|sharebee\.com|short-link\.fr|shortlink\.ca|shorturlscript\.net|shrt\.st|simurl\.com|sinl\.es|skroc\.pl|slexy\.org|slnky\.net|smlk\.es|smsdl\.com|sn\.im|snipr\.com|snipurl\.com|snurl\.com|sonofertas\.es|spedr\.com|spreadlink\.us|star-cyber\.com|stu\.tc|subedlc\.com|subirfacil\.com|syl\.me|szort\.pl|t\.co|t7\.hu|takemyfile\.com|takemylinks\.com|textsave\.de|textsnip\.com|thecow\.me|thesefiles\.com|thinfi\.com|tilien\.net|tiny\.cc|tiny\.lt|tinylinks\.co|tinypaste\.com|tinyurl\.com|tinyurlscript\.info|tmf\.myegy\.com|togoto\.us|tot\.to|tra\.kz|trick\.ly|u\.to|uberpicz\.com|ubervidz\.com|ulinks\.net|ultrafiles\.net|undeadlink\.com|uploadjockey\.com|uploadmirrors\.com|uploadonall\.com|upmirror\.com|upsafe\.org|ur\.ly|url-go\.com|url-site\.com|url\.zeta24\.com|url4t\.com|urla\.in|urlbeat\.net|urlcash\.net|urlcorta\.es|urlcrypt\.com|urlcut\.com|urlcut\.in|urldefender\.com|urlink\.at|urln\.tk|urlpulse\.net|urlspy\.co\.cc|urwij|uselink\.info|uucc\.cc|uze\.in|wa9\.la|wcrypt\.in|webtooljungle\.com|weepax\.com|whackyvidz\.com|wtc\.la|x-ls\.ru|x\.co|xa\.ly|xc\.io|xr\.com|xtreemhost\.com|xurl\.cn|xurl\.es|xxs\.ru|youfap\.me|ysu\.me|yvy\.me|yyv\.co|zff\.co|zio\.in|zpag\.es)/.*"
+ __version__ = "0.23"
__description__ = """linkdecrypter.com"""
- __author_name__ = ("zoidberg")
-
+ __author_name__ = ("zoidberg", "flowlee")
+
TEXTAREA_PATTERN = r'<textarea name="links" wrap="off" readonly="1" class="caja_des">(.+)</textarea>'
PASSWORD_PATTERN = r'<p class="textog" style="color:red"><b>PASSWORD:</b></p>'
CAPTCHA_PATTERN = r'<img style="cursor:crosshair;" src="([^"]+)" alt="Loading CAPTCHA...">'
-
+ REDIR_PATTERN = r'<i>(Click <a href="./">here</a> if your browser does not redirect you).</i>'
+
def decrypt(self, pyfile):
- self.html = self.load('http://linkdecrypter.com', cookies = True)
- phpsessid = self.req.cj.getCookie("PHPSESSID")
-
- self.html = self.load('http://linkdecrypter.com', post={
- "link_cache": "on",
- "links" + phpsessid: self.pyfile.url,
- "modo_links": "text"
- }, cookies = True)
- new_links = []
- captcha = ''
- passwords = self.getPassword().splitlines()
-
- for i in range(5 + len(passwords)):
- self.logDebug("Trying to decrypt #" + str(i))
- self.html = self.load('http://linkdecrypter.com')
+ self.passwords = self.getPassword().splitlines()
+
+ new_links = self.decryptAPI() or self.decryptHTML()
+ if new_links:
+ self.core.files.addLinks(new_links, self.pyfile.package().id)
+ else:
+ self.fail('Could not extract any links')
- textarea = re.search(self.TEXTAREA_PATTERN, self.html, flags=re.DOTALL)
- if textarea is not None:
- self.logDebug(textarea.group(1))
- new_links.extend(textarea.group(1).split())
- break
- elif re.search(self.PASSWORD_PATTERN, self.html):
- if len(passwords):
- password = passwords.pop(0)
+ def decryptAPI(self):
+
+ get_dict = { "t": "link", "url": self.pyfile.url, "lcache": "1" }
+ self.html = self.load('http://linkdecrypter.com/api', get = get_dict)
+ if self.html.startswith('http://'): return self.html.splitlines()
+
+ if self.html == 'INTERRUPTION(PASSWORD)':
+ for get_dict['pass'] in self.passwords:
+ self.html = self.load('http://linkdecrypter.com/api', get= get_dict)
+ if self.html.startswith('http://'): return self.html.splitlines()
+
+ self.logError('API', self.html)
+ if self.html == 'INTERRUPTION(PASSWORD)':
+ self.fail("No or incorrect password")
+
+ return None
+
+ def decryptHTML(self):
+
+ self.html = self.load('http://linkdecrypter.com', cookies = True)
+ links_sessid = "links" + self.req.cj.getCookie("PHPSESSID")
+ retries = 5
+
+ post_dict = { "link_cache": "on", links_sessid: self.pyfile.url, "modo_links": "text" }
+ self.html = self.load('http://linkdecrypter.com', post = post_dict, cookies = True)
+
+ while self.passwords or retries:
+ found = re.search(self.TEXTAREA_PATTERN, self.html, flags=re.DOTALL)
+ if found: return found.group(1).splitlines()
+
+ found = re.search(self.CAPTCHA_PATTERN, self.html)
+ if found:
+ self.logInfo("Captcha protected link")
+ captcha = self.decryptCaptcha(url='http://linkdecrypter.com/' + found.group(1))
+ self.html = self.load('http://linkdecrypter.com', post={ "captcha": captcha })
+ retries -= 1
+
+ elif self.PASSWORD_PATTERN in self.html:
+ if self.passwords:
+ password = self.passwords.pop(0)
self.logInfo("Password protected link, trying " + password)
- self.html = self.load('http://linkdecrypter.com', post={
- "password": password
- })
+ self.html = self.load('http://linkdecrypter.com', post= {'password': password})
else:
self.fail("No or incorrect password")
+
else:
- found = re.search(self.CAPTCHA_PATTERN, self.html)
- if found is not None:
- self.logInfo("Captcha protected link")
- if captcha:
- self.invalidCaptcha()
- captcha = self.decryptCaptcha(url='http://linkdecrypter.com/' + found.group(1))
- self.html = self.load('http://linkdecrypter.com', post={
- "captcha": captcha
- })
- else:
- self.fail('Max retries reached')
-
- if new_links:
- if captcha:
- self.correctCaptcha()
- self.core.files.addLinks(new_links, self.pyfile.package().id)
- else:
- self.fail('Could not extract any links') \ No newline at end of file
+ retries -= 1
+ self.html = self.load('http://linkdecrypter.com', cookies = True)
+
+ return None \ No newline at end of file
diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py
deleted file mode 100644
index 8ab9dd8eb..000000000
--- a/module/plugins/hoster/DlFreeFr.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import re
-
-from module.plugins.Hoster import Hoster
-
-class DlFreeFr(Hoster):
- __name__ = "DlFreeFr"
- __type__ = "hoster"
- __pattern__ = r"http://dl\.free\.fr/([a-zA-Z0-9]+|getfile\.pl\?file=/[a-zA-Z0-9]+)$"
- __version__ = "0.1"
- __description__ = """dl.free.fr download hoster"""
- __author_name__ = ("the-razer")
- __author_mail__ = ("daniel_ AT gmx DOT net")
-
- def setup(self):
- self.html = None
- self.multiDL = False
-
- def process(self, pyfile):
-
- self.download_html()
-
- if not self.file_exists():
- self.log.debug(self.__name__+": File not yet available.")
- self.offline()
-
- pyfile.name = self.get_file_name()
-
- url = self.get_file_url()
- if url:
- self.download(url)
- else:
- self.offline()
-
- def download_html(self):
- self.html = self.load(self.pyfile.url, cookies=False)
-
- def file_exists(self):
- warnings = (r"Erreur 404 - Document non trouv",
- r"Fichier inexistant.",
- r"Le fichier demand&eacute; n'a pas &eacute;t&eacute; trouv&eacute;")
- expr = '(' + '|'.join(warnings) + ')'
- if re.search(expr, self.html) is not None:
- return False
- return True
-
- def get_file_url(self):
- self.log.debug(self.__name__+": Getting file URL")
- file_url_pattern = r'href="(?P<url>http://.*?)">T&eacute;l&eacute;charger ce fichier'
-
- m = re.search(file_url_pattern, self.html)
- if m is not None:
- url = m.group('url')
- self.log.debug(self.__name__+": File URL [%s]" % url)
- return url
- else:
- self.log.debug(self.__name__+": Error getting URL")
- return False
-
- def get_file_name(self):
- self.log.debug(self.__name__+": Getting file name")
-
- file_name_pattern = r"Fichier:</td>\s*<td.*>(?P<name>.*?)</td>"
- m = re.search(file_name_pattern, self.html)
-
- if m is not None:
- name = m.group('name').strip()
- self.log.debug(self.__name__+": File name [%s]" % name)
- return name
- else:
- self.log.debug(self.__name__+": Could not find filename")
diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py
index 3343c7c8c..16401891b 100644
--- a/module/plugins/hoster/OneFichierCom.py
+++ b/module/plugins/hoster/OneFichierCom.py
@@ -1,80 +1,29 @@
# -*- coding: utf-8 -*-
import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-from module.plugins.Hoster import Hoster
-from module.network.RequestFactory import getURL
-
-
-def getInfo(urls):
- result = []
-
- for url in urls:
-
- # Get file info html
- id = re.match(OneFichierCom.__pattern__, url).group('id')
- url = 'http://%s.1fichier.com/en' % id # Force response in english
- html = getURL(url)
-
- # Offline?
- if re.search(OneFichierCom.FILE_OFFLINE_PATTERN, html):
- result.append((url, 0, 1, url))
- continue
-
- # Name
- for pattern in OneFichierCom.FILE_NAME_PATTERNS:
- m = re.search(pattern, html)
- if m is not None:
- name = m.group('name').strip()
-
- # Size
- m = re.search(OneFichierCom.FILE_SIZE_PATTERN, html)
- value = float(m.group('size'))
- units = m.group('units')[0].upper()
- pow = {'K' : 1, 'M' : 2, 'G' : 3}[units]
- size = int(value*1024**pow)
-
- # Return info
- result.append((name, size, 2, url))
-
- yield result
-
-
-class OneFichierCom(Hoster):
+class OneFichierCom(SimpleHoster):
__name__ = "OneFichierCom"
__type__ = "hoster"
- __pattern__ = r"http://(?P<id>[a-z0-9]+)\.1fichier\.com(?P<remain>.*)"
- __version__ = "0.3"
+ __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.4"
__description__ = """1fichier.com download hoster"""
- __author_name__ = ("fragonib")
- __author_mail__ = ("fragonib[AT]yahoo[DOT]es")
+ __author_name__ = ("fragonib", "the-razer", "zoidberg")
+ __author_mail__ = ("fragonib[AT]yahoo[DOT]es", "daniel_ AT gmx DOT net", "zoidberg@mujmail.cz")
+
+ FILE_NAME_PATTERN = r'">File name :</th>[\t\r\n ]+<td>(?P<N>.*?)</td>'
+ FILE_SIZE_PATTERN = r'<th>File size :</th>\s+<td>(?P<S>[\d\.]*) (?P<U>\w+)</td>'
+ FILE_OFFLINE_PATTERN = r'The (requested)? file (could not be found|has been deleted)'
+ FILE_URL_REPLACEMENTS = [(r'(http://[^/]*).*', r'\1/en/')]
- FILE_NAME_PATTERNS = (
- r'">File name :</th>[\t\r\n ]+<td>(?P<name>.*?)</td>',
- r">Click here to download (?P<name>.*?)</a>",
- r"content=\"Download the file named (?P<name>.*?)\">",
- r"<title>Download the file\s*:\s*(?P<name>.*?)</title>"
- )
- FILE_SIZE_PATTERN = r"<th>File size :</th>\s+<td>(?P<size>[\d\.]*) (?P<units>\w+)</td>"
- DOWNLOAD_LINK_PATTERN = r'<br/>&nbsp;<br/>&nbsp;<br/>&nbsp;\s+<a href="(?P<url>http://.*?)"'
- FILE_OFFLINE_PATTERN = r"(The requested file could not be found|The file may has been deleted by its owner)"
+ DOWNLOAD_LINK_PATTERN = r'<br/>&nbsp;<br/>&nbsp;<br/>&nbsp;\s+<a href="(?P<url>http://.*?)"'
PASSWORD_PROTECTED_TOKEN = "protected by password"
WAITING_TOKEN = "Please wait a few seconds"
-
- def setup(self):
- self.html = None
- self.multiDL = False
-
- def process(self, pyfile):
-
- # Get main page (english version)
- url = self.getEnglishURL()
- self.html = self.load(url)
- self.handleErrors()
-
- # Get file info
- pyfile.name = self.getFileName()
- pyfile.size = self.getFileSize()
+
+ def handleFree(self):
+ if self.WAITING_TOKEN in self.html:
+ self.waitAndRetry(60)
# Check for protection
if self.isProtected():
@@ -86,33 +35,7 @@ class OneFichierCom(Hoster):
self.download(downloadLink)
# Check download
- self.handleDownloadedFile()
-
- def getEnglishURL(self):
- id = re.match(self.__pattern__, self.pyfile.url).group('id')
- url = 'http://%s.1fichier.com/en' % id
- return url
-
- def getFileName(self):
- for pattern in self.FILE_NAME_PATTERNS:
- m = re.search(pattern, self.html)
- if m is not None:
- name = m.group('name').strip()
- self.logDebug("Got file name [%s]" % name)
- return name
-
- def getFileSize(self):
- m = re.search(self.FILE_SIZE_PATTERN, self.html)
- if m is not None:
- size = float(m.group('size'))
- units = m.group('units')[0].upper()
- try:
- multiplier = 1024 ** {"K":1, "M":2, "G":3}[units]
- except KeyError:
- multiplier = 1
- bytes = int(size * multiplier)
- self.logDebug("Got file size of [%s] bytes" % bytes)
- return bytes
+ self.checkDownloadedFile()
def isProtected(self):
if self.PASSWORD_PROTECTED_TOKEN in self.html:
@@ -126,16 +49,15 @@ class OneFichierCom(Hoster):
url = m.group('url')
self.logDebug("Got file URL [%s]" % url)
return url
-
- def handleErrors(self):
- if re.search(self.FILE_OFFLINE_PATTERN, self.html) is not None:
- self.logDebug("File not yet available.")
- self.offline()
- def handleDownloadedFile(self):
+ def checkDownloadedFile(self):
check = self.checkDownload({"wait": self.WAITING_TOKEN})
if check == "wait":
- wait = 5
- self.setWait(wait, True)
- self.wait()
- self.retry() \ No newline at end of file
+ self.waitAndRetry(60)
+
+ def waitAndRetry(self, wait_time):
+ self.setWait(wait_time, True)
+ self.wait()
+ self.retry()
+
+getInfo = create_getInfo(OneFichierCom) \ No newline at end of file
diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py
index 9c9f502c3..6b699e39f 100644
--- a/module/plugins/hoster/UlozTo.py
+++ b/module/plugins/hoster/UlozTo.py
@@ -20,21 +20,21 @@ import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
def convertDecimalPrefix(m):
- # decimal prefixes used in filesize and traffic
- return "%s%s%s B" % (m.group(1), m.group(2).ljust(3, '0') if m.group(2) else '000', {'k': '', 'M': '000', 'G': '000000'}[m.group(3)])
+ # decimal prefixes used in filesize and traffic
+ 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)/.*"
- __version__ = "0.80"
+ __version__ = "0.81"
__description__ = """uloz.to"""
__author_name__ = ("zoidberg")
FILE_NAME_PATTERN = r'<a share_url="[^&]*&amp;t=(?P<N>[^"]+)"'
#FILE_NAME_PATTERN = r'<h2 class="nadpis" style="margin-left:196px;"><a href="[^"]+">(?P<N>[^<]+)</a></h2>'
FILE_SIZE_PATTERN = r'<div class="info_velikost" style="top:-55px;">\s*<div>[^<]*\s+(?P<S>[0-9.]+\s[kMG]B)\s*</div>\s*</div>'
- FILE_SIZE_REPLACEMENTS = [('(\d+)\.?(\d+)? (\w)B', convertDecimalPrefix), (' ','')]
+ FILE_SIZE_REPLACEMENTS = [('([0-9.]+)\s([kMG])B', convertDecimalPrefix)]
FILE_OFFLINE_PATTERN = r'http://www.uloz.to/(neexistujici|smazano|nenalezeno)'
PASSWD_PATTERN = r'<input type="password" class="text" name="file_password" id="frmfilepasswordForm-file_password" />'
@@ -70,7 +70,7 @@ class UlozTo(SimpleHoster):
if re.search(self.VIPLINK_PATTERN, self.html):
self.html = self.load(pyfile.url, get={"disclaimer": "1"})
- if self.premium and self.checkCredit():
+ if self.premium and self.checkTrafficLeft():
self.handlePremium()
else:
self.handleFree()
@@ -97,7 +97,7 @@ class UlozTo(SimpleHoster):
self.log.debug('CAPTCHA_URL:' + captcha_url + ' CAPTCHA:' + captcha + ' CAPTCHA_NB:' + captcha_nb)
# download and check
- self.download(parsed_url, post={"captcha_user": captcha, "captcha_nb": captcha_nb}, cookies=True, disposition = True)
+ self.download(parsed_url, post={"captcha_user": captcha, "captcha_nb": captcha_nb}, cookies=True)
self.doCheckDownload()
self.setStorage("captchaUser", captcha)
@@ -105,7 +105,7 @@ class UlozTo(SimpleHoster):
def handlePremium(self):
parsed_url = self.findDownloadURL(premium=True)
- self.download(parsed_url, disposition = True)
+ self.download(parsed_url)
self.doCheckDownload()
def findDownloadURL(self, premium=False):
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index d4d74057e..12b629a81 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -20,13 +20,14 @@ from urlparse import urlparse
import re
from module.plugins.Hoster import Hoster
-from module.utils import html_unescape, parseFileSize
+from module.utils import html_unescape, fixup, parseFileSize
from module.network.RequestFactory import getURL
def reSub(string, ruleslist):
for r in ruleslist:
rf, rt = r
string = re.sub(rf, rt, string)
+ #self.logDebug(rf, rt, string)
return string
def parseHtmlTagAttrValue(attr_name, tag):
@@ -81,7 +82,7 @@ class PluginParseError(Exception):
class SimpleHoster(Hoster):
__name__ = "SimpleHoster"
- __version__ = "0.15"
+ __version__ = "0.16"
__pattern__ = None
__type__ = "hoster"
__description__ = """Base hoster plugin"""
@@ -97,7 +98,7 @@ class SimpleHoster(Hoster):
"""
FILE_SIZE_REPLACEMENTS = []
- FILE_NAME_REPLACEMENTS = []
+ FILE_NAME_REPLACEMENTS = [("&#?\w+;", fixup)]
FILE_URL_REPLACEMENTS = []
def setup(self):
@@ -107,7 +108,7 @@ class SimpleHoster(Hoster):
pyfile.url = reSub(pyfile.url, self.FILE_URL_REPLACEMENTS)
self.html = self.load(pyfile.url, decode = True)
self.file_info = self.getFileInfo()
- if self.account:
+ if self.premium:
self.handlePremium()
else:
self.handleFree()
@@ -156,4 +157,10 @@ class SimpleHoster(Hoster):
name = parseHtmlTagAttrValue("name", input.group(1))
if name:
inputs[name] = parseHtmlTagAttrValue("value", input.group(1))
- return action, inputs \ No newline at end of file
+ return action, inputs
+
+ def checkTrafficLeft(self):
+ traffic = self.account.getAccountInfo(self.user, True)["trafficleft"]
+ size = self.pyfile.size / 1024
+ self.logInfo("Filesize: %i KiB, Traffic left for user %s: %i KiB" % (size, self.user, traffic))
+ return size <= traffic \ No newline at end of file