diff options
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/accounts/MegasharesCom.py | 42 | ||||
-rw-r--r-- | module/plugins/accounts/UlozTo.py | 34 | ||||
-rw-r--r-- | module/plugins/crypter/LinkdecrypterCom.py | 106 | ||||
-rwxr-xr-x | module/plugins/crypter/OronComFolder.py | 32 | ||||
-rw-r--r-- | module/plugins/hooks/ExtractArchive.py | 20 | ||||
-rw-r--r-- | module/plugins/hooks/Premium4Me.py | 46 | ||||
-rw-r--r-- | module/plugins/hooks/RehostTo.py | 4 | ||||
-rw-r--r-- | module/plugins/hooks/UpdateManager.py | 10 | ||||
-rw-r--r-- | module/plugins/hoster/MegasharesCom.py | 48 |
9 files changed, 262 insertions, 80 deletions
diff --git a/module/plugins/accounts/MegasharesCom.py b/module/plugins/accounts/MegasharesCom.py new file mode 100644 index 000000000..91601fc95 --- /dev/null +++ b/module/plugins/accounts/MegasharesCom.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- + +from module.plugins.Account import Account +import re +from time import mktime, strptime + +class MegasharesCom(Account): + __name__ = "MegasharesCom" + __version__ = "0.02" + __type__ = "account" + __description__ = """megashares.com account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + VALID_UNTIL_PATTERN = r'<p class="premium_info_box">Period Ends: (\w{3} \d{1,2}, \d{4})</p>' + + def loadAccountInfo(self, user, req): + #self.relogin(user) + html = req.load("http://d01.megashares.com/myms.php", decode = True) + + premium = False if '>Premium Upgrade<' in html else True + + validuntil = trafficleft = -1 + try: + timestr = re.search(self.VALID_UNTIL_PATTERN, html).group(1) + self.logDebug(timestr) + validuntil = mktime(strptime(timestr, "%b %d, %Y")) + except Exception, e: + self.logError(e) + + return {"validuntil": validuntil, "trafficleft": -1, "premium": premium} + + def login(self, user, data, req): + html = req.load('http://d01.megashares.com/myms_login.php', post = { + "httpref": "", + "myms_login": "Login", + "mymslogin_name": user, + "mymspassword": data['password'] + }, decode = True) + + if not '<span class="b ml">%s</span>' % user in html: + self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/UlozTo.py b/module/plugins/accounts/UlozTo.py new file mode 100644 index 000000000..36e1ae342 --- /dev/null +++ b/module/plugins/accounts/UlozTo.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- + +from module.plugins.Account import Account +import re + +class UlozTo(Account): + __name__ = "UlozTo" + __version__ = "0.01" + __type__ = "account" + __description__ = """uloz.to account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + TRAFFIC_LEFT_PATTERN = r'<li class="credit"><a href="/kredit/" class="coins" title="[^"]* GB = ([^"]+) MB">' + + def loadAccountInfo(self, user, req): + html = req.load("http://www.uloz.to/statistiky/", decode = True) + + found = re.search(self.TRAFFIC_LEFT_PATTERN, html) + trafficleft = int(float(found.group(1).replace(' ','').replace(',','.')) * 1000 / 1.024) if found else 0 + self.premium = True if trafficleft else False + + return {"validuntil": -1, "trafficleft": trafficleft} + + def login(self, user, data, req): + html = req.load('http://www.uloz.to/?do=authForm-submit', post = { + "login": "Přihlásit", + "password": data['password'], + "trvale": "on", + "username": user + }, decode = True) + + if '<ul class="error">' in html: + self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/crypter/LinkdecrypterCom.py b/module/plugins/crypter/LinkdecrypterCom.py index c087c3518..83c74188d 100644 --- a/module/plugins/crypter/LinkdecrypterCom.py +++ b/module/plugins/crypter/LinkdecrypterCom.py @@ -22,62 +22,74 @@ from module.plugins.Crypter import Crypter class LinkdecrypterCom(Crypter): __name__ = "LinkdecrypterCom" __type__ = "crypter" - __pattern__ = r"http://(\w*\.)?(10001mb\.com|123link\.it|1cl\.in|1kh\.de|1zh\.us|2joy\.de|2so\.be|3\.ly|5\.gp|6nc\.net|7li\.in|9\.bb|adf\.ly|adflav\.com|adfoc\.us|allanalpass\.com|alturl\.com|amy\.gs|any\.gs|apurl\.ru|aurl\.es|b23\.ru|baberepublic\.com|bat5\.com|bax\.li|beam\.to|bit\.ly|blu\.cc|c\.ly|capourl\.com|cc\.st|cd\.vg|cloneurl\.com|convertircodigo\.com|crypt-it\.com|crypt\.to|cryptlink\.ws|deb\.gs|digzip\.com|djurl\.com|dl-protect\.com|doiop\.com|ehe\.me|encript\.in|encurtador\.com|enlacs\.com|evg\.in|extreme-protect\.com|fa\.by|faja\.me|fapoff\.com|fdnlinks\.com|fea\.me|fff\.to|filedeck\.net|filemirrorupload\.com|fileupster\.com|flameupload\.com|freetexthost\.com|fwd4\.me|fyad\.org|goandgrab\.info|goblig\.com|goo\.gl|h-url\.in|hasurl\.co\.cc|hide-url\.net|hidemyass\.com|hides\.at|hideurl\.biz|ho\.io|hornywood\.tv|href\.hu|id2\.tryjav\.com|ilix\.in|ily\.me|ino\.me|interupload\.com|is\.gd|ivpaste\.com|j\.mp|je\.pl|jheberg\.com|just\.as|kickupload\.com|klnk\.de|knoffl\.com|kodo\.ameoto\.com|ks\.gs|latwy\.pl|link-go\.info|link-protector\.com|link-safe\.net|link4jo\.com|linkanonimo\.com|linkbabes\.com|linkbank\.eu|linkbee\.com|linkblur\.com|linkbucks\.com|linkcrypt\.com|linkcrypt\.ws|linkencrypter\.com|linkhide\.com\.ar|linkhide\.in|linkoculto\.net|linkok\.org|linkprivado\.com|linkprivate\.net|linkprotect\.in|links-protect\.com|links-protect\.info|links\.tc|linksafe\.me|linksaver\.info|linkse\.info|linkseguro\.com\.ar|linkseguro\.org|linksole\.com|linksprotegidos\.info|linkto\.net|linkweb\.dk|linkx\.in|linkzip\.net|listedfiles\.com|littleurl\.net|lixk\.me|ljv2\.com|ll11\.org|lnk\.cm|lnk\.co|longr\.us|lovelink\.in|mcaf\.ee|megaline\.co|megaupper\.com|mhz\.me|migre\.me|miniurls\.co|minu\.me|mir\.cr|mirrorcreator\.com|mo\.by|multi-uploadeur\.com|murl\.kz|musicalmente\.info|mypaqe\.com|mypl\.us|myrapidlinks\.com|myref\.de|myurl\.in|nbanews\.us|okconsolas\.com|oneddl\.canhaz\.it|ow\.ly|p4p\.com\.es|p6l\.org|paste\.frubar\.net|paste\.hotfile-bb\.com|paste\.ubuntu\.com|paste2\.org|paste21\.info|pastebin\.com|paylesssofts\.net|poontown\.net|pqueno\.com|priva\.us|protec-link\.com|protect-ddl\.com|protect-my-links\.com|protected\.socadvnet\.com|protectlinks\.com|protectlinks\.net|protectlk\.com|protege-mes-liens\.com|ptl\.li|qooy\.com|qqc\.co|qvvo\.com|rapidfolder\.com|rapidsafe\.de|rapidsafe\.org|rapidshare\.mu|realfiles\.net|redir\.ec|ref\.so|relinka\.net|rexwo\.com|rqq\.co|rs-layer\.com|rsmonkey\.com|s2l\.biz|saf\.li|safe\.mn|safelinking\.net|saferlinks\.com|sealed\.in|seclnk\.in|seriousfiles\.com|sharebee\.com|short-link\.fr|shortlink\.ca|shorturlscript\.net|simurl\.com|sinl\.es|skroc\.pl|slexy\.org|slnky\.net|smsdl\.com|sn\.im|sonofertas\.es|spedr\.com|spreadlink\.us|star-cyber\.com|subedlc\.com|subirfacil\.com|syl\.me|szort\.pl|takemyfile\.com|takemylinks\.com|textsnip\.com|thecow\.me|thesefiles\.com|tilien\.net|tiny\.cc|tiny\.lt|tinylinks\.co|tinypaste\.com|tinyurl\.com|tinyurlscript\.info|tmf\.myegy\.com|togoto\.us|tot\.to|tra\.kz|u\.to|uberpicz\.com|ulinks\.net|ultra-protect\.com|ultrafiles\.net|undeadlink\.com|uploadjockey\.com|uploadmirrors\.com|uploadonall\.com|upmirror\.com|upsafe\.org|ur\.ly|url-go\.com|url-site\.com|url4t\.com|urla\.in|urlbeat\.net|urlcash\.net|urlcrypt\.com|urlcut\.com|urlcut\.in|urldefender\.com|urln\.tk|urlpulse\.net|urlspy\.co\.cc|urwij|uselink\.info|uucc\.cc|uze\.in|wcrypt\.in|webtooljungle\.com|weepax\.com|whackyvidz\.com|x-ls\.ru|x\.co|xa\.ly|xc\.io|xr\.com|xtreemhost\.com|xurl\.cn|xxs\.ru|ysu\.me|yyv\.co|zff\.co|zio\.in|zpag\.es)/.*" - __version__ = "0.21" + #excluded: "1kh\.de|crypt-it\.com|linksave\.in|lix\.in|lof\.cc|multiload\.cz|multiupload\.com|ncrypt\.in|relink\.us|rs-layer\.com|secured\.in|stealth\.to" + __pattern__ = r"http://(\w*\.)?(00\.uz|10001mb\.com|123link\.it|123url\.org|1cl\.in|1tool\.biz|1zh\.us|2joy\.de|2so\.be|3\.ly|5\.gp|6nc\.net|7li\.in|9\.bb|adf\.ly|adflav\.com|adfoc\.us|allanalpass\.com|alturl\.com|amy\.gs|any\.gs|apurl\.ru|aurl\.es|b23\.ru|baberepublic\.com|bai\.lu|bat5\.com|bax\.li|bc\.vc|beam\.to|birurl\.com|bit\.ly|blu\.cc|bofh\.us|boo\.io|c\.ly|capourl\.com|cash4links\.co|cc\.st|cd\.vg|cl\.lk|cli\.gs|cloneurl\.com|convertircodigo\.com|crypt\.to|crypt2\.be|cryptlink\.ws|ddl-warez\.in|deb\.gs|deurl\.me|digzip\.com|djurl\.com|dl-protect\.com|dl\.dropbox\.com|doiop\.com|ehe\.me|embedupload\.com|encript\.in|encurtador\.com|enlacs\.com|evg\.in|extreme-protect\.com|fa\.by|faja\.me|fapoff\.com|fdnlinks\.com|fea\.me|fff\.to|filedeck\.net|filemirrorupload\.com|filesonthe\.net|fileupster\.com|flameupload\.com|freetexthost\.com|fwd4\.me|fyad\.org|galleries\.bz|goandgrab\.info|goblig\.com|goo\.gl|guardlink\.org|h-url\.in|hasurl\.co\.cc|hide-url\.net|hidemyass\.com|hides\.at|hideurl\.biz|ho\.io|hornywood\.tv|href\.hu|id2\.tryjav\.com|ilii\.in|ilix\.in|ily\.me|ino\.me|interupload\.com|is\.gd|ivpaste\.com|j\.mp|j7\.se|je\.pl|jheberg\.com|just\.as|kickupload\.com|klnk\.de|knoffl\.com|kodo\.ameoto\.com|ks\.gs|latwy\.pl|li\.co\.ve|link-go\.info|link-protector\.com|link-safe\.net|link\.file-up\.ru|link4jo\.com|linkanonimo\.com|linkbabes\.com|linkbank\.eu|linkbee\.com|linkblur\.com|linkbucks\.com|linkbun\.ch|linkcrypt\.com|linkcrypt\.ws|linkencrypter\.com|linkhide\.com\.ar|linkhide\.in|linkoculto\.net|linkok\.org|linkprivado\.com|linkprivate\.net|linkprotect\.in|links-protect\.com|links-protect\.info|links-protection\.com|links\.tc|linksafe\.me|linksaver\.info|linkse\.info|linkseguro\.com\.ar|linkseguro\.org|linksole\.com|linksprotec\.com|linksprotegidos\.info|linkssafe\.com|linkto\.net|linkweb\.dk|linkx\.in|linkzip\.net|listedfiles\.com|littleurl\.net|lixk\.me|lixxin\.com|ljv2\.com|lkt\.es|ll11\.org|lnk\.cm|lnk\.co|longr\.us|lovelink\.in|madlink\.sk|maxi-upload\.com|mcaf\.ee|mediahide\.com|megaline\.co|megalinks\.es|megaupper\.com|mf1\.jp|mhz\.me|migre\.me|miniurl\.com|miniurl\.es|miniurl\.org|miniurls\.co|minu\.me|mir\.cr|mirrorcreator\.com|mo\.by|multi-uploadeur\.com|murl\.kz|musicalmente\.info|myooo\.info|mypaqe\.com|mypl\.us|myrapidlinks\.com|myref\.de|myurl\.in|nbanews\.us|nov\.io|okconsolas\.com|oneddl\.canhaz\.it|ow\.ly|p4p\.com\.es|p6l\.org|paste\.frubar\.net|paste\.hotfile-bb\.com|paste\.to|paste\.ubuntu\.com|paste2\.org|paste21\.info|pastebin\.com|paylesssofts\.net|poontown\.net|pqueno\.com|priva\.us|protec-link\.com|protect-ddl\.com|protect-my-links\.com|protected\.socadvnet\.com|protectlinks\.com|protectlinks\.net|protectlk\.com|protege-mes-liens\.com|ptl\.li|qooy\.com|qqc\.co|qvvo\.com|rapidfolder\.com|rapidsafe\.de|rapidsafe\.org|rapidshare\.mu|realfiles\.net|redir\.ec|ref\.so|relinka\.net|rexwo\.com|rqq\.co|rsmonkey\.com|rurls\.ru|s2l\.biz|saf\.li|safe\.mn|safelinking\.net|saferlinks\.com|scut\.ly|sealed\.in|seclnk\.in|seriousfiles\.com|share-links\.biz|sharebee\.com|short-link\.fr|shortlink\.ca|shorturlscript\.net|shrt\.st|simurl\.com|sinl\.es|skroc\.pl|slexy\.org|slnky\.net|smlk\.es|smsdl\.com|sn\.im|snipr\.com|snipurl\.com|snurl\.com|sonofertas\.es|spedr\.com|spreadlink\.us|star-cyber\.com|stu\.tc|subedlc\.com|subirfacil\.com|syl\.me|szort\.pl|t\.co|t7\.hu|takemyfile\.com|takemylinks\.com|textsave\.de|textsnip\.com|thecow\.me|thesefiles\.com|thinfi\.com|tilien\.net|tiny\.cc|tiny\.lt|tinylinks\.co|tinypaste\.com|tinyurl\.com|tinyurlscript\.info|tmf\.myegy\.com|togoto\.us|tot\.to|tra\.kz|trick\.ly|u\.to|uberpicz\.com|ubervidz\.com|ulinks\.net|ultrafiles\.net|undeadlink\.com|uploadjockey\.com|uploadmirrors\.com|uploadonall\.com|upmirror\.com|upsafe\.org|ur\.ly|url-go\.com|url-site\.com|url\.zeta24\.com|url4t\.com|urla\.in|urlbeat\.net|urlcash\.net|urlcorta\.es|urlcrypt\.com|urlcut\.com|urlcut\.in|urldefender\.com|urlink\.at|urln\.tk|urlpulse\.net|urlspy\.co\.cc|urwij|uselink\.info|uucc\.cc|uze\.in|wa9\.la|wcrypt\.in|webtooljungle\.com|weepax\.com|whackyvidz\.com|wtc\.la|x-ls\.ru|x\.co|xa\.ly|xc\.io|xr\.com|xtreemhost\.com|xurl\.cn|xurl\.es|xxs\.ru|youfap\.me|ysu\.me|yvy\.me|yyv\.co|zff\.co|zio\.in|zpag\.es)/.*" + __version__ = "0.23" __description__ = """linkdecrypter.com""" - __author_name__ = ("zoidberg") - + __author_name__ = ("zoidberg", "flowlee") + TEXTAREA_PATTERN = r'<textarea name="links" wrap="off" readonly="1" class="caja_des">(.+)</textarea>' PASSWORD_PATTERN = r'<p class="textog" style="color:red"><b>PASSWORD:</b></p>' CAPTCHA_PATTERN = r'<img style="cursor:crosshair;" src="([^"]+)" alt="Loading CAPTCHA...">' - + REDIR_PATTERN = r'<i>(Click <a href="./">here</a> if your browser does not redirect you).</i>' + def decrypt(self, pyfile): - self.html = self.load('http://linkdecrypter.com', post={ - "link_cache": "on", - "links": self.pyfile.url, - "modo_links": "text" - }) - - new_links = [] - captcha = '' - passwords = self.getPassword().split() - for i in range(5 + len(passwords)): - self.logDebug("Trying to decrypt #" + str(i)) - self.html = self.load('http://linkdecrypter.com') + self.passwords = self.getPassword().splitlines() + + new_links = self.decryptAPI() or self.decryptHTML() + if new_links: + self.core.files.addLinks(new_links, self.pyfile.package().id) + else: + self.fail('Could not extract any links') - textarea = re.search(self.TEXTAREA_PATTERN, self.html, flags=re.DOTALL) - if textarea is not None: - self.logDebug(textarea.group(1)) - new_links.extend(textarea.group(1).split()) - break - elif re.search(self.PASSWORD_PATTERN, self.html): - if len(passwords): - password = passwords.pop(0) + def decryptAPI(self): + + get_dict = { "t": "link", "url": self.pyfile.url, "lcache": "1" } + self.html = self.load('http://linkdecrypter.com/api', get = get_dict) + if self.html.startswith('http://'): return self.html.splitlines() + + if self.html == 'INTERRUPTION(PASSWORD)': + for get_dict['pass'] in self.passwords: + self.html = self.load('http://linkdecrypter.com/api', get= get_dict) + if self.html.startswith('http://'): return self.html.splitlines() + + self.logError('API', self.html) + if self.html == 'INTERRUPTION(PASSWORD)': + self.fail("No or incorrect password") + + return None + + def decryptHTML(self): + + self.html = self.load('http://linkdecrypter.com', cookies = True) + links_sessid = "links" + self.req.cj.getCookie("PHPSESSID") + retries = 5 + + post_dict = { "link_cache": "on", links_sessid: self.pyfile.url, "modo_links": "text" } + self.html = self.load('http://linkdecrypter.com', post = post_dict, cookies = True) + + while self.passwords or retries: + found = re.search(self.TEXTAREA_PATTERN, self.html, flags=re.DOTALL) + if found: return found.group(1).splitlines() + + found = re.search(self.CAPTCHA_PATTERN, self.html) + if found: + self.logInfo("Captcha protected link") + captcha = self.decryptCaptcha(url='http://linkdecrypter.com/' + found.group(1)) + self.html = self.load('http://linkdecrypter.com', post={ "captcha": captcha }) + retries -= 1 + + elif self.PASSWORD_PATTERN in self.html: + if self.passwords: + password = self.passwords.pop(0) self.logInfo("Password protected link, trying " + password) - self.html = self.load('http://linkdecrypter.com', post={ - "password": password - }) + self.html = self.load('http://linkdecrypter.com', post= {'password': password}) else: self.fail("No or incorrect password") + else: - found = re.search(self.CAPTCHA_PATTERN, self.html) - if found is not None: - self.logInfo("Captcha protected link") - if captcha: - self.invalidCaptcha() - captcha = self.decryptCaptcha(url='http://linkdecrypter.com/' + found.group(1)) - self.html = self.load('http://linkdecrypter.com', post={ - "captcha": captcha - }) - else: - self.fail('Max retries reached') - - if new_links: - if captcha: - self.correctCaptcha() - self.core.files.addLinks(new_links, self.pyfile.package().id) - else: - self.fail('Could not extract any links') - + retries -= 1 + self.html = self.load('http://linkdecrypter.com', cookies = True) + return None
\ No newline at end of file diff --git a/module/plugins/crypter/OronComFolder.py b/module/plugins/crypter/OronComFolder.py new file mode 100755 index 000000000..57b273163 --- /dev/null +++ b/module/plugins/crypter/OronComFolder.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.Crypter import Crypter + +class OronComFolder(Crypter): + __name__ = "OronComFolder" + __type__ = "crypter" + __pattern__ = r"http://(?:www\.)?oron.com/folder/\w+" + __version__ = "0.1" + __description__ = """Oron.com Folder Plugin""" + __author_name__ = ("DHMH") + __author_mail__ = ("webmaster@pcProfil.de") + + FOLDER_PATTERN = r'<table width="100%" cellpadding="7" cellspacing="1" class="tbl2">(.*)</table>\n </div>' + LINK_PATTERN = r'<a href="([^"]+)" target="_blank">' + + def decrypt(self, pyfile): + html = self.load(self.pyfile.url) + + new_links = [] + + folder = re.search(self.FOLDER_PATTERN, html, re.DOTALL) + if folder is None: self.fail("Parse error (FOLDER)") + + new_links.extend(re.findall(self.LINK_PATTERN, folder.group(0))) + + if new_links: + self.core.files.addLinks(new_links, self.pyfile.package().id) + else: + self.fail('Could not extract any links')
\ No newline at end of file diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 53f88b3a5..12bd40d1b 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -24,7 +24,8 @@ if sys.version_info < (2, 7) and os.name != "nt": continue raise - def wait(self): + # unsued timeout option for older python version + def wait(self, timeout=0): """Wait for child process to terminate. Returns returncode attribute.""" if self.returncode is None: @@ -56,7 +57,7 @@ class ExtractArchive(Hook): Provides: unrarFinished (folder, filename) """ __name__ = "ExtractArchive" - __version__ = "0.1" + __version__ = "0.12" __description__ = "Extract different kind of archives" __config__ = [("activated", "bool", "Activated", True), ("fullpath", "bool", "Extract full path", True), @@ -65,7 +66,8 @@ class ExtractArchive(Hook): ("deletearchive", "bool", "Delete archives when done", False), ("subfolder", "bool", "Create subfolder for each package", False), ("destination", "folder", "Extract files to", ""), - ("queue", "bool", "Wait for all downloads to be fninished", True), + ("recursive", "bool", "Extract archives in archvies", True), + ("queue", "bool", "Wait for all downloads to be finished", True), ("renice", "int", "CPU Priority", 0), ] __author_name__ = ("pyload Team") __author_mail__ = ("admin<at>pyload.org") @@ -157,6 +159,7 @@ class ExtractArchive(Hook): makedirs(out) files_ids = [(save_join(dl, p.folder, x["name"]), x["id"]) for x in p.getChildren().itervalues()] + matched = False # check as long there are unseen files while files_ids: @@ -164,7 +167,9 @@ class ExtractArchive(Hook): for plugin in self.plugins: targets = plugin.getTargets(files_ids) - if targets: self.logDebug("Targets for %s: %s" % (plugin.__name__, targets)) + if targets: + self.logDebug("Targets for %s: %s" % (plugin.__name__, targets)) + matched = True for target, fid in targets: if target in extracted: self.logDebug(basename(target), "skipped") @@ -184,11 +189,14 @@ class ExtractArchive(Hook): if not exists(file): self.logDebug("new file %s does not exists" % file) continue - if isfile(file): + if self.getConfig("recursive") and isfile(file): new_files_ids.append((file, fid)) #append as new target files_ids = new_files_ids # also check extracted files + if not matched: self.logInfo(_("No files found to extract")) + + def startExtracting(self, plugin, fid, passwords, thread): pyfile = self.core.files.getFile(fid) @@ -303,4 +311,4 @@ class ExtractArchive(Hook): gid = getgrnam(self.config["permission"]["group"])[2] chown(f, uid, gid) except Exception, e: - self.log.warning(_("Setting User and Group failed"), e)
\ No newline at end of file + self.log.warning(_("Setting User and Group failed"), e) diff --git a/module/plugins/hooks/Premium4Me.py b/module/plugins/hooks/Premium4Me.py new file mode 100644 index 000000000..fc3ce2343 --- /dev/null +++ b/module/plugins/hooks/Premium4Me.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*-
+
+from module.network.RequestFactory import getURL
+from module.plugins.internal.MultiHoster import MultiHoster
+
+class Premium4Me(MultiHoster):
+ __name__ = "Premium4Me"
+ __version__ = "0.02"
+ __type__ = "hook"
+
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("hosterListMode", "all;listed;unlisted", "Use for downloads from supported hosters:", "all"),
+ ("hosterList", "str", "Hoster list (comma separated)", "")]
+ __description__ = """premium4.me hook plugin"""
+ __author_name__ = ("RaNaN", "zoidberg")
+ __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz")
+
+ replacements = [("freakshare.net", "freakshare.com")]
+
+ def getHoster(self):
+
+ page = getURL("http://premium4.me/api/hosters.php?authcode=%s" % self.account.authcode)
+ hosters = set([x.strip() for x in page.replace("\"", "").split(";")])
+
+ configMode = self.getConfig('hosterListMode')
+ if configMode in ("listed", "unlisted"):
+ configList = set(self.getConfig('hosterList').strip().lower().replace(',','|').split('|'))
+ configList.discard(u'')
+ if configMode == "listed":
+ hosters &= configList
+ elif configMode == "unlisted":
+ hosters -= configList
+
+ return list(hosters)
+
+ def coreReady(self):
+
+ self.account = self.core.accountManager.getAccountPlugin("Premium4Me")
+
+ user = self.account.selectAccount()[0]
+
+ if not user:
+ self.logError(_("Please add your premium4.me account first and restart pyLoad"))
+ return
+
+ return MultiHoster.coreReady(self)
\ No newline at end of file diff --git a/module/plugins/hooks/RehostTo.py b/module/plugins/hooks/RehostTo.py index 34bcbf4c7..b16987f5c 100644 --- a/module/plugins/hooks/RehostTo.py +++ b/module/plugins/hooks/RehostTo.py @@ -5,7 +5,7 @@ from module.plugins.internal.MultiHoster import MultiHoster class RehostTo(MultiHoster): __name__ = "RehostTo" - __version__ = "0.4" + __version__ = "0.41" __type__ = "hook" __config__ = [("activated", "bool", "Activated", "False")] @@ -24,7 +24,7 @@ class RehostTo(MultiHoster): def coreReady(self): - self.account = self.core.accountManager.loadClass("accounts", "RehostTo") + self.account = self.core.accountManager.getAccountPlugin("RehostTo") user = self.account.selectAccount()[0] diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index d0c7f213d..230a6e858 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -15,7 +15,6 @@ along with this program; if not, see <http://www.gnu.org/licenses/>. @author: RaNaN - @interface-version: 0.1 """ import sys @@ -30,7 +29,7 @@ from module.plugins.Hook import threaded, Expose, Hook class UpdateManager(Hook): __name__ = "UpdateManager" - __version__ = "0.1" + __version__ = "0.12" __description__ = """checks for updates""" __config__ = [("activated", "bool", "Activated", "True"), ("interval", "int", "Check interval in minutes", "360"), @@ -129,6 +128,7 @@ class UpdateManager(Hook): else: name = filename.replace(".py", "") + #TODO: obsolete if prefix.endswith("s"): type = prefix[:-1] else: @@ -165,7 +165,7 @@ class UpdateManager(Hook): f.close() self.updated = True - reloads.append((type, name)) + reloads.append((prefix, name)) self.reloaded = self.core.pluginManager.reloadPlugins(reloads) @@ -176,7 +176,7 @@ class UpdateManager(Hook): self.last_check = time() modules = filter( - lambda m: m and (m.__name__.startswith("module.plugins.") or m.__name__.startswith("userplugins.")), + lambda m: m and (m.__name__.startswith("module.plugins.") or m.__name__.startswith("userplugins.")) and m.__name__.count(".") >= 2, sys.modules.itervalues()) reloads = [] @@ -196,4 +196,4 @@ class UpdateManager(Hook): reloads.append(id) self.mtimes[id] = mtime - self.core.pluginManager.reloadPlugins(reloads)
\ No newline at end of file + self.core.pluginManager.reloadPlugins(reloads) diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index a1dd6e694..3fac633bc 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -19,20 +19,19 @@ import re from time import time from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.network.RequestFactory import getURL class MegasharesCom(SimpleHoster): __name__ = "MegasharesCom" __type__ = "hoster" __pattern__ = r"http://(\w+\.)?megashares.com/.*" - __version__ = "0.13" + __version__ = "0.21" __description__ = """megashares.com plugin - free only""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") 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="([^"]+)">' + DOWNLOAD_URL_PATTERN = '<div id="show_download_button_%d"[^>]*>\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>' REACTIVATE_NUM_PATTERN = r'<input[^>]*id="random_num" value="(\d+)" />' @@ -41,15 +40,21 @@ class MegasharesCom(SimpleHoster): NO_SLOTS_PATTERN = r'<dd class="red">All download slots for this link are currently filled' FILE_OFFLINE_PATTERN = r'<dd class="red">(Invalid Link Request|Link has been deleted)' - def process(self, pyfile): - self.html = self.load(pyfile.url, decode=True) + def setup(self): + self.resumeDownload = True + self.multiDL = True if self.premium else False + + def handlePremium(self): + self.handleDownload(True) + + def handleFree(self): + self.html = self.load(self.pyfile.url, decode=True) + if self.NO_SLOTS_PATTERN in self.html: self.retry(wait_time = 300) + self.getFileInfo() - self.handleFree() - - def handleFree(self): - if self.pyfile.size > 576716800: self.fail("This file is too large for free download") + #if self.pyfile.size > 576716800: self.fail("This file is too large for free download") # Reactivate passport if needed found = re.search(self.REACTIVATE_PASSPORT_PATTERN, self.html) @@ -82,19 +87,22 @@ class MegasharesCom(SimpleHoster): self.logInfo("Download passport: %s" % found.group(1)) data_left = float(found.group(2)) * 1024 ** {'KB': 1, 'MB': 2, 'GB': 3}[found.group(3)] self.logInfo("Data left: %s %s (%d MB needed)" % (found.group(2), found.group(3), self.pyfile.size / 1048576)) - if self.pyfile.size > data_left: + + if not data_left: found = re.search(self.PASSPORT_RENEW_PATTERN, self.html) - if not found: self.fail('Passport renew time not found') - renew = found.group(1) + 60 * (found.group(2) + 60 * found.group(3)) - self.retry(renew, 3, "Unable to get passport") - - # Find download link - found = re.search(self.DOWNLOAD_URL_PATTERN, self.html) - if not found: self.fail('Download link not found') + renew = (found.group(1) + 60 * (found.group(2) + 60 * found.group(3))) if found else 600 + self.retry(renew, 15, "Unable to get passport") + + self.handleDownload(False) + + def handleDownload(self, premium = False): + # Find download link; + found = re.search(self.DOWNLOAD_URL_PATTERN % (1 if premium else 2), self.html) + msg = '%s download URL' % ('Premium' if premium else 'Free') + if not found: self.parseError(msg) + download_url = found.group(1) - - # Download - self.logDebug("Download URL: %s" % download_url) + self.logDebug("%s: %s" % (msg, download_url)) self.download(download_url) getInfo = create_getInfo(MegasharesCom)
\ No newline at end of file |