summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/plugins/crypter/MediafireComFolder.py7
-rw-r--r--module/plugins/hoster/EnteruploadCom.py4
-rw-r--r--module/plugins/hoster/MediafireCom.py4
-rw-r--r--module/plugins/hoster/TurbouploadCom.py7
-rw-r--r--module/plugins/hoster/UploadboxCom.py7
-rw-r--r--module/plugins/hoster/UploadhereCom.py7
-rw-r--r--module/plugins/hoster/UploadingCom.py64
-rw-r--r--module/plugins/hoster/UploadkingCom.py5
-rw-r--r--module/plugins/hoster/WuploadCom.py191
-rw-r--r--module/plugins/internal/DeadHoster.py19
-rw-r--r--module/plugins/internal/SimpleHoster.py21
11 files changed, 256 insertions, 80 deletions
diff --git a/module/plugins/crypter/MediafireComFolder.py b/module/plugins/crypter/MediafireComFolder.py
index 1056a3947..1d800b1b0 100644
--- a/module/plugins/crypter/MediafireComFolder.py
+++ b/module/plugins/crypter/MediafireComFolder.py
@@ -8,8 +8,8 @@ from module.common.json_layer import json_loads
class MediafireComFolder(Crypter):
__name__ = "MediafireComFolder"
__type__ = "crypter"
- __pattern__ = r"http://(\w*\.)*mediafire\.com/(folder/|\?).*"
- __version__ = "0.12"
+ __pattern__ = r"http://(\w*\.)*mediafire\.com/(folder/|\?sharekey=|(\?\w{13}|\w+)($|[/#]))"
+ __version__ = "0.13"
__description__ = """Mediafire.com Folder Plugin"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
@@ -44,9 +44,6 @@ class MediafireComFolder(Crypter):
new_links.append("http://www.mediafire.com/file/%s" % link['quickkey'])
else:
self.fail(json_resp['response']['message'])
- else:
- fileID = re.search(self.__pattern__, pyfile.url)
- new_links.append("ttp://www.mediafire.com/file/%s" % fileID)
elif result == 1:
self.offline()
else:
diff --git a/module/plugins/hoster/EnteruploadCom.py b/module/plugins/hoster/EnteruploadCom.py
index 37e24a93f..2c99b0047 100644
--- a/module/plugins/hoster/EnteruploadCom.py
+++ b/module/plugins/hoster/EnteruploadCom.py
@@ -17,13 +17,13 @@
"""
import re
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.plugins.internal.DeadHoster import DeadHoster as SimpleHoster, create_getInfo
class EnteruploadCom(SimpleHoster):
__name__ = "EnteruploadCom"
__type__ = "hoster"
__pattern__ = r"http://(?:www\.)?enterupload.com/\w+.*"
- __version__ = "0.01"
+ __version__ = "0.02"
__description__ = """EnterUpload.com plugin - free only"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py
index f40071478..c1d6e3595 100644
--- a/module/plugins/hoster/MediafireCom.py
+++ b/module/plugins/hoster/MediafireCom.py
@@ -57,8 +57,8 @@ def getInfo(urls):
class MediafireCom(SimpleHoster):
__name__ = "MediafireCom"
__type__ = "hoster"
- __pattern__ = r"http://(?:\w*\.)*mediafire\.com/[^?].*"
- __version__ = "0.73"
+ __pattern__ = r"http://(\w*\.)*mediafire\.com/(file/|(download.php)?\?)(\w{11}|\w{15})($|/)"
+ __version__ = "0.74"
__description__ = """Mediafire.com plugin - free only"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
diff --git a/module/plugins/hoster/TurbouploadCom.py b/module/plugins/hoster/TurbouploadCom.py
index 59939d3c7..6e81c6319 100644
--- a/module/plugins/hoster/TurbouploadCom.py
+++ b/module/plugins/hoster/TurbouploadCom.py
@@ -17,14 +17,15 @@
"""
import re
-from module.plugins.internal.SimpleHoster import create_getInfo
-from module.plugins.hoster.EasybytezCom import EasybytezCom
+from module.plugins.internal.DeadHoster import DeadHoster as EasybytezCom, create_getInfo
+#from module.plugins.internal.SimpleHoster import create_getInfo
+#from module.plugins.hoster.EasybytezCom import EasybytezCom
class TurbouploadCom(EasybytezCom):
__name__ = "TurbouploadCom"
__type__ = "hoster"
__pattern__ = r"http://(?:\w*\.)?turboupload.com/(\w+).*"
- __version__ = "0.01"
+ __version__ = "0.02"
__description__ = """turboupload.com"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
diff --git a/module/plugins/hoster/UploadboxCom.py b/module/plugins/hoster/UploadboxCom.py
index 0eb023cb2..ce80b37dc 100644
--- a/module/plugins/hoster/UploadboxCom.py
+++ b/module/plugins/hoster/UploadboxCom.py
@@ -17,7 +17,9 @@
"""
import re
-from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
+from module.plugins.internal.DeadHoster import DeadHoster as SimpleHoster
+
+"""
from module.network.RequestFactory import getURL
def getInfo(urls):
@@ -26,12 +28,13 @@ def getInfo(urls):
html = getURL('http://uploadbox.com/files/%s/?ac=lang&lang_new=en' % file_id, decode = False)
file_info = parseFileInfo(UploadboxCom, url, html)
yield file_info
+"""
class UploadboxCom(SimpleHoster):
__name__ = "Uploadbox"
__type__ = "hoster"
__pattern__ = r"http://(?:www\.)?uploadbox\.com/files/([^/]+).*"
- __version__ = "0.04"
+ __version__ = "0.05"
__description__ = """UploadBox.com plugin - free only"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
diff --git a/module/plugins/hoster/UploadhereCom.py b/module/plugins/hoster/UploadhereCom.py
index 385e77dc7..8deec1397 100644
--- a/module/plugins/hoster/UploadhereCom.py
+++ b/module/plugins/hoster/UploadhereCom.py
@@ -16,14 +16,15 @@
@author: zoidberg
"""
-from module.plugins.internal.SimpleHoster import create_getInfo
-from UploadkingCom import UploadkingCom
+from module.plugins.internal.DeadHoster import DeadHoster as UploadkingCom, create_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.11"
+ __version__ = "0.12"
__description__ = """Uploadhere.com plugin - free only"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py
index 83bbaea82..1278bfc01 100644
--- a/module/plugins/hoster/UploadingCom.py
+++ b/module/plugins/hoster/UploadingCom.py
@@ -18,32 +18,21 @@
"""
import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp
-from time import time
-
-from module.plugins.Hoster import Hoster
-
-def timestamp():
- return int(time()*1000)
-
-class UploadingCom(Hoster):
+class UploadingCom(SimpleHoster):
__name__ = "UploadingCom"
__type__ = "hoster"
__pattern__ = r"http://(?:www\.)?uploading\.com/files/(?:get/)?[\w\d]+/?"
- __version__ = "0.2"
+ __version__ = "0.30"
__description__ = """Uploading.Com File Download Hoster"""
- __author_name__ = ("jeix", "mkaay")
- __author_mail__ = ("jeix@hasnomail.de", "mkaay@mkaay.de")
+ __author_name__ = ("jeix", "mkaay", "zoidberg")
+ __author_mail__ = ("jeix@hasnomail.de", "mkaay@mkaay.de", "zoidberg@mujmail.cz")
+
+ FILE_NAME_PATTERN = r'<title>Download (?P<N>.*?) for free on uploading.com</title>'
+ FILE_SIZE_PATTERN = r'<span>File size: (?P<S>.*?)</span>'
+ FILE_OFFLINE_PATTERN = r'<h2 style=".*?">The requested file is not found</h2>'
- def setup(self):
- self.html = [None,None,None]
- if self.account:
- self.resumeDownload = True
- self.multiDL = True
- else:
- self.resumeDownload = False
- self.multiDL = False
-
def process(self, pyfile):
# set lang to english
self.req.cj.setCookie("uploading.com", "lang", "1")
@@ -51,16 +40,13 @@ class UploadingCom(Hoster):
self.req.cj.setCookie("uploading.com", "setlang", "en")
self.req.cj.setCookie("uploading.com", "_lang", "en")
- if not "/get" in self.pyfile.url:
+ if not "/get/" in self.pyfile.url:
self.pyfile.url = self.pyfile.url.replace("/files", "/files/get")
- self.html[0] = self.load(self.pyfile.url)
- if re.search(r'<h2 style=".*?">The requested file is not found</h2>', self.html[0]) is not None:
- self.offline()
-
- self.pyfile.name = re.search(r'<title>Download (.*?) for free on uploading.com</title>', self.html[0]).group(1)
+ self.html = self.load(pyfile.url, decode = True)
+ self.file_info = self.getFileInfo()
- if self.account:
+ if self.premium:
url = self.handlePremium()
else:
url = self.handleFree()
@@ -69,35 +55,35 @@ class UploadingCom(Hoster):
def handlePremium(self):
postData = {'action': 'get_link',
- 'code': re.search('code: "(.*?)",', self.html[0]).group(1),
+ 'code': re.search('code: "(.*?)",', self.html).group(1),
'pass': 'undefined'}
- self.html[2] = self.load('http://uploading.com/files/get/?JsHttpRequest=%d-xml' % timestamp(), post=postData)
- url = re.search(r'"link"\s*:\s*"(.*?)"', self.html[2])
+ self.html = self.load('http://uploading.com/files/get/?JsHttpRequest=%d-xml' % timestamp(), post=postData)
+ url = re.search(r'"link"\s*:\s*"(.*?)"', self.html)
if url:
return url.group(1).replace("\\/", "/")
raise Exception("Plugin defect.")
def handleFree(self):
- found = re.search('<h2>((Daily )?Download Limit)</h2>', self.html[0])
+ found = re.search('<h2>((Daily )?Download Limit)</h2>', self.html)
if found:
self.pyfile.error = found.group(1)
self.logWarning(self.pyfile.error)
self.retry(max_tries=6, wait_time = 21600 if found.group(2) else 900, reason = self.pyfile.error)
- self.code = re.search(r'name="code" value="(.*?)"', self.html[0]).group(1)
- self.fileid = re.search(r'name="file_id" value="(.*?)"', self.html[0]).group(1)
+ self.code = re.search(r'name="code" value="(.*?)"', self.html).group(1)
+ self.fileid = re.search(r'name="file_id" value="(.*?)"', self.html).group(1)
postData = {'action': 'second_page',
'code': self.code,
'file_id': self.fileid}
- self.html[1] = self.load(self.pyfile.url, post=postData)
+ self.html = self.load(self.pyfile.url, post=postData)
- wait_time = re.search(r'timead_counter">(\d+)<', self.html[1])
+ wait_time = re.search(r'timead_counter">(\d+)<', self.html)
if not wait_time:
- wait_time = re.search(r'start_timer\((\d+)\)', self.html[1])
+ wait_time = re.search(r'start_timer\((\d+)\)', self.html)
if wait_time:
wait_time = int(wait_time.group(1))
@@ -114,9 +100,11 @@ class UploadingCom(Hoster):
captcha_url = "http://uploading.com/general/captcha/download%s/?ts=%d" % (self.fileid, timestamp())
postData['captcha_code'] = self.decryptCaptcha(captcha_url)
- self.html[2] = self.load('http://uploading.com/files/get/?JsHttpRequest=%d-xml' % timestamp(), post=postData)
- url = re.search(r'"link"\s*:\s*"(.*?)"', self.html[2])
+ self.html = self.load('http://uploading.com/files/get/?JsHttpRequest=%d-xml' % timestamp(), post=postData)
+ url = re.search(r'"link"\s*:\s*"(.*?)"', self.html)
if url:
return url.group(1).replace("\\/", "/")
raise Exception("Plugin defect.")
+
+getInfo = create_getInfo(UploadingCom) \ No newline at end of file
diff --git a/module/plugins/hoster/UploadkingCom.py b/module/plugins/hoster/UploadkingCom.py
index a2e246d29..be2d6c3bd 100644
--- a/module/plugins/hoster/UploadkingCom.py
+++ b/module/plugins/hoster/UploadkingCom.py
@@ -17,13 +17,14 @@
"""
import re
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.plugins.internal.DeadHoster import DeadHoster as SimpleHoster, create_getInfo
+#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.13"
+ __version__ = "0.14"
__description__ = """UploadKing.com plugin - free only"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
diff --git a/module/plugins/hoster/WuploadCom.py b/module/plugins/hoster/WuploadCom.py
index 11b61ae59..1a0eb442b 100644
--- a/module/plugins/hoster/WuploadCom.py
+++ b/module/plugins/hoster/WuploadCom.py
@@ -3,10 +3,10 @@
import re
import string
-
-from types import MethodType
+from urllib import unquote
from module.plugins.Hoster import Hoster
+from module.plugins.ReCaptcha import ReCaptcha
from module.plugins.Plugin import chunks
from module.network.RequestFactory import getURL
@@ -31,7 +31,7 @@ def getInfo(urls):
if item["status"] != "AVAILABLE":
result.append((None, 0, 1, ids[str(item["id"])]))
else:
- result.append((item["filename"], item["size"], 2, ids[str(item["id"])]))
+ result.append((unquote(item["filename"]), item["size"], 2, ids[str(item["id"])]))
yield result
@@ -47,7 +47,7 @@ class WuploadCom(Hoster):
__name__ = "WuploadCom"
__type__ = "hoster"
__pattern__ = r"http://[\w\.]*?wupload\..*?/file/(([a-z][0-9]+/)?[0-9]+)(/.*)?"
- __version__ = "0.1"
+ __version__ = "0.20"
__description__ = """Wupload com"""
__author_name__ = ("jeix", "paulking")
__author_mail__ = ("jeix@hasnomail.de", "")
@@ -63,24 +63,179 @@ class WuploadCom(Hoster):
CAPTCHA_TYPE2_PATTERN = r'id="recaptcha_image"><img style="display: block;" src="(.+)image?c=(.+?)"'
def init(self):
- #this plugin shares most things with filesonic, always keep in mind when editing it
+ if self.account:
+ self.premium = self.account.getAccountInfo(self.user)["premium"]
+ if not self.premium:
+ self.chunkLimit = 1
+ self.multiDL = False
+
+ def process(self, pyfile):
+ self.pyfile = pyfile
+
+ self.pyfile.url = self.checkFile(self.pyfile.url)
+
+ if self.premium:
+ self.downloadPremium()
+ else:
+ self.downloadFree()
+
+ def checkFile(self, url):
+ id = getId(url)
+ self.logDebug("file id is %s" % id)
+ if id:
+ # Use the api to check the current status of the file and fixup data
+ check_url = self.API_ADDRESS + "/link?method=getInfo&format=json&ids=%s" % id
+ result = json_loads(self.load(check_url, decode=True))
+ item = result["FSApi_Link"]["getInfo"]["response"]["links"][0]
+ self.logDebug("api check returns %s" % item)
+
+ if item["status"] != "AVAILABLE":
+ self.offline()
+ if item["is_password_protected"] != 0:
+ self.fail("This file is password protected")
+
+ # ignored this check due to false api information
+ #if item["is_premium_only"] != 0 and not self.premium:
+ # self.fail("need premium account for file")
+
+ self.pyfile.name = unquote(item["filename"])
+
+ # Fix the url and resolve the domain to the correct regional variation
+ url = item["url"]
+ urlparts = re.search(self.URL_DOMAIN_PATTERN, url)
+ if urlparts:
+ url = urlparts.group("prefix") + self.getDomain() + urlparts.group("suffix")
+ self.logDebug("localised url is %s" % url)
+ return url
+ else:
+ self.fail("Invalid URL")
+
+ def getDomain(self):
+ result = json_loads(
+ self.load(self.API_ADDRESS + "/utility?method=getWuploadDomainForCurrentIp&format=json", decode=True))
+ self.log.debug("%s: response to get domain %s" % (self.__name__, result))
+ return result["FSApi_Utility"]["getWuploadDomainForCurrentIp"]["response"]
+
+ def downloadPremium(self):
+ self.logDebug("Premium download")
+
+ api = self.API_ADDRESS + "/link?method=getDownloadLink&u=%%s&p=%%s&ids=%s" % getId(self.pyfile.url)
+
+ result = json_loads(self.load(api % (self.user, self.account.getAccountData(self.user)["password"])))
+ links = result["FSApi_Link"]["getDownloadLink"]["response"]["links"]
+
+ #wupload seems to return list and no dicts
+ if type(links) == dict:
+ info = links.values()[0]
+ else:
+ info = links[0]
+
+ if "status" in info and info["status"] == "NOT_AVAILABLE":
+ self.tempOffline()
+
+ self.download(info["url"])
+
+ def downloadFree(self):
+ self.logDebug("Free download")
+ # Get initial page
+ self.html = self.load(self.pyfile.url)
+ url = self.pyfile.url + "?start=1"
+ self.html = self.load(url)
+ self.handleErrors()
+
+ finalUrl = re.search(self.FILE_LINK_PATTERN, self.html)
+
+ if not finalUrl:
+ self.doWait(url)
+
+ chall = re.search(self.CAPTCHA_TYPE1_PATTERN, self.html)
+ chall2 = re.search(self.CAPTCHA_TYPE2_PATTERN, self.html)
+ if chall or chall2:
+ for i in range(5):
+ re_captcha = ReCaptcha(self)
+ if chall:
+ self.logDebug("Captcha type1")
+ challenge, result = re_captcha.challenge(chall.group(1))
+ else:
+ self.logDebug("Captcha type2")
+ server = chall2.group(1)
+ challenge = chall2.group(2)
+ result = re_captcha.result(server, challenge)
+
+ postData = {"recaptcha_challenge_field": challenge,
+ "recaptcha_response_field": result}
+
+ self.html = self.load(url, post=postData)
+ self.handleErrors()
+ chall = re.search(self.CAPTCHA_TYPE1_PATTERN, self.html)
+ chall2 = re.search(self.CAPTCHA_TYPE2_PATTERN, self.html)
+
+ if chall or chall2:
+ self.invalidCaptcha()
+ else:
+ self.correctCaptcha()
+ break
+
+ finalUrl = re.search(self.FILE_LINK_PATTERN, self.html)
+
+ if not finalUrl:
+ self.fail("Couldn't find free download link")
+
+ self.logDebug("got download url %s" % finalUrl.group(1))
+ self.download(finalUrl.group(1))
+
+ def doWait(self, url):
+ # If the current page requires us to wait then wait and move to the next page as required
+
+ # There maybe more than one wait period. The extended wait if download limits have been exceeded (in which case we try reconnect)
+ # and the short wait before every download. Visually these are the same, the difference is that one includes a code to allow
+ # progress to the next page
+
+ waitSearch = re.search(self.WAIT_TIME_PATTERN, self.html)
+ while waitSearch:
+ wait = int(waitSearch.group("wait"))
+ if wait > 300:
+ self.wantReconnect = True
+
+ self.setWait(wait)
+ self.logDebug("Waiting %d seconds." % wait)
+ self.wait()
+
+ tm = re.search(self.WAIT_TM_PATTERN, self.html)
+ tm_hash = re.search(self.WAIT_TM_HASH_PATTERN, self.html)
+
+ if tm and tm_hash:
+ tm = tm.group(1)
+ tm_hash = tm_hash.group(1)
+ self.html = self.load(url, post={"tm": tm, "tm_hash": tm_hash})
+ self.handleErrors()
+ break
+ else:
+ self.html = self.load(url)
+ self.handleErrors()
+ waitSearch = re.search(self.WAIT_TIME_PATTERN, self.html)
- module = self.core.pluginManager.getPlugin("FilesonicCom")
- fs = getattr(module, "FilesonicCom")
+ def handleErrors(self):
+ if "This file is available for premium users only." in self.html:
+ self.fail("need premium account for file")
- self.newInit = MethodType(fs.__dict__["init"], self, WuploadCom)
+ if "The file that you're trying to download is larger than" in self.html:
+ self.fail("need premium account for file")
- methods = ["process", "checkFile", "downloadPremium", "downloadFree", "doWait", "handleErrors"]
- #methods to bind from fs
+ if "Free users may only download 1 file at a time" in self.html:
+ self.fail("only 1 file at a time for free users")
- for m in methods:
- setattr(self, m, MethodType(fs.__dict__[m], self, WuploadCom))
+ if "Free user can not download files" in self.html:
+ self.fail("need premium account for file")
- self.newInit()
+ if "Download session in progress" in self.html:
+ self.fail("already downloading")
+ if "This file is password protected" in self.html:
+ self.fail("This file is password protected")
- def getDomain(self):
- result = json_loads(
- self.load(self.API_ADDRESS + "/utility?method=getWuploadDomainForCurrentIp&format=json", decode=True))
- self.log.debug("%s: response to get domain %s" % (self.__name__, result))
- return result["FSApi_Utility"]["getWuploadDomainForCurrentIp"]["response"] \ No newline at end of file
+ if "An Error Occurred" in self.html:
+ self.fail("A server error occured.")
+
+ if "This file was deleted" in self.html:
+ self.offline()
diff --git a/module/plugins/internal/DeadHoster.py b/module/plugins/internal/DeadHoster.py
new file mode 100644
index 000000000..2de1634b9
--- /dev/null
+++ b/module/plugins/internal/DeadHoster.py
@@ -0,0 +1,19 @@
+from module.plugins.Hoster import Hoster as _Hoster
+
+def create_getInfo(plugin):
+ def getInfo(urls):
+ for url in urls:
+ yield '#N/A: ' + url, 0, 1, url
+ return getInfo
+
+class Hoster(_Hoster):
+ __name__ = "DeadHoster"
+ __type__ = "hoster"
+ __pattern__ = r""
+ __version__ = "0.1"
+ __description__ = """Hoster is no longer available"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ def init(self):
+ self.fail("Hoster is no longer available") \ No newline at end of file
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index 12b629a81..69909a8a1 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -18,6 +18,7 @@
"""
from urlparse import urlparse
import re
+from time import time
from module.plugins.Hoster import Hoster
from module.utils import html_unescape, fixup, parseFileSize
@@ -36,10 +37,13 @@ def parseHtmlTagAttrValue(attr_name, tag):
def parseFileInfo(self, url = '', html = '', infomode = False):
if not html and hasattr(self, "html"): html = self.html
+
info = {"name" : url, "size" : 0, "status" : 3}
online = False
- if hasattr(self, "FILE_OFFLINE_PATTERN") and re.search(self.FILE_OFFLINE_PATTERN, html):
+ if hasattr(self, "req") and self.req.http.code == '404':
+ info['status'] = 1
+ elif hasattr(self, "FILE_OFFLINE_PATTERN") and re.search(self.FILE_OFFLINE_PATTERN, html):
# File offline
info['status'] = 1
else:
@@ -53,7 +57,8 @@ def parseFileInfo(self, url = '', html = '', infomode = False):
if online:
# File online, return name and size
info['status'] = 2
- if 'N' in info: info['name'] = reSub(info['N'], self.FILE_NAME_REPLACEMENTS)
+ if 'N' in info:
+ info['name'] = reSub(info['N'], self.FILE_NAME_REPLACEMENTS)
if 'S' in info:
size = reSub(info['S'] + info['U'] if 'U' in info else info['S'], self.FILE_SIZE_REPLACEMENTS)
info['size'] = parseFileSize(size)
@@ -69,10 +74,14 @@ def parseFileInfo(self, url = '', html = '', infomode = False):
def create_getInfo(plugin):
def getInfo(urls):
for url in urls:
- file_info = parseFileInfo(plugin, url, getURL(reSub(url, plugin.FILE_URL_REPLACEMENTS), decode=True))
+ file_info = parseFileInfo(plugin, url, getURL(reSub(url, plugin.FILE_URL_REPLACEMENTS), \
+ decode = False if plugin.HTML_BROKEN_ENCODING else True))
yield file_info
return getInfo
+def timestamp():
+ return int(time()*1000)
+
class PluginParseError(Exception):
def __init__(self, msg):
Exception.__init__(self)
@@ -82,7 +91,7 @@ class PluginParseError(Exception):
class SimpleHoster(Hoster):
__name__ = "SimpleHoster"
- __version__ = "0.16"
+ __version__ = "0.17"
__pattern__ = None
__type__ = "hoster"
__description__ = """Base hoster plugin"""
@@ -100,13 +109,15 @@ class SimpleHoster(Hoster):
FILE_SIZE_REPLACEMENTS = []
FILE_NAME_REPLACEMENTS = [("&#?\w+;", fixup)]
FILE_URL_REPLACEMENTS = []
+
+ HTML_BROKEN_ENCODING = False
def setup(self):
self.resumeDownload = self.multiDL = True if self.account else False
def process(self, pyfile):
pyfile.url = reSub(pyfile.url, self.FILE_URL_REPLACEMENTS)
- self.html = self.load(pyfile.url, decode = True)
+ self.html = self.load(pyfile.url, decode = False if self.HTML_BROKEN_ENCODING else True)
self.file_info = self.getFileInfo()
if self.premium:
self.handlePremium()