diff options
Diffstat (limited to 'module/plugins/hoster/ShareplaceCom.py')
-rw-r--r-- | module/plugins/hoster/ShareplaceCom.py | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/module/plugins/hoster/ShareplaceCom.py b/module/plugins/hoster/ShareplaceCom.py index cfc2807f9..07724a9d1 100644 --- a/module/plugins/hoster/ShareplaceCom.py +++ b/module/plugins/hoster/ShareplaceCom.py @@ -1,24 +1,30 @@ # -*- coding: utf-8 -*- import re -import urllib + +from urllib import unquote + from module.plugins.Hoster import Hoster class ShareplaceCom(Hoster): - __name__ = "ShareplaceCom" - __type__ = "hoster" - __pattern__ = r'(http://)?(?:www\.)?shareplace\.(com|org)/\?[a-zA-Z0-9]+' - __version__ = "0.11" + __name__ = "ShareplaceCom" + __type__ = "hoster" + __version__ = "0.12" + + __pattern__ = r'http://(?:www\.)?shareplace\.(com|org)/\?\w+' + __description__ = """Shareplace.com hoster plugin""" - __author_name__ = "ACCakut" - __author_mail__ = None + __license__ = "GPLv3" + __authors__ = [("ACCakut", None)] + def process(self, pyfile): self.pyfile = pyfile self.prepare() self.download(self.get_file_url()) + def prepare(self): if not self.file_exists(): self.offline() @@ -27,9 +33,9 @@ class ShareplaceCom(Hoster): wait_time = self.get_waiting_time() self.setWait(wait_time) - self.logDebug("%s: Waiting %d seconds." % (self.__name__, wait_time)) self.wait() + def get_waiting_time(self): if not self.html: self.download_html() @@ -43,23 +49,26 @@ class ShareplaceCom(Hoster): return sec + def download_html(self): url = re.sub("shareplace.com\/\?", "shareplace.com//index1.php/?a=", self.pyfile.url) self.html = self.load(url, decode=True) + def get_file_url(self): """ returns the absolute downloadable filepath """ url = re.search(r"var beer = '(.*?)';", self.html) if url: url = url.group(1) - url = urllib.unquote( + url = unquote( url.replace("http://http:/", "").replace("vvvvvvvvv", "").replace("lllllllll", "").replace( "teletubbies", "")) self.logDebug("URL: %s" % url) return url else: - self.fail("absolute filepath could not be found. offline? ") + self.error(_("Absolute filepath not found")) + def get_file_name(self): if not self.html: @@ -67,6 +76,7 @@ class ShareplaceCom(Hoster): return re.search("<title>\s*(.*?)\s*</title>", self.html).group(1) + def file_exists(self): """ returns True or False """ |