summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar zoidberg10 <zoidberg@mujmail.cz> 2011-11-22 00:26:08 +0100
committerGravatar zoidberg10 <zoidberg@mujmail.cz> 2011-11-22 00:26:08 +0100
commit9378237ddc39f8ee96e7a3ddb9cc37ce487c5f4d (patch)
tree325aba4194c29ee7869f662e1b8f8b5015afd283 /module/plugins
parentSimpleHoster fix (diff)
downloadpyload-9378237ddc39f8ee96e7a3ddb9cc37ce487c5f4d.tar.xz
fix filepost (#431), hellspy, ifolder, letitbit, change SimpleHoster patterns
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/accounts/HellspyCz.py19
-rw-r--r--module/plugins/hoster/BezvadataCz.py20
-rw-r--r--module/plugins/hoster/CzshareCom.py6
-rw-r--r--module/plugins/hoster/DataportCz.py22
-rw-r--r--module/plugins/hoster/DepositfilesCom.py4
-rw-r--r--module/plugins/hoster/EdiskCz.py46
-rw-r--r--module/plugins/hoster/FilejungleCom.py19
-rw-r--r--module/plugins/hoster/FilepostCom.py28
-rw-r--r--module/plugins/hoster/FlyshareCz.py78
-rw-r--r--module/plugins/hoster/FourSharedCom.py8
-rw-r--r--module/plugins/hoster/HellshareCz.py22
-rw-r--r--module/plugins/hoster/HellspyCz.py47
-rw-r--r--module/plugins/hoster/IfileIt.py19
-rw-r--r--module/plugins/hoster/IfolderRu.py25
-rw-r--r--module/plugins/hoster/LetitbitNet.py42
-rw-r--r--module/plugins/hoster/MediafireCom.py7
-rw-r--r--module/plugins/hoster/MegasharesCom.py21
-rw-r--r--module/plugins/hoster/MultishareCz.py20
-rw-r--r--module/plugins/hoster/QuickshareCz.py27
-rw-r--r--module/plugins/hoster/SendspaceCom.py20
-rw-r--r--module/plugins/hoster/ShareRapidCom.py6
-rw-r--r--module/plugins/hoster/SpeedfileCz.py29
-rw-r--r--module/plugins/hoster/StahnuTo.py6
-rw-r--r--module/plugins/hoster/UlozTo.py4
-rw-r--r--module/plugins/hoster/UloziskoSk.py20
-rw-r--r--module/plugins/hoster/UploadhereCom.py9
-rw-r--r--module/plugins/hoster/UploadkingCom.py21
-rw-r--r--module/plugins/internal/SimpleHoster.py12
28 files changed, 173 insertions, 434 deletions
diff --git a/module/plugins/accounts/HellspyCz.py b/module/plugins/accounts/HellspyCz.py
index c07fd748a..5f14a093e 100644
--- a/module/plugins/accounts/HellspyCz.py
+++ b/module/plugins/accounts/HellspyCz.py
@@ -29,8 +29,7 @@ class HellspyCz(Account):
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
- ACTION_PATTERN = r'<div id="snippet--loginBoxSn"><form[^>]*action="([^"]+user_hash=([^"]+))">'
- CREDIT_LEFT_PATTERN = r'<strong class="text-credits">(\d+)</strong>'
+ CREDIT_LEFT_PATTERN = r'<strong>Credits: </strong>\s*(\d+)'
WRONG_PASSWORD_PATTERN = r'<p class="block-error-3 marg-tb-050">\s*Wrong user or password was entered<br />'
phpsessid = ''
@@ -50,16 +49,13 @@ class HellspyCz(Account):
return {"validuntil": -1, "trafficleft": credits}
def login(self, user, data,req):
- html = req.load('http://www.hellspy.com/')
- found = re.search(self.ACTION_PATTERN, html)
- if found is None:
- self.logError('Parse error (FORM)')
- action, self.phpsessid = found.group(1).replace('&amp;','&'), found.group(2)
-
+ header = req.load('http://www.hellspy.com/', just_header = True)
+ self.phpsessid = re.search(r'PHPSESSID=(\w+)', header).group(1)
self.logDebug("PHPSESSID:" + self.phpsessid)
+
html = req.load("http://www.hellspy.com/--%s-" % self.phpsessid)
- html = req.load(action, post={
+ html = req.load("http://www.hell-share.com/user/login/?do=apiLoginForm-submit&api_hash=hellspy_iq&user_hash=%s" % self.phpsessid, post={
"login": "1",
"password": data["password"],
"username": user,
@@ -70,10 +66,5 @@ class HellspyCz(Account):
cj = self.getAccountCookies(user)
cj.setCookie(".hellspy.com", "PHPSESSID", self.phpsessid)
- self.logDebug(req.lastURL)
- self.logDebug(req.lastEffectiveURL)
-
- html = req.load("http://www.hellspy.com/", get = {"do":"loginBox-login"})
-
if not re.search(self.CREDIT_LEFT_PATTERN, html):
self.wrongPassword() \ No newline at end of file
diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py
index 4c198d95f..f061fa2b5 100644
--- a/module/plugins/hoster/BezvadataCz.py
+++ b/module/plugins/hoster/BezvadataCz.py
@@ -17,29 +17,19 @@
"""
import re
-from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
-from module.network.RequestFactory import getURL
-
-def getInfo(urls):
- result = []
-
- for url in urls:
- file_info = parseFileInfo(BezvadataCz, url, getURL(url, decode=True))
- result.append(file_info)
-
- yield result
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class BezvadataCz(SimpleHoster):
__name__ = "BezvadataCz"
__type__ = "hoster"
__pattern__ = r"http://(\w*\.)*bezvadata.cz/stahnout/.*"
- __version__ = "0.21"
+ __version__ = "0.22"
__description__ = """BezvaData.cz"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
- FILE_NAME_PATTERN = r'<p><b>Soubor: ([^<]+)</b></p>'
- FILE_SIZE_PATTERN = r'<li><strong>Velikost:</strong> ([0-9.]+) ([kKMG]i?B)</li>'
+ FILE_NAME_PATTERN = r'<p><b>Soubor: (?P<N>[^<]+)</b></p>'
+ FILE_SIZE_PATTERN = r'<li><strong>Velikost:</strong> (?P<S>[0-9.]+) (?P<U>[kKMG])i?)</li>'
FILE_OFFLINE_PATTERN = r'<title>BezvaData \| Soubor nenalezen</title>'
DOWNLOAD_FORM_PATTERN = r'<form class="download" action="([^"]+)" method="post" id="frm-stahnoutForm">'
@@ -50,4 +40,6 @@ class BezvadataCz(SimpleHoster):
self.logDebug("Download form: %s" % url)
self.download(url, post = {"stahnoutSoubor": "St%C3%A1hnout"}, cookies = True)
+
+getInfo = create_getInfo(BezvadataCz)
\ No newline at end of file
diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py
index 3684e5f53..1a705e302 100644
--- a/module/plugins/hoster/CzshareCom.py
+++ b/module/plugins/hoster/CzshareCom.py
@@ -45,7 +45,7 @@ class CzshareCom(SimpleHoster):
__name__ = "CzshareCom"
__type__ = "hoster"
__pattern__ = r"http://(\w*\.)*czshare\.(com|cz)/(\d+/|download.php\?).*"
- __version__ = "0.83"
+ __version__ = "0.84"
__description__ = """CZshare.com"""
__author_name__ = ("zoidberg")
@@ -58,8 +58,8 @@ class CzshareCom(SimpleHoster):
FILE_OFFLINE_PATTERN = r'<div class="header clearfix">\s*<h2 class="red">'
MULTIDL_PATTERN = r"<p><font color='red'>Z[^<]*PROFI.</font></p>"
#FILE_NAME_PATTERN = r'<h1>([^<]+)<span>&nbsp;</span></h1>'
- FILE_NAME_PATTERN = r'<div class="tab" id="parameters">\s*<p>\s*Cel. n.zev: <a href=[^>]*>([^<]+)</a>'
- FILE_SIZE_PATTERN = r'<div class="tab" id="category">(?:\s*<p>[^\n]*</p>)*\s*Velikost:\s*([0-9., ]+)([kKMG]i?B)\s*</div>'
+ 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>'
USER_CREDIT_PATTERN = r'<div class="credit">\s*kredit: <strong>([0-9., ]+)([kKMG]i?B)</strong>\s*</div><!-- .credit -->'
def setup(self):
diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py
index ed4ffa07c..487766201 100644
--- a/module/plugins/hoster/DataportCz.py
+++ b/module/plugins/hoster/DataportCz.py
@@ -17,28 +17,18 @@
"""
import re
-from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
-from module.network.RequestFactory import getURL
-
-def getInfo(urls):
- result = []
-
- for url in urls:
- file_info = parseFileInfo(DataportCz, url, getURL(url, decode=True))
- result.append(file_info)
-
- yield result
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class DataportCz(SimpleHoster):
__name__ = "DataportCz"
__type__ = "hoster"
__pattern__ = r"http://.*dataport.cz/file/.*"
- __version__ = "0.32"
+ __version__ = "0.33"
__description__ = """Dataport.cz plugin - free only"""
__author_name__ = ("zoidberg")
- FILE_NAME_PATTERN = r'<h2 style="color: red;">([^<]+)</h2>'
- FILE_SIZE_PATTERN = r'<td>Velikost souboru:</td>\s*<td>([0-9.]+)([kKMG]i?B)</td>'
+ FILE_NAME_PATTERN = r'<h2 style="color: red;">(?P<N>[^<]+)</h2>'
+ FILE_SIZE_PATTERN = r'<td>Velikost souboru:</td>\s*<td>(?P<S>[0-9.]+)(?P<U>[kKMG])i?B</td>'
URL_PATTERN = r'<td><a href="([^"]+)"[^>]*class="ui-state-default button hover ui-corner-all "><strong>'
NO_SLOTS_PATTERN = r'<td><a href="http://dataport.cz/kredit/"[^>]*class="ui-state-default button hover ui-corner-all ui-state-disabled">'
FILE_OFFLINE_PATTERN = r'<h2>Soubor nebyl nalezen</h2>'
@@ -54,4 +44,6 @@ class DataportCz(SimpleHoster):
self.fail("Parse error (URL)")
download_url = found.group(1)
- self.download(download_url) \ No newline at end of file
+ self.download(download_url)
+
+create_getInfo(DataportCz) \ No newline at end of file
diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py
index 13a8abe03..87e5e7254 100644
--- a/module/plugins/hoster/DepositfilesCom.py
+++ b/module/plugins/hoster/DepositfilesCom.py
@@ -20,12 +20,12 @@ class DepositfilesCom(SimpleHoster):
__name__ = "DepositfilesCom"
__type__ = "hoster"
__pattern__ = r"http://[\w\.]*?depositfiles\.com(/\w{1,3})?/files/[\w]+"
- __version__ = "0.35"
+ __version__ = "0.36"
__description__ = """Depositfiles.com Download Hoster"""
__author_name__ = ("spoob", "zoidberg")
__author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz")
- FILE_INFO_PATTERN = r'File name: <b title="([^"]+)">.*\s*<span class="nowrap">File size: <b>([0-9.]+)&nbsp;([kKMG]i?B)</b>'
+ FILE_INFO_PATTERN = r'File name: <b title="(?P<N>[^"]+)">.*\s*<span class="nowrap">File size: <b>(?P<S>[0-9.]+)&nbsp;(?P<U>[kKMG])i?B</b>'
FILE_OFFLINE_PATTERN = r'<span class="html_download_api-not_exists"></span>'
RECAPTCHA_PATTERN = r"Recaptcha.create\('([^']+)', this\);"
DOWNLOAD_LINK_PATTERN = r'<form action="(http://.+?\.depositfiles.com/.+?)" method="get"'
diff --git a/module/plugins/hoster/EdiskCz.py b/module/plugins/hoster/EdiskCz.py
index f5291547f..a253be0d9 100644
--- a/module/plugins/hoster/EdiskCz.py
+++ b/module/plugins/hoster/EdiskCz.py
@@ -17,36 +17,18 @@
"""
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, decode=True)
- if re.search(EdiskCz.FILE_OFFLINE_PATTERN, html):
- # File offline
- result.append((url, 0, 1, url))
- else:
- # Get file info
- found = re.search(EdiskCz.FILE_NAME_PATTERN, html)
- if found is not None:
- name = found.group(1)
- result.append((name, 0, 2, url))
- yield result
-
-
-class EdiskCz(Hoster):
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+class EdiskCz(SimpleHoster):
__name__ = "EdiskCz"
__type__ = "hoster"
__pattern__ = r"http://(\w*\.)?edisk.(cz|sk|eu)/(stahni|sk/stahni|en/download)/.*"
- __version__ = "0.2"
+ __version__ = "0.21"
__description__ = """Edisk.cz"""
__author_name__ = ("zoidberg")
URL_PATTERN = r'<form name = "formular" action = "([^"]+)" method = "post">'
- FILE_NAME_PATTERN = r'<span class="fl" title="([^"]+)">'
+ FILE_INFO_PATTERN = r'<span class="fl" title="(?P<N>[^"]+)">\s*.*?\((?P<S>[0-9.]*) (?P<U>[kKMG])i?B\)</h1></span>'
ACTION_PATTERN = r'/en/download/(\d+/.*\.html)'
DLLINK_PATTERN = r'http://.*edisk.cz.*\.html'
FILE_OFFLINE_PATTERN = r'<h3>This file does not exist due to one of the following:</h3><ul><li>'
@@ -60,21 +42,11 @@ class EdiskCz(Hoster):
self.logDebug('URL:' + url)
found = re.search(self.ACTION_PATTERN, url)
- if found is None:
- self.fail("Parse error (ACTION)")
+ if found is None: self.parseError("ACTION")
action = found.group(1)
self.html = self.load(url, decode=True)
-
- if re.search(self.FILE_OFFLINE_PATTERN, self.html) is not None:
- self.offline()
-
- found = re.search(self.FILE_NAME_PATTERN, self.html)
- if found is None:
- self.fail("Parse error (FILENAME)")
- pyfile.name = found.group(1)
-
- self.logDebug('NAME:' + pyfile.name)
+ self.getFileInfo()
self.html = self.load(re.sub("/en/download/", "/en/download-slow/", url))
@@ -85,4 +57,6 @@ class EdiskCz(Hoster):
if not re.match(self.DLLINK_PATTERN, url):
self.fail("Unexpected server response")
- self.download(url) \ No newline at end of file
+ self.download(url)
+
+getInfo = create_getInfo(EdiskCz) \ No newline at end of file
diff --git a/module/plugins/hoster/FilejungleCom.py b/module/plugins/hoster/FilejungleCom.py
index 597d1aa3f..b880086a6 100644
--- a/module/plugins/hoster/FilejungleCom.py
+++ b/module/plugins/hoster/FilejungleCom.py
@@ -17,29 +17,20 @@
"""
import re
-from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.network.RequestFactory import getURL
from module.plugins.ReCaptcha import ReCaptcha
-def getInfo(urls):
- result = []
-
- for url in urls:
- file_info = parseFileInfo(FilejungleCom, url, getURL(url, decode=True))
- result.append(file_info)
-
- yield result
-
class FilejungleCom(SimpleHoster):
__name__ = "FilejungleCom"
__type__ = "hoster"
__pattern__ = r"http://(?:www\.)?filejungle\.com/f/([^/]+).*"
- __version__ = "0.22"
+ __version__ = "0.23"
__description__ = """Filejungle.com plugin - free only"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
- FILE_INFO_PATTERN = r'<div id="file_name">([^<]+) <span class="filename_normal">\(([0-9.]+) (KB|MB|GB)\)</span></div>'
+ FILE_INFO_PATTERN = r'<div id="file_name">(?P<N>[^<]+) <span class="filename_normal">\((?P<S>[0-9.]+) (?P<U>[kKMG])i?B\)</span></div>'
FILE_OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. </div>'
RECAPTCHA_KEY_PATTERN = r"var reCAPTCHA_publickey='([^']+)'"
WAIT_TIME_PATTERN = r'<h1>Please wait for (\d+) seconds to download the next file\.</h1>'
@@ -89,4 +80,6 @@ class FilejungleCom(SimpleHoster):
self.wait()
response = self.load(url, post = {"downloadLink" : "show"})
- self.download(url, post = {"download" : "normal"}) \ No newline at end of file
+ self.download(url, post = {"download" : "normal"})
+
+getInfo = create_getInfo(FilejungleCom) \ No newline at end of file
diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py
index 779eef1d2..42ec0788b 100644
--- a/module/plugins/hoster/FilepostCom.py
+++ b/module/plugins/hoster/FilepostCom.py
@@ -17,44 +17,36 @@
"""
import re
-from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.network.RequestFactory import getURL
from module.plugins.ReCaptcha import ReCaptcha
from module.common.json_layer import json_loads
from time import time
-def getInfo(urls):
- result = []
-
- for url in urls:
- file_info = parseFileInfo(FilepostCom, url, getURL(url, decode=True))
- result.append(file_info)
-
- yield result
-
class FilepostCom(SimpleHoster):
__name__ = "FilepostCom"
__type__ = "hoster"
__pattern__ = r"https?://(?:www\.)?filepost\.com/files/([^/]+).*"
- __version__ = "0.22"
+ __version__ = "0.23"
__description__ = """Filepost.com plugin - free only"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
- FILE_INFO_PATTERN = r'<h1>([^<]+)</h1>\s*<div class="ul">\s*<ul>\s*<li><span>Size:</span> ([0-9.]+) (KB|MB|GB)</li>'
+ FILE_INFO_PATTERN = r'<h1>(?P<N>[^<]+)</h1>\s*<div class="ul">\s*<ul>\s*<li><span>Size:</span> (?P<S>[0-9.]+) (?P<U>[kKMG])i?B</li>'
FILE_OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. </div>'
RECAPTCHA_KEY_PATTERN = r"Captcha.init\({\s*key:\s*'([^']+)'"
- FLP_TOKEN_PATTERN = r"store.set\('flp_token', '([^']+)'\);"
+ FLP_TOKEN_PATTERN = r"store.set\('(?:flp_)?token', '([^']+)'\);"
def handleFree(self):
# Find token and captcha key
file_id = re.search(self.__pattern__, self.pyfile.url).group(1)
+
found = re.search(self.FLP_TOKEN_PATTERN, self.html)
- if not found: self.fail("Parse error (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.fail("Parse error (captcha key)")
+ if not found: self.parseError("Captcha key")
captcha_key = found.group(1)
url = 'https://filepost.com/files/get/'
@@ -68,7 +60,7 @@ class FilepostCom(SimpleHoster):
self.setWait(int(json_response['js']['answer']['wait_time']))
except Exception, e:
self.logError(e)
- self.fail("Parse error (wait time)")
+ self.self.parseError("Wait time")
self.wait()
# Solve recaptcha
@@ -93,4 +85,6 @@ class FilepostCom(SimpleHoster):
else: self.fail("Invalid captcha")
# Download
- self.download(download_url) \ No newline at end of file
+ self.download(download_url)
+
+getInfo = create_getInfo(FilepostCom) \ No newline at end of file
diff --git a/module/plugins/hoster/FlyshareCz.py b/module/plugins/hoster/FlyshareCz.py
deleted file mode 100644
index fc7e9f13b..000000000
--- a/module/plugins/hoster/FlyshareCz.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# -*- 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: zoidberg
-"""
-
-import re
-from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
-from module.network.RequestFactory import getURL
-
-def getInfo(urls):
- result = []
-
- for url in urls:
- file_info = parseFileInfo(FlyshareCz, url, getURL(url, decode=True))
- result.append(file_info)
-
- yield result
-
-class FlyshareCz(SimpleHoster):
- __name__ = "FlyshareCz"
- __type__ = "hoster"
- __pattern__ = r"http://.*flyshare.cz/stahni/.*"
- __version__ = "0.31"
- __description__ = """flyshare.cz"""
- __author_name__ = ("zoidberg")
-
- FILE_NAME_PATTERN = r'<p><span class="filename">([^<]+)</span>'
- ERR_PATTERN = r'<p class="errorreport_error">Chyba: ([^<]+)</p>'
- FILE_OFFLINE_PATTERN = r'<p class="errorreport_error">Chyba: File is not available on the server</p>'
-
- def process(self, pyfile):
- self.html = self.load(pyfile.url, decode=True)
-
- found = re.search(self.ERR_PATTERN, self.html)
- if found is not None:
- err_dsc = found.group(1)
- if err_dsc == "Too many simultaneous downloads, try again later":
- self.waitForFreeSlot()
- elif err_dsc == "File is not available on the server":
- self.offline()
- else:
- self.fail(err_dsc)
-
- self.getFileInfo()
- self.handleFree()
-
- def handleFree(self):
- self.download(self.pyfile.url, post={
- "wmod_command": "wmod_fileshare3:startDownload",
- "method": "free"
- })
-
- check = self.checkDownload({
- "sim_dl": '<p class="errorreport_error">Chyba: Too many simultaneous downloads, try again later</p>'
- })
-
- if check == "sim_dl":
- self.waitForFreeSlot()
-
- def waitForFreeSlot(self):
- self.setWait(600, True)
- self.wait()
- self.retry()
-
-
diff --git a/module/plugins/hoster/FourSharedCom.py b/module/plugins/hoster/FourSharedCom.py
index 1c12a2d34..4680088d9 100644
--- a/module/plugins/hoster/FourSharedCom.py
+++ b/module/plugins/hoster/FourSharedCom.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-from module.plugins.internal.SimpleHoster import SimpleHoster
+from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
from module.network.RequestFactory import getURL
import re
@@ -20,13 +20,13 @@ class FourSharedCom(SimpleHoster):
__name__ = "FourSharedCom"
__type__ = "hoster"
__pattern__ = r"http://[\w\.]*?4shared(-china)?\.com/(account/)?(download|get|file|document|photo|video|audio)/.+?/.*"
- __version__ = "0.21"
+ __version__ = "0.22"
__description__ = """4Shared Download Hoster"""
__author_name__ = ("jeix", "zoidberg")
__author_mail__ = ("jeix@hasnomail.de", "zoidberg@mujmail.cz")
- FILE_NAME_PATTERN = '<meta name="title" content="([^"]+)" />'
- FILE_SIZE_PATTERN = '<span title="Size: ([0-9,.]+) ([kKMG]i?B)">'
+ FILE_NAME_PATTERN = '<meta name="title" content="(?P<N>[^"]+)" />'
+ FILE_SIZE_PATTERN = '<span title="Size: (?P<S>[0-9,.]+) (?P<U>[kKMG])i?B">'
FILE_OFFLINE_PATTERN = 'The file link that you requested is not valid\.|This file was deleted.'
FREE_LINK_PATTERN = '<a href="([^"]+)" class="dbtn"'
DOWNLOAD_URL_PATTERN = "<div class=\"(?:dl|xxlarge bold)\">\s*<a href='([^']+)'"
diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py
index c969d3285..cc8341f8e 100644
--- a/module/plugins/hoster/HellshareCz.py
+++ b/module/plugins/hoster/HellshareCz.py
@@ -18,30 +18,22 @@
import re
import datetime
-from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
+from math import ceil
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.network.RequestFactory import getURL
-def getInfo(urls):
- result = []
-
- for url in urls:
- file_info = parseFileInfo(HellshareCz, url, getURL(url, decode=True))
- result.append(file_info)
-
- yield result
-
class HellshareCz(SimpleHoster):
__name__ = "HellshareCz"
__type__ = "hoster"
__pattern__ = r"(http://(?:.*\.)*hellshare\.(?:cz|com|sk|hu)/[^?]*/\d+).*"
- __version__ = "0.75"
+ __version__ = "0.76"
__description__ = """Hellshare.cz"""
__author_name__ = ("zoidberg")
FREE_URL_PATTERN = r'<form[^>]*action="(http://free\d*\.helldata[^"]*)"'
PREMIUM_URL_PATTERN = r"launchFullDownload\('([^']*)'\);"
- FILE_NAME_PATTERN = r'<h1 id="filename">([^<]+)</h1>'
- FILE_SIZE_PATTERN = r'<td><span>Size</span></td>\s*<th><span>([0-9.]*)&nbsp;(kB|KB|MB|GB)</span></th>'
+ FILE_NAME_PATTERN = r'<h1 id="filename">(?P<N>[^<]+)</h1>'
+ FILE_SIZE_PATTERN = r'<td><span>Size</span></td>\s*<th><span>(?P<S>[0-9.]*)&nbsp;(?P<U>[kKMG])i?B</span></th>'
FILE_OFFLINE_PATTERN = r'<h1>File not found.</h1>'
CAPTCHA_PATTERN = r'<img class="left" id="captcha-img"src="([^"]*)" />'
#FILE_CREDITS_PATTERN = r'<strong class="filesize">(\d+) MB</strong>'
@@ -128,4 +120,6 @@ class HellshareCz(SimpleHoster):
self.download(download_url)
info = self.account.getAccountInfo(self.user, True)
- self.logInfo("User %s has %i credits left" % (self.user, info["trafficleft"] / 1024)) \ No newline at end of file
+ self.logInfo("User %s has %i credits left" % (self.user, info["trafficleft"] / 1024))
+
+getInfo = create_getInfo(HellshareCz) \ No newline at end of file
diff --git a/module/plugins/hoster/HellspyCz.py b/module/plugins/hoster/HellspyCz.py
index e1077a0cb..6d3f84b55 100644
--- a/module/plugins/hoster/HellspyCz.py
+++ b/module/plugins/hoster/HellspyCz.py
@@ -17,6 +17,7 @@
"""
import re
+from math import ceil
from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
from module.network.RequestFactory import getURL
@@ -33,17 +34,15 @@ class HellspyCz(SimpleHoster):
__name__ = "HellspyCz"
__type__ = "hoster"
__pattern__ = r"http://(?:\w*\.)*hellspy\.(?:cz|com|sk|hu)(/\S+/\d+)/?.*"
- __version__ = "0.21"
+ __version__ = "0.22"
__description__ = """HellSpy.cz"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
- FILE_NAME_PATTERN = r'<h1 class="text-yellow-1 " "><span ><span class="text" title="">([^<]+)</span></span></h1>'
+ FILE_INFO_PATTERN = '<span class="filesize right">(?P<S>[0-9.]+) <span>(?P<U>[kKMG])i?B</span></span>\s*<h1>(?P<N>[^<]+)</h1>'
FILE_OFFLINE_PATTERN = r'<h2>(404 - Page|File) not found</h2>'
- FILE_CREDITS_PATTERN = r'<span class="text-credit-taken-1">\s*<span class="text-size"><span class="hidden">Size: </span>(\S+) (kB|MB|GB)</span>\s*<span >\((\d+) credits\)</span>'
- CREDIT_LEFT_PATTERN = r'<strong class="text-credits">(\d+)</strong>'
-
- PREMIUM_URL_PATTERN = r"launchFullDownload\('(http://[^']+)',\s*\d*\);"
+ CREDIT_LEFT_PATTERN = r'<strong>Credits: </strong>\s*(\d+)'
+ PREMIUM_URL_PATTERN = r'<a href="([^"]+)" class="ajax button button-blue button-download"'
DOWNLOAD_AGAIN_PATTERN = r'<a id="button-download-start"[^>]*title="You can download the file without deducting your credit.">'
def setup(self):
@@ -51,8 +50,7 @@ class HellspyCz(SimpleHoster):
self.chunkLimit = 1
def process(self, pyfile):
- if not self.premium: self.fail("Only premium users can download from HellSpy.cz")
- if not self.account: self.fail("Not logged in")
+ if not self.account: self.fail("Only premium users can download from HellSpy.cz")
# set PHPSESSID cookie
cj = self.account.getAccountCookies(self.user)
@@ -65,33 +63,20 @@ class HellspyCz(SimpleHoster):
# load html
rel_url = re.search(self.__pattern__, pyfile.url).group(1)
self.html = self.load("http://www.hellspy.com/--%s-/%s" % (self.account.phpsessid, rel_url), decode = True)
+
+ self.getFileInfo()
- # get premium download URL
- download_url = self.getPremiumURL()
- if download_url is None:
- self.checkFile(pyfile)
- self.html = self.load("http://www.hellspy.com/%s?download=1" % rel_url)
- download_url = self.getPremiumURL()
-
- # download
- if download_url is None: self.fail("Parse error (DOWNLOAD URL)")
+ # get premium download URL and download
+ found = re.search(self.PREMIUM_URL_PATTERN, self.html)
+ if not found: self.parseError('Download URL')
+ download_url = "http://www.hellspy.cz" + found.group(1)
self.logDebug("Download URL: " + download_url)
self.download(download_url, disposition = True)
info = self.account.getAccountInfo(self.user)
self.logInfo("User %s has %i credits left" % (self.user, info["trafficleft"]/1024))
- def checkFile(self, pyfile):
- # marks the file as "offline" when the pattern was found on the html-page
- if re.search(self.FILE_OFFLINE_PATTERN, self.html) is not None:
- self.offline()
-
- # parse the name from the site and set attribute in pyfile
- found = re.search(self.FILE_NAME_PATTERN, self.html)
- if found is None:
- self.fail("Parse error (FILENAME)")
- pyfile.name = found.group(1)
-
+ """
# parse credits left info
found = re.search(self.CREDIT_LEFT_PATTERN, self.html)
if found is None:
@@ -111,8 +96,4 @@ class HellspyCz(SimpleHoster):
file_credits = int(found.group(3))
if file_credits > credits_left: self.fail("Not enough credits left to download file")
self.logInfo("Premium download for %i credits" % file_credits)
-
-
- def getPremiumURL(self):
- found = re.search(self.PREMIUM_URL_PATTERN, self.html)
- return found.group(1) if found else None \ No newline at end of file
+ """
diff --git a/module/plugins/hoster/IfileIt.py b/module/plugins/hoster/IfileIt.py
index 3bc60220a..b0e60d25a 100644
--- a/module/plugins/hoster/IfileIt.py
+++ b/module/plugins/hoster/IfileIt.py
@@ -17,25 +17,16 @@
"""
import re
-from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
+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
-def getInfo(urls):
- result = []
-
- for url in urls:
- file_info = parseFileInfo(IfileIt, url, getURL(url, decode=True))
- result.append(file_info)
-
- yield result
-
class IfileIt(SimpleHoster):
__name__ = "IfileIt"
__type__ = "hoster"
__pattern__ = r"http://(?:\w*\.)*ifile\.it/(\w+).*"
- __version__ = "0.22"
+ __version__ = "0.23"
__description__ = """Ifile.it"""
__author_name__ = ("zoidberg")
@@ -43,7 +34,7 @@ class IfileIt(SimpleHoster):
#DEC_PATTERN = r"requestBtn_clickEvent[^}]*url:\s*([^,]+)"
DOWNLOAD_LINK_PATTERN = r'</span> If it doesn\'t, <a target="_blank" href="([^"]+)">'
RECAPTCHA_KEY_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';"
- FILE_INFO_PATTERN = r'<span style="cursor: default;[^>]*>\s*(.*?)\s*&nbsp;\s*<strong>\s*([0-9.]+)\s*([kKMG]i?B)\s*</strong>\s*</span>'
+ 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'$\("#errorPnl"\)\.empty\(\)\.append\( "no such file" \);'
def handleFree(self):
@@ -79,4 +70,6 @@ class IfileIt(SimpleHoster):
self.html = self.load(self.pyfile.url)
download_url = re.search(self.DOWNLOAD_LINK_PATTERN, self.html).group(1)
- self.download(download_url) \ No newline at end of file
+ self.download(download_url)
+
+getInfo = create_getInfo(IfileIt) \ No newline at end of file
diff --git a/module/plugins/hoster/IfolderRu.py b/module/plugins/hoster/IfolderRu.py
index 8a8e18282..3177271c4 100644
--- a/module/plugins/hoster/IfolderRu.py
+++ b/module/plugins/hoster/IfolderRu.py
@@ -18,35 +18,26 @@
import re
from urllib import quote
-from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.network.RequestFactory import getURL
-def getInfo(urls):
- result = []
-
- for url in urls:
- file_info = parseFileInfo(IfolderRu, url, getURL(url, decode=True))
- result.append(file_info)
-
- yield result
-
class IfolderRu(SimpleHoster):
__name__ = "IfolderRu"
__type__ = "hoster"
__pattern__ = r"http://(?:\w*\.)?ifolder.ru/(\d+).*"
- __version__ = "0.32"
+ __version__ = "0.33"
__description__ = """ifolder.ru"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
SIZE_UNITS = {u'Кб': 1, u'Мб': 2, u'Гб': 3}
- FILE_NAME_PATTERN = ur'(?:<div><span>)?Название:(?:</span>)? <b>([^<]+)</b><(?:/div|br)>'
- FILE_SIZE_PATTERN = ur'(?:<div><span>)?Размер:(?:</span>)? <b>([0-9.]+) ([^<]+)</b><(?:/div|br)>'
+ FILE_NAME_PATTERN = ur'(?:<div><span>)?Название:(?:</span>)? <b>(?P<N>[^<]+)</b><(?:/div|br)>'
+ FILE_SIZE_PATTERN = ur'(?:<div><span>)?Размер:(?:</span>)? <b>(?P<S>[0-9.]+) (?P<U>[^<]+)</b><(?:/div|br)>'
SESSION_ID_PATTERN = r'<a href=(http://ints.ifolder.ru/ints/sponsor/\?bi=\d*&session=([^&]+)&u=[^>]+)>'
FORM1_PATTERN = r'<form method=post name="form1" ID="Form1" style="margin-bottom:200px">(.*?)</form>'
FORM_INPUT_PATTERN = r'<input[^>]* name="?([^" ]+)"? value="?([^" ]+)"?[^>]*>'
INTS_SESSION_PATTERN = r'\(\'ints_session\'\);\s*if\(tag\)\{tag.value = "([^"]+)";\}'
- HIDDEN_INPUT_PATTERN = r"var s= 'hh([^']*)';"
+ HIDDEN_INPUT_PATTERN = r"var v = .*?name='([^']+)' value='1'"
DOWNLOAD_LINK_PATTERN = r'<a id="download_file_href" href="([^"]+)"'
WRONG_CAPTCHA_PATTERN = ur'<font color=Red>неверный код,<br>введите еще раз</font><br>'
FILE_OFFLINE_PATTERN = ur'<p>Файл номер <b>[^<]*</b> не найден !!!</p>'
@@ -81,7 +72,7 @@ class IfolderRu(SimpleHoster):
inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form))
inputs['ints_session'] = re.search(self.INTS_SESSION_PATTERN, form).group(1)
inputs['Submit1'] = u"Подтвердить".encode("utf-8")
- inputs[re.search(self.HIDDEN_INPUT_PATTERN, form).group(1)] = '1'
+ inputs[re.search(self.HIDDEN_INPUT_PATTERN, self.html).group(1)] = '1'
inputs['confirmed_number'] = self.decryptCaptcha(captcha_url, cookies = True)
self.logDebug(inputs)
@@ -98,4 +89,6 @@ class IfolderRu(SimpleHoster):
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) \ No newline at end of file
+ self.download(download_url)
+
+getInfo = create_getInfo(IfolderRu) \ No newline at end of file
diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py
index dd65d7e7a..170693a9e 100644
--- a/module/plugins/hoster/LetitbitNet.py
+++ b/module/plugins/hoster/LetitbitNet.py
@@ -17,35 +17,13 @@
"""
import re
-from module.plugins.Hoster import Hoster
-from module.network.RequestFactory import getURL
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-def getInfo(urls):
- result = []
-
- for url in urls:
-
- html = getURL(url, decode=True)
- if re.search(LetitbitNet.FILE_OFFLINE_PATTERN, html):
- # File offline
- result.append((url, 0, 1, url))
- else:
- # Get file info
- found = re.search(r'<input[^>]* name="name" value="([^"]+)" />', html)
- if found is not None:
- name = found.group(1)
- found = re.search(r'<input[^>]* name="sssize" value="([^"]+)" />', html)
- if found is not None:
- size = float(found.group(1))/1024
- result.append((name, size, 2, url))
- yield result
-
-
-class LetitbitNet(Hoster):
+class LetitbitNet(SimpleHoster):
__name__ = "LetitbitNet"
__type__ = "hoster"
__pattern__ = r"http://(?:\w*\.)*letitbit.net/download/.*"
- __version__ = "0.1"
+ __version__ = "0.11"
__description__ = """letitbit.net"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
@@ -55,7 +33,7 @@ class LetitbitNet(Hoster):
FORM_INPUT_PATTERN = r'<input[^>]* name="([^"]+)" value="([^"]+)" />'
JS_SCRIPT_PATTERN = r'<title>[^<]*</title>\s*<script language="JavaScript">(.*?)</script>'
JS_VARS_PATTERN = r"(\S+) = '?([^';]+)'?;"
-
+ FILE_INFO_PATTERN = r'<h1[^>]*>File: <a[^>]*><span>(?P<N>[^<]+)</span></a> [<span>(?P<S>[0-9.]+)\s*(?P<U>[kKMG])i?[Bb]</span>]</h1>'
FILE_OFFLINE_PATTERN = r'<div id="download_content" class="hide-block">[^<]*<br>File not found<br /></div>'
def setup(self):
@@ -74,15 +52,17 @@ class LetitbitNet(Hoster):
except Exception, e:
self.logError(e)
self.fail("Parse error on page 1")
-
- self.html = self.load("http://letitbit.net"+action, post = inputs)
+
+ self.logDebug(inputs)
+ inputs['desc'] = ""
+ self.html = self.load("http://letitbit.net" + action, post = inputs)
try:
action, form = re.search(self.DVIFREE_FORM_PATTERN, self.html, re.DOTALL).groups()
inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form))
except Exception, e:
self.logError(e)
self.fail("Parse error on page 2")
-
+
self.html = self.load(action, post = inputs)
try:
form = re.search(self.JS_SCRIPT_PATTERN, self.html, re.DOTALL).group(1)
@@ -95,4 +75,6 @@ class LetitbitNet(Hoster):
self.fail("Parse error on page 3")
download_url = self.load(ajax_check_url, post = inputs)
- self.download(download_url) \ No newline at end of file
+ self.download(download_url)
+
+getInfo = create_getInfo(LetitbitNet) \ No newline at end of file
diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py
index 2309dd94f..f014c58e8 100644
--- a/module/plugins/hoster/MediafireCom.py
+++ b/module/plugins/hoster/MediafireCom.py
@@ -27,7 +27,7 @@ class MediafireCom(SimpleHoster):
__name__ = "MediafireCom"
__type__ = "hoster"
__pattern__ = r"http://(?:\w*\.)*mediafire\.com/download.php\?.*"
- __version__ = "0.65"
+ __version__ = "0.66"
__description__ = """Mediafire.com plugin - free only"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
@@ -45,8 +45,8 @@ class MediafireCom(SimpleHoster):
PAGE2_LINK_PATTERN = r"(\w+='';\w+=unescape.*?)eval\(\w+\);(.{0,10}href=[^>]*>)?"
FINAL_LINK_PATTERN = r'parent.document.getElementById\(\'(\w{32})\'\).*(http://[^"]+)" \+(\w+)\+ "([^"]+)">'
- FILE_NAME_PATTERN = r'<META NAME="description" CONTENT="([^"]+)"/>'
- FILE_SIZE_PATTERN = r'<input type="hidden" id="sharedtabsfileinfo1-fs" value="([0-9.]+) ([kKMG]i?B)">'
+ FILE_NAME_PATTERN = r'<META NAME="description" CONTENT="(?P<N>[^"]+)"/>'
+ FILE_SIZE_PATTERN = r'<input type="hidden" id="sharedtabsfileinfo1-fs" value="(?P<S>[0-9.]+) (?P<U>[kKMG])i?B">'
FILE_OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. </div>'
def process(self, pyfile):
@@ -132,5 +132,4 @@ class MediafireCom(SimpleHoster):
else:
self.fail("No valid recaptcha solution received")
-
getInfo = create_getInfo(MediafireCom) \ No newline at end of file
diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py
index 3c17eb979..a1dd6e694 100644
--- a/module/plugins/hoster/MegasharesCom.py
+++ b/module/plugins/hoster/MegasharesCom.py
@@ -18,29 +18,20 @@
import re
from time import time
-from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.network.RequestFactory import getURL
-def getInfo(urls):
- result = []
-
- for url in urls:
- file_info = parseFileInfo(MegasharesCom, url, getURL(url, decode=True))
- result.append(file_info)
-
- yield result
-
class MegasharesCom(SimpleHoster):
__name__ = "MegasharesCom"
__type__ = "hoster"
__pattern__ = r"http://(\w+\.)?megashares.com/.*"
- __version__ = "0.12"
+ __version__ = "0.13"
__description__ = """megashares.com plugin - free only"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
- FILE_NAME_PATTERN = '<h1 class="black xxl"[^>]*title="([^"]+)">'
- FILE_SIZE_PATTERN = '<strong><span class="black">Filesize:</span></strong> ([0-9.]+) (KB|MB|GB)<br />'
+ 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_2" style="display:none">\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>'
@@ -104,4 +95,6 @@ class MegasharesCom(SimpleHoster):
# Download
self.logDebug("Download URL: %s" % download_url)
- self.download(download_url) \ No newline at end of file
+ self.download(download_url)
+
+getInfo = create_getInfo(MegasharesCom) \ No newline at end of file
diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py
index ac35d93e1..bf1d9f3bf 100644
--- a/module/plugins/hoster/MultishareCz.py
+++ b/module/plugins/hoster/MultishareCz.py
@@ -17,28 +17,18 @@
"""
import re
-from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
-from module.network.RequestFactory import getURL
-
-def getInfo(urls):
- result = []
-
- for url in urls:
- file_info = parseFileInfo(MultishareCz, url, getURL(url, decode=True))
- result.append(file_info)
-
- yield result
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class MultishareCz(SimpleHoster):
__name__ = "MultishareCz"
__type__ = "hoster"
__pattern__ = r"http://(\w*\.)?multishare.cz/stahnout/.*"
- __version__ = "0.31"
+ __version__ = "0.32"
__description__ = """MultiShare.cz"""
__author_name__ = ("zoidberg")
FILE_ID_PATTERN = r'/stahnout/(\d+)/'
- FILE_INFO_PATTERN = ur'<ul class="no-padding"><li>Název: <strong>([^<]+)</strong></li><li>Velikost: <strong>([^&]+)&nbsp;([^<]+)</strong>'
+ FILE_INFO_PATTERN = ur'<ul class="no-padding"><li>Název: <strong>(?P<N>[^<]+)</strong></li><li>Velikost: <strong>(?P<S>[^&]+)&nbsp;(?P<U>[^<]+)</strong>'
FILE_OFFLINE_PATTERN = ur'<h1>Stáhnout soubor</h1><p><strong>Požadovaný soubor neexistuje.</strong></p>'
def handleFree(self):
@@ -49,4 +39,6 @@ class MultishareCz(SimpleHoster):
self.download("http://www.multishare.cz/html/download_free.php", get={
"ID": file_id
- }) \ No newline at end of file
+ })
+
+getInfo = create_getInfo(MultishareCz) \ No newline at end of file
diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py
index 4c82ff1a9..ef33d3263 100644
--- a/module/plugins/hoster/QuickshareCz.py
+++ b/module/plugins/hoster/QuickshareCz.py
@@ -17,44 +17,31 @@
"""
import re
-from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
-from module.network.RequestFactory import getURL
-
-def getInfo(urls):
- result = []
-
- for url in urls:
- file_info = parseFileInfo(QuickshareCz, url, getURL(url, decode=True))
- result.append(file_info)
-
- yield result
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class QuickshareCz(SimpleHoster):
__name__ = "QuickshareCz"
__type__ = "hoster"
__pattern__ = r"http://.*quickshare.cz/stahnout-soubor/.*"
- __version__ = "0.51"
+ __version__ = "0.52"
__description__ = """Quickshare.cz"""
__author_name__ = ("zoidberg")
VAR_PATTERN = r"var ID1 = '(?P<ID1>[^']+)';var ID2 = '(?P<ID2>[^']+)';var ID3 = '(?P<ID3>[^']+)';var ID4 = '(?P<ID4>[^']+)';var ID5 = '[^']*';var UU_prihlasen = '[^']*';var UU_kredit = [^;]*;var velikost = [^;]*;var kredit_odecet = [^;]*;var CaptchaText = '(?P<CaptchaText>[^']+)';var server = '(?P<Server>[^']+)';"
FILE_OFFLINE_PATTERN = r'<script type="text/javascript">location.href=\'/chyba\';</script>'
- FILE_SIZE_PATTERN = r'<br>Velikost: <strong>([0-9.]+)</strong>\s*(KB|MB|GB)<br>'
+ FILE_NAME_PATTERN = r'<th width="145px">Název:</th>\s*<td style="word-wrap:break-word;">(?P<N>[^<]+)</td>'
+ FILE_SIZE_PATTERN = r'<th>Velikost:</th>\s*<td>(?P<S>[0-9.]+) (?P<U>[kKMG])i?B</td>'
def setup(self):
self.multiDL = False
def process(self, pyfile):
self.html = self.load(pyfile.url, decode=True)
-
- # marks the file as "offline" when the pattern was found on the html-page
- if re.search(self.FILE_OFFLINE_PATTERN, self.html) is not None:
- self.offline()
+ self.getFileInfo()
# parse the name from the site and set attribute in pyfile
parsed_vars = re.search(self.VAR_PATTERN, self.html)
- if parsed_vars is None:
- self.fail("Parser error")
+ if parsed_vars is None: self.parseError("VARs")
pyfile.name = parsed_vars.group('ID3')
@@ -77,3 +64,5 @@ class QuickshareCz(SimpleHoster):
if check == "no_slots":
self.retry(5, 600, "No free slots")
+
+create_getInfo(QuickshareCz) \ No newline at end of file
diff --git a/module/plugins/hoster/SendspaceCom.py b/module/plugins/hoster/SendspaceCom.py
index b28df29f9..22abaff56 100644
--- a/module/plugins/hoster/SendspaceCom.py
+++ b/module/plugins/hoster/SendspaceCom.py
@@ -17,29 +17,19 @@
"""
import re
-from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
-from module.network.RequestFactory import getURL
-
-def getInfo(urls):
- result = []
-
- for url in urls:
- file_info = parseFileInfo(SendspaceCom, url, getURL(url, decode=True))
- result.append(file_info)
-
- yield result
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class SendspaceCom(SimpleHoster):
__name__ = "SendspaceCom"
__type__ = "hoster"
__pattern__ = r"http://(www\.)?sendspace.com/file/.*"
- __version__ = "0.12"
+ __version__ = "0.13"
__description__ = """sendspace.com plugin - free only"""
__author_name__ = ("zoidberg")
DOWNLOAD_URL_PATTERN = r'<a id="download_button" href="([^"]+)"'
- FILE_NAME_PATTERN = r'<h2 class="bgray">\s*<(?:b|strong)>([^<]+)</'
- FILE_SIZE_PATTERN = r'<div class="file_description reverse margin_center">\s*<b>File Size:</b>\s*([0-9.]+)([kKMG]i?B)\s*</div>'
+ FILE_NAME_PATTERN = r'<h2 class="bgray">\s*<(?:b|strong)>(?P<N>[^<]+)</'
+ FILE_SIZE_PATTERN = r'<div class="file_description reverse margin_center">\s*<b>File Size:</b>\s*(?P<S>[0-9.]+)(?P<U>[kKMG])i?B\s*</div>'
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>'
@@ -73,3 +63,5 @@ class SendspaceCom(SimpleHoster):
self.logDebug("Download URL: %s" % download_url)
self.download(download_url)
+
+create_getInfo(SendspaceCom) \ No newline at end of file
diff --git a/module/plugins/hoster/ShareRapidCom.py b/module/plugins/hoster/ShareRapidCom.py
index ae8211ef7..21512046e 100644
--- a/module/plugins/hoster/ShareRapidCom.py
+++ b/module/plugins/hoster/ShareRapidCom.py
@@ -27,13 +27,13 @@ class ShareRapidCom(SimpleHoster):
__name__ = "ShareRapidCom"
__type__ = "hoster"
__pattern__ = r"http://(?:www\.)?((share(-?rapid\.(biz|com|cz|info|eu|net|org|pl|sk)|-(central|credit|free|net)\.cz|-ms\.net)|(s-?rapid|rapids)\.(cz|sk))|(e-stahuj|mediatack|premium-rapidshare|rapidshare-premium|qiuck)\.cz|kadzet\.com|stahuj-zdarma\.eu|strelci\.net|universal-share\.com)/(stahuj/.+)"
- __version__ = "0.45"
+ __version__ = "0.46"
__description__ = """Share-rapid.com plugin - premium only"""
__author_name__ = ("MikyWoW", "zoidberg")
__author_mail__ = ("MikyWoW@seznam.cz", "zoidberg@mujmail.cz")
- FILE_NAME_PATTERN = r'(?:title="Stahnout"|<h3>)([^<]+)</(?:a|h3)>'
- FILE_SIZE_PATTERN = r'<td class="i">Velikost:</td>\s*<td class="h"><strong>\s*([0-9.]+) (kB|MB|GB)</strong></td>'
+ FILE_NAME_PATTERN = r'(?:title="Stahnout"|<h3>)(?P<N>[^<]+)</(?:a|h3)>'
+ 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>'
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áš'
diff --git a/module/plugins/hoster/SpeedfileCz.py b/module/plugins/hoster/SpeedfileCz.py
index 0c5010b15..bfd316dfa 100644
--- a/module/plugins/hoster/SpeedfileCz.py
+++ b/module/plugins/hoster/SpeedfileCz.py
@@ -17,35 +17,18 @@
"""
import re
-from module.plugins.Hoster import Hoster
-from module.network.RequestFactory import getURL
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-def getInfo(urls):
- result = []
-
- for url in urls:
- html = getURL(url, decode=True)
- if re.search(SpeedfileCz.FILE_OFFLINE_PATTERN, html):
- # File offline
- result.append((url, 0, 1, url))
- else:
- # Get file info
- found = re.search(SpeedfileCz.FILE_NAME_PATTERN, html)
- if found is not None:
- name = found.group(1)
- result.append((name, 0, 2, url))
- yield result
-
-
-class SpeedfileCz(Hoster):
+class SpeedfileCz(SimpleHoster):
__name__ = "SpeedFileCz"
__type__ = "hoster"
__pattern__ = r"http://speedfile.cz/.*"
- __version__ = "0.3"
+ __version__ = "0.31"
__description__ = """speedfile.cz"""
__author_name__ = ("zoidberg")
- FILE_NAME_PATTERN = r'<meta property="og:title" content="([^"]+)" />'
+ FILE_NAME_PATTERN = r'<meta property="og:title" content="(?P<N>[^"]+)" />'
+ FILE_SIZE_PATTERN = r'<strong><big>(?P<S>[0-9.]+) (?P<U>[kKMG])i?B'
URL_PATTERN = r'<a id="request" class="caps" href="([^"]+)" rel="nofollow">'
FILE_OFFLINE_PATTERN = r'<title>Speedfile \| 404'
WAIT_PATTERN = r'"requestedAt":(\d+),"allowedAt":(\d+),"adUri"'
@@ -78,3 +61,5 @@ class SpeedfileCz(Hoster):
self.wait()
self.download(download_url)
+
+create_getInfo(SpeedfileCz) \ No newline at end of file
diff --git a/module/plugins/hoster/StahnuTo.py b/module/plugins/hoster/StahnuTo.py
index fb17fad7c..a78615dba 100644
--- a/module/plugins/hoster/StahnuTo.py
+++ b/module/plugins/hoster/StahnuTo.py
@@ -33,12 +33,12 @@ class StahnuTo(SimpleHoster):
__name__ = "StahnuTo"
__type__ = "hoster"
__pattern__ = r"http://(\w*\.)?stahnu.to/(files/get/|.*\?file=)([^/]+).*"
- __version__ = "0.11"
+ __version__ = "0.12"
__description__ = """stahnu.to"""
__author_name__ = ("zoidberg")
- FILE_NAME_PATTERN = r"<div class='nadpis-01'><h2>([^<]+)</h2></div>"
- FILE_SIZE_PATTERN = r'<td>Velikost souboru<br /><span>([^<]+)\s*(kb|Mb|Gb)</span></td>'
+ FILE_NAME_PATTERN = r"<div class='nadpis-01'><h2>(?<N>[^<]+)</h2></div>"
+ FILE_SIZE_PATTERN = r'<td>Velikost souboru<br /><span>(?<S>[^<]+)\s*(?<U>[kKMG])i?[Bb]</span></td>'
FILE_OFFLINE_PATTERN = r'<!-- Obsah - start -->\s*<!-- Obsah - end -->'
#FILE_OFFLINE_PATTERN = r'<h2 align="center">Tento soubor neexistuje nebo byl odstran&#283;n! </h2>'
CAPTCHA_PATTERN = r'<img src="captcha/captcha.php" id="captcha" /></td>'
diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py
index f1a08b3e9..53c5cd81f 100644
--- a/module/plugins/hoster/UlozTo.py
+++ b/module/plugins/hoster/UlozTo.py
@@ -32,14 +32,14 @@ class UlozTo(SimpleHoster):
__author_name__ = ("zoidberg")
FILE_URL_PATTERN = r'<form name="dwn" action="([^"]+)"'
- FILE_NAME_PATTERN = r'<h2 class="nadpis" style="margin-left:196px;"><a href="[^"]+">([^<]+)</a></h2>'
+ FILE_NAME_PATTERN = r'<h2 class="nadpis" style="margin-left:196px;"><a href="[^"]+">(?P<N>[^<]+)</a></h2>'
CAPTCHA_PATTERN = r'<img style=".*src="([^"]+)" alt="Captcha" class="captcha"'
CAPTCHA_NB_PATTERN = r'<input class="captcha_nb" type="hidden" name="captcha_nb" value="([0-9]+)" >'
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" />'
LIVE_URL_PATTERN = r'<div id="flashplayer"[^>]*>\s*<a href="([^"]+)"'
LIVE_NAME_PATTERN = r'<a share_url="[^&]*&amp;t=([^"]+)"'
- FILE_SIZE_PATTERN = r'<div class="info_velikost" style="top:-55px;">\s*<div>[^<]*\s+([0-9.]+)\s([kKMG]i?B)\s*</div>\s*</div>'
+ FILE_SIZE_PATTERN = r'<div class="info_velikost" style="top:-55px;">\s*<div>[^<]*\s+(?P<S>[0-9.]+)\s(?P<U>[kKMG])i?B\s*</div>\s*</div>'
VIPLINK_PATTERN = r'<a href="[^"]*\?disclaimer=1" class="linkVip">'
def setup(self):
diff --git a/module/plugins/hoster/UloziskoSk.py b/module/plugins/hoster/UloziskoSk.py
index 1fd15502d..8d950f0a6 100644
--- a/module/plugins/hoster/UloziskoSk.py
+++ b/module/plugins/hoster/UloziskoSk.py
@@ -17,17 +17,7 @@
"""
import re
-from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
-from module.network.RequestFactory import getURL
-
-def getInfo(urls):
- result = []
-
- for url in urls:
- file_info = parseFileInfo(UloziskoSk, url, getURL(url, decode=True))
- result.append(file_info)
-
- yield result
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class UloziskoSk(SimpleHoster):
__name__ = "UloziskoSk"
@@ -39,8 +29,8 @@ class UloziskoSk(SimpleHoster):
URL_PATTERN = r'<form name = "formular" action = "([^"]+)" method = "post">'
ID_PATTERN = r'<input type = "hidden" name = "id" value = "([^"]+)" />'
- FILE_NAME_PATTERN = r'<div class="down1">([^<]+)</div>'
- FILE_SIZE_PATTERN = ur'Veľkosť súboru: <strong>([0-9.]+) ([kKMG]i?B)</strong><br />'
+ FILE_NAME_PATTERN = r'<div class="down1">(?P<N>[^<]+)</div>'
+ FILE_SIZE_PATTERN = ur'Veľkosť súboru: <strong>(?P<S>[0-9.]+) (?P<U>[kKMG])i?B</strong><br />'
CAPTCHA_PATTERN = r'<img src="(/obrazky/obrazky.php\?fid=[^"]+)" alt="" />'
FILE_OFFLINE_PATTERN = ur'<span class = "red">Zadaný súbor neexistuje z jedného z nasledujúcich dôvodov:</span>'
IMG_PATTERN = ur'<strong>PRE ZVÄČŠENIE KLIKNITE NA OBRÁZOK</strong><br /><a href = "([^"]+)">'
@@ -80,4 +70,6 @@ class UloziskoSk(SimpleHoster):
"id": id,
"name": self.pyfile.name,
"but": "++++STIAHNI+S%DABOR++++"
- }) \ No newline at end of file
+ })
+
+getInfo = create_getInfo(UloziskoSk) \ No newline at end of file
diff --git a/module/plugins/hoster/UploadhereCom.py b/module/plugins/hoster/UploadhereCom.py
index 35ddf25c8..385e77dc7 100644
--- a/module/plugins/hoster/UploadhereCom.py
+++ b/module/plugins/hoster/UploadhereCom.py
@@ -16,15 +16,18 @@
@author: zoidberg
"""
-from UploadkingCom import UploadkingCom, getInfo
+from module.plugins.internal.SimpleHoster import create_getInfo
+from UploadkingCom import UploadkingCom
class UploadhereCom(UploadkingCom):
__name__ = "UploadhereCom"
__type__ = "hoster"
__pattern__ = r"http://(?:www\.)?uploadhere\.com/\w{10}"
- __version__ = "0.1"
+ __version__ = "0.11"
__description__ = """Uploadhere.com plugin - free only"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
- # shares code with UploadkingCom \ No newline at end of file
+ # shares code with UploadkingCom
+
+create_getInfo(UploadhereCom) \ No newline at end of file
diff --git a/module/plugins/hoster/UploadkingCom.py b/module/plugins/hoster/UploadkingCom.py
index a706e95bc..a2e246d29 100644
--- a/module/plugins/hoster/UploadkingCom.py
+++ b/module/plugins/hoster/UploadkingCom.py
@@ -17,28 +17,19 @@
"""
import re
-from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
-from module.network.RequestFactory import getURL
-
-def getInfo(urls):
- result = []
-
- for url in urls:
- file_info = parseFileInfo(UploadkingCom, url, getURL(url, decode=False))
- result.append(file_info)
-
- yield result
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class UploadkingCom(SimpleHoster):
__name__ = "UploadkingCom"
__type__ = "hoster"
__pattern__ = r"http://(?:www\.)?uploadking\.com/\w{10}"
- __version__ = "0.12"
+ __version__ = "0.13"
__description__ = """UploadKing.com plugin - free only"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
- FILE_INFO_PATTERN = r'<font style="font-size:\d*px;">File(?:name)?:\s*<(?:b|/font><font[^>]*)>([^<]+)(?:</b>)?</div></TD></TR><TR><TD[^>]*><font style="font-size:\d*px;">(?:Files|S)ize:\s*<(?:b|/font><font[^>]*)>([0-9.]+) ([kKMG]i?B)</(?:b|font)>'
+ FILE_NAME_PATTERN = r'<font style="font-size:\d*px;">File(?:name)?:\s*<(?:b|/font><font[^>]*)>(?P<N>[^<]+)'
+ FILE_SIZE_PATTERN = r'<font style="font-size:\d*px;">(?:Files|S)ize:\s*<(?:b|/font><font[^>]*)>(?P<S>[0-9.]+) (?P<U>[kKMG])i?B'
FILE_OFFLINE_PATTERN = r'<center><font[^>]*>Unfortunately, this file is unavailable</font></center>'
FILE_URL_PATTERN = r'id="dlbutton"><a href="([^"]+)"'
@@ -47,4 +38,6 @@ class UploadkingCom(SimpleHoster):
if not found: self.fail("Download URL not found")
url = found.group(1)
self.logDebug("DOWNLOAD URL: " + url)
- self.download(url) \ No newline at end of file
+ self.download(url)
+
+create_getInfo(UploadkingCom) \ No newline at end of file
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index 2fbb07b2e..9eb9fd407 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -33,17 +33,17 @@ def parseFileInfo(self, url = '', html = ''):
elif hasattr(self, "FILE_INFO_PATTERN"):
found = search(self.FILE_INFO_PATTERN, html)
if found:
- name, size, units = found.groups()
+ name, size, units = found.group('N'), found.group('S'), found.group('U')
else:
if hasattr(self, "FILE_NAME_PATTERN"):
found = search(self.FILE_NAME_PATTERN, html)
if found:
- name = found.group(1)
+ name = found.group('N')
if hasattr(self, "FILE_SIZE_PATTERN"):
found = search(self.FILE_SIZE_PATTERN, html)
if found:
- size, units = found.groups()
+ size, units = found.group('S'), found.group('U')
if size:
# File online, return name and size
@@ -66,14 +66,14 @@ def create_getInfo(plugin):
class PluginParseError(Exception):
def __init__(self, msg):
- Exception.__init__(msg)
+ Exception.__init__
self.value = 'Parse error (%s) - plugin may be out of date' % msg
def __str__(self):
return repr(self.value)
class SimpleHoster(Hoster):
__name__ = "SimpleHoster"
- __version__ = "0.1"
+ __version__ = "0.11"
__pattern__ = None
__type__ = "hoster"
__description__ = """Base hoster plugin"""
@@ -81,7 +81,7 @@ class SimpleHoster(Hoster):
__author_mail__ = ("zoidberg@mujmail.cz")
#TODO: could be replaced when using utils.parseFileSize ?
- SIZE_UNITS = {'kB': 1, 'KB': 1, 'KiB': 1, 'MB': 2, 'MiB': 2, 'GB': 3, 'GiB': 3}
+ SIZE_UNITS = {'k': 1, 'K': 1, 'M': 2, 'G': 3}
SIZE_REPLACEMENTS = {',': '', ' ': ''}
def setup(self):