From 2a5ff9ce8b025336cccdd7dde1260a7255efc683 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 5 Oct 2014 17:06:22 +0200 Subject: Fix pillow import header --- module/plugins/captcha/LinksaveIn.py | 6 +++++- module/plugins/captcha/captcha.py | 10 +++++----- module/plugins/hooks/CaptchaBrotherhood.py | 6 +++++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index d915b7628..069c8090d 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -1,6 +1,10 @@ # -*- coding: utf-8 -*- -from PIL import Image +try: + from PIL import Image +except ImportError: + import Image + from glob import glob from os import sep from os.path import abspath, dirname diff --git a/module/plugins/captcha/captcha.py b/module/plugins/captcha/captcha.py index cc07f50cf..7d6ff264f 100644 --- a/module/plugins/captcha/captcha.py +++ b/module/plugins/captcha/captcha.py @@ -2,11 +2,11 @@ from __future__ import with_statement -import GifImagePlugin -import Image -import JpegImagePlugin -import PngImagePlugin -import TiffImagePlugin +try: + from PIL import Image, GifImagePlugin, JpegImagePlugin, PngImagePlugin, TiffImagePlugin +except ImportError: + import Image, GifImagePlugin, JpegImagePlugin, PngImagePlugin, TiffImagePlugin + import logging import os import subprocess diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index e4d24c366..217f0b89f 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -5,7 +5,11 @@ from __future__ import with_statement import StringIO import pycurl -from PIL import Image +try: + from PIL import Image +except ImportError: + import Image + from thread import start_new_thread from time import sleep from urllib import urlencode -- cgit v1.2.3 From 4fd7c36b3d0cda16fb68baa378169ad8094ba62e Mon Sep 17 00:00:00 2001 From: igel-kun Date: Sun, 5 Oct 2014 17:32:38 +0200 Subject: [MegasharesCom] Update patterns --- module/plugins/hoster/MegasharesCom.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index c12897ed0..3b6f29536 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -10,21 +10,23 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MegasharesCom(SimpleHoster): __name__ = "MegasharesCom" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" - __pattern__ = r'http://(?:www\.)?megashares.com/.*' + __pattern__ = r'http://(?:www\.)?(d\d{2}\.)?megashares\.com/((index.php)?\?d\d{2}=|dl/)\w+' __description__ = """Megashares.com hoster plugin""" __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" + FILE_NAME_PATTERN = r'

]*title="(?P[^"]+)">' - FILE_SIZE_PATTERN = r'Filesize: (?P[0-9.]+) (?P[kKMG])i?B
' - OFFLINE_PATTERN = r'
(Invalid Link Request|Link has been deleted)' + FILE_SIZE_PATTERN = r'Filesize: (?P[\d.]+) (?P\w+)' + OFFLINE_PATTERN = r'
(Invalid Link Request|Link has been deleted|Invalid link)' LINK_PATTERN = r'
]*>\s*' - PASSPORT_LEFT_PATTERN = r'Your Download Passport is: <[^>]*>(\w+).*\s*You have\s*<[^>]*>\s*([0-9.]+) ([kKMG]i?B)' - PASSPORT_RENEW_PATTERN = r'Your download passport will renew in\s*(\d+):(\d+):(\d+)' + + PASSPORT_LEFT_PATTERN = r'Your Download Passport is: <[^>]*>(\w+).*?You have.*?<[^>]*>.*?([\d.]+) (\w+)' + PASSPORT_RENEW_PATTERN = r'Your download passport will renew(?:.|\n)*?(\d+).*?(\d+).*?(\d+)' REACTIVATE_NUM_PATTERN = r']*id="random_num" value="(\d+)" />' REACTIVATE_PASSPORT_PATTERN = r']*id="passport_num" value="(\w+)" />' REQUEST_URI_PATTERN = r'var request_uri = "([^"]+)";' @@ -35,9 +37,11 @@ class MegasharesCom(SimpleHoster): self.resumeDownload = True self.multiDL = self.premium + def handlePremium(self): self.handleDownload(True) + def handleFree(self): self.html = self.load(self.pyfile.url, decode=True) @@ -45,10 +49,7 @@ class MegasharesCom(SimpleHoster): self.retry(wait_time=5 * 60) self.getFileInfo() - # if self.pyfile.size > 576716800: - # self.fail("This file is too large for free download") - # Reactivate passport if needed m = re.search(self.REACTIVATE_PASSPORT_PATTERN, self.html) if m: passport_num = m.group(1) @@ -76,20 +77,22 @@ class MegasharesCom(SimpleHoster): self.fail("Failed to reactivate passport") # Check traffic left on passport - m = re.search(self.PASSPORT_LEFT_PATTERN, self.html) + m = re.search(self.PASSPORT_LEFT_PATTERN, self.html, re.M | re.S) if m is None: self.fail('Passport not found') self.logInfo("Download passport: %s" % m.group(1)) - data_left = float(m.group(2)) * 1024 ** {'KB': 1, 'MB': 2, 'GB': 3}[m.group(3)] + data_left = float(m.group(2)) * 1024 ** {'B': 0, 'KB': 1, 'MB': 2, 'GB': 3}[m.group(3)] self.logInfo("Data left: %s %s (%d MB needed)" % (m.group(2), m.group(3), self.pyfile.size / 1048576)) if not data_left: m = re.search(self.PASSPORT_RENEW_PATTERN, self.html) - renew = m.group(1) + m.group(2) + m.group(3) * 60 * 60 if m else 10 * 60 - self.retry(max_tries=15, wait_time=renew, reason="Unable to get passport") + renew = int(m.group(1) + 60 * (m.group(2) + 60 * m.group(3))) if found else 600 + self.logDebug('Waiting %d seconds for a new passport' % renew) + self.retry(wait_time=renew, reason="Passport renewal") self.handleDownload(False) + def handleDownload(self, premium=False): # Find download link; m = re.search(self.LINK_PATTERN % (1 if premium else 2), self.html) -- cgit v1.2.3 From 55233a0e25d6034c9b80568fdda24041a00b2eb9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 5 Oct 2014 22:08:34 +0200 Subject: New hoster plugin FilepupNet --- module/plugins/hoster/FilepupNet.py | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 module/plugins/hoster/FilepupNet.py diff --git a/module/plugins/hoster/FilepupNet.py b/module/plugins/hoster/FilepupNet.py new file mode 100644 index 000000000..69065565f --- /dev/null +++ b/module/plugins/hoster/FilepupNet.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# +# Test links: +# http://www.filepup.net/files/k5w4ZVoF1410184283.html +# http://www.filepup.net/files/R4GBq9XH1410186553.html + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class FilepupNet(SimpleHoster): + __name__ = "FilepupNet" + __type__ = "hoster" + __version__ = "0.01" + + __pattern__ = r"http://(?:www\.)?filepup\.net/files/\w+" + + __description__ = """Filepup.net hoster plugin""" + __author_name__ = ("zapp-brannigan", "Walter Purcaro") + __author_mail__ = ("fuerst.reinje@web.de", "vuolter@gmail.com") + + + FILE_NAME_PATTERN = r'>(?P.+?)

' + FILE_SIZE_PATTERN = r'class="fa fa-archive"> \((?P[\d.]+) (?P\w+)' + + OFFLINE_PATTERN = r'>This file has been deleted' + + LINK_PATTERN = r'(http://www\.filepup\.net/get/.+?)\'' + + + def setup(self): + self.multiDL = False + self.chunkLimit = 1 + + + def handleFree(self): + m = re.search(self.LINK_PATTERN, self.html) + if m is None: + self.parseError("Download link not found") + + dl_link = m.group(1) + self.download(dl_link, post={'task': "download"}) + + check = self.checkDownload({'html': re.compile("html")}) + if check == "html": + self.parseError("Downloaded file is an html file") + + +getInfo = create_getInfo(FilepupNet) -- cgit v1.2.3 From b994d8fa6a7dcc902787bb2450acdbed535d72fc Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 5 Oct 2014 22:11:49 +0200 Subject: [SimpleHoster] Added default handle patterns LINK_FREE_PATTERN and LINK_PREMIUM_PATTERN --- module/plugins/internal/SimpleHoster.py | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 3625f171e..160125cdf 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -153,7 +153,7 @@ class PluginParseError(Exception): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "0.36" + __version__ = "0.37" __pattern__ = None @@ -255,11 +255,35 @@ class SimpleHoster(Hoster): def handleFree(self): - self.fail("Free download not implemented") + if not hasattr(self, 'LINK_FREE_PATTERN'): + self.fail("Free download not implemented") + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.parseError("Free download link not found") + + try: + link = m.group(1) + except Exception, e: + self.logError(str(e)) + else: + self.download(link, ref=True, cookies=True, disposition=True) def handlePremium(self): - self.fail("Premium download not implemented") + if not hasattr(self, 'LINK_PREMIUM_PATTERN'): + self.fail("Premium download not implemented") + + m = re.search(self.LINK_PREMIUM_PATTERN, self.html) + if m is None: + self.parseError("Premium download link not found") + + try: + link = m.group(1) + except Exception, e: + self.logError(str(e)) + else: + self.download(link, ref=True, cookies=True, disposition=True) def parseError(self, msg): -- cgit v1.2.3 From ff91b58bf9ee65aaeb048426295af6ad122b119e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 5 Oct 2014 22:14:53 +0200 Subject: Spare code cosmetics --- module/plugins/crypter/DevhostStFolder.py | 2 +- module/plugins/crypter/EasybytezComFolder.py | 2 +- module/plugins/hoster/AlldebridCom.py | 4 ++-- module/plugins/hoster/CzshareCom.py | 4 ++-- module/plugins/hoster/DevhostSt.py | 4 ++-- module/plugins/hoster/DropboxCom.py | 4 ++-- module/plugins/hoster/FastshareCz.py | 5 ++--- module/plugins/hoster/FilepupNet.py | 2 +- module/plugins/hoster/KingfilesNet.py | 4 ++-- module/plugins/hoster/SpeedyshareCom.py | 4 ++-- 10 files changed, 17 insertions(+), 18 deletions(-) diff --git a/module/plugins/crypter/DevhostStFolder.py b/module/plugins/crypter/DevhostStFolder.py index 0d9c032cb..1986f9fd0 100644 --- a/module/plugins/crypter/DevhostStFolder.py +++ b/module/plugins/crypter/DevhostStFolder.py @@ -17,7 +17,7 @@ class DevhostStFolder(SimpleCrypter): __pattern__ = r'http://(?:www\.)?d-h\.st/users/\w+/\?fld_id=\d+' - __description__ = """d-h.st decrypter plugin""" + __description__ = """d-h.st folder decrypter plugin""" __author_name_ = "zapp-brannigan" __author_mail_ = "fuerst.reinje@web.de" diff --git a/module/plugins/crypter/EasybytezComFolder.py b/module/plugins/crypter/EasybytezComFolder.py index 500f12278..be85a3798 100644 --- a/module/plugins/crypter/EasybytezComFolder.py +++ b/module/plugins/crypter/EasybytezComFolder.py @@ -10,7 +10,7 @@ class EasybytezComFolder(SimpleCrypter): __pattern__ = r'http://(?:www\.)?easybytez\.com/users/(?P\d+/\d+)' - __description__ = """Easybytez.com decrypter plugin""" + __description__ = """Easybytez.com folder decrypter plugin""" __author_name__ = "stickell" __author_mail__ = "l.stickell@yahoo.it" diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py index b1513bbac..44d709b1d 100644 --- a/module/plugins/hoster/AlldebridCom.py +++ b/module/plugins/hoster/AlldebridCom.py @@ -78,8 +78,8 @@ class AlldebridCom(Hoster): self.download(new_url, disposition=True) - check = self.checkDownload({"error": "An error occured while processing your request", - "empty": re.compile(r"^$")}) + check = self.checkDownload({'error': "An error occured while processing your request", + 'empty': re.compile(r"^$")}) if check == "error": self.retry(wait_time=60, reason="An error occured while generating link.") diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index df8cfea9e..f7fb119ac 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -128,13 +128,13 @@ class CzshareCom(SimpleHoster): def checkDownloadedFile(self): # check download check = self.checkDownload({ - "tempoffline": re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), + "temp_offline": re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), "credit": re.compile(r"^Nem.*te dostate.*n.* kredit.$"), "multi_dl": re.compile(self.MULTIDL_PATTERN), "captcha_err": "
  • Zadaný ověřovací kód nesouhlasí!
  • " }) - if check == "tempoffline": + if check == "temp_offline": self.fail("File not available - try later") if check == "credit": self.resetAccount() diff --git a/module/plugins/hoster/DevhostSt.py b/module/plugins/hoster/DevhostSt.py index 088ace93a..b50257238 100644 --- a/module/plugins/hoster/DevhostSt.py +++ b/module/plugins/hoster/DevhostSt.py @@ -41,8 +41,8 @@ class DevhostSt(SimpleHoster): self.logDebug("Download URL = " + dl_url) self.download(dl_url, disposition=True) - check = self.checkDownload({'is_html': re.compile("html")}) - if check == "is_html": + check = self.checkDownload({'html': re.compile("html")}) + if check == "html": self.parseError("Downloaded file is an html file") diff --git a/module/plugins/hoster/DropboxCom.py b/module/plugins/hoster/DropboxCom.py index 07e251946..e5de6823d 100644 --- a/module/plugins/hoster/DropboxCom.py +++ b/module/plugins/hoster/DropboxCom.py @@ -34,8 +34,8 @@ class DropboxCom(SimpleHoster): def handleFree(self): self.download(self.pyfile.url, get={'dl': "1"}) - check = self.checkDownload({'is_html': re.compile("html")}) - if check == "is_html": + check = self.checkDownload({'html': re.compile("html")}) + if check == "html": self.parseError("Downloaded file is an html file") diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index 5a6773af6..7a70baf93 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -48,9 +48,8 @@ class FastshareCz(SimpleHoster): self.download(urljoin(baseurl, action), post={"code": captcha, "btn.x": 77, "btn.y": 18}) check = self.checkDownload({ - "paralell_dl": - "FastShare.cz|