summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar OndrejIT <git@ondrej.it> 2016-04-26 08:24:45 +0200
committerGravatar OndrejIT <git@ondrej.it> 2016-04-26 08:24:45 +0200
commit58c8bb0632c1e5a8e9b76b086f4addd3dfa0186e (patch)
tree44657b8d7706b2c1532b1d6aea39ae200d399c74 /module
parent[misc] add 'plugin=' parameter to 'config' class to allow getting other plugi... (diff)
downloadpyload-58c8bb0632c1e5a8e9b76b086f4addd3dfa0186e.tar.xz
Fix UloTo
Diffstat (limited to 'module')
-rw-r--r--module/plugins/accounts/UlozTo.py9
-rw-r--r--module/plugins/hoster/UlozTo.py47
2 files changed, 32 insertions, 24 deletions
diff --git a/module/plugins/accounts/UlozTo.py b/module/plugins/accounts/UlozTo.py
index 2f8ffac1f..da3bb6f0c 100644
--- a/module/plugins/accounts/UlozTo.py
+++ b/module/plugins/accounts/UlozTo.py
@@ -9,16 +9,17 @@ from module.plugins.internal.Account import Account
class UlozTo(Account):
__name__ = "UlozTo"
__type__ = "account"
- __version__ = "0.16"
+ __version__ = "0.17"
__status__ = "testing"
__description__ = """Uloz.to account plugin"""
__license__ = "GPLv3"
__authors__ = [("zoidberg", "zoidberg@mujmail.cz"),
- ("pulpe", None)]
+ ("pulpe", None),
+ ("ondrej", "git@ondrej.it"),]
- TRAFFIC_LEFT_PATTERN = r'<li class="menu-kredit"><a .*?title=".+?GB = ([\d.]+) MB"'
+ TRAFFIC_LEFT_PATTERN = r'<a class="menu-kredit" href="/kredit" title="[^"]*?[MGT]+B = ([\d.]+) MB"'
def grab_info(self, user, password, data):
@@ -37,7 +38,7 @@ class UlozTo(Account):
action = re.findall('<form action="(.+?)"', login_page)[1].replace('&amp;', '&')
token = re.search('_token_" value="(.+?)"', login_page).group(1)
- html = self.load(urlparse.urljoin("https://www.ulozto.net/", action),
+ html = self.load(urlparse.urljoin("http://www.ulozto.net/", action),
post={'_token_' : token,
'do' : "loginForm-submit",
'login' : u"Přihlásit",
diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py
index cf0c48191..d1bf57835 100644
--- a/module/plugins/hoster/UlozTo.py
+++ b/module/plugins/hoster/UlozTo.py
@@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
import re
-import time
from module.plugins.internal.SimpleHoster import SimpleHoster
-from module.plugins.internal.misc import json, timestamp
+from module.plugins.internal.misc import json, timestamp, parse_name
def convert_decimal_prefix(m):
@@ -15,10 +14,12 @@ def convert_decimal_prefix(m):
class UlozTo(SimpleHoster):
__name__ = "UlozTo"
__type__ = "hoster"
- __version__ = "1.22"
+ __version__ = "1.32"
__status__ = "testing"
- __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(?:live/)?(?P<ID>\w+/[^/?]*)'
+ __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl|pornfile\.cz)/(?:live/)?(?P<ID>\w+/[^/?]*)'
+
+
__config__ = [("activated" , "bool", "Activated" , True),
("use_premium" , "bool", "Use premium account if available" , True),
("fallback" , "bool", "Fallback to free download if premium fails" , True),
@@ -28,7 +29,8 @@ class UlozTo(SimpleHoster):
__description__ = """Uloz.to hoster plugin"""
__license__ = "GPLv3"
- __authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
+ __authors__ = [("zoidberg", "zoidberg@mujmail.cz"),
+ ("ondrej", "git@ondrej.it"),]
NAME_PATTERN = r'(<p>File <strong>|<title>)(?P<N>.+?)(<| \|)'
@@ -40,18 +42,34 @@ class UlozTo(SimpleHoster):
CHECK_TRAFFIC = True
- ADULT_PATTERN = r'<form action="(.+?)" method="post" id="frm-askAgeForm">'
+ ADULT_PATTERN = r'PORNfile.cz'
PASSWD_PATTERN = r'<div class="passwordProtectedFile">'
VIPLINK_PATTERN = r'<a href=".+?\?disclaimer=1" class="linkVip">'
TOKEN_PATTERN = r'<input type="hidden" name="_token_" .*?value="(.+?)"'
- def setup(self):
+ def setup(self):
self.chunk_limit = 16 if self.premium else 1
- self.multiDL = True
+ self.multiDL = True
self.resume_download = True
+ def process(self, pyfile):
+ html = self.load(pyfile.url)
+ if re.search(self.ADULT_PATTERN, html):
+ self.log_info(_("Adult content confirmation needed"))
+
+ url = pyfile.url.replace("ulozto.net", "pornfile.cz")
+ self.load("http://pornfile.cz/porn-disclaimer",
+ post={'agree': "Confirm", 'do': 'pornDisclaimer-submit'})
+
+ html = self.load(url)
+ name = re.search(self.NAME_PATTERN, html).group(2)
+ self.pyfile.name = parse_name(name)
+
+ return super(UlozTo, self).process(pyfile)
+
+
def handle_free(self, pyfile):
action, inputs = self.parse_html_form('id="frm-downloadDialog-freeDownloadForm"')
if not action or not inputs:
@@ -106,23 +124,12 @@ class UlozTo(SimpleHoster):
def check_errors(self):
- if re.search(self.ADULT_PATTERN, self.data):
- self.log_info(_("Adult content confirmation needed"))
-
- m = re.search(self.TOKEN_PATTERN, self.data)
- if m is None:
- self.error(_("TOKEN_PATTERN not found"))
-
- self.data = self.load(pyfile.url,
- get={'do': "askAgeForm-submit"},
- post={'agree': "Confirm", '_token_': m.group(1)})
-
if self.PASSWD_PATTERN in self.data:
password = self.get_password()
if password:
self.log_info(_("Password protected link, trying ") + password)
- self.data = self.load(pyfile.url,
+ self.data = self.load(self.pyfile.url,
get={'do': "passwordProtectedForm-submit"},
post={'password': password, 'password_send': 'Send'})