summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster')
-rw-r--r--module/plugins/hoster/OneFichierCom.py59
-rw-r--r--module/plugins/hoster/OpenloadIo.py12
-rw-r--r--module/plugins/hoster/PremiumizeMe.py8
-rw-r--r--module/plugins/hoster/ShareonlineBiz.py4
-rw-r--r--module/plugins/hoster/UlozTo.py10
-rw-r--r--module/plugins/hoster/UserscloudCom.py37
-rw-r--r--module/plugins/hoster/YoutubeCom.py28
7 files changed, 120 insertions, 38 deletions
diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py
index cba67b26c..70229a6ef 100644
--- a/module/plugins/hoster/OneFichierCom.py
+++ b/module/plugins/hoster/OneFichierCom.py
@@ -2,13 +2,14 @@
import re
+from module.network.RequestFactory import getURL as get_url
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class OneFichierCom(SimpleHoster):
__name__ = "OneFichierCom"
__type__ = "hoster"
- __version__ = "0.88"
+ __version__ = "0.90"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?(?:(?P<ID1>\w+)\.)?(?P<HOST>1fichier\.com|alterupload\.com|cjoint\.net|d(es)?fichiers\.com|dl4free\.com|megadl\.fr|mesfichiers\.org|piecejointe\.net|pjointe\.com|tenvoi\.com)(?:/\?(?P<ID2>\w+))?'
@@ -28,6 +29,8 @@ class OneFichierCom(SimpleHoster):
COOKIES = [("1fichier.com", "LG", "en")]
+ DIRECT_LINK = True
+
NAME_PATTERN = r'>File\s*Name :</td>\s*<td.*>(?P<N>.+?)<'
SIZE_PATTERN = r'>Size :</td>\s*<td.*>(?P<S>[\d.,]+) (?P<U>[\w^_]+)'
OFFLINE_PATTERN = r'File not found !\s*<'
@@ -40,7 +43,61 @@ class OneFichierCom(SimpleHoster):
self.resume_download = True
+ @classmethod
+ def get_info(cls, url="", html=""):
+ redirect = url
+ for i in xrange(10):
+ try:
+ headers = dict(re.findall(r"(?P<name>.+?): (?P<value>.+?)\r?\n", get_url(redirect, just_header=True).lower()))
+ if 'location' in headers and headers['location']:
+ redirect = headers['location']
+ else:
+ if 'content-type' in headers and headers['content-type'] == "application/octet-stream":
+ if "filename=" in headers.get('content-disposition'):
+ name = dict(_i.split("=") for _i in map(str.strip, headers['content-disposition'].split(";"))[1:])['filename'].strip("\"'")
+ else:
+ name = url
+
+ info = {'name' : name,
+ 'size' : long(headers.get('content-length')),
+ 'status': 3,
+ 'url' : url}
+
+ else:
+ info = super(OneFichierCom, cls).get_info(url, html)
+
+ break
+
+ except Exception, e:
+ info = {'status' : 8,
+ 'error' : e.message}
+
+ else:
+ info = {'status' : 8,
+ 'error' : _("Too many redirects")}
+
+ return info
+
+
+ def handle_direct(self, pyfile):
+ redirect = pyfile.url
+ for i in xrange(self.get_config("maxredirs", plugin="UserAgentSwitcher")):
+
+ headers = self.load(redirect, just_header=True)
+ if 'location' in headers and headers['location']:
+ self.log_debug("Redirect #%d to: %s" % (i, redirect))
+ redirect = headers['location']
+ else:
+ if 'content-type' in headers and headers['content-type'] == "application/octet-stream":
+ self.link = pyfile.url
+ break
+ else:
+ self.fail(_("Too many redirects"))
+
+
def handle_free(self, pyfile):
+ self.check_errors()
+
id = self.info['pattern']['ID1'] or self.info['pattern']['ID2']
url, inputs = self.parse_html_form('action="https://1fichier.com/\?%s' % id)
diff --git a/module/plugins/hoster/OpenloadIo.py b/module/plugins/hoster/OpenloadIo.py
index c46462344..372ce28f9 100644
--- a/module/plugins/hoster/OpenloadIo.py
+++ b/module/plugins/hoster/OpenloadIo.py
@@ -6,25 +6,25 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class OpenloadIo(SimpleHoster):
__name__ = "OpenloadIo"
__type__ = "hoster"
- __version__ = "0.04"
+ __version__ = "0.05"
__status__ = "testing"
- __pattern__ = r'https?://(?:www\.)?openload\.io/f/[\w_-]{11}'
+ __pattern__ = r'https?://(?:www\.)?openload\.(co|io)/f/[\w-]+'
- __description__ = """Openload.io hoster plugin"""
+ __description__ = """Openload.co hoster plugin"""
__license__ = "GPLv3"
__authors__ = [(None, None)]
NAME_PATTERN = r'<span id="filename">(?P<N>.+?)</'
- SIZE_PATTERN = r'<span class="count">(?P<S>[\d.,]+) (?P<U>[\w^_]+)<'
+ SIZE_PATTERN = r'<span class="count">(?P<S>[\d.,]+) (?P<U>[\w^_]+)'
OFFLINE_PATTERN = r">(We can't find the file you are looking for)"
- LINK_FREE_PATTERN = r'id="real\w*download"><a href="(https?://[\w\.]+\.openload\.io/dl/.*?)"'
+ LINK_FREE_PATTERN = r'id="real\w*download"><a href="(https?://[\w\.]+\.openload\.co/dl/.*?)"'
def setup(self):
- self.multiDL = True
+ self.multiDL = True
self.chunk_limit = 1
diff --git a/module/plugins/hoster/PremiumizeMe.py b/module/plugins/hoster/PremiumizeMe.py
index d968eccec..e682a5a4c 100644
--- a/module/plugins/hoster/PremiumizeMe.py
+++ b/module/plugins/hoster/PremiumizeMe.py
@@ -7,7 +7,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
class PremiumizeMe(MultiHoster):
__name__ = "PremiumizeMe"
__type__ = "hoster"
- __version__ = "0.20"
+ __version__ = "0.21"
__status__ = "testing"
__pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate
@@ -44,6 +44,12 @@ class PremiumizeMe(MultiHoster):
status = data['status']
if status == 200:
+ if 'filename' in data['result']:
+ self.pyfile.name = data['result']['filename']
+
+ if 'filesize' in data['result']:
+ self.pyfile.size = data['result']['filesize']
+
self.link = data['result']['location']
return
diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py
index b5af3ea35..dbe7fe401 100644
--- a/module/plugins/hoster/ShareonlineBiz.py
+++ b/module/plugins/hoster/ShareonlineBiz.py
@@ -79,7 +79,7 @@ class ShareonlineBiz(SimpleHoster):
post={'dl_free' : "1",
'recaptcha_challenge_field': challenge,
'recaptcha_response_field' : response})
- if not res == "0":
+ if res != "0":
self.captcha.correct()
return res
else:
@@ -136,7 +136,7 @@ class ShareonlineBiz(SimpleHoster):
self.log_debug(dlinfo)
- if not dlinfo['status'] == "online":
+ if dlinfo['status'] != "online":
self.offline()
else:
pyfile.name = dlinfo['name']
diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py
index b402433a4..066d1daf0 100644
--- a/module/plugins/hoster/UlozTo.py
+++ b/module/plugins/hoster/UlozTo.py
@@ -15,7 +15,7 @@ def convert_decimal_prefix(m):
class UlozTo(SimpleHoster):
__name__ = "UlozTo"
__type__ = "hoster"
- __version__ = "1.13"
+ __version__ = "1.14"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(?:live/)?(?P<ID>\w+/[^/?]*)'
@@ -27,7 +27,7 @@ class UlozTo(SimpleHoster):
INFO_PATTERN = r'<p>File <strong>(?P<N>[^<]+)</strong> is password protected</p>'
- NAME_PATTERN = r'<title>(?P<N>[^<]+) \| Uloz\.to</title>'
+ NAME_PATTERN = r'<title>(?P<N>.+?) \|'
SIZE_PATTERN = r'<span id="fileSize">.*?(?P<S>[\d.,]+\s[kMG]?B)</span>'
OFFLINE_PATTERN = r'<title>404 - Page not found</title>|<h1 class="h1">File (has been deleted|was banned)</h1>'
@@ -68,7 +68,9 @@ class UlozTo(SimpleHoster):
#: New version - better to get new parameters (like captcha reload) because of image url - since 6.12.2013
self.log_debug('Using "new" version')
- xapca = self.load("http://www.ulozto.net/reloadXapca.php", get={'rnd': str(int(time.time()))})
+ xapca = self.load("http://www.ulozto.net/reloadXapca.php",
+ get={'rnd': str(int(time.time()))})
+ xapca = xapca.replace('sound":"', 'sound":"http:').replace('image":"', 'image":"http:')
self.log_debug("xapca = " + str(xapca))
data = json_loads(xapca)
@@ -121,7 +123,7 @@ class UlozTo(SimpleHoster):
def check_file(self):
check = self.check_download({
- 'wrong_captcha': re.compile(r'<ul class="error">\s*<li>Error rewriting the text.</li>'),
+ 'wrong_captcha': ">An error ocurred while verifying the user",
'offline' : re.compile(self.OFFLINE_PATTERN),
'passwd' : self.PASSWD_PATTERN,
'server_error' : 'src="http://img.ulozto.cz/error403/vykricnik.jpg"', #: Paralell dl, server overload etc.
diff --git a/module/plugins/hoster/UserscloudCom.py b/module/plugins/hoster/UserscloudCom.py
new file mode 100644
index 000000000..ebaed4859
--- /dev/null
+++ b/module/plugins/hoster/UserscloudCom.py
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class UserscloudCom(SimpleHoster):
+ __name__ = "UserscloudCom"
+ __type__ = "hoster"
+ __version__ = "0.01"
+ __status__ = "testing"
+
+ __pattern__ = r'https?://(?:www\.)?userscloud\.com/\w{12}'
+
+ __description__ = """Userscloud.com hoster plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("GammaC0de", None)]
+
+
+ NAME_PATTERN = r'<h2 class="strong margin-none">(?P<N>.+?)<'
+ SIZE_PATTERN = r'<div class="ribbon">(?P<S>[\d.,]+) (?P<U>[\w^_]+)<'
+ OFFLINE_PATTERN = r'The file you are trying to download is no longer available'
+
+
+ def setup(self):
+ self.multiDL = True
+ self.resume_download = False
+ self.chunk_limit = 1
+
+
+ def handle_free(self, pyfile):
+ self.download(pyfile.url,
+ post=dict(re.findall(r'<input type="hidden" name="(.+?)" value="(.*?)">', self.html)))
+
+
+getInfo = create_getInfo(UserscloudCom)
diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py
index 86cca7cf1..5c7c13962 100644
--- a/module/plugins/hoster/YoutubeCom.py
+++ b/module/plugins/hoster/YoutubeCom.py
@@ -6,37 +6,17 @@ import subprocess
import urllib
from module.plugins.internal.Hoster import Hoster
-from module.plugins.internal.Plugin import replace_patterns
+from module.plugins.internal.Plugin import replace_patterns, which
from module.utils import html_unescape
-def which(program):
- """
- Works exactly like the unix command which
- Courtesy of http://stackoverflow.com/a/377028/675646
- """
- isExe = lambda x: os.path.isfile(x) and os.access(x, os.X_OK)
-
- fpath, fname = os.path.split(program)
-
- if fpath:
- if isExe(program):
- return program
- else:
- for path in os.environ['PATH'].split(os.pathsep):
- path = path.strip('"')
- exe_file = os.path.join(path, program)
- if isExe(exe_file):
- return exe_file
-
-
class YoutubeCom(Hoster):
__name__ = "YoutubeCom"
__type__ = "hoster"
- __version__ = "0.45"
+ __version__ = "0.46"
__status__ = "testing"
- __pattern__ = r'https?://(?:[^/]*\.)?(youtube\.com|youtu\.be)/watch\?(?:.*&)?v=.+'
+ __pattern__ = r'https?://(?:[^/]*\.)?(youtu\.be/|youtube\.com/watch\?(?:.*&)?v=)\w+'
__config__ = [("quality", "sd;hd;fullhd;240p;360p;480p;720p;1080p;3072p", "Quality Setting" , "hd" ),
("fmt" , "int" , "FMT/ITAG Number (0 for auto)", 0 ),
(".mp4" , "bool" , "Allow .mp4" , True ),
@@ -51,7 +31,7 @@ class YoutubeCom(Hoster):
("zoidberg", "zoidberg@mujmail.cz")]
- URL_REPLACEMENTS = [(r'youtu\.be/', 'youtube.com/')]
+ URL_REPLACEMENTS = [(r'youtu\.be/', 'youtube.com/watch?v=')]
#: Invalid characters that must be removed from the file name
invalid_chars = u'\u2605:?><"|\\'