summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/plugins/accounts/AlldebridCom.py20
-rw-r--r--module/plugins/accounts/AniStreamCom.py4
-rw-r--r--module/plugins/accounts/BackinNet.py4
-rw-r--r--module/plugins/accounts/BitshareCom.py10
-rw-r--r--module/plugins/accounts/CatShareNet.py8
-rw-r--r--module/plugins/accounts/CloudsixMe.py4
-rw-r--r--module/plugins/accounts/CloudzillaTo.py8
-rw-r--r--module/plugins/accounts/CramitIn.py4
-rw-r--r--module/plugins/accounts/CzshareCom.py10
-rw-r--r--module/plugins/accounts/DebridItaliaCom.py18
-rw-r--r--module/plugins/accounts/DepositfilesCom.py8
-rw-r--r--module/plugins/accounts/EasybytezCom.py14
-rw-r--r--module/plugins/accounts/EuroshareEu.py8
-rw-r--r--module/plugins/accounts/ExashareCom.py4
-rw-r--r--module/plugins/accounts/FastixRu.py40
-rw-r--r--module/plugins/accounts/FastshareCz.py12
-rw-r--r--module/plugins/accounts/File4SafeCom.py4
-rw-r--r--module/plugins/accounts/FileParadoxIn.py4
-rw-r--r--module/plugins/accounts/FilecloudIo.py10
-rw-r--r--module/plugins/accounts/FilefactoryCom.py14
-rw-r--r--module/plugins/accounts/FilejungleCom.py10
-rw-r--r--module/plugins/accounts/FileomCom.py4
-rw-r--r--module/plugins/accounts/FilerNet.py8
-rw-r--r--module/plugins/accounts/FilerioCom.py4
-rw-r--r--module/plugins/accounts/FilesMailRu.py8
-rw-r--r--module/plugins/accounts/FileserveCom.py10
-rw-r--r--module/plugins/accounts/FourSharedCom.py10
-rw-r--r--module/plugins/accounts/FreakshareCom.py10
-rw-r--r--module/plugins/accounts/FreeWayMe.py28
-rw-r--r--module/plugins/accounts/FshareVn.py12
-rw-r--r--module/plugins/accounts/Ftp.py2
-rw-r--r--module/plugins/accounts/HellshareCz.py17
-rw-r--r--module/plugins/accounts/HighWayMe.py18
-rw-r--r--module/plugins/accounts/Http.py2
-rw-r--r--module/plugins/accounts/HugefilesNet.py4
-rw-r--r--module/plugins/accounts/HundredEightyUploadCom.py4
-rw-r--r--module/plugins/accounts/JunkyvideoCom.py4
-rw-r--r--module/plugins/accounts/JunocloudMe.py4
-rw-r--r--module/plugins/accounts/Keep2ShareCc.py14
-rw-r--r--module/plugins/accounts/LetitbitNet.py6
-rw-r--r--module/plugins/accounts/LinestorageCom.py18
-rw-r--r--module/plugins/accounts/LinksnappyCom.py22
-rw-r--r--module/plugins/accounts/MegaDebridEu.py26
-rw-r--r--module/plugins/accounts/MegaRapidCz.py13
-rw-r--r--module/plugins/accounts/MegaRapidoNet.py77
-rw-r--r--module/plugins/accounts/MegasharesCom.py9
-rw-r--r--module/plugins/accounts/MovReelCom.py4
-rw-r--r--module/plugins/accounts/MultihostersCom.py4
-rw-r--r--module/plugins/accounts/MultishareCz.py21
-rw-r--r--module/plugins/accounts/MyfastfileCom.py20
-rw-r--r--module/plugins/accounts/NitroflareCom.py15
-rw-r--r--module/plugins/accounts/NoPremiumPl.py40
-rw-r--r--module/plugins/accounts/NosuploadCom.py4
-rw-r--r--module/plugins/accounts/NovafileCom.py4
-rw-r--r--module/plugins/accounts/NowVideoSx.py10
-rw-r--r--module/plugins/accounts/OboomCom.py28
-rw-r--r--module/plugins/accounts/OneFichierCom.py17
-rw-r--r--module/plugins/accounts/OverLoadMe.py19
-rw-r--r--module/plugins/accounts/PremiumTo.py26
-rw-r--r--module/plugins/accounts/PremiumizeMe.py29
-rw-r--r--module/plugins/accounts/PutdriveCom.py4
-rw-r--r--module/plugins/accounts/QuickshareCz.py10
-rw-r--r--module/plugins/accounts/RPNetBiz.py33
-rw-r--r--module/plugins/accounts/RapideoPl.py40
-rw-r--r--module/plugins/accounts/RapidfileshareNet.py4
-rw-r--r--module/plugins/accounts/RapidgatorNet.py14
-rw-r--r--module/plugins/accounts/RapiduNet.py14
-rw-r--r--module/plugins/accounts/RarefileNet.py4
-rw-r--r--module/plugins/accounts/RealdebridCom.py17
-rw-r--r--module/plugins/accounts/RehostTo.py21
-rw-r--r--module/plugins/accounts/RyushareCom.py4
-rw-r--r--module/plugins/accounts/SafesharingEu.py4
-rw-r--r--module/plugins/accounts/SecureUploadEu.py4
-rw-r--r--module/plugins/accounts/SendmywayCom.py4
-rw-r--r--module/plugins/accounts/SharebeastCom.py4
-rw-r--r--module/plugins/accounts/ShareonlineBiz.py18
-rw-r--r--module/plugins/accounts/SimplyPremiumCom.py23
-rw-r--r--module/plugins/accounts/SimplydebridCom.py17
-rw-r--r--module/plugins/accounts/SmoozedCom.py24
-rw-r--r--module/plugins/accounts/StreamcloudEu.py4
-rw-r--r--module/plugins/accounts/TurbobitNet.py12
-rw-r--r--module/plugins/accounts/TusfilesNet.py4
-rw-r--r--module/plugins/accounts/UlozTo.py8
-rw-r--r--module/plugins/accounts/UploadableCh.py8
-rw-r--r--module/plugins/accounts/UploadcCom.py4
-rw-r--r--module/plugins/accounts/UploadedTo.py16
-rw-r--r--module/plugins/accounts/UploadheroCom.py9
-rw-r--r--module/plugins/accounts/UploadingCom.py10
-rw-r--r--module/plugins/accounts/UptoboxCom.py12
-rw-r--r--module/plugins/accounts/VidPlayNet.py4
-rw-r--r--module/plugins/accounts/WebshareCz.py12
-rw-r--r--module/plugins/accounts/WorldbytezCom.py4
-rw-r--r--module/plugins/accounts/XFileSharingPro.py12
-rw-r--r--module/plugins/accounts/YibaishiwuCom.py8
-rw-r--r--module/plugins/accounts/ZeveraCom.py38
-rw-r--r--module/plugins/captcha/AdYouLike.py4
-rw-r--r--module/plugins/captcha/LinksaveIn.py2
-rw-r--r--module/plugins/captcha/ReCaptcha.py2
-rw-r--r--module/plugins/captcha/SolveMedia.py2
-rw-r--r--module/plugins/container/DLC.py2
-rw-r--r--module/plugins/crypter/ChipDe.py2
-rw-r--r--module/plugins/crypter/CloudzillaToFolder.py7
-rw-r--r--module/plugins/crypter/Dereferer.py14
-rw-r--r--module/plugins/crypter/DevhostStFolder.py2
-rw-r--r--module/plugins/crypter/DlProtectCom.py2
-rw-r--r--module/plugins/crypter/EmbeduploadCom.py2
-rw-r--r--module/plugins/crypter/FilecryptCc.py117
-rw-r--r--module/plugins/crypter/FreakhareComFolder.py2
-rwxr-xr-x[-rw-r--r--]module/plugins/crypter/Go4UpCom.py33
-rw-r--r--module/plugins/crypter/GoogledriveComFolder.py4
-rw-r--r--module/plugins/crypter/LinkCryptWs.py24
-rw-r--r--module/plugins/crypter/LinkdecrypterCom.py10
-rw-r--r--module/plugins/crypter/LixIn.py17
-rw-r--r--module/plugins/crypter/MediafireComFolder.py4
-rw-r--r--module/plugins/crypter/MultiUpOrg.py8
-rw-r--r--module/plugins/crypter/MultiloadCz.py4
-rw-r--r--module/plugins/crypter/NCryptIn.py12
-rw-r--r--module/plugins/crypter/RelinkUs.py15
-rw-r--r--module/plugins/crypter/SafelinkingNet.py35
-rw-r--r--module/plugins/crypter/SexuriaCom.py61
-rw-r--r--module/plugins/crypter/ShSt.py4
-rw-r--r--module/plugins/crypter/ShareLinksBiz.py39
-rw-r--r--module/plugins/crypter/TNTVillageScambioeticoOrg.py4
-rw-r--r--module/plugins/crypter/UlozToFolder.py2
-rw-r--r--module/plugins/crypter/UploadedToFolder.py1
-rw-r--r--module/plugins/crypter/XFileSharingProFolder.py26
-rw-r--r--module/plugins/hooks/AlldebridComHook.py25
-rw-r--r--module/plugins/hooks/AntiStandby.py4
-rw-r--r--module/plugins/hooks/AntiVirus.py72
-rw-r--r--module/plugins/hooks/Captcha9Kw.py9
-rw-r--r--module/plugins/hooks/CaptchaBrotherhood.py2
-rw-r--r--module/plugins/hooks/Checksum.py14
-rw-r--r--module/plugins/hooks/ClickAndLoad.py2
-rw-r--r--module/plugins/hooks/DebridItaliaComHook.py26
-rw-r--r--module/plugins/hooks/EasybytezComHook.py30
-rw-r--r--module/plugins/hooks/ExternalScripts.py12
-rw-r--r--module/plugins/hooks/ExtractArchive.py94
-rw-r--r--module/plugins/hooks/FastixRuHook.py29
-rw-r--r--module/plugins/hooks/FreeWayMeHook.py28
-rw-r--r--module/plugins/hooks/HighWayMeHook.py26
-rw-r--r--module/plugins/hooks/HotFolder.py3
-rw-r--r--module/plugins/hooks/IRCInterface.py11
-rw-r--r--module/plugins/hooks/ImageTyperz.py1
-rw-r--r--module/plugins/hooks/LinksnappyComHook.py27
-rw-r--r--module/plugins/hooks/MegaDebridEuHook.py33
-rw-r--r--module/plugins/hooks/MegaRapidoNetHook.py82
-rw-r--r--module/plugins/hooks/MergeFiles.py5
-rw-r--r--module/plugins/hooks/MultihostersComHook.py19
-rw-r--r--module/plugins/hooks/MultishareCzHook.py29
-rw-r--r--module/plugins/hooks/MyfastfileComHook.py28
-rw-r--r--module/plugins/hooks/NoPremiumPlHook.py29
-rw-r--r--module/plugins/hooks/OverLoadMeHook.py25
-rw-r--r--module/plugins/hooks/PremiumToHook.py29
-rw-r--r--module/plugins/hooks/PremiumizeMeHook.py40
-rw-r--r--module/plugins/hooks/PutdriveComHook.py19
-rw-r--r--module/plugins/hooks/RPNetBizHook.py38
-rw-r--r--module/plugins/hooks/RapideoPlHook.py29
-rw-r--r--module/plugins/hooks/RealdebridComHook.py24
-rw-r--r--module/plugins/hooks/RehostToHook.py27
-rw-r--r--module/plugins/hooks/SimplyPremiumComHook.py29
-rw-r--r--module/plugins/hooks/SimplydebridComHook.py24
-rw-r--r--module/plugins/hooks/SkipRev.py15
-rw-r--r--module/plugins/hooks/SmoozedComHook.py24
-rw-r--r--module/plugins/hooks/TransmissionRPC.py84
-rw-r--r--module/plugins/hooks/UpdateManager.py15
-rw-r--r--module/plugins/hooks/XFileSharingPro.py34
-rw-r--r--module/plugins/hooks/XMPPInterface.py5
-rw-r--r--module/plugins/hooks/ZeveraComHook.py25
-rw-r--r--module/plugins/hoster/AndroidfilehostCom.py2
-rw-r--r--module/plugins/hoster/BasePlugin.py73
-rw-r--r--module/plugins/hoster/BezvadataCz.py30
-rw-r--r--module/plugins/hoster/BitshareCom.py30
-rw-r--r--module/plugins/hoster/CatShareNet.py2
-rw-r--r--module/plugins/hoster/CloudzillaTo.py6
-rw-r--r--module/plugins/hoster/CrockoCom.py19
-rw-r--r--module/plugins/hoster/CzshareCom.py42
-rw-r--r--module/plugins/hoster/DataportCz.py40
-rw-r--r--module/plugins/hoster/DateiTo.py3
-rw-r--r--module/plugins/hoster/DebridItaliaCom.py2
-rw-r--r--module/plugins/hoster/DepositfilesCom.py8
-rw-r--r--module/plugins/hoster/DlFreeFr.py5
-rw-r--r--module/plugins/hoster/EuroshareEu.py12
-rw-r--r--module/plugins/hoster/ExashareCom.py6
-rw-r--r--module/plugins/hoster/ExtabitCom.py26
-rw-r--r--module/plugins/hoster/FastixRu.py14
-rw-r--r--module/plugins/hoster/FastshareCz.py16
-rw-r--r--module/plugins/hoster/FileSharkPl.py16
-rw-r--r--module/plugins/hoster/FileboomMe.py83
-rw-r--r--module/plugins/hoster/FilecloudIo.py28
-rw-r--r--module/plugins/hoster/FiledropperCom.py10
-rw-r--r--module/plugins/hoster/FilefactoryCom.py27
-rw-r--r--module/plugins/hoster/FilepostCom.py27
-rw-r--r--module/plugins/hoster/FilepupNet.py8
-rw-r--r--module/plugins/hoster/FilerNet.py5
-rw-r--r--module/plugins/hoster/FilesMailRu.py5
-rw-r--r--module/plugins/hoster/FileserveCom.py41
-rw-r--r--module/plugins/hoster/FourSharedCom.py5
-rw-r--r--module/plugins/hoster/FreakshareCom.py13
-rw-r--r--module/plugins/hoster/FreeWayMe.py4
-rw-r--r--module/plugins/hoster/FshareVn.py4
-rw-r--r--module/plugins/hoster/Ftp.py31
-rw-r--r--module/plugins/hoster/GigapetaCom.py33
-rw-r--r--module/plugins/hoster/GoogledriveCom.py19
-rw-r--r--module/plugins/hoster/HellshareCz.py2
-rw-r--r--module/plugins/hoster/HighWayMe.py6
-rw-r--r--module/plugins/hoster/HostujeNet.py10
-rw-r--r--module/plugins/hoster/IfolderRu.py23
-rw-r--r--module/plugins/hoster/Keep2ShareCc.py22
-rw-r--r--module/plugins/hoster/KingfilesNet.py2
-rw-r--r--module/plugins/hoster/LetitbitNet.py21
-rw-r--r--module/plugins/hoster/LinksnappyCom.py6
-rw-r--r--module/plugins/hoster/LoadTo.py2
-rw-r--r--module/plugins/hoster/LuckyShareNet.py36
-rw-r--r--module/plugins/hoster/MediafireCom.py6
-rw-r--r--module/plugins/hoster/MegaDebridEu.py2
-rw-r--r--module/plugins/hoster/MegaRapidCz.py17
-rw-r--r--module/plugins/hoster/MegaRapidoNet.py18
-rw-r--r--module/plugins/hoster/MegasharesCom.py46
-rw-r--r--module/plugins/hoster/MultishareCz.py4
-rw-r--r--module/plugins/hoster/MyfastfileCom.py5
-rw-r--r--module/plugins/hoster/MystoreTo.py2
-rw-r--r--module/plugins/hoster/NarodRu.py36
-rw-r--r--module/plugins/hoster/NoPremiumPl.py16
-rw-r--r--module/plugins/hoster/NosuploadCom.py6
-rw-r--r--module/plugins/hoster/NowDownloadSx.py11
-rw-r--r--module/plugins/hoster/NowVideoSx.py6
-rw-r--r--module/plugins/hoster/OboomCom.py55
-rw-r--r--module/plugins/hoster/OneFichierCom.py63
-rw-r--r--module/plugins/hoster/OpenloadIo.py59
-rw-r--r--module/plugins/hoster/OverLoadMe.py4
-rw-r--r--module/plugins/hoster/PornhostCom.py2
-rw-r--r--module/plugins/hoster/PornhubCom.py2
-rw-r--r--module/plugins/hoster/PremiumTo.py8
-rw-r--r--module/plugins/hoster/PremiumizeMe.py10
-rw-r--r--module/plugins/hoster/QuickshareCz.py10
-rw-r--r--module/plugins/hoster/RPNetBiz.py9
-rw-r--r--module/plugins/hoster/RapideoPl.py10
-rw-r--r--module/plugins/hoster/RapidgatorNet.py44
-rw-r--r--module/plugins/hoster/RapiduNet.py2
-rw-r--r--module/plugins/hoster/RehostTo.py4
-rw-r--r--module/plugins/hoster/SendspaceCom.py29
-rw-r--r--module/plugins/hoster/Share4WebCom.py4
-rw-r--r--module/plugins/hoster/ShareonlineBiz.py65
-rw-r--r--module/plugins/hoster/ShareplaceCom.py2
-rw-r--r--module/plugins/hoster/SimplyPremiumCom.py6
-rw-r--r--module/plugins/hoster/SimplydebridCom.py8
-rw-r--r--module/plugins/hoster/SizedriveCom.py2
-rw-r--r--module/plugins/hoster/SmoozedCom.py6
-rw-r--r--module/plugins/hoster/SpeedyshareCom.py1
-rw-r--r--module/plugins/hoster/TurbobitNet.py97
-rw-r--r--module/plugins/hoster/UlozTo.py26
-rw-r--r--module/plugins/hoster/UloziskoSk.py4
-rw-r--r--module/plugins/hoster/UnibytesCom.py16
-rw-r--r--module/plugins/hoster/UpleaCom.py6
-rw-r--r--module/plugins/hoster/UploadableCh.py8
-rw-r--r--module/plugins/hoster/UploadedTo.py5
-rw-r--r--module/plugins/hoster/UploadheroCom.py8
-rw-r--r--module/plugins/hoster/UploadingCom.py10
-rw-r--r--module/plugins/hoster/UpstoreNet.py8
-rw-r--r--module/plugins/hoster/UptoboxCom.py4
-rw-r--r--module/plugins/hoster/UserscloudCom.py37
-rw-r--r--module/plugins/hoster/VeohCom.py2
-rw-r--r--module/plugins/hoster/WebshareCz.py6
-rw-r--r--module/plugins/hoster/XFileSharingPro.py26
-rw-r--r--module/plugins/hoster/XHamsterCom.py1
-rw-r--r--module/plugins/hoster/Xdcc.py4
-rw-r--r--module/plugins/hoster/YadiSk.py2
-rw-r--r--module/plugins/hoster/YibaishiwuCom.py5
-rw-r--r--module/plugins/hoster/YourfilesTo.py2
-rw-r--r--module/plugins/hoster/YoutubeCom.py30
-rw-r--r--module/plugins/hoster/ZeveraCom.py5
-rw-r--r--module/plugins/hoster/ZippyshareCom.py4
-rw-r--r--module/plugins/internal/Account.py465
-rw-r--r--module/plugins/internal/Addon.py24
-rw-r--r--module/plugins/internal/Base.py503
-rw-r--r--module/plugins/internal/Captcha.py27
-rw-r--r--module/plugins/internal/Container.py24
-rw-r--r--module/plugins/internal/Crypter.py39
-rw-r--r--module/plugins/internal/Extractor.py57
-rw-r--r--module/plugins/internal/Hook.py2
-rw-r--r--module/plugins/internal/Hoster.py595
-rw-r--r--module/plugins/internal/MultiAccount.py (renamed from module/plugins/internal/MultiHook.py)59
-rw-r--r--module/plugins/internal/MultiCrypter.py9
-rw-r--r--module/plugins/internal/MultiHoster.py24
-rw-r--r--module/plugins/internal/OCR.py8
-rw-r--r--module/plugins/internal/Plugin.py237
-rw-r--r--module/plugins/internal/SevenZip.py42
-rw-r--r--module/plugins/internal/SimpleCrypter.py53
-rw-r--r--module/plugins/internal/SimpleHoster.py309
-rw-r--r--module/plugins/internal/UnRar.py53
-rw-r--r--module/plugins/internal/UnZip.py15
-rw-r--r--module/plugins/internal/XFSAccount.py70
-rw-r--r--module/plugins/internal/XFSCrypter.py31
-rw-r--r--module/plugins/internal/XFSHoster.py51
294 files changed, 3605 insertions, 3623 deletions
diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py
index 6a2f09c9c..12d0582a8 100644
--- a/module/plugins/accounts/AlldebridCom.py
+++ b/module/plugins/accounts/AlldebridCom.py
@@ -12,16 +12,25 @@ from module.plugins.internal.Account import Account
class AlldebridCom(Account):
__name__ = "AlldebridCom"
__type__ = "account"
- __version__ = "0.26"
+ __version__ = "0.28"
__status__ = "testing"
+ __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval", "int" , "Reload interval in minutes" , 60 )]
+
__description__ = """AllDebrid.com account plugin"""
__license__ = "GPLv3"
__authors__ = [("Andy Voigt", "spamsales@online.de")]
- def parse_info(self, user, password, data, req):
- data = self.get_data(user)
+ def grab_hosters(self, user, password, data):
+ html = self.load("https://www.alldebrid.com/api.php",
+ get={'action': "get_host"})
+ return [x for x in map(str.strip, html.replace("\"", "").split(",")) if x]
+
+
+ def grab_info(self, user, password, data):
html = self.load("http://www.alldebrid.com/account/")
soup = BeautifulSoup.BeautifulSoup(html)
@@ -38,7 +47,6 @@ class AlldebridCom(Account):
#: Get expiration date from API
except Exception:
- data = self.get_data(user)
html = self.load("https://www.alldebrid.com/api.php",
get={'action': "info_user",
'login' : user,
@@ -54,7 +62,7 @@ class AlldebridCom(Account):
'premium' : True }
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load("https://www.alldebrid.com/register/",
get={'action' : "login",
'login_login' : user,
@@ -63,4 +71,4 @@ class AlldebridCom(Account):
if "This login doesn't exist" in html \
or "The password is not valid" in html \
or "Invalid captcha" in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/AniStreamCom.py b/module/plugins/accounts/AniStreamCom.py
index 53ca1d5b8..5c7ac9fff 100644
--- a/module/plugins/accounts/AniStreamCom.py
+++ b/module/plugins/accounts/AniStreamCom.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class AniStreamCom(XFSAccount):
__name__ = "AniStreamCom"
__type__ = "account"
- __version__ = "0.01"
+ __version__ = "0.02"
__status__ = "testing"
__description__ = """Ani-Stream.com account plugin"""
@@ -14,4 +14,4 @@ class AniStreamCom(XFSAccount):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = "ani-stream.com"
+ PLUGIN_DOMAIN = "ani-stream.com"
diff --git a/module/plugins/accounts/BackinNet.py b/module/plugins/accounts/BackinNet.py
index 58939c13a..d903f020c 100644
--- a/module/plugins/accounts/BackinNet.py
+++ b/module/plugins/accounts/BackinNet.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class BackinNet(XFSAccount):
__name__ = "BackinNet"
__type__ = "account"
- __version__ = "0.02"
+ __version__ = "0.03"
__status__ = "testing"
__description__ = """Backin.net account plugin"""
@@ -14,4 +14,4 @@ class BackinNet(XFSAccount):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = "backin.net"
+ PLUGIN_DOMAIN = "backin.net"
diff --git a/module/plugins/accounts/BitshareCom.py b/module/plugins/accounts/BitshareCom.py
index 280f008b2..e8028b9d0 100644
--- a/module/plugins/accounts/BitshareCom.py
+++ b/module/plugins/accounts/BitshareCom.py
@@ -6,7 +6,7 @@ from module.plugins.internal.Account import Account
class BitshareCom(Account):
__name__ = "BitshareCom"
__type__ = "account"
- __version__ = "0.15"
+ __version__ = "0.17"
__status__ = "testing"
__description__ = """Bitshare account plugin"""
@@ -14,7 +14,7 @@ class BitshareCom(Account):
__authors__ = [("Paul King", None)]
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
html = self.load("http://bitshare.com/mysettings.html")
if "\"http://bitshare.com/myupgrade.html\">Free" in html:
@@ -26,11 +26,11 @@ class BitshareCom(Account):
return {'validuntil': -1, 'trafficleft': -1, 'premium': True}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load("https://bitshare.com/login.html",
post={'user' : user,
'password': password,
'submit' : "Login"})
- if "login" in req.lastEffectiveURL:
- self.login_fail()
+ if "login" in self.req.lastEffectiveURL:
+ self.fail_login()
diff --git a/module/plugins/accounts/CatShareNet.py b/module/plugins/accounts/CatShareNet.py
index 92f1cb27e..6e11064a6 100644
--- a/module/plugins/accounts/CatShareNet.py
+++ b/module/plugins/accounts/CatShareNet.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account
class CatShareNet(Account):
__name__ = "CatShareNet"
__type__ = "account"
- __version__ = "0.08"
+ __version__ = "0.10"
__status__ = "testing"
__description__ = """Catshare.net account plugin"""
@@ -22,7 +22,7 @@ class CatShareNet(Account):
TRAFFIC_LEFT_PATTERN = r'<a href="/premium">([0-9.]+ [kMG]B)'
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
premium = False
validuntil = -1
trafficleft = -1
@@ -50,7 +50,7 @@ class CatShareNet(Account):
return {'premium': premium, 'trafficleft': trafficleft, 'validuntil': validuntil}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load("http://catshare.net/login", #@TODO: Revert to `https` in 0.4.10
post={'user_email' : user,
'user_password' : password,
@@ -58,4 +58,4 @@ class CatShareNet(Account):
'user[submit]' : "Login"})
if not '<a href="/logout">Wyloguj</a>' in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/CloudsixMe.py b/module/plugins/accounts/CloudsixMe.py
index 973e37044..3410af002 100644
--- a/module/plugins/accounts/CloudsixMe.py
+++ b/module/plugins/accounts/CloudsixMe.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class CloudsixMe(XFSAccount):
__name__ = "CloudsixMe"
__type__ = "account"
- __version__ = "0.01"
+ __version__ = "0.02"
__status__ = "testing"
__description__ = """Cloudsix.me account plugin"""
@@ -14,4 +14,4 @@ class CloudsixMe(XFSAccount):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = "cloudsix.me"
+ PLUGIN_DOMAIN = "cloudsix.me"
diff --git a/module/plugins/accounts/CloudzillaTo.py b/module/plugins/accounts/CloudzillaTo.py
index 0d473eb7d..821975ef0 100644
--- a/module/plugins/accounts/CloudzillaTo.py
+++ b/module/plugins/accounts/CloudzillaTo.py
@@ -8,7 +8,7 @@ from module.plugins.internal.Account import Account
class CloudzillaTo(Account):
__name__ = "CloudzillaTo"
__type__ = "account"
- __version__ = "0.04"
+ __version__ = "0.06"
__status__ = "testing"
__description__ = """Cloudzilla.to account plugin"""
@@ -19,7 +19,7 @@ class CloudzillaTo(Account):
PREMIUM_PATTERN = r'<h2>account type</h2>\s*Premium Account'
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
html = self.load("http://www.cloudzilla.to/")
premium = True if re.search(self.PREMIUM_PATTERN, html) else False
@@ -27,11 +27,11 @@ class CloudzillaTo(Account):
return {'validuntil': -1, 'trafficleft': -1, 'premium': premium}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load("https://www.cloudzilla.to/",
post={'lusername': user,
'lpassword': password,
'w' : "dologin"})
if "ERROR" in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/CramitIn.py b/module/plugins/accounts/CramitIn.py
index d3f2e0d77..084aa79a6 100644
--- a/module/plugins/accounts/CramitIn.py
+++ b/module/plugins/accounts/CramitIn.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class CramitIn(XFSAccount):
__name__ = "CramitIn"
__type__ = "account"
- __version__ = "0.04"
+ __version__ = "0.05"
__status__ = "testing"
__description__ = """Cramit.in account plugin"""
@@ -14,4 +14,4 @@ class CramitIn(XFSAccount):
__authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
- HOSTER_DOMAIN = "cramit.in"
+ PLUGIN_DOMAIN = "cramit.in"
diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py
index e9a34cb83..209a94f60 100644
--- a/module/plugins/accounts/CzshareCom.py
+++ b/module/plugins/accounts/CzshareCom.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account
class CzshareCom(Account):
__name__ = "CzshareCom"
__type__ = "account"
- __version__ = "0.20"
+ __version__ = "0.23"
__status__ = "testing"
__description__ = """Czshare.com account plugin, now Sdilej.cz"""
@@ -21,7 +21,7 @@ class CzshareCom(Account):
CREDIT_LEFT_PATTERN = r'<tr class="active">\s*<td>([\d ,]+) (KiB|MiB|GiB)</td>\s*<td>([^<]*)</td>\s*</tr>'
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
premium = False
validuntil = None
trafficleft = None
@@ -30,7 +30,7 @@ class CzshareCom(Account):
try:
m = re.search(self.CREDIT_LEFT_PATTERN, html)
- trafficleft = self.parse_traffic(m.group(1).replace(' ', '').replace(',', '.')) + m.group(2)
+ trafficleft = self.parse_traffic(m.group(1), m.group(2)
validuntil = time.mktime(time.strptime(m.group(3), '%d.%m.%y %H:%M'))
except Exception, e:
@@ -44,11 +44,11 @@ class CzshareCom(Account):
'trafficleft': trafficleft}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load('https://sdilej.cz/index.php',
post={'Prihlasit' : "Prihlasit",
"login-password": password,
"login-name" : user})
if '<div class="login' in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/DebridItaliaCom.py b/module/plugins/accounts/DebridItaliaCom.py
index 9c0956668..50d849a98 100644
--- a/module/plugins/accounts/DebridItaliaCom.py
+++ b/module/plugins/accounts/DebridItaliaCom.py
@@ -9,9 +9,13 @@ from module.plugins.internal.Account import Account
class DebridItaliaCom(Account):
__name__ = "DebridItaliaCom"
__type__ = "account"
- __version__ = "0.15"
+ __version__ = "0.17"
__status__ = "testing"
+ __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval", "int" , "Reload interval in minutes" , 60 )]
+
__description__ = """Debriditalia.com account plugin"""
__license__ = "GPLv3"
__authors__ = [("stickell", "l.stickell@yahoo.it"),
@@ -21,13 +25,17 @@ class DebridItaliaCom(Account):
WALID_UNTIL_PATTERN = r'Premium valid till: (.+?) \|'
- def parse_info(self, user, password, data, req):
+ def grab_hosters(self, user, password, data):
+ return self.load("http://debriditalia.com/api.php", get={'hosts': ""}).replace('"', '').split(',')
+
+
+ def grab_info(self, user, password, data):
info = {'premium': False, 'validuntil': None, 'trafficleft': None}
html = self.load("http://debriditalia.com/")
if 'Account premium not activated' not in html:
m = re.search(self.WALID_UNTIL_PATTERN, html)
- if m:
+ if m is not None:
validuntil = time.mktime(time.strptime(m.group(1), "%d/%m/%Y %H:%M"))
info = {'premium': True, 'validuntil': validuntil, 'trafficleft': -1}
else:
@@ -36,10 +44,10 @@ class DebridItaliaCom(Account):
return info
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load("https://debriditalia.com/login.php",
get={'u': user,
'p': password})
if 'NO' in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/DepositfilesCom.py b/module/plugins/accounts/DepositfilesCom.py
index 848529bc3..35df3f939 100644
--- a/module/plugins/accounts/DepositfilesCom.py
+++ b/module/plugins/accounts/DepositfilesCom.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account
class DepositfilesCom(Account):
__name__ = "DepositfilesCom"
__type__ = "account"
- __version__ = "0.34"
+ __version__ = "0.36"
__status__ = "testing"
__description__ = """Depositfiles.com account plugin"""
@@ -19,7 +19,7 @@ class DepositfilesCom(Account):
("Walter Purcaro", "vuolter@gmail.com")]
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
html = self.load("https://dfiles.eu/de/gold/")
validuntil = re.search(r"Sie haben Gold Zugang bis: <b>(.*?)</b></div>", html).group(1)
@@ -28,11 +28,11 @@ class DepositfilesCom(Account):
return {'validuntil': validuntil, 'trafficleft': -1}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load("https://dfiles.eu/de/login.php",
get={'return': "/de/gold/payment.php"},
post={'login' : user,
'password': password})
if r'<div class="error_message">Sie haben eine falsche Benutzername-Passwort-Kombination verwendet.</div>' in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/EasybytezCom.py b/module/plugins/accounts/EasybytezCom.py
index 5e1a4f962..9340f49e6 100644
--- a/module/plugins/accounts/EasybytezCom.py
+++ b/module/plugins/accounts/EasybytezCom.py
@@ -8,13 +8,23 @@ from module.plugins.internal.XFSAccount import XFSAccount
class EasybytezCom(XFSAccount):
__name__ = "EasybytezCom"
__type__ = "account"
- __version__ = "0.13"
+ __version__ = "0.14"
__status__ = "testing"
+ __config__ = [("mh_activated", "bool" , "Use multihoster feature" , True ),
+ ("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval" , "int" , "Reload interval in minutes" , 60 )]
+
__description__ = """EasyBytez.com account plugin"""
__license__ = "GPLv3"
__authors__ = [("zoidberg", "zoidberg@mujmail.cz"),
("guidobelix", "guidobelix@hotmail.it")]
- HOSTER_DOMAIN = "easybytez.com"
+ PLUGIN_DOMAIN = "easybytez.com"
+
+
+ def grab_hosters(self, user, password, data):
+ return re.search(r'</textarea>\s*Supported sites:(.*)',
+ self.load("http://www.easybytez.com")).group(1).split(',')
diff --git a/module/plugins/accounts/EuroshareEu.py b/module/plugins/accounts/EuroshareEu.py
index bc8618250..09f08dc01 100644
--- a/module/plugins/accounts/EuroshareEu.py
+++ b/module/plugins/accounts/EuroshareEu.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account
class EuroshareEu(Account):
__name__ = "EuroshareEu"
__type__ = "account"
- __version__ = "0.04"
+ __version__ = "0.06"
__status__ = "testing"
__description__ = """Euroshare.eu account plugin"""
@@ -17,7 +17,7 @@ class EuroshareEu(Account):
__authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
self.relogin(user)
html = self.load("http://euroshare.eu/customer-zone/settings/")
@@ -32,11 +32,11 @@ class EuroshareEu(Account):
return {'validuntil': validuntil, 'trafficleft': -1, 'premium': premium}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load('http://euroshare.eu/customer-zone/login/',
post={'trvale' : "1",
'login' : user,
'password': password})
if u">Nesprávne prihlasovacie meno alebo heslo" in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/ExashareCom.py b/module/plugins/accounts/ExashareCom.py
index 26594c702..6b352e40e 100644
--- a/module/plugins/accounts/ExashareCom.py
+++ b/module/plugins/accounts/ExashareCom.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class ExashareCom(XFSAccount):
__name__ = "ExashareCom"
__type__ = "account"
- __version__ = "0.02"
+ __version__ = "0.03"
__status__ = "testing"
__description__ = """Exashare.com account plugin"""
@@ -14,4 +14,4 @@ class ExashareCom(XFSAccount):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = "exashare.com"
+ PLUGIN_DOMAIN = "exashare.com"
diff --git a/module/plugins/accounts/FastixRu.py b/module/plugins/accounts/FastixRu.py
index 13edbbb44..83a02d76b 100644
--- a/module/plugins/accounts/FastixRu.py
+++ b/module/plugins/accounts/FastixRu.py
@@ -7,18 +7,30 @@ from module.common.json_layer import json_loads
class FastixRu(Account):
__name__ = "FastixRu"
__type__ = "account"
- __version__ = "0.05"
+ __version__ = "0.08"
__status__ = "testing"
+ __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval", "int" , "Reload interval in minutes" , 60 )]
+
__description__ = """Fastix account plugin"""
__license__ = "GPLv3"
__authors__ = [("Massimo Rosamilia", "max@spiritix.eu")]
- def parse_info(self, user, password, data, req):
- data = self.get_data(user)
+ def grab_hosters(self, user, password, data):
+ html = self.load("http://fastix.ru/api_v2",
+ get={'apikey': "5182964c3f8f9a7f0b00000a_kelmFB4n1IrnCDYuIFn2y",
+ 'sub' : "allowed_sources"})
+ host_list = json_loads(html)
+ host_list = host_list['allow']
+ return host_list
+
+
+ def grab_info(self, user, password, data):
html = json_loads(self.load("http://fastix.ru/api_v2/",
- get={'apikey': data['api'],
+ get={'apikey': data['apikey'],
'sub' : "getaccountdetails"}))
points = html['points']
@@ -31,16 +43,14 @@ class FastixRu(Account):
return account_info
- def login(self, user, password, data, req):
- html = self.load("https://fastix.ru/api_v2/",
- get={'sub' : "get_apikey",
- 'email' : user,
- 'password': password})
+ def signin(self, user, password, data):
+ api = json_loads(self.load("https://fastix.ru/api_v2/",
+ get={'sub' : "get_apikey",
+ 'email' : user,
+ 'password': password}))
- api = json_loads(html)
- api = api['apikey']
+ if 'error' in api:
+ self.fail_login(api['error_txt'])
- data['api'] = api
-
- if "error_code" in html:
- self.login_fail()
+ else:
+ data['apikey'] = api['apikey']
diff --git a/module/plugins/accounts/FastshareCz.py b/module/plugins/accounts/FastshareCz.py
index 3a3769a1c..68c65bd3f 100644
--- a/module/plugins/accounts/FastshareCz.py
+++ b/module/plugins/accounts/FastshareCz.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Plugin import set_cookie
class FastshareCz(Account):
__name__ = "FastshareCz"
__type__ = "account"
- __version__ = "0.09"
+ __version__ = "0.11"
__status__ = "testing"
__description__ = """Fastshare.cz account plugin"""
@@ -21,7 +21,7 @@ class FastshareCz(Account):
CREDIT_PATTERN = r'Credit\s*:\s*</td>\s*<td>(.+?)\s*<'
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
validuntil = -1
trafficleft = None
premium = False
@@ -29,7 +29,7 @@ class FastshareCz(Account):
html = self.load("http://www.fastshare.cz/user")
m = re.search(self.CREDIT_PATTERN, html)
- if m:
+ if m is not None:
trafficleft = self.parse_traffic(m.group(1))
premium = bool(trafficleft)
@@ -39,8 +39,8 @@ class FastshareCz(Account):
'premium' : premium}
- def login(self, user, password, data, req):
- set_cookie(req.cj, "fastshare.cz", "lang", "en")
+ def signin(self, user, password, data):
+ set_cookie(self.req.cj, "fastshare.cz", "lang", "en")
self.load('http://www.fastshare.cz/login') #@NOTE: Do not remove or it will not login
@@ -49,4 +49,4 @@ class FastshareCz(Account):
'heslo': password})
if ">Wrong username or password" in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/File4SafeCom.py b/module/plugins/accounts/File4SafeCom.py
index 54c3a2359..8e5f437b3 100644
--- a/module/plugins/accounts/File4SafeCom.py
+++ b/module/plugins/accounts/File4SafeCom.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class File4SafeCom(XFSAccount):
__name__ = "File4SafeCom"
__type__ = "account"
- __version__ = "0.06"
+ __version__ = "0.07"
__status__ = "testing"
__description__ = """File4Safe.com account plugin"""
@@ -14,6 +14,6 @@ class File4SafeCom(XFSAccount):
__authors__ = [("stickell", "l.stickell@yahoo.it")]
- HOSTER_DOMAIN = "file4safe.com"
+ PLUGIN_DOMAIN = "file4safe.com"
LOGIN_FAIL_PATTERN = r'input_login'
diff --git a/module/plugins/accounts/FileParadoxIn.py b/module/plugins/accounts/FileParadoxIn.py
index 21f43be6e..86183f4d3 100644
--- a/module/plugins/accounts/FileParadoxIn.py
+++ b/module/plugins/accounts/FileParadoxIn.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class FileParadoxIn(XFSAccount):
__name__ = "FileParadoxIn"
__type__ = "account"
- __version__ = "0.03"
+ __version__ = "0.04"
__status__ = "testing"
__description__ = """FileParadox.in account plugin"""
@@ -14,4 +14,4 @@ class FileParadoxIn(XFSAccount):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = "fileparadox.in"
+ PLUGIN_DOMAIN = "fileparadox.in"
diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py
index bdb13bd3d..d80a8b9d6 100644
--- a/module/plugins/accounts/FilecloudIo.py
+++ b/module/plugins/accounts/FilecloudIo.py
@@ -8,7 +8,7 @@ from module.plugins.internal.Plugin import set_cookie
class FilecloudIo(Account):
__name__ = "FilecloudIo"
__type__ = "account"
- __version__ = "0.07"
+ __version__ = "0.09"
__status__ = "testing"
__description__ = """FilecloudIo account plugin"""
@@ -17,7 +17,7 @@ class FilecloudIo(Account):
("stickell", "l.stickell@yahoo.it")]
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
#: It looks like the first API request always fails, so we retry 5 times, it should work on the second try
for _i in xrange(5):
rep = self.load("https://secure.filecloud.io/api-fetch_apikey.api",
@@ -43,8 +43,8 @@ class FilecloudIo(Account):
return {'premium': False}
- def login(self, user, password, data, req):
- set_cookie(req.cj, "secure.filecloud.io", "lang", "en")
+ def signin(self, user, password, data):
+ set_cookie(self.req.cj, "secure.filecloud.io", "lang", "en")
html = self.load('https://secure.filecloud.io/user-login.html')
if not hasattr(self, "form_data"):
@@ -57,4 +57,4 @@ class FilecloudIo(Account):
post=self.form_data)
if "you have successfully logged in" not in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/FilefactoryCom.py b/module/plugins/accounts/FilefactoryCom.py
index e3d0c8491..0f8f709c6 100644
--- a/module/plugins/accounts/FilefactoryCom.py
+++ b/module/plugins/accounts/FilefactoryCom.py
@@ -10,7 +10,7 @@ from module.plugins.internal.Account import Account
class FilefactoryCom(Account):
__name__ = "FilefactoryCom"
__type__ = "account"
- __version__ = "0.17"
+ __version__ = "0.19"
__status__ = "testing"
__description__ = """Filefactory.com account plugin"""
@@ -22,11 +22,11 @@ class FilefactoryCom(Account):
VALID_UNTIL_PATTERN = r'Premium valid until: <strong>(?P<D>\d{1,2})\w{1,2} (?P<M>\w{3}), (?P<Y>\d{4})</strong>'
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
html = self.load("http://www.filefactory.com/account/")
m = re.search(self.VALID_UNTIL_PATTERN, html)
- if m:
+ if m is not None:
premium = True
validuntil = re.sub(self.VALID_UNTIL_PATTERN, '\g<D> \g<M> \g<Y>', m.group(0))
validuntil = time.mktime(time.strptime(validuntil, "%d %b %Y"))
@@ -37,13 +37,13 @@ class FilefactoryCom(Account):
return {'premium': premium, 'trafficleft': -1, 'validuntil': validuntil}
- def login(self, user, password, data, req):
- req.http.c.setopt(pycurl.REFERER, "http://www.filefactory.com/member/login.php")
+ def signin(self, user, password, data):
+ self.req.http.c.setopt(pycurl.REFERER, "http://www.filefactory.com/member/login.php")
html = self.load("https://www.filefactory.com/member/signin.php",
post={'loginEmail' : user,
'loginPassword': password,
'Submit' : "Sign In"})
- if req.lastEffectiveURL != "http://www.filefactory.com/account/":
- self.login_fail()
+ if self.req.lastEffectiveURL != "http://www.filefactory.com/account/":
+ self.fail_login()
diff --git a/module/plugins/accounts/FilejungleCom.py b/module/plugins/accounts/FilejungleCom.py
index fb251ac5f..230aa9939 100644
--- a/module/plugins/accounts/FilejungleCom.py
+++ b/module/plugins/accounts/FilejungleCom.py
@@ -10,7 +10,7 @@ from module.plugins.internal.Account import Account
class FilejungleCom(Account):
__name__ = "FilejungleCom"
__type__ = "account"
- __version__ = "0.14"
+ __version__ = "0.16"
__status__ = "testing"
__description__ = """Filejungle.com account plugin"""
@@ -25,10 +25,10 @@ class FilejungleCom(Account):
LOGIN_FAILED_PATTERN = r'<span htmlfor="loginUser(Name|Password)" generated="true" class="fail_info">'
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
html = self.load(self.URL + "dashboard.php")
m = re.search(self.TRAFFIC_LEFT_PATTERN, html)
- if m:
+ if m is not None:
premium = True
validuntil = time.mktime(time.strptime(m.group(1), "%d %b %Y"))
else:
@@ -38,7 +38,7 @@ class FilejungleCom(Account):
return {'premium': premium, 'trafficleft': -1, 'validuntil': validuntil}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load(urlparse.urljoin(self.URL, "login.php"),
post={'loginUserName' : user,
'loginUserPassword' : password,
@@ -48,4 +48,4 @@ class FilejungleCom(Account):
'recaptcha_shortencode_field': ""})
if re.search(self.LOGIN_FAILED_PATTERN, html):
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/FileomCom.py b/module/plugins/accounts/FileomCom.py
index 957f4ef05..0bd0b60cf 100644
--- a/module/plugins/accounts/FileomCom.py
+++ b/module/plugins/accounts/FileomCom.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class FileomCom(XFSAccount):
__name__ = "FileomCom"
__type__ = "account"
- __version__ = "0.03"
+ __version__ = "0.04"
__status__ = "testing"
__description__ = """Fileom.com account plugin"""
@@ -14,4 +14,4 @@ class FileomCom(XFSAccount):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = "fileom.com"
+ PLUGIN_DOMAIN = "fileom.com"
diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py
index 674c7a5dd..96bdebd81 100644
--- a/module/plugins/accounts/FilerNet.py
+++ b/module/plugins/accounts/FilerNet.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account
class FilerNet(Account):
__name__ = "FilerNet"
__type__ = "account"
- __version__ = "0.07"
+ __version__ = "0.09"
__status__ = "testing"
__description__ = """Filer.net account plugin"""
@@ -23,7 +23,7 @@ class FilerNet(Account):
FREE_PATTERN = r'Account Status</th>\s*<td>\s*Free'
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
html = self.load("https://filer.net/profile")
#: Free user
@@ -43,7 +43,7 @@ class FilerNet(Account):
return {'premium': False, 'validuntil': None, 'trafficleft': None}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load("https://filer.net/login")
token = re.search(self.TOKEN_PATTERN, html).group(1)
@@ -56,4 +56,4 @@ class FilerNet(Account):
'_target_path': "https://filer.net/"})
if 'Logout' not in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/FilerioCom.py b/module/plugins/accounts/FilerioCom.py
index 8a4750036..d843dd605 100644
--- a/module/plugins/accounts/FilerioCom.py
+++ b/module/plugins/accounts/FilerioCom.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class FilerioCom(XFSAccount):
__name__ = "FilerioCom"
__type__ = "account"
- __version__ = "0.04"
+ __version__ = "0.05"
__status__ = "testing"
__description__ = """FileRio.in account plugin"""
@@ -14,4 +14,4 @@ class FilerioCom(XFSAccount):
__authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
- HOSTER_DOMAIN = "filerio.in"
+ PLUGIN_DOMAIN = "filerio.in"
diff --git a/module/plugins/accounts/FilesMailRu.py b/module/plugins/accounts/FilesMailRu.py
index 7ed09e731..551a7b8e5 100644
--- a/module/plugins/accounts/FilesMailRu.py
+++ b/module/plugins/accounts/FilesMailRu.py
@@ -6,7 +6,7 @@ from module.plugins.internal.Account import Account
class FilesMailRu(Account):
__name__ = "FilesMailRu"
__type__ = "account"
- __version__ = "0.13"
+ __version__ = "0.15"
__status__ = "testing"
__description__ = """Filesmail.ru account plugin"""
@@ -14,11 +14,11 @@ class FilesMailRu(Account):
__authors__ = [("RaNaN", "RaNaN@pyload.org")]
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
return {'validuntil': None, 'trafficleft': None}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
user, domain = user.split("@")
html = self.load("https://swa.mail.ru/cgi-bin/auth",
@@ -28,4 +28,4 @@ class FilesMailRu(Account):
'Page' : "http://files.mail.ru/"})
if "НеверМПе ОЌя пПльзПвателя ОлО парПль" in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/FileserveCom.py b/module/plugins/accounts/FileserveCom.py
index dabfc1932..bc56d4b96 100644
--- a/module/plugins/accounts/FileserveCom.py
+++ b/module/plugins/accounts/FileserveCom.py
@@ -9,7 +9,7 @@ from module.common.json_layer import json_loads
class FileserveCom(Account):
__name__ = "FileserveCom"
__type__ = "account"
- __version__ = "0.22"
+ __version__ = "0.24"
__status__ = "testing"
__description__ = """Fileserve.com account plugin"""
@@ -17,9 +17,7 @@ class FileserveCom(Account):
__authors__ = [("mkaay", "mkaay@mkaay.de")]
- def parse_info(self, user, password, data, req):
- data = self.get_data(user)
-
+ def grab_info(self, user, password, data):
html = self.load("http://app.fileserve.com/api/login/",
post={'username': user,
'password': password,
@@ -33,7 +31,7 @@ class FileserveCom(Account):
return {'premium': False, 'trafficleft': None, 'validuntil': None}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load("http://app.fileserve.com/api/login/",
post={'username': user,
'password': password,
@@ -41,7 +39,7 @@ class FileserveCom(Account):
res = json_loads(html)
if not res['type']:
- self.login_fail()
+ self.fail_login()
#: Login at fileserv html
self.load("http://www.fileserve.com/login.php",
diff --git a/module/plugins/accounts/FourSharedCom.py b/module/plugins/accounts/FourSharedCom.py
index a7ec8e2c5..05e75f326 100644
--- a/module/plugins/accounts/FourSharedCom.py
+++ b/module/plugins/accounts/FourSharedCom.py
@@ -7,7 +7,7 @@ from module.plugins.internal.Plugin import set_cookie
class FourSharedCom(Account):
__name__ = "FourSharedCom"
__type__ = "account"
- __version__ = "0.07"
+ __version__ = "0.09"
__status__ = "testing"
__description__ = """FourShared.com account plugin"""
@@ -16,13 +16,13 @@ class FourSharedCom(Account):
("stickell", "l.stickell@yahoo.it")]
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
#: Free mode only for now
return {'premium': False}
- def login(self, user, password, data, req):
- set_cookie(req.cj, "4shared.com", "4langcookie", "en")
+ def signin(self, user, password, data):
+ set_cookie(self.req.cj, "4shared.com", "4langcookie", "en")
res = self.load("https://www.4shared.com/web/login",
post={'login' : user,
@@ -32,4 +32,4 @@ class FourSharedCom(Account):
'returnTo' : "http://www.4shared.com/account/home.jsp"})
if 'Please log in to access your 4shared account' in res:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/FreakshareCom.py b/module/plugins/accounts/FreakshareCom.py
index a2f66f3b3..a319096db 100644
--- a/module/plugins/accounts/FreakshareCom.py
+++ b/module/plugins/accounts/FreakshareCom.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account
class FreakshareCom(Account):
__name__ = "FreakshareCom"
__type__ = "account"
- __version__ = "0.15"
+ __version__ = "0.17"
__status__ = "testing"
__description__ = """Freakshare.com account plugin"""
@@ -17,7 +17,7 @@ class FreakshareCom(Account):
__authors__ = [("RaNaN", "RaNaN@pyload.org")]
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
premium = False
validuntil = None
trafficleft = None
@@ -26,7 +26,7 @@ class FreakshareCom(Account):
try:
m = re.search(r'ltig bis:</td>\s*<td><b>([\d.:-]+)</b></td>', html, re.M)
- validuntil = time.mktime(time.strptime(m.group(1).strip(), "%d.%m.%Y - %H:%M"))
+ validuntil = time.mktime(time.strptime(m.group(1), "%d.%m.%Y - %H:%M"))
except Exception:
pass
@@ -41,7 +41,7 @@ class FreakshareCom(Account):
return {'premium': premium, 'validuntil': validuntil, 'trafficleft': trafficleft}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
self.load("http://freakshare.com/index.php?language=EN")
html = self.load("https://freakshare.com/login.html",
@@ -50,4 +50,4 @@ class FreakshareCom(Account):
'pass' : password})
if ">Wrong Username or Password" in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/FreeWayMe.py b/module/plugins/accounts/FreeWayMe.py
index 0c315873f..5e214db35 100644
--- a/module/plugins/accounts/FreeWayMe.py
+++ b/module/plugins/accounts/FreeWayMe.py
@@ -7,22 +7,32 @@ from module.common.json_layer import json_loads
class FreeWayMe(Account):
__name__ = "FreeWayMe"
__type__ = "account"
- __version__ = "0.16"
+ __version__ = "0.19"
__status__ = "testing"
+ __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval", "int" , "Reload interval in minutes" , 60 )]
+
__description__ = """FreeWayMe account plugin"""
__license__ = "GPLv3"
__authors__ = [("Nicolas Giese", "james@free-way.me")]
- def parse_info(self, user, password, data, req):
- status = self.get_account_status(user, password, req)
+ def grab_hosters(self, user, password, data):
+ html = self.load("http://www.free-way.bz/ajax/jd.php",
+ get={'id' : 3, 'user': user, 'pass': password}) #@TODO: Revert to `https` in 0.4.10
+ return [x for x in map(str.strip, html.replace("\"", "").split(",")) if x]
+
+
+ def grab_info(self, user, password, data):
+ status = self.get_account_status(user, password)
self.log_debug(status)
account_info = {'validuntil': -1, 'premium': False}
if status['premium'] == "Free":
- account_info['trafficleft'] = self.parse_traffic(status['guthaben'] + "MB")
+ account_info['trafficleft'] = self.parse_traffic(status['guthaben'], "MB")
elif status['premium'] == "Spender":
account_info['trafficleft'] = -1
elif status['premium'] == "Flatrate":
@@ -33,21 +43,21 @@ class FreeWayMe(Account):
return account_info
- def login(self, user, password, data, req):
- status = self.get_account_status(user, password, req)
+ def signin(self, user, password, data):
+ status = self.get_account_status(user, password)
#: Check if user and password are valid
if not status:
- self.login_fail()
+ self.fail_login()
- def get_account_status(self, user, password, req):
+ def get_account_status(self, user, password):
answer = self.load("http://www.free-way.bz/ajax/jd.php", #@TODO: Revert to `https` in 0.4.10
get={'id': 4, 'user': user, 'pass': password})
self.log_debug("Login: %s" % answer)
if answer == "Invalid login":
- self.login_fail()
+ self.fail_login()
return json_loads(answer)
diff --git a/module/plugins/accounts/FshareVn.py b/module/plugins/accounts/FshareVn.py
index bc8ced5e2..e692394ef 100644
--- a/module/plugins/accounts/FshareVn.py
+++ b/module/plugins/accounts/FshareVn.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account
class FshareVn(Account):
__name__ = "FshareVn"
__type__ = "account"
- __version__ = "0.11"
+ __version__ = "0.14"
__status__ = "testing"
__description__ = """Fshare.vn account plugin"""
@@ -24,7 +24,7 @@ class FshareVn(Account):
DIRECT_DOWNLOAD_PATTERN = ur'<input type="checkbox"\s*([^=>]*)[^>]*/>Kích hoạt download trực tiếp</dt>'
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
html = self.load("http://www.fshare.vn/account_info.php")
if re.search(self.LIFETIME_PATTERN, html):
@@ -33,7 +33,7 @@ class FshareVn(Account):
return {'validuntil': -1, 'trafficleft': trafficleft, 'premium': True}
m = re.search(self.VALID_UNTIL_PATTERN, html)
- if m:
+ if m is not None:
premium = True
validuntil = time.mktime(time.strptime(m.group(1), '%I:%M:%S %p %d-%m-%Y'))
trafficleft = self.get_traffic_left()
@@ -45,7 +45,7 @@ class FshareVn(Account):
return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load("https://www.fshare.vn/login.php",
post={'LoginForm[email]' : user,
'LoginForm[password]' : password,
@@ -53,9 +53,9 @@ class FshareVn(Account):
'yt0' : "Login"})
if not re.search(r'<img\s+alt="VIP"', html):
- self.login_fail()
+ self.fail_login()
def get_traffic_left(self):
m = re.search(self.TRAFFIC_LEFT_PATTERN, html)
- return self.parse_traffic(m.group(1) + m.group(2)) if m else 0
+ return self.parse_traffic(m.group(1), m.group(2)) if m else 0
diff --git a/module/plugins/accounts/Ftp.py b/module/plugins/accounts/Ftp.py
index 2d35ab7bb..d73b557ef 100644
--- a/module/plugins/accounts/Ftp.py
+++ b/module/plugins/accounts/Ftp.py
@@ -6,7 +6,7 @@ from module.plugins.internal.Account import Account
class Ftp(Account):
__name__ = "Ftp"
__type__ = "account"
- __version__ = "0.03"
+ __version__ = "0.04"
__status__ = "testing"
__description__ = """Ftp dummy account plugin"""
diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py
index 55daa8c2d..cdfa9937a 100644
--- a/module/plugins/accounts/HellshareCz.py
+++ b/module/plugins/accounts/HellshareCz.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account
class HellshareCz(Account):
__name__ = "HellshareCz"
__type__ = "account"
- __version__ = "0.18"
+ __version__ = "0.21"
__status__ = "testing"
__description__ = """Hellshare.cz account plugin"""
@@ -20,7 +20,7 @@ class HellshareCz(Account):
CREDIT_LEFT_PATTERN = r'<div class="credit-link">\s*<table>\s*<tr>\s*<th>(\d+|\d\d\.\d\d\.)</th>'
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
self.relogin(user)
html = self.load("http://www.hellshare.com/")
@@ -42,8 +42,9 @@ class HellshareCz(Account):
trafficleft = -1
else:
#: Traffic-based account
- trafficleft = self.parse_traffic(credit + "MB")
+ trafficleft = self.parse_traffic(credit, "MB")
validuntil = -1
+
except Exception, e:
self.log_error(_("Unable to parse credit info"), e)
validuntil = -1
@@ -52,13 +53,13 @@ class HellshareCz(Account):
return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load('http://www.hellshare.com/')
- if req.lastEffectiveURL != 'http://www.hellshare.com/':
+ if self.req.lastEffectiveURL != 'http://www.hellshare.com/':
#: Switch to English
- self.log_debug("Switch lang - URL: %s" % req.lastEffectiveURL)
+ self.log_debug("Switch lang - URL: %s" % self.req.lastEffectiveURL)
- json = self.load("%s?do=locRouter-show" % req.lastEffectiveURL)
+ json = self.load("%s?do=locRouter-show" % self.req.lastEffectiveURL)
hash = re.search(r"(\-\-[0-9a-f]+\-)", json).group(1)
self.log_debug("Switch lang - HASH: %s" % hash)
@@ -77,4 +78,4 @@ class HellshareCz(Account):
'perm_login': "on"})
if "<p>You input a wrong user name or wrong password</p>" in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/HighWayMe.py b/module/plugins/accounts/HighWayMe.py
index ff90ec2d2..3b39b7da6 100644
--- a/module/plugins/accounts/HighWayMe.py
+++ b/module/plugins/accounts/HighWayMe.py
@@ -7,15 +7,25 @@ from module.plugins.internal.Account import Account
class HighWayMe(Account):
__name__ = "HighWayMe.py"
__type__ = "account"
- __version__ = "0.04"
+ __version__ = "0.06"
__status__ = "testing"
+ __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval", "int" , "Reload interval in minutes" , 60 )]
+
__description__ = """High-Way.me account plugin"""
__license__ = "GPLv3"
__authors__ = [("EvolutionClip", "evolutionclip@live.de")]
- def parse_info(self, user, password, data, req):
+ def grab_hosters(self, user, password, data):
+ json_data = json_loads(self.load("https://high-way.me/api.php",
+ get={'hoster': 1}))
+ return [element['name'] for element in json_data['hoster']]
+
+
+ def grab_info(self, user, password, data):
premium = False
validuntil = -1
trafficleft = None
@@ -40,11 +50,11 @@ class HighWayMe(Account):
'trafficleft': trafficleft}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load("https://high-way.me/api.php?login",
post={'login': '1',
'user': user,
'pass': password})
if 'UserOrPassInvalid' in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/Http.py b/module/plugins/accounts/Http.py
index dcab156ee..261b3b240 100644
--- a/module/plugins/accounts/Http.py
+++ b/module/plugins/accounts/Http.py
@@ -6,7 +6,7 @@ from module.plugins.internal.Account import Account
class Http(Account):
__name__ = "Http"
__type__ = "account"
- __version__ = "0.03"
+ __version__ = "0.04"
__status__ = "testing"
__description__ = """Http dummy account plugin"""
diff --git a/module/plugins/accounts/HugefilesNet.py b/module/plugins/accounts/HugefilesNet.py
index fa64945a3..a5920f4a4 100644
--- a/module/plugins/accounts/HugefilesNet.py
+++ b/module/plugins/accounts/HugefilesNet.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class HugefilesNet(XFSAccount):
__name__ = "HugefilesNet"
__type__ = "account"
- __version__ = "0.03"
+ __version__ = "0.04"
__status__ = "testing"
__description__ = """Hugefiles.net account plugin"""
@@ -14,4 +14,4 @@ class HugefilesNet(XFSAccount):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = "hugefiles.net"
+ PLUGIN_DOMAIN = "hugefiles.net"
diff --git a/module/plugins/accounts/HundredEightyUploadCom.py b/module/plugins/accounts/HundredEightyUploadCom.py
index a8527d62c..8b757de61 100644
--- a/module/plugins/accounts/HundredEightyUploadCom.py
+++ b/module/plugins/accounts/HundredEightyUploadCom.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class HundredEightyUploadCom(XFSAccount):
__name__ = "HundredEightyUploadCom"
__type__ = "account"
- __version__ = "0.04"
+ __version__ = "0.05"
__status__ = "testing"
__description__ = """180upload.com account plugin"""
@@ -14,4 +14,4 @@ class HundredEightyUploadCom(XFSAccount):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = "180upload.com"
+ PLUGIN_DOMAIN = "180upload.com"
diff --git a/module/plugins/accounts/JunkyvideoCom.py b/module/plugins/accounts/JunkyvideoCom.py
index 5fcefda36..316332fd9 100644
--- a/module/plugins/accounts/JunkyvideoCom.py
+++ b/module/plugins/accounts/JunkyvideoCom.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class JunkyvideoCom(XFSAccount):
__name__ = "JunkyvideoCom"
__type__ = "account"
- __version__ = "0.02"
+ __version__ = "0.03"
__status__ = "testing"
__description__ = """Junkyvideo.com account plugin"""
@@ -14,4 +14,4 @@ class JunkyvideoCom(XFSAccount):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = "junkyvideo.com"
+ PLUGIN_DOMAIN = "junkyvideo.com"
diff --git a/module/plugins/accounts/JunocloudMe.py b/module/plugins/accounts/JunocloudMe.py
index 791835dfe..95bc57640 100644
--- a/module/plugins/accounts/JunocloudMe.py
+++ b/module/plugins/accounts/JunocloudMe.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class JunocloudMe(XFSAccount):
__name__ = "JunocloudMe"
__type__ = "account"
- __version__ = "0.03"
+ __version__ = "0.04"
__status__ = "testing"
__description__ = """Junocloud.me account plugin"""
@@ -14,4 +14,4 @@ class JunocloudMe(XFSAccount):
__authors__ = [("guidobelix", "guidobelix@hotmail.it")]
- HOSTER_DOMAIN = "junocloud.me"
+ PLUGIN_DOMAIN = "junocloud.me"
diff --git a/module/plugins/accounts/Keep2ShareCc.py b/module/plugins/accounts/Keep2ShareCc.py
index 014d43a69..32bccc2e4 100644
--- a/module/plugins/accounts/Keep2ShareCc.py
+++ b/module/plugins/accounts/Keep2ShareCc.py
@@ -10,7 +10,7 @@ from module.plugins.internal.Plugin import set_cookie
class Keep2ShareCc(Account):
__name__ = "Keep2ShareCc"
__type__ = "account"
- __version__ = "0.08"
+ __version__ = "0.10"
__status__ = "testing"
__description__ = """Keep2Share.cc account plugin"""
@@ -25,7 +25,7 @@ class Keep2ShareCc(Account):
LOGIN_FAIL_PATTERN = r'Please fix the following input errors'
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
validuntil = None
trafficleft = -1
premium = False
@@ -33,7 +33,7 @@ class Keep2ShareCc(Account):
html = self.load("http://keep2share.cc/site/profile.html")
m = re.search(self.VALID_UNTIL_PATTERN, html)
- if m:
+ if m is not None:
expiredate = m.group(1).strip()
self.log_debug("Expire date: " + expiredate)
@@ -51,7 +51,7 @@ class Keep2ShareCc(Account):
premium = True if validuntil > time.mktime(time.gmtime()) else False
m = re.search(self.TRAFFIC_LEFT_PATTERN, html)
- if m:
+ if m is not None:
try:
trafficleft = self.parse_traffic(m.group(1))
@@ -61,8 +61,8 @@ class Keep2ShareCc(Account):
return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium}
- def login(self, user, password, data, req):
- set_cookie(req.cj, "keep2share.cc", "lang", "en")
+ def signin(self, user, password, data):
+ set_cookie(self.req.cj, "keep2share.cc", "lang", "en")
html = self.load("https://keep2share.cc/login.html",
post={'LoginForm[username]' : user,
@@ -71,4 +71,4 @@ class Keep2ShareCc(Account):
'yt0' : ""})
if re.search(self.LOGIN_FAIL_PATTERN, html):
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/LetitbitNet.py b/module/plugins/accounts/LetitbitNet.py
index 1fc9b76ba..f7350e547 100644
--- a/module/plugins/accounts/LetitbitNet.py
+++ b/module/plugins/accounts/LetitbitNet.py
@@ -7,7 +7,7 @@ from module.plugins.internal.Account import Account
class LetitbitNet(Account):
__name__ = "LetitbitNet"
__type__ = "account"
- __version__ = "0.04"
+ __version__ = "0.06"
__status__ = "testing"
__description__ = """Letitbit.net account plugin"""
@@ -15,7 +15,7 @@ class LetitbitNet(Account):
__authors__ = [("stickell", "l.stickell@yahoo.it")]
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
## DISABLED BECAUSE IT GET 'key exausted' EVEN IF VALID ##
# json_data = [password, ['key/info']]
# api_rep = self.load("http://api.letitbit.net/json",
@@ -30,6 +30,6 @@ class LetitbitNet(Account):
return {'premium': True}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
#: API_KEY is the username and the PREMIUM_KEY is the password
self.log_info(_("You must use your API KEY as username and the PREMIUM KEY as password"))
diff --git a/module/plugins/accounts/LinestorageCom.py b/module/plugins/accounts/LinestorageCom.py
deleted file mode 100644
index 87dd2a1d3..000000000
--- a/module/plugins/accounts/LinestorageCom.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.plugins.internal.XFSAccount import XFSAccount
-
-
-class LinestorageCom(XFSAccount):
- __name__ = "LinestorageCom"
- __type__ = "account"
- __version__ = "0.04"
- __status__ = "testing"
-
- __description__ = """Linestorage.com account plugin"""
- __license__ = "GPLv3"
- __authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
-
-
- HOSTER_DOMAIN = "linestorage.com"
- HOSTER_URL = "http://linestorage.com/"
diff --git a/module/plugins/accounts/LinksnappyCom.py b/module/plugins/accounts/LinksnappyCom.py
index 00ae64b44..6953f311c 100644
--- a/module/plugins/accounts/LinksnappyCom.py
+++ b/module/plugins/accounts/LinksnappyCom.py
@@ -9,16 +9,26 @@ from module.common.json_layer import json_loads
class LinksnappyCom(Account):
__name__ = "LinksnappyCom"
__type__ = "account"
- __version__ = "0.07"
+ __version__ = "0.10"
__status__ = "testing"
+ __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval", "int" , "Reload interval in minutes" , 60 )]
+
__description__ = """Linksnappy.com account plugin"""
__license__ = "GPLv3"
__authors__ = [("stickell", "l.stickell@yahoo.it")]
- def parse_info(self, user, password, data, req):
- data = self.get_data(user)
+ def grab_hosters(self, user, password, data):
+ json_data = self.load("http://gen.linksnappy.com/lseAPI.php", get={'act': "FILEHOSTS"})
+ json_data = json_loads(json_data)
+
+ return json_data['return'].keys()
+
+
+ def grab_info(self, user, password, data):
r = self.load('http://gen.linksnappy.com/lseAPI.php',
get={'act' : 'USERDETAILS',
'username': user,
@@ -45,18 +55,18 @@ class LinksnappyCom(Account):
if 'trafficleft' not in j['return'] or isinstance(j['return']['trafficleft'], str):
trafficleft = -1
else:
- trafficleft = self.parse_traffic("%d MB" % j['return']['trafficleft'])
+ trafficleft = self.parse_traffic(j['return']['trafficleft'], "MB")
return {'premium' : True ,
'validuntil' : validuntil ,
'trafficleft': trafficleft}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load("https://gen.linksnappy.com/lseAPI.php",
get={'act' : 'USERDETAILS',
'username': user,
'password': hashlib.md5(password).hexdigest()})
if "Invalid Account Details" in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/MegaDebridEu.py b/module/plugins/accounts/MegaDebridEu.py
index d7a04491d..46375716f 100644
--- a/module/plugins/accounts/MegaDebridEu.py
+++ b/module/plugins/accounts/MegaDebridEu.py
@@ -7,9 +7,13 @@ from module.common.json_layer import json_loads
class MegaDebridEu(Account):
__name__ = "MegaDebridEu"
__type__ = "account"
- __version__ = "0.22"
+ __version__ = "0.24"
__status__ = "testing"
+ __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval", "int" , "Reload interval in minutes" , 60 )]
+
__description__ = """Mega-debrid.eu account plugin"""
__license__ = "GPLv3"
__authors__ = [("D.Ducatel", "dducatel@je-geek.fr")]
@@ -19,8 +23,20 @@ class MegaDebridEu(Account):
API_URL = "https://www.mega-debrid.eu/api.php"
- def parse_info(self, user, password, data, req):
- data = self.get_data(user)
+ def grab_hosters(self, user, password, data):
+ reponse = self.load("http://www.mega-debrid.eu/api.php", get={'action': "getHosters"})
+ json_data = json_loads(reponse)
+
+ if json_data['response_code'] == "ok":
+ host_list = [element[0] for element in json_data['hosters']]
+ else:
+ self.log_error(_("Unable to retrieve hoster list"))
+ host_list = []
+
+ return host_list
+
+
+ def grab_info(self, user, password, data):
jsonResponse = self.load(self.API_URL,
get={'action' : 'connectUser',
'login' : user,
@@ -34,11 +50,11 @@ class MegaDebridEu(Account):
return {'status': False, 'premium': False}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
jsonResponse = self.load(self.API_URL,
get={'action' : 'connectUser',
'login' : user,
'password': password})
res = json_loads(jsonResponse)
if res['response_code'] != "ok":
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/MegaRapidCz.py b/module/plugins/accounts/MegaRapidCz.py
index ce2d78994..050e3e4c6 100644
--- a/module/plugins/accounts/MegaRapidCz.py
+++ b/module/plugins/accounts/MegaRapidCz.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account
class MegaRapidCz(Account):
__name__ = "MegaRapidCz"
__type__ = "account"
- __version__ = "0.37"
+ __version__ = "0.39"
__status__ = "testing"
__description__ = """MegaRapid.cz account plugin"""
@@ -25,28 +25,27 @@ class MegaRapidCz(Account):
TRAFFIC_LEFT_PATTERN = r'<tr><td>Kredit</td><td>(.*?) GiB'
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
htmll = self.load("http://megarapid.cz/mujucet/")
m = re.search(self.LIMITDL_PATTERN, htmll)
- if m:
- data = self.get_data(user)
+ if m is not None:
data['options']['limitDL'] = [int(m.group(1))]
m = re.search(self.VALID_UNTIL_PATTERN, htmll)
- if m:
+ if m is not None:
validuntil = time.mktime(time.strptime(m.group(1), "%d.%m.%Y - %H:%M"))
return {'premium': True, 'trafficleft': -1, 'validuntil': validuntil}
m = re.search(self.TRAFFIC_LEFT_PATTERN, htmll)
- if m:
+ if m is not None:
trafficleft = float(m.group(1)) * (1 << 20)
return {'premium': True, 'trafficleft': trafficleft, 'validuntil': -1}
return {'premium': False, 'trafficleft': None, 'validuntil': None}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load("http://megarapid.cz/prihlaseni/")
if "Heslo:" in html:
diff --git a/module/plugins/accounts/MegaRapidoNet.py b/module/plugins/accounts/MegaRapidoNet.py
index 08cf1f535..d8291e0e2 100644
--- a/module/plugins/accounts/MegaRapidoNet.py
+++ b/module/plugins/accounts/MegaRapidoNet.py
@@ -9,9 +9,13 @@ from module.plugins.internal.Account import Account
class MegaRapidoNet(Account):
__name__ = "MegaRapidoNet"
__type__ = "account"
- __version__ = "0.04"
+ __version__ = "0.06"
__status__ = "testing"
+ __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval", "int" , "Reload interval in minutes" , 60 )]
+
__description__ = """MegaRapido.net account plugin"""
__license__ = "GPLv3"
__authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")]
@@ -21,7 +25,68 @@ class MegaRapidoNet(Account):
USER_ID_PATTERN = r'<\s*?div[^>]*?class\s*?=\s*?["\']checkbox_compartilhar["\'].*?>.*?<\s*?input[^>]*?name\s*?=\s*?["\']usar["\'].*?>.*?<\s*?input[^>]*?name\s*?=\s*?["\']user["\'][^>]*?value\s*?=\s*?["\'](.*?)\s*?["\']'
- def parse_info(self, user, password, data, req):
+ def grab_hosters(self, user, password, data):
+ hosters = {'1fichier' : [], # leave it there are so many possible addresses?
+ '1st-files' : ['1st-files.com'],
+ '2shared' : ['2shared.com'],
+ '4shared' : ['4shared.com', '4shared-china.com'],
+ 'asfile' : ['http://asfile.com/'],
+ 'bitshare' : ['bitshare.com'],
+ 'brupload' : ['brupload.net'],
+ 'crocko' : ['crocko.com', 'easy-share.com'],
+ 'dailymotion' : ['dailymotion.com'],
+ 'depfile' : ['depfile.com'],
+ 'depositfiles': ['depositfiles.com', 'dfiles.eu'],
+ 'dizzcloud' : ['dizzcloud.com'],
+ 'dl.dropbox' : [],
+ 'extabit' : ['extabit.com'],
+ 'extmatrix' : ['extmatrix.com'],
+ 'facebook' : [],
+ 'file4go' : ['file4go.com'],
+ 'filecloud' : ['filecloud.io', 'ifile.it', 'mihd.net'],
+ 'filefactory' : ['filefactory.com'],
+ 'fileom' : ['fileom.com'],
+ 'fileparadox' : ['fileparadox.in'],
+ 'filepost' : ['filepost.com', 'fp.io'],
+ 'filerio' : ['filerio.in', 'filerio.com', 'filekeen.com'],
+ 'filesflash' : ['filesflash.com'],
+ 'firedrive' : ['firedrive.com', 'putlocker.com'],
+ 'flashx' : [],
+ 'freakshare' : ['freakshare.net', 'freakshare.com'],
+ 'gigasize' : ['gigasize.com'],
+ 'hipfile' : ['hipfile.com'],
+ 'junocloud' : ['junocloud.me'],
+ 'letitbit' : ['letitbit.net', 'shareflare.net'],
+ 'mediafire' : ['mediafire.com'],
+ 'mega' : ['mega.co.nz'],
+ 'megashares' : ['megashares.com'],
+ 'metacafe' : ['metacafe.com'],
+ 'netload' : ['netload.in'],
+ 'oboom' : ['oboom.com'],
+ 'rapidgator' : ['rapidgator.net'],
+ 'rapidshare' : ['rapidshare.com'],
+ 'rarefile' : ['rarefile.net'],
+ 'ryushare' : ['ryushare.com'],
+ 'sendspace' : ['sendspace.com'],
+ 'turbobit' : ['turbobit.net', 'unextfiles.com'],
+ 'uploadable' : ['uploadable.ch'],
+ 'uploadbaz' : ['uploadbaz.com'],
+ 'uploaded' : ['uploaded.to', 'uploaded.net', 'ul.to'],
+ 'uploadhero' : ['uploadhero.com'],
+ 'uploading' : ['uploading.com'],
+ 'uptobox' : ['uptobox.com'],
+ 'xvideos' : ['xvideos.com'],
+ 'youtube' : ['youtube.com']}
+
+ hoster_list = []
+
+ for item in hosters.values():
+ hoster_list.extend(item)
+
+ return hoster_list
+
+
+ def grab_info(self, user, password, data):
validuntil = None
trafficleft = None
premium = False
@@ -40,7 +105,7 @@ class MegaRapidoNet(Account):
'premium' : premium}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
self.load("http://megarapido.net/login")
self.load("http://megarapido.net/painel_user/ajax/logar.php",
post={'login': user,
@@ -49,10 +114,10 @@ class MegaRapidoNet(Account):
html = self.load("http://megarapido.net/gerador")
if "sair" not in html.lower():
- self.login_fail()
+ self.fail_login()
else:
m = re.search(self.USER_ID_PATTERN, html)
- if m:
+ if m is not None:
data['uid'] = m.group(1)
else:
- self.login_fail("Couldn't find the user ID")
+ self.fail_login("Couldn't find the user ID")
diff --git a/module/plugins/accounts/MegasharesCom.py b/module/plugins/accounts/MegasharesCom.py
index ec43b7fc0..6967a7502 100644
--- a/module/plugins/accounts/MegasharesCom.py
+++ b/module/plugins/accounts/MegasharesCom.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account
class MegasharesCom(Account):
__name__ = "MegasharesCom"
__type__ = "account"
- __version__ = "0.05"
+ __version__ = "0.07"
__status__ = "testing"
__description__ = """Megashares.com account plugin"""
@@ -20,7 +20,7 @@ class MegasharesCom(Account):
VALID_UNTIL_PATTERN = r'<p class="premium_info_box">Period Ends: (\w{3} \d{1,2}, \d{4})</p>'
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
# self.relogin(user)
html = self.load("http://d01.megashares.com/myms.php")
@@ -31,13 +31,14 @@ class MegasharesCom(Account):
timestr = re.search(self.VALID_UNTIL_PATTERN, html).group(1)
self.log_debug(timestr)
validuntil = time.mktime(time.strptime(timestr, "%b %d, %Y"))
+
except Exception, e:
self.log_error(e)
return {'validuntil': validuntil, 'trafficleft': -1, 'premium': premium}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load('http://d01.megashares.com/myms_login.php',
post={'httpref' : "",
'myms_login' : "Login",
@@ -45,4 +46,4 @@ class MegasharesCom(Account):
'mymspassword' : password})
if not '<span class="b ml">%s</span>' % user in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/MovReelCom.py b/module/plugins/accounts/MovReelCom.py
index 090950bf2..1594a2b6a 100644
--- a/module/plugins/accounts/MovReelCom.py
+++ b/module/plugins/accounts/MovReelCom.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class MovReelCom(XFSAccount):
__name__ = "MovReelCom"
__type__ = "account"
- __version__ = "0.04"
+ __version__ = "0.05"
__status__ = "testing"
__description__ = """Movreel.com account plugin"""
@@ -17,4 +17,4 @@ class MovReelCom(XFSAccount):
login_timeout = 60
info_threshold = 30
- HOSTER_DOMAIN = "movreel.com"
+ PLUGIN_DOMAIN = "movreel.com"
diff --git a/module/plugins/accounts/MultihostersCom.py b/module/plugins/accounts/MultihostersCom.py
index ed04ad3c2..1ede88574 100644
--- a/module/plugins/accounts/MultihostersCom.py
+++ b/module/plugins/accounts/MultihostersCom.py
@@ -6,7 +6,7 @@ from module.plugins.accounts.ZeveraCom import ZeveraCom
class MultihostersCom(ZeveraCom):
__name__ = "MultihostersCom"
__type__ = "account"
- __version__ = "0.04"
+ __version__ = "0.05"
__status__ = "testing"
__description__ = """Multihosters.com account plugin"""
@@ -14,4 +14,4 @@ class MultihostersCom(ZeveraCom):
__authors__ = [("tjeh", "tjeh@gmx.net")]
- HOSTER_DOMAIN = "multihosters.com"
+ PLUGIN_DOMAIN = "multihosters.com"
diff --git a/module/plugins/accounts/MultishareCz.py b/module/plugins/accounts/MultishareCz.py
index c9e30a93f..77facb308 100644
--- a/module/plugins/accounts/MultishareCz.py
+++ b/module/plugins/accounts/MultishareCz.py
@@ -8,9 +8,13 @@ from module.plugins.internal.Account import Account
class MultishareCz(Account):
__name__ = "MultishareCz"
__type__ = "account"
- __version__ = "0.07"
+ __version__ = "0.10"
__status__ = "testing"
+ __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval", "int" , "Reload interval in minutes" , 60 )]
+
__description__ = """Multishare.cz account plugin"""
__license__ = "GPLv3"
__authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
@@ -19,13 +23,20 @@ class MultishareCz(Account):
TRAFFIC_LEFT_PATTERN = r'<span class="profil-zvyrazneni">Kredit:</span>\s*<strong>(?P<S>[\d.,]+)&nbsp;(?P<U>[\w^_]+)</strong>'
ACCOUNT_INFO_PATTERN = r'<input type="hidden" id="(u_ID|u_hash)" name=".+?" value="(.+?)">'
+ PLUGIN_PATTERN = r'<img class="logo-shareserveru"[^>]*?alt="(.+?)"></td>\s*<td class="stav">[^>]*?alt="OK"'
+
+
+ def grab_hosters(self, user, password, data):
+ html = self.load("http://www.multishare.cz/monitoring/")
+ return re.findall(self.PLUGIN_PATTERN, html)
+
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
# self.relogin(user)
html = self.load("http://www.multishare.cz/profil/")
m = re.search(self.TRAFFIC_LEFT_PATTERN, html)
- trafficleft = self.parse_traffic(m.group('S') + m.group('U')) if m else 0
+ trafficleft = self.parse_traffic(m.group('S'), m.group('U')) if m else 0
self.premium = True if trafficleft else False
html = self.load("http://www.multishare.cz/")
@@ -34,11 +45,11 @@ class MultishareCz(Account):
return dict(mms_info, **{'validuntil': -1, 'trafficleft': trafficleft})
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load('https://www.multishare.cz/html/prihlaseni_process.php',
post={'akce' : "Přihlásit",
'heslo': password,
'jmeno': user})
if '<div class="akce-chyba akce">' in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/MyfastfileCom.py b/module/plugins/accounts/MyfastfileCom.py
index 008b62cc6..eff112a2f 100644
--- a/module/plugins/accounts/MyfastfileCom.py
+++ b/module/plugins/accounts/MyfastfileCom.py
@@ -9,15 +9,26 @@ from module.plugins.internal.Account import Account
class MyfastfileCom(Account):
__name__ = "MyfastfileCom"
__type__ = "account"
- __version__ = "0.06"
+ __version__ = "0.08"
__status__ = "testing"
+ __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval", "int" , "Reload interval in minutes" , 60 )]
+
__description__ = """Myfastfile.com account plugin"""
__license__ = "GPLv3"
__authors__ = [("stickell", "l.stickell@yahoo.it")]
- def parse_info(self, user, password, data, req):
+ def grab_hosters(self, user, password, data):
+ json_data = self.load("http://myfastfile.com/api.php", get={'hosts': ""})
+ self.log_debug("JSON data", json_data)
+ json_data = json_loads(json_data)
+
+ return json_data['hosts']
+
+ def grab_info(self, user, password, data):
if 'days_left' in self.json_data:
validuntil = time.time() + self.json_data['days_left'] * 24 * 60 * 60
return {'premium': True, 'validuntil': validuntil, 'trafficleft': -1}
@@ -25,7 +36,7 @@ class MyfastfileCom(Account):
self.log_error(_("Unable to get account information"))
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
#: Password to use is the API-Password written in http://myfastfile.com/myaccount
html = self.load("https://myfastfile.com/api.php",
get={'user': user,
@@ -35,5 +46,4 @@ class MyfastfileCom(Account):
self.json_data = json_loads(html)
if self.json_data['status'] != 'ok':
- self.log_error(_('Invalid login. The password to use is the API-Password you find in your "My Account" page'))
- self.login_fail()
+ self.fail_login(_("Invalid username or password"))
diff --git a/module/plugins/accounts/NitroflareCom.py b/module/plugins/accounts/NitroflareCom.py
index b7edcca32..af71b1321 100644
--- a/module/plugins/accounts/NitroflareCom.py
+++ b/module/plugins/accounts/NitroflareCom.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account
class NitroflareCom(Account):
__name__ = "NitroflareCom"
__type__ = "account"
- __version__ = "0.06"
+ __version__ = "0.09"
__status__ = "testing"
__description__ = """Nitroflare.com account plugin"""
@@ -24,7 +24,7 @@ class NitroflareCom(Account):
TOKEN_PATTERN = r'name="token" value="(.+?)"'
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
validuntil = -1
trafficleft = None
premium = False
@@ -33,13 +33,14 @@ class NitroflareCom(Account):
get={'s': "premium"})
m = re.search(self.VALID_UNTIL_PATTERN, html)
- if m:
+ if m is not None:
expiredate = m.group(1).strip()
self.log_debug("Time Left: " + expiredate)
try:
validuntil = sum(int(v) * {'day': 24 * 3600, 'hour': 3600, 'minute': 60}[u.lower()] for v, u in
re.findall(r'(\d+)\s*(day|hour|minute)', expiredate, re.I))
+
except Exception, e:
self.log_error(e)
@@ -53,9 +54,9 @@ class NitroflareCom(Account):
validuntil = -1
m = re.search(self.TRAFFIC_LEFT_PATTERN, html)
- if m:
+ if m is not None:
try:
- trafficleft = self.parse_traffic(str(max(0, 50 - float(m.group(1)))) + " GB")
+ trafficleft = self.parse_traffic(str(max(0, 50 - float(m.group(1)))), "GB")
except Exception, e:
self.log_error(e)
@@ -67,7 +68,7 @@ class NitroflareCom(Account):
'premium' : premium}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load("https://nitroflare.com/login")
token = re.search(self.TOKEN_PATTERN, html).group(1)
@@ -79,4 +80,4 @@ class NitroflareCom(Account):
'token' : token})
if re.search(self.LOGIN_FAIL_PATTERN, html):
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py
index e9dad7647..f8236c978 100644
--- a/module/plugins/accounts/NoPremiumPl.py
+++ b/module/plugins/accounts/NoPremiumPl.py
@@ -6,14 +6,19 @@ import time
from module.common.json_layer import json_loads
from module.plugins.internal.Account import Account
+# from module.plugins.internal.MultiAccount import MultiAccount
class NoPremiumPl(Account):
__name__ = "NoPremiumPl"
__type__ = "account"
- __version__ = "0.03"
+ __version__ = "0.06"
__status__ = "testing"
+ __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval", "int" , "Reload interval in minutes" , 60 )]
+
__description__ = "NoPremium.pl account plugin"
__license__ = "GPLv3"
__authors__ = [("goddie", "dev@nopremium.pl")]
@@ -27,15 +32,19 @@ class NoPremiumPl(Account):
'loc' : "1" ,
'info' : "1" }
- _req = None
- _usr = None
- _pwd = None
+ def grab_hosters(self, user, password, data):
+ hostings = json_loads(self.load("https://www.nopremium.pl/clipboard.php?json=3").strip())
+ hostings_domains = [domain for row in hostings for domain in row['domains'] if row['sdownload'] == "0"]
+
+ self.log_debug(hostings_domains)
+
+ return hostings_domains
- def parse_info(self, name, req):
- self._req = req
+ def grab_info(self, user, password, data):
try:
result = json_loads(self.run_auth_query())
+
except Exception:
#@TODO: return or let it be thrown?
return
@@ -54,27 +63,24 @@ class NoPremiumPl(Account):
'premium' : premium }
- def login(self, user, password, data, req):
- self._usr = user
- self._pwd = hashlib.sha1(hashlib.md5(password).hexdigest()).hexdigest()
- self._req = req
+ def signin(self, user, password, data):
+ data['usr'] = user
+ data['pwd'] = hashlib.sha1(hashlib.md5(password).hexdigest()).hexdigest()
try:
response = json_loads(self.run_auth_query())
+
except Exception:
- self.login_fail()
+ self.fail_login()
if "errno" in response.keys():
- self.login_fail()
-
- data['usr'] = self._usr
- data['pwd'] = self._pwd
+ self.fail_login()
def create_auth_query(self):
query = self.API_QUERY
- query['username'] = self._usr
- query['password'] = self._pwd
+ query['username'] = self.info['data']['usr']
+ query['password'] = self.info['data']['pwd']
return query
diff --git a/module/plugins/accounts/NosuploadCom.py b/module/plugins/accounts/NosuploadCom.py
index 5febc8d66..65ac8d4fc 100644
--- a/module/plugins/accounts/NosuploadCom.py
+++ b/module/plugins/accounts/NosuploadCom.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class NosuploadCom(XFSAccount):
__name__ = "NosuploadCom"
__type__ = "account"
- __version__ = "0.03"
+ __version__ = "0.04"
__status__ = "testing"
__description__ = """Nosupload.com account plugin"""
@@ -14,4 +14,4 @@ class NosuploadCom(XFSAccount):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = "nosupload.com"
+ PLUGIN_DOMAIN = "nosupload.com"
diff --git a/module/plugins/accounts/NovafileCom.py b/module/plugins/accounts/NovafileCom.py
index 524c01087..1506ec315 100644
--- a/module/plugins/accounts/NovafileCom.py
+++ b/module/plugins/accounts/NovafileCom.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class NovafileCom(XFSAccount):
__name__ = "NovafileCom"
__type__ = "account"
- __version__ = "0.03"
+ __version__ = "0.04"
__status__ = "testing"
__description__ = """Novafile.com account plugin"""
@@ -14,4 +14,4 @@ class NovafileCom(XFSAccount):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = "novafile.com"
+ PLUGIN_DOMAIN = "novafile.com"
diff --git a/module/plugins/accounts/NowVideoSx.py b/module/plugins/accounts/NowVideoSx.py
index 73bb383be..36d26930a 100644
--- a/module/plugins/accounts/NowVideoSx.py
+++ b/module/plugins/accounts/NowVideoSx.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account
class NowVideoSx(Account):
__name__ = "NowVideoSx"
__type__ = "account"
- __version__ = "0.05"
+ __version__ = "0.07"
__status__ = "testing"
__description__ = """NowVideo.at account plugin"""
@@ -20,7 +20,7 @@ class NowVideoSx(Account):
VALID_UNTIL_PATTERN = r'>Your premium membership expires on: (.+?)<'
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
validuntil = None
trafficleft = -1
premium = None
@@ -28,7 +28,7 @@ class NowVideoSx(Account):
html = self.load("http://www.nowvideo.sx/premium.php")
m = re.search(self.VALID_UNTIL_PATTERN, html)
- if m:
+ if m is not None:
expiredate = m.group(1).strip()
self.log_debug("Expire date: " + expiredate)
@@ -48,10 +48,10 @@ class NowVideoSx(Account):
return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load("http://www.nowvideo.sx/login.php",
post={'user': user,
'pass': password})
if re.search(r'>Log In<', html):
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/OboomCom.py b/module/plugins/accounts/OboomCom.py
index 380368b70..c19396854 100644
--- a/module/plugins/accounts/OboomCom.py
+++ b/module/plugins/accounts/OboomCom.py
@@ -23,7 +23,7 @@ from module.plugins.internal.Account import Account
class OboomCom(Account):
__name__ = "OboomCom"
__type__ = "account"
- __version__ = "0.27"
+ __version__ = "0.29"
__status__ = "testing"
__description__ = """Oboom.com account plugin"""
@@ -31,31 +31,27 @@ class OboomCom(Account):
__authors__ = [("stanley", "stanley.foerster@gmail.com")]
- def load_account_data(self, user, req):
- passwd = self.get_info(user)['login']['password']
- salt = passwd[::-1]
- pbkdf2 = PBKDF2(passwd, salt, 1000).hexread(16)
+ def load_account_data(self, user, password):
+ salt = password[::-1]
+ pbkdf2 = PBKDF2(password, salt, 1000).hexread(16)
result = json_loads(self.load("http://www.oboom.com/1/login", #@TODO: Revert to `https` in 0.4.10
get={'auth': user,
'pass': pbkdf2}))
- if not result[0] == 200:
+ if result[0] != 200:
self.log_warning(_("Failed to log in: %s") % result[1])
- self.login_fail()
+ self.fail_login()
return result[1]
- def parse_info(self, name, req):
- account_data = self.load_account_data(name, req)
+ def grab_info(self, user, password, data):
+ account_data = self.load_account_data(user, password)
userData = account_data['user']
- if userData['premium'] == "null":
- premium = False
- else:
- premium = True
+ premium = userData['premium'] != "null"
if userData['premium_unix'] == "null":
validUntil = -1
@@ -65,7 +61,7 @@ class OboomCom(Account):
traffic = userData['traffic']
trafficLeft = traffic['current'] / 1024 #@TODO: Remove `/ 1024` in 0.4.10
- maxTraffic = traffic['max'] / 1024 #@TODO: Remove `/ 1024` in 0.4.10
+ maxTraffic = traffic['max'] / 1024 #@TODO: Remove `/ 1024` in 0.4.10
session = account_data['session']
@@ -76,5 +72,5 @@ class OboomCom(Account):
'session' : session}
- def login(self, user, password, data, req):
- self.load_account_data(user, req)
+ def signin(self, user, password, data):
+ self.load_account_data(user, password)
diff --git a/module/plugins/accounts/OneFichierCom.py b/module/plugins/accounts/OneFichierCom.py
index 3a0131a3f..0249f2b93 100644
--- a/module/plugins/accounts/OneFichierCom.py
+++ b/module/plugins/accounts/OneFichierCom.py
@@ -10,7 +10,7 @@ from module.plugins.internal.Account import Account
class OneFichierCom(Account):
__name__ = "OneFichierCom"
__type__ = "account"
- __version__ = "0.14"
+ __version__ = "0.17"
__status__ = "testing"
__description__ = """1fichier.com account plugin"""
@@ -19,10 +19,10 @@ class OneFichierCom(Account):
("Walter Purcaro", "vuolter@gmail.com")]
- VALID_UNTIL_PATTERN = r'Your Premium Status will end the (\d+/\d+/\d+)'
+ VALID_UNTIL_PATTERN = r'Your subscription will end the (\d+-\d+-\d+)'
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
validuntil = None
trafficleft = -1
premium = None
@@ -30,12 +30,13 @@ class OneFichierCom(Account):
html = self.load("https://1fichier.com/console/abo.pl")
m = re.search(self.VALID_UNTIL_PATTERN, html)
- if m:
+ if m is not None:
expiredate = m.group(1)
self.log_debug("Expire date: " + expiredate)
try:
- validuntil = time.mktime(time.strptime(expiredate, "%d/%m/%Y"))
+ validuntil = time.mktime(time.strptime(expiredate, "%Y-%m-%d"))
+
except Exception, e:
self.log_error(e)
else:
@@ -44,8 +45,8 @@ class OneFichierCom(Account):
return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium or False}
- def login(self, user, password, data, req):
- req.http.c.setopt(pycurl.REFERER, "https://1fichier.com/login.pl?lg=en")
+ def signin(self, user, password, data):
+ self.req.http.c.setopt(pycurl.REFERER, "https://1fichier.com/login.pl?lg=en")
html = self.load("https://1fichier.com/login.pl?lg=en",
post={'mail' : user,
@@ -55,4 +56,4 @@ class OneFichierCom(Account):
'valider': "Send"})
if '>Invalid email address' in html or '>Invalid password' in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/OverLoadMe.py b/module/plugins/accounts/OverLoadMe.py
index 6741b674f..02d0d2649 100644
--- a/module/plugins/accounts/OverLoadMe.py
+++ b/module/plugins/accounts/OverLoadMe.py
@@ -7,16 +7,25 @@ from module.common.json_layer import json_loads
class OverLoadMe(Account):
__name__ = "OverLoadMe"
__type__ = "account"
- __version__ = "0.06"
+ __version__ = "0.08"
__status__ = "testing"
+ __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval", "int" , "Reload interval in minutes" , 60 )]
+
__description__ = """Over-Load.me account plugin"""
__license__ = "GPLv3"
__authors__ = [("marley", "marley@over-load.me")]
- def parse_info(self, user, password, data, req):
- data = self.get_data(user)
+ def grab_hosters(self, user, password, data):
+ html = self.load("https://api.over-load.me/hoster.php",
+ get={'auth': "0001-cb1f24dadb3aa487bda5afd3b76298935329be7700cd7-5329be77-00cf-1ca0135f"})
+ return [x for x in map(str.strip, html.replace("\"", "").split(",")) if x]
+
+
+ def grab_info(self, user, password, data):
html = self.load("https://api.over-load.me/account.php",
get={'user': user,
'auth': password}).strip()
@@ -31,7 +40,7 @@ class OverLoadMe(Account):
return {'premium': True, 'validuntil': data['expirationunix'], 'trafficleft': -1}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
jsondata = self.load("https://api.over-load.me/account.php",
get={'user': user,
'auth': password}).strip()
@@ -39,4 +48,4 @@ class OverLoadMe(Account):
data = json_loads(jsondata)
if data['err'] == 1:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/PremiumTo.py b/module/plugins/accounts/PremiumTo.py
index ba8f24c6d..74859d8a5 100644
--- a/module/plugins/accounts/PremiumTo.py
+++ b/module/plugins/accounts/PremiumTo.py
@@ -6,9 +6,13 @@ from module.plugins.internal.Account import Account
class PremiumTo(Account):
__name__ = "PremiumTo"
__type__ = "account"
- __version__ = "0.11"
+ __version__ = "0.13"
__status__ = "testing"
+ __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval", "int" , "Reload interval in minutes" , 60 )]
+
__description__ = """Premium.to account plugin"""
__license__ = "GPLv3"
__authors__ = [("RaNaN", "RaNaN@pyload.org"),
@@ -16,10 +20,16 @@ class PremiumTo(Account):
("stickell", "l.stickell@yahoo.it")]
- def parse_info(self, user, password, data, req):
+ def grab_hosters(self, user, password, data):
+ html = self.load("http://premium.to/api/hosters.php",
+ get={'username': user, 'password': password})
+ return [x for x in map(str.strip, html.replace("\"", "").split(",")) if x]
+
+
+ def grab_info(self, user, password, data):
traffic = self.load("http://premium.to/api/straffic.php", #@TODO: Revert to `https` in 0.4.10
- get={'username': self.username,
- 'password': self.password})
+ get={'username': user,
+ 'password': password})
if "wrong username" not in traffic:
trafficleft = sum(map(float, traffic.split(';'))) / 1024 #@TODO: Remove `/ 1024` in 0.4.10
@@ -28,12 +38,10 @@ class PremiumTo(Account):
return {'premium': False, 'trafficleft': None, 'validuntil': None}
- def login(self, user, password, data, req):
- self.username = user
- self.password = password
+ def signin(self, user, password, data):
authcode = self.load("http://premium.to/api/getauthcode.php", #@TODO: Revert to `https` in 0.4.10
get={'username': user,
- 'password': self.password})
+ 'password': password})
if "wrong username" in authcode:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/PremiumizeMe.py b/module/plugins/accounts/PremiumizeMe.py
index df3b5db51..2dc9b8a71 100644
--- a/module/plugins/accounts/PremiumizeMe.py
+++ b/module/plugins/accounts/PremiumizeMe.py
@@ -7,15 +7,36 @@ from module.plugins.internal.Account import Account
class PremiumizeMe(Account):
__name__ = "PremiumizeMe"
__type__ = "account"
- __version__ = "0.19"
+ __version__ = "0.21"
__status__ = "testing"
+ __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval", "int" , "Reload interval in minutes" , 60 )]
+
__description__ = """Premiumize.me account plugin"""
__license__ = "GPLv3"
__authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")]
- def parse_info(self, user, password, data, req):
+ def grab_hosters(self, user, password, data):
+ #: Get supported hosters list from premiumize.me using the
+ #: json API v1 (see https://secure.premiumize.me/?show=api)
+ answer = self.load("http://api.premiumize.me/pm-api/v1.php", #@TODO: Revert to `https` in 0.4.10
+ get={'method' : "hosterlist",
+ 'params[login]': user,
+ 'params[pass]' : password})
+ data = json_loads(answer)
+
+ #: If account is not valid thera are no hosters available
+ if data['status'] != 200:
+ return []
+
+ #: Extract hosters from json file
+ return data['result']['hosterlist']
+
+
+ def grab_info(self, user, password, data):
#: Get user data from premiumize.me
status = self.get_account_status(user, password)
self.log_debug(status)
@@ -30,13 +51,13 @@ class PremiumizeMe(Account):
return account_info
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
#: Get user data from premiumize.me
status = self.get_account_status(user, password)
#: Check if user and password are valid
if status['status'] != 200:
- self.login_fail()
+ self.fail_login()
def get_account_status(self, user, password):
diff --git a/module/plugins/accounts/PutdriveCom.py b/module/plugins/accounts/PutdriveCom.py
index 5356c4d1a..4da71f41b 100644
--- a/module/plugins/accounts/PutdriveCom.py
+++ b/module/plugins/accounts/PutdriveCom.py
@@ -6,7 +6,7 @@ from module.plugins.accounts.ZeveraCom import ZeveraCom
class PutdriveCom(ZeveraCom):
__name__ = "PutdriveCom"
__type__ = "account"
- __version__ = "0.03"
+ __version__ = "0.04"
__status__ = "testing"
__description__ = """Putdrive.com account plugin"""
@@ -14,4 +14,4 @@ class PutdriveCom(ZeveraCom):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = "putdrive.com"
+ PLUGIN_DOMAIN = "putdrive.com"
diff --git a/module/plugins/accounts/QuickshareCz.py b/module/plugins/accounts/QuickshareCz.py
index 42022ec82..19cde51c4 100644
--- a/module/plugins/accounts/QuickshareCz.py
+++ b/module/plugins/accounts/QuickshareCz.py
@@ -8,7 +8,7 @@ from module.plugins.internal.Account import Account
class QuickshareCz(Account):
__name__ = "QuickshareCz"
__type__ = "account"
- __version__ = "0.05"
+ __version__ = "0.07"
__status__ = "testing"
__description__ = """Quickshare.cz account plugin"""
@@ -19,11 +19,11 @@ class QuickshareCz(Account):
TRAFFIC_LEFT_PATTERN = r'Stav kreditu: <strong>(.+?)</strong>'
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
html = self.load("http://www.quickshare.cz/premium")
m = re.search(self.TRAFFIC_LEFT_PATTERN, html)
- if m:
+ if m is not None:
trafficleft = self.parse_traffic(m.group(1))
premium = True if trafficleft else False
else:
@@ -33,11 +33,11 @@ class QuickshareCz(Account):
return {'validuntil': -1, 'trafficleft': trafficleft, 'premium': premium}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load('http://www.quickshare.cz/html/prihlaseni_process.php',
post={'akce' : u'Přihlásit',
'heslo': password,
'jmeno': user})
if u'>TakovÜ uşivatel neexistuje.<' in html or u'>Špatné heslo.<' in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/RPNetBiz.py b/module/plugins/accounts/RPNetBiz.py
index d713cedca..3b814debc 100644
--- a/module/plugins/accounts/RPNetBiz.py
+++ b/module/plugins/accounts/RPNetBiz.py
@@ -7,17 +7,36 @@ from module.common.json_layer import json_loads
class RPNetBiz(Account):
__name__ = "RPNetBiz"
__type__ = "account"
- __version__ = "0.15"
+ __version__ = "0.17"
__status__ = "testing"
+ __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval", "int" , "Reload interval in minutes" , 60 )]
+
__description__ = """RPNet.biz account plugin"""
__license__ = "GPLv3"
__authors__ = [("Dman", "dmanugm@gmail.com")]
- def parse_info(self, user, password, data, req):
+ def grab_hosters(self, user, password, data):
+ res = self.load("https://premium.rpnet.biz/client_api.php",
+ get={'username': user,
+ 'password': password,
+ 'action' : "showHosterList"})
+ hoster_list = json_loads(res)
+
+ #: If account is not valid thera are no hosters available
+ if 'error' in hoster_list:
+ return []
+
+ #: Extract hosters from json file
+ return hoster_list['hosters']
+
+
+ def grab_info(self, user, password, data):
#: Get account information from rpnet.biz
- res = self.get_account_status(user, password, req)
+ res = self.get_account_status(user, password)
try:
if res['accountInfo']['isPremium']:
#: Parse account info. Change the trafficleft later to support per host info.
@@ -33,16 +52,16 @@ class RPNetBiz(Account):
return account_info
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
#: Get account information from rpnet.biz
- res = self.get_account_status(user, password, req)
+ res = self.get_account_status(user, password)
#: If we have an error in the res, we have wrong login information
if 'error' in res:
- self.login_fail()
+ self.fail_login()
- def get_account_status(self, user, password, req):
+ def get_account_status(self, user, password):
#: Using the rpnet API, check if valid premium account
res = self.load("https://premium.rpnet.biz/client_api.php",
get={'username': user, 'password': password,
diff --git a/module/plugins/accounts/RapideoPl.py b/module/plugins/accounts/RapideoPl.py
index 42d084bdb..fc17622b0 100644
--- a/module/plugins/accounts/RapideoPl.py
+++ b/module/plugins/accounts/RapideoPl.py
@@ -6,14 +6,19 @@ import time
from module.common.json_layer import json_loads
from module.plugins.internal.Account import Account
+# from module.plugins.internal.MultiAccount import MultiAccount
class RapideoPl(Account):
__name__ = "RapideoPl"
__type__ = "account"
- __version__ = "0.03"
+ __version__ = "0.06"
__status__ = "testing"
+ __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval", "int" , "Reload interval in minutes" , 60 )]
+
__description__ = "Rapideo.pl account plugin"
__license__ = "GPLv3"
__authors__ = [("goddie", "dev@rapideo.pl")]
@@ -27,15 +32,19 @@ class RapideoPl(Account):
'loc' : "1" ,
'info' : "1" }
- _req = None
- _usr = None
- _pwd = None
+ def grab_hosters(self, user, password, data):
+ hostings = json_loads(self.load("https://www.rapideo.pl/clipboard.php?json=3").strip())
+ hostings_domains = [domain for row in hostings for domain in row['domains'] if row['sdownload'] == "0"]
+
+ self.log_debug(hostings_domains)
+
+ return hostings_domains
- def parse_info(self, name, req):
- self._req = req
+ def grab_info(self, user, password, data):
try:
result = json_loads(self.run_auth_query())
+
except Exception:
#@TODO: return or let it be thrown?
return
@@ -54,27 +63,24 @@ class RapideoPl(Account):
'premium' : premium }
- def login(self, user, password, data, req):
- self._usr = user
- self._pwd = hashlib.md5(password).hexdigest()
- self._req = req
+ def signin(self, user, password, data):
+ data['usr'] = user
+ data['pwd'] = hashlib.md5(password).hexdigest()
try:
response = json_loads(self.run_auth_query())
+
except Exception:
- self.login_fail()
+ self.fail_login()
if "errno" in response.keys():
- self.login_fail()
-
- data['usr'] = self._usr
- data['pwd'] = self._pwd
+ self.fail_login()
def create_auth_query(self):
query = self.API_QUERY
- query['username'] = self._usr
- query['password'] = self._pwd
+ query['username'] = self.info['data']['usr']
+ query['password'] = self.info['data']['pwd']
return query
diff --git a/module/plugins/accounts/RapidfileshareNet.py b/module/plugins/accounts/RapidfileshareNet.py
index 069b30900..a28c61b36 100644
--- a/module/plugins/accounts/RapidfileshareNet.py
+++ b/module/plugins/accounts/RapidfileshareNet.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class RapidfileshareNet(XFSAccount):
__name__ = "RapidfileshareNet"
__type__ = "account"
- __version__ = "0.06"
+ __version__ = "0.07"
__status__ = "testing"
__description__ = """Rapidfileshare.net account plugin"""
@@ -14,6 +14,6 @@ class RapidfileshareNet(XFSAccount):
__authors__ = [("guidobelix", "guidobelix@hotmail.it")]
- HOSTER_DOMAIN = "rapidfileshare.net"
+ PLUGIN_DOMAIN = "rapidfileshare.net"
TRAFFIC_LEFT_PATTERN = r'>Traffic available today:</TD><TD><label for="name">\s*(?P<S>[\d.,]+)\s*(?:(?P<U>[\w^_]+))?'
diff --git a/module/plugins/accounts/RapidgatorNet.py b/module/plugins/accounts/RapidgatorNet.py
index 5ce51a1ec..f1177530f 100644
--- a/module/plugins/accounts/RapidgatorNet.py
+++ b/module/plugins/accounts/RapidgatorNet.py
@@ -9,7 +9,7 @@ from module.common.json_layer import json_loads
class RapidgatorNet(Account):
__name__ = "RapidgatorNet"
__type__ = "account"
- __version__ = "0.11"
+ __version__ = "0.15"
__status__ = "testing"
__description__ = """Rapidgator.net account plugin"""
@@ -17,17 +17,17 @@ class RapidgatorNet(Account):
__authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
- API_URL = "http://rapidgator.net/api/user"
+ API_URL = "http://rapidgator.net/api/user/"
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
validuntil = None
trafficleft = None
premium = False
sid = None
try:
- sid = self.get_data(user).get('sid', None)
+ sid = data.get('sid', None)
assert sid
html = self.load(urlparse.urljoin(self.API_URL, "info"),
@@ -39,7 +39,7 @@ class RapidgatorNet(Account):
if json['response_status'] == 200:
if "reset_in" in json['response']:
- self.schedule_refresh(user, json['response']['reset_in'])
+ self._schedule_refresh(user, json['response']['reset_in'])
validuntil = json['response']['expire_date']
trafficleft = float(json['response']['traffic_left']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10
@@ -56,7 +56,7 @@ class RapidgatorNet(Account):
'sid' : sid}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
try:
html = self.load(urlparse.urljoin(self.API_URL, "login"),
post={'username': user,
@@ -75,4 +75,4 @@ class RapidgatorNet(Account):
except Exception, e:
self.log_error(e)
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/RapiduNet.py b/module/plugins/accounts/RapiduNet.py
index 1ec29bd77..c11eb9214 100644
--- a/module/plugins/accounts/RapiduNet.py
+++ b/module/plugins/accounts/RapiduNet.py
@@ -10,7 +10,7 @@ from module.common.json_layer import json_loads
class RapiduNet(Account):
__name__ = "RapiduNet"
__type__ = "account"
- __version__ = "0.07"
+ __version__ = "0.09"
__status__ = "testing"
__description__ = """Rapidu.net account plugin"""
@@ -26,7 +26,7 @@ class RapiduNet(Account):
TRAFFIC_LEFT_PATTERN = r'class="tipsyS"><b>(.+?)<'
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
validuntil = None
trafficleft = -1
premium = False
@@ -37,17 +37,17 @@ class RapiduNet(Account):
premium = True
m = re.search(self.VALID_UNTIL_PATTERN, html)
- if m:
+ if m is not None:
validuntil = time.time() + (86400 * int(m.group(1)))
m = re.search(self.TRAFFIC_LEFT_PATTERN, html)
- if m:
+ if m is not None:
trafficleft = self.parse_traffic(m.group(1))
return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
self.load("https://rapidu.net/ajax.php",
get={'a': "getChangeLang"},
post={'_go' : "",
@@ -62,5 +62,5 @@ class RapiduNet(Account):
self.log_debug(json)
- if not json['message'] == "success":
- self.login_fail()
+ if json['message'] != "success":
+ self.fail_login()
diff --git a/module/plugins/accounts/RarefileNet.py b/module/plugins/accounts/RarefileNet.py
index 5f52ba147..0004c0f79 100644
--- a/module/plugins/accounts/RarefileNet.py
+++ b/module/plugins/accounts/RarefileNet.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class RarefileNet(XFSAccount):
__name__ = "RarefileNet"
__type__ = "account"
- __version__ = "0.05"
+ __version__ = "0.06"
__status__ = "testing"
__description__ = """RareFile.net account plugin"""
@@ -14,4 +14,4 @@ class RarefileNet(XFSAccount):
__authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
- HOSTER_DOMAIN = "rarefile.net"
+ PLUGIN_DOMAIN = "rarefile.net"
diff --git a/module/plugins/accounts/RealdebridCom.py b/module/plugins/accounts/RealdebridCom.py
index 718850c1a..63ef62da0 100644
--- a/module/plugins/accounts/RealdebridCom.py
+++ b/module/plugins/accounts/RealdebridCom.py
@@ -8,15 +8,24 @@ from module.plugins.internal.Account import Account
class RealdebridCom(Account):
__name__ = "RealdebridCom"
__type__ = "account"
- __version__ = "0.48"
+ __version__ = "0.50"
__status__ = "testing"
+ __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval", "int" , "Reload interval in minutes" , 60 )]
+
__description__ = """Real-Debrid.com account plugin"""
__license__ = "GPLv3"
__authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")]
- def parse_info(self, user, password, data, req):
+ def grab_hosters(self, user, password, data):
+ html = self.load("https://real-debrid.com/api/hosters.php")
+ return [x for x in map(str.strip, html.replace("\"", "").split(",")) if x]
+
+
+ def grab_info(self, user, password, data):
if self.pin_code:
return
@@ -30,7 +39,7 @@ class RealdebridCom(Account):
'premium' : True }
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
self.pin_code = False
html = self.load("https://real-debrid.com/ajax/login.php",
@@ -38,7 +47,7 @@ class RealdebridCom(Account):
'pass': password})
if "Your login informations are incorrect" in html:
- self.login_fail()
+ self.fail_login()
elif "PIN Code required" in html:
self.log_warning(_("PIN code required. Please login to https://real-debrid.com using the PIN or disable the double authentication in your control panel on https://real-debrid.com"))
diff --git a/module/plugins/accounts/RehostTo.py b/module/plugins/accounts/RehostTo.py
index 36e5e33eb..4ff3f15a8 100644
--- a/module/plugins/accounts/RehostTo.py
+++ b/module/plugins/accounts/RehostTo.py
@@ -6,15 +6,26 @@ from module.plugins.internal.Account import Account
class RehostTo(Account):
__name__ = "RehostTo"
__type__ = "account"
- __version__ = "0.18"
+ __version__ = "0.21"
__status__ = "testing"
+ __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval", "int" , "Reload interval in minutes" , 60 )]
+
__description__ = """Rehost.to account plugin"""
__license__ = "GPLv3"
__authors__ = [("RaNaN", "RaNaN@pyload.org")]
- def parse_info(self, user, password, data, req):
+ def grab_hosters(self, user, password, data):
+ html = self.load("http://rehost.to/api.php",
+ get={'cmd' : "get_supported_och_dl",
+ 'long_ses': data['session']})
+ return [x for x in map(str.strip, html.replace("\"", "").split(",")) if x]
+
+
+ def grab_info(self, user, password, data):
premium = False
trafficleft = None
validuntil = -1
@@ -37,7 +48,7 @@ class RehostTo(Account):
traffic, valid = html.split(",")
premium = True
- trafficleft = self.parse_traffic(traffic + "MB")
+ trafficleft = self.parse_traffic(traffic, "MB")
validuntil = float(valid)
finally:
@@ -47,7 +58,7 @@ class RehostTo(Account):
'session' : session}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load("https://rehost.to/api.php",
get={'cmd': "login",
'user': user,
@@ -55,4 +66,4 @@ class RehostTo(Account):
if "ERROR" in html:
self.log_debug(html)
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/RyushareCom.py b/module/plugins/accounts/RyushareCom.py
index 3ab907a76..84b786bac 100644
--- a/module/plugins/accounts/RyushareCom.py
+++ b/module/plugins/accounts/RyushareCom.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class RyushareCom(XFSAccount):
__name__ = "RyushareCom"
__type__ = "account"
- __version__ = "0.07"
+ __version__ = "0.08"
__status__ = "testing"
__description__ = """Ryushare.com account plugin"""
@@ -14,4 +14,4 @@ class RyushareCom(XFSAccount):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = "ryushare.com"
+ PLUGIN_DOMAIN = "ryushare.com"
diff --git a/module/plugins/accounts/SafesharingEu.py b/module/plugins/accounts/SafesharingEu.py
index eb84d502f..632b2bff8 100644
--- a/module/plugins/accounts/SafesharingEu.py
+++ b/module/plugins/accounts/SafesharingEu.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class SafesharingEu(XFSAccount):
__name__ = "SafesharingEu"
__type__ = "account"
- __version__ = "0.03"
+ __version__ = "0.04"
__status__ = "testing"
__description__ = """Safesharing.eu account plugin"""
@@ -14,4 +14,4 @@ class SafesharingEu(XFSAccount):
__authors__ = [("guidobelix", "guidobelix@hotmail.it")]
- HOSTER_DOMAIN = "safesharing.eu"
+ PLUGIN_DOMAIN = "safesharing.eu"
diff --git a/module/plugins/accounts/SecureUploadEu.py b/module/plugins/accounts/SecureUploadEu.py
index a81030b67..e3f2dbc4f 100644
--- a/module/plugins/accounts/SecureUploadEu.py
+++ b/module/plugins/accounts/SecureUploadEu.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class SecureUploadEu(XFSAccount):
__name__ = "SecureUploadEu"
__type__ = "account"
- __version__ = "0.03"
+ __version__ = "0.04"
__status__ = "testing"
__description__ = """SecureUpload.eu account plugin"""
@@ -14,4 +14,4 @@ class SecureUploadEu(XFSAccount):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = "secureupload.eu"
+ PLUGIN_DOMAIN = "secureupload.eu"
diff --git a/module/plugins/accounts/SendmywayCom.py b/module/plugins/accounts/SendmywayCom.py
index 2875e0d46..a1675b654 100644
--- a/module/plugins/accounts/SendmywayCom.py
+++ b/module/plugins/accounts/SendmywayCom.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class SendmywayCom(XFSAccount):
__name__ = "SendmywayCom"
__type__ = "account"
- __version__ = "0.03"
+ __version__ = "0.04"
__status__ = "testing"
__description__ = """Sendmyway.com account plugin"""
@@ -14,4 +14,4 @@ class SendmywayCom(XFSAccount):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = "sendmyway.com"
+ PLUGIN_DOMAIN = "sendmyway.com"
diff --git a/module/plugins/accounts/SharebeastCom.py b/module/plugins/accounts/SharebeastCom.py
index a104a4a46..b8ddbe34d 100644
--- a/module/plugins/accounts/SharebeastCom.py
+++ b/module/plugins/accounts/SharebeastCom.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class SharebeastCom(XFSAccount):
__name__ = "SharebeastCom"
__type__ = "account"
- __version__ = "0.02"
+ __version__ = "0.03"
__status__ = "testing"
__description__ = """Sharebeast.com account plugin"""
@@ -14,4 +14,4 @@ class SharebeastCom(XFSAccount):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = "sharebeast.com"
+ PLUGIN_DOMAIN = "sharebeast.com"
diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py
index 87bbc4632..f5d213ecd 100644
--- a/module/plugins/accounts/ShareonlineBiz.py
+++ b/module/plugins/accounts/ShareonlineBiz.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Plugin import set_cookie
class ShareonlineBiz(Account):
__name__ = "ShareonlineBiz"
__type__ = "account"
- __version__ = "0.39"
+ __version__ = "0.41"
__status__ = "testing"
__description__ = """Share-online.biz account plugin"""
@@ -17,7 +17,7 @@ class ShareonlineBiz(Account):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- def api_response(self, user, password, req):
+ def api_response(self, user, password):
res = self.load("https://api.share-online.biz/cgi-bin",
get={'q' : "userdetails",
'aux' : "traffic",
@@ -30,21 +30,21 @@ class ShareonlineBiz(Account):
api = dict(line.split("=") for line in res.splitlines() if "=" in line)
if not 'a' in api:
- self.login_fail(res.strip('*').strip())
+ self.fail_login(res.strip('*'))
if api['a'].lower() == "not_available":
- self.login_fail(_("No info available"))
+ self.fail_login(_("No info available"))
return api
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
premium = False
validuntil = None
trafficleft = -1
maxtraffic = 100 * 1024 * 1024 * 1024 #: 100 GB
- api = self.api_response(user, password, req)
+ api = self.api_response(user, password)
premium = api['group'] in ("PrePaid", "Premium", "Penalty-Premium")
validuntil = float(api['expire_date'])
@@ -64,6 +64,6 @@ class ShareonlineBiz(Account):
'maxtraffic' : maxtraffic}
- def login(self, user, password, data, req):
- api = self.api_response(user, password, req)
- set_cookie(req.cj, "share-online.biz", 'a', api['a'])
+ def signin(self, user, password, data):
+ api = self.api_response(user, password)
+ set_cookie(self.req.cj, "share-online.biz", 'a', api['a'])
diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py
index a5c69f51c..2be8782ce 100644
--- a/module/plugins/accounts/SimplyPremiumCom.py
+++ b/module/plugins/accounts/SimplyPremiumCom.py
@@ -8,15 +8,28 @@ from module.plugins.internal.Plugin import set_cookie
class SimplyPremiumCom(Account):
__name__ = "SimplyPremiumCom"
__type__ = "account"
- __version__ = "0.08"
+ __version__ = "0.10"
__status__ = "testing"
+ __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval", "int" , "Reload interval in minutes" , 60 )]
+
__description__ = """Simply-Premium.com account plugin"""
__license__ = "GPLv3"
__authors__ = [("EvolutionClip", "evolutionclip@live.de")]
- def parse_info(self, user, password, data, req):
+ def grab_hosters(self, user, password, data):
+ json_data = self.load("http://www.simply-premium.com/api/hosts.php", get={'format': "json", 'online': 1})
+ json_data = json_loads(json_data)
+
+ host_list = [element['regex'] for element in json_data['result']]
+
+ return host_list
+
+
+ def grab_info(self, user, password, data):
premium = False
validuntil = -1
trafficleft = None
@@ -39,11 +52,11 @@ class SimplyPremiumCom(Account):
return {'premium': premium, 'validuntil': validuntil, 'trafficleft': trafficleft}
- def login(self, user, password, data, req):
- set_cookie(req.cj, "simply-premium.com", "lang", "EN")
+ def signin(self, user, password, data):
+ set_cookie(self.req.cj, "simply-premium.com", "lang", "EN")
html = self.load("https://www.simply-premium.com/login.php",
post={'key': user} if not password else {'login_name': user, 'login_pass': password})
if 'logout' not in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/SimplydebridCom.py b/module/plugins/accounts/SimplydebridCom.py
index 84c38227e..bd56dd5ec 100644
--- a/module/plugins/accounts/SimplydebridCom.py
+++ b/module/plugins/accounts/SimplydebridCom.py
@@ -8,15 +8,24 @@ from module.plugins.internal.Account import Account
class SimplydebridCom(Account):
__name__ = "SimplydebridCom"
__type__ = "account"
- __version__ = "0.13"
+ __version__ = "0.15"
__status__ = "testing"
+ __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval", "int" , "Reload interval in minutes" , 60 )]
+
__description__ = """Simply-Debrid.com account plugin"""
__license__ = "GPLv3"
__authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")]
- def parse_info(self, user, password, data, req):
+ def grab_hosters(self, user, password, data):
+ html = self.load("http://simply-debrid.com/api.php", get={'list': 1})
+ return [x for x in map(str.strip, html.rstrip(';').replace("\"", "").split(";")) if x]
+
+
+ def grab_info(self, user, password, data):
res = self.load("http://simply-debrid.com/api.php",
get={'login': 2,
'u' : user,
@@ -28,10 +37,10 @@ class SimplydebridCom(Account):
return {'trafficleft': -1, 'validuntil': time.mktime(time.strptime(str(data[2]), "%d/%m/%Y"))}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
res = self.load("https://simply-debrid.com/api.php",
get={'login': 1,
'u' : user,
'p' : password})
if res != "02: loggin success":
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/SmoozedCom.py b/module/plugins/accounts/SmoozedCom.py
index 9c2451794..1c3da5269 100644
--- a/module/plugins/accounts/SmoozedCom.py
+++ b/module/plugins/accounts/SmoozedCom.py
@@ -26,16 +26,24 @@ from module.plugins.internal.Account import Account
class SmoozedCom(Account):
__name__ = "SmoozedCom"
__type__ = "account"
- __version__ = "0.07"
+ __version__ = "0.09"
__status__ = "testing"
+ __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval", "int" , "Reload interval in minutes" , 60 )]
+
__description__ = """Smoozed.com account plugin"""
__license__ = "GPLv3"
- __authors__ = [("", "")]
+ __authors__ = [(None, None)]
+
+
+ def grab_hosters(self, user, password, data):
+ return self.get_data('hosters')
- def parse_info(self, user, password, data, req):
- status = self.get_account_status(user, password, req)
+ def grab_info(self, user, password, data):
+ status = self.get_account_status(user, password)
self.log_debug(status)
@@ -61,16 +69,16 @@ class SmoozedCom(Account):
return info
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
#: Get user data from premiumize.me
- status = self.get_account_status(user, password, req)
+ status = self.get_account_status(user, password)
#: Check if user and password are valid
if status['state'] != 'ok':
- self.login_fail()
+ self.fail_login()
- def get_account_status(self, user, password, req):
+ def get_account_status(self, user, password):
password = password
salt = hashlib.sha256(password).hexdigest()
encrypted = PBKDF2(password, salt, iterations=1000).hexread(32)
diff --git a/module/plugins/accounts/StreamcloudEu.py b/module/plugins/accounts/StreamcloudEu.py
index 9549896cc..54dd8e2fe 100644
--- a/module/plugins/accounts/StreamcloudEu.py
+++ b/module/plugins/accounts/StreamcloudEu.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class StreamcloudEu(XFSAccount):
__name__ = "StreamcloudEu"
__type__ = "account"
- __version__ = "0.03"
+ __version__ = "0.04"
__status__ = "testing"
__description__ = """Streamcloud.eu account plugin"""
@@ -14,4 +14,4 @@ class StreamcloudEu(XFSAccount):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = "streamcloud.eu"
+ PLUGIN_DOMAIN = "streamcloud.eu"
diff --git a/module/plugins/accounts/TurbobitNet.py b/module/plugins/accounts/TurbobitNet.py
index 206e7874f..c3edd0c09 100644
--- a/module/plugins/accounts/TurbobitNet.py
+++ b/module/plugins/accounts/TurbobitNet.py
@@ -10,7 +10,7 @@ from module.plugins.internal.Plugin import set_cookie
class TurbobitNet(Account):
__name__ = "TurbobitNet"
__type__ = "account"
- __version__ = "0.05"
+ __version__ = "0.07"
__status__ = "testing"
__description__ = """TurbobitNet account plugin"""
@@ -18,11 +18,11 @@ class TurbobitNet(Account):
__authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
html = self.load("http://turbobit.net")
m = re.search(r'<u>Turbo Access</u> to ([\d.]+)', html)
- if m:
+ if m is not None:
premium = True
validuntil = time.mktime(time.strptime(m.group(1), "%d.%m.%Y"))
else:
@@ -32,8 +32,8 @@ class TurbobitNet(Account):
return {'premium': premium, 'trafficleft': -1, 'validuntil': validuntil}
- def login(self, user, password, data, req):
- set_cookie(req.cj, "turbobit.net", "user_lang", "en")
+ def signin(self, user, password, data):
+ set_cookie(self.req.cj, "turbobit.net", "user_lang", "en")
html = self.load("http://turbobit.net/user/login",
post={"user[login]" : user,
@@ -41,4 +41,4 @@ class TurbobitNet(Account):
"user[submit]": "Login"})
if not '<div class="menu-item user-name">' in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/TusfilesNet.py b/module/plugins/accounts/TusfilesNet.py
index c549bbaf7..d826e5a3d 100644
--- a/module/plugins/accounts/TusfilesNet.py
+++ b/module/plugins/accounts/TusfilesNet.py
@@ -9,7 +9,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class TusfilesNet(XFSAccount):
__name__ = "TusfilesNet"
__type__ = "account"
- __version__ = "0.07"
+ __version__ = "0.08"
__status__ = "testing"
__description__ = """Tusfile.net account plugin"""
@@ -17,7 +17,7 @@ class TusfilesNet(XFSAccount):
__authors__ = [("guidobelix", "guidobelix@hotmail.it")]
- HOSTER_DOMAIN = "tusfiles.net"
+ PLUGIN_DOMAIN = "tusfiles.net"
VALID_UNTIL_PATTERN = r'<span class="label label-default">([^<]+)</span>'
TRAFFIC_LEFT_PATTERN = r'<td><img src="//www\.tusfiles\.net/i/icon/meter\.png" alt=""/></td>\n<td>&nbsp;(?P<S>[\d.,]+)'
diff --git a/module/plugins/accounts/UlozTo.py b/module/plugins/accounts/UlozTo.py
index 00e125dbc..8380099e1 100644
--- a/module/plugins/accounts/UlozTo.py
+++ b/module/plugins/accounts/UlozTo.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account
class UlozTo(Account):
__name__ = "UlozTo"
__type__ = "account"
- __version__ = "0.12"
+ __version__ = "0.14"
__status__ = "testing"
__description__ = """Uloz.to account plugin"""
@@ -21,7 +21,7 @@ class UlozTo(Account):
TRAFFIC_LEFT_PATTERN = r'<li class="menu-kredit"><a .*?title=".+?GB = ([\d.]+) MB"'
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
html = self.load("http://www.ulozto.net/")
m = re.search(self.TRAFFIC_LEFT_PATTERN, html)
@@ -32,7 +32,7 @@ class UlozTo(Account):
return {'validuntil': -1, 'trafficleft': trafficleft, 'premium': premium}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
login_page = self.load('http://www.ulozto.net/?do=web-login')
action = re.findall('<form action="(.+?)"', login_page)[1].replace('&amp;', '&')
token = re.search('_token_" value="(.+?)"', login_page).group(1)
@@ -46,4 +46,4 @@ class UlozTo(Account):
'remember': "on"})
if '<div class="flash error">' in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/UploadableCh.py b/module/plugins/accounts/UploadableCh.py
index 9c2649e51..eefa1f3a0 100644
--- a/module/plugins/accounts/UploadableCh.py
+++ b/module/plugins/accounts/UploadableCh.py
@@ -6,7 +6,7 @@ from module.plugins.internal.Account import Account
class UploadableCh(Account):
__name__ = "UploadableCh"
__type__ = "account"
- __version__ = "0.05"
+ __version__ = "0.07"
__status__ = "testing"
__description__ = """Uploadable.ch account plugin"""
@@ -14,7 +14,7 @@ class UploadableCh(Account):
__authors__ = [("Sasch", "gsasch@gmail.com")]
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
html = self.load("http://www.uploadable.ch/login.php")
premium = '<a href="/logout.php"' in html
@@ -23,7 +23,7 @@ class UploadableCh(Account):
return {'validuntil': None, 'trafficleft': trafficleft, 'premium': premium} #@TODO: validuntil
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load("http://www.uploadable.ch/login.php",
post={'userName' : user,
'userPassword' : password,
@@ -31,4 +31,4 @@ class UploadableCh(Account):
'action__login': "normalLogin"})
if "Login failed" in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/UploadcCom.py b/module/plugins/accounts/UploadcCom.py
index 5b834ac3b..dbad01858 100644
--- a/module/plugins/accounts/UploadcCom.py
+++ b/module/plugins/accounts/UploadcCom.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class UploadcCom(XFSAccount):
__name__ = "UploadcCom"
__type__ = "account"
- __version__ = "0.03"
+ __version__ = "0.04"
__status__ = "testing"
__description__ = """Uploadc.com account plugin"""
@@ -14,4 +14,4 @@ class UploadcCom(XFSAccount):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = "uploadc.com"
+ PLUGIN_DOMAIN = "uploadc.com"
diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py
index 59d3fcff9..9c3369bd8 100644
--- a/module/plugins/accounts/UploadedTo.py
+++ b/module/plugins/accounts/UploadedTo.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account
class UploadedTo(Account):
__name__ = "UploadedTo"
__type__ = "account"
- __version__ = "0.35"
+ __version__ = "0.37"
__status__ = "testing"
__description__ = """Uploaded.to account plugin"""
@@ -24,7 +24,7 @@ class UploadedTo(Account):
TRAFFIC_LEFT_PATTERN = r'<b class="cB">(?P<S>[\d.,]+) (?P<U>[\w^_]+)'
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
validuntil = None
trafficleft = None
premium = None
@@ -34,20 +34,20 @@ class UploadedTo(Account):
premium = True if re.search(self.PREMIUM_PATTERN, html) else False
m = re.search(self.VALID_UNTIL_PATTERN, html, re.M)
- if m:
+ if m is not None:
expiredate = m.group(1).lower().strip()
if expiredate == "unlimited":
validuntil = -1
else:
m = re.findall(r'(\d+) (week|day|hour)', expiredate)
- if m:
+ if m is not None:
validuntil = time.time()
for n, u in m:
validuntil += float(n) * 60 * 60 * {'week': 168, 'day': 24, 'hour': 1}[u]
m = re.search(self.TRAFFIC_LEFT_PATTERN, html)
- if m:
+ if m is not None:
traffic = m.groupdict()
size = traffic['S'].replace('.', '')
unit = traffic['U'].lower()
@@ -56,14 +56,14 @@ class UploadedTo(Account):
trafficleft = float(size.replace(',', '.')) / 1024
trafficleft *= 1 << 40
else:
- trafficleft = self.parse_traffic(size + unit)
+ trafficleft = self.parse_traffic(size, unit)
return {'validuntil' : validuntil,
'trafficleft': trafficleft,
'premium' : premium}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
self.load("http://uploaded.net/language/en")
html = self.load("http://uploaded.net/io/login",
@@ -72,4 +72,4 @@ class UploadedTo(Account):
m = re.search(r'"err":"(.+?)"', html)
if m is not None:
- self.login_fail(m.group(1))
+ self.fail_login(m.group(1))
diff --git a/module/plugins/accounts/UploadheroCom.py b/module/plugins/accounts/UploadheroCom.py
index f31b01d03..c5e684033 100644
--- a/module/plugins/accounts/UploadheroCom.py
+++ b/module/plugins/accounts/UploadheroCom.py
@@ -10,7 +10,7 @@ from module.plugins.internal.Account import Account
class UploadheroCom(Account):
__name__ = "UploadheroCom"
__type__ = "account"
- __version__ = "0.23"
+ __version__ = "0.25"
__status__ = "testing"
__description__ = """Uploadhero.co account plugin"""
@@ -18,10 +18,9 @@ class UploadheroCom(Account):
__authors__ = [("mcmyst", "mcmyst@hotmail.fr")]
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
premium_pattern = re.compile('Il vous reste <span class="bleu">(\d+)</span> jours premium')
- data = self.get_data(user)
html = self.load("http://uploadhero.co/my-account")
if premium_pattern.search(html):
@@ -34,10 +33,10 @@ class UploadheroCom(Account):
return account_info
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load("http://uploadhero.co/lib/connexion.php",
post={'pseudo_login': user,
'password_login': password})
if "mot de passe invalide" in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py
index d269abde7..c038d1ebc 100644
--- a/module/plugins/accounts/UploadingCom.py
+++ b/module/plugins/accounts/UploadingCom.py
@@ -10,7 +10,7 @@ from module.plugins.internal.Plugin import set_cookies
class UploadingCom(Account):
__name__ = "UploadingCom"
__type__ = "account"
- __version__ = "0.14"
+ __version__ = "0.16"
__status__ = "testing"
__description__ = """Uploading.com account plugin"""
@@ -22,7 +22,7 @@ class UploadingCom(Account):
VALID_UNTIL_PATTERN = r'Valid Until:(.+?)<'
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
validuntil = None
trafficleft = None
premium = None
@@ -32,7 +32,7 @@ class UploadingCom(Account):
premium = False if re.search(self.PREMIUM_PATTERN, html) else True
m = re.search(self.VALID_UNTIL_PATTERN, html)
- if m:
+ if m is not None:
expiredate = m.group(1).strip()
self.log_debug("Expire date: " + expiredate)
@@ -54,8 +54,8 @@ class UploadingCom(Account):
'premium' : premium}
- def login(self, user, password, data, req):
- set_cookies(req.cj,
+ def signin(self, user, password, data):
+ set_cookies(self.req.cj,
[("uploading.com", "lang" , "1" ),
("uploading.com", "language", "1" ),
("uploading.com", "setlang" , "en"),
diff --git a/module/plugins/accounts/UptoboxCom.py b/module/plugins/accounts/UptoboxCom.py
index 68aaecc47..8df558e2a 100644
--- a/module/plugins/accounts/UptoboxCom.py
+++ b/module/plugins/accounts/UptoboxCom.py
@@ -6,14 +6,14 @@ from module.plugins.internal.XFSAccount import XFSAccount
class UptoboxCom(XFSAccount):
__name__ = "UptoboxCom"
__type__ = "account"
- __version__ = "0.09"
+ __version__ = "0.13"
__status__ = "testing"
- __description__ = """DDLStorage.com account plugin"""
+ __description__ = """Uptobox.com account plugin"""
__license__ = "GPLv3"
- __authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
+ __authors__ = [("benbox69", "dev@tollet.me")]
- HOSTER_DOMAIN = "uptobox.com"
- HOSTER_URL = "https://uptobox.com/"
- LOGIN_URL = "https://login.uptobox.com/"
+ PLUGIN_DOMAIN = "uptobox.com"
+ PLUGIN_URL = "https://uptobox.com/"
+ LOGIN_URL = "https://login.uptobox.com/logarithme/"
diff --git a/module/plugins/accounts/VidPlayNet.py b/module/plugins/accounts/VidPlayNet.py
index d543c5671..e54515faf 100644
--- a/module/plugins/accounts/VidPlayNet.py
+++ b/module/plugins/accounts/VidPlayNet.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class VidPlayNet(XFSAccount):
__name__ = "VidPlayNet"
__type__ = "account"
- __version__ = "0.03"
+ __version__ = "0.04"
__status__ = "testing"
__description__ = """VidPlay.net account plugin"""
@@ -14,4 +14,4 @@ class VidPlayNet(XFSAccount):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = "vidplay.net"
+ PLUGIN_DOMAIN = "vidplay.net"
diff --git a/module/plugins/accounts/WebshareCz.py b/module/plugins/accounts/WebshareCz.py
index bbfb90a92..484ea06ce 100644
--- a/module/plugins/accounts/WebshareCz.py
+++ b/module/plugins/accounts/WebshareCz.py
@@ -12,7 +12,7 @@ from module.plugins.internal.Account import Account
class WebshareCz(Account):
__name__ = "WebshareCz"
__type__ = "account"
- __version__ = "0.10"
+ __version__ = "0.12"
__status__ = "testing"
__description__ = """Webshare.cz account plugin"""
@@ -25,9 +25,9 @@ class WebshareCz(Account):
TRAFFIC_LEFT_PATTERN = r'<bytes>(.+)</bytes>'
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
html = self.load("https://webshare.cz/api/user_data/",
- post={'wst': self.get_data(user).get('wst', None)})
+ post={'wst': data.get('wst', None)})
self.log_debug("Response: " + html)
@@ -41,13 +41,13 @@ class WebshareCz(Account):
return {'validuntil': validuntil, 'trafficleft': -1, 'premium': premium}
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
salt = self.load("https://webshare.cz/api/salt/",
post={'username_or_email': user,
'wst' : ""})
if "<status>OK</status>" not in salt:
- self.login_fail()
+ self.fail_login()
salt = re.search('<salt>(.+)</salt>', salt).group(1)
password = hashlib.sha1(md5_crypt.encrypt(password, salt=salt)).hexdigest()
@@ -61,6 +61,6 @@ class WebshareCz(Account):
'wst' : ""})
if "<status>OK</status>" not in login:
- self.login_fail()
+ self.fail_login()
data['wst'] = re.search('<token>(.+)</token>', login).group(1)
diff --git a/module/plugins/accounts/WorldbytezCom.py b/module/plugins/accounts/WorldbytezCom.py
index ea409fd58..6987bc0cc 100644
--- a/module/plugins/accounts/WorldbytezCom.py
+++ b/module/plugins/accounts/WorldbytezCom.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class WorldbytezCom(XFSAccount):
__name__ = "WorldbytezCom"
__type__ = "account"
- __version__ = "0.02"
+ __version__ = "0.03"
__status__ = "testing"
__description__ = """Worldbytez.com account plugin"""
@@ -14,4 +14,4 @@ class WorldbytezCom(XFSAccount):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = "worldbytez.com"
+ PLUGIN_DOMAIN = "worldbytez.com"
diff --git a/module/plugins/accounts/XFileSharingPro.py b/module/plugins/accounts/XFileSharingPro.py
index f21247cf4..68797b7f0 100644
--- a/module/plugins/accounts/XFileSharingPro.py
+++ b/module/plugins/accounts/XFileSharingPro.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount
class XFileSharingPro(XFSAccount):
__name__ = "XFileSharingPro"
__type__ = "account"
- __version__ = "0.09"
+ __version__ = "0.10"
__status__ = "testing"
__description__ = """XFileSharingPro multi-purpose account plugin"""
@@ -14,13 +14,13 @@ class XFileSharingPro(XFSAccount):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = None
+ PLUGIN_DOMAIN = None
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
try:
- return super(XFileSharingPro, self).login(user, data, req)
+ return super(XFileSharingPro, self).signin(user, password, data)
except Fail:
- self.HOSTER_URL = self.HOSTER_URL.replace("www.", "")
- return super(XFileSharingPro, self).login(user, data, req)
+ self.PLUGIN_URL = self.PLUGIN_URL.replace("www.", "")
+ return super(XFileSharingPro, self).signin(user, password, data)
diff --git a/module/plugins/accounts/YibaishiwuCom.py b/module/plugins/accounts/YibaishiwuCom.py
index c5dda0921..ba7454183 100644
--- a/module/plugins/accounts/YibaishiwuCom.py
+++ b/module/plugins/accounts/YibaishiwuCom.py
@@ -8,7 +8,7 @@ from module.plugins.internal.Account import Account
class YibaishiwuCom(Account):
__name__ = "YibaishiwuCom"
__type__ = "account"
- __version__ = "0.04"
+ __version__ = "0.06"
__status__ = "testing"
__description__ = """115.com account plugin"""
@@ -19,7 +19,7 @@ class YibaishiwuCom(Account):
ACCOUNT_INFO_PATTERN = r'var USER_PERMISSION = {(.*?)}'
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
# self.relogin(user)
html = self.load("http://115.com/")
@@ -29,7 +29,7 @@ class YibaishiwuCom(Account):
return dict({'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium})
- def login(self, user, password, data, req):
+ def signin(self, user, password, data):
html = self.load("https://passport.115.com/?ac=login",
post={'back' : "http://www.115.com/",
'goto' : "http://115.com/",
@@ -37,4 +37,4 @@ class YibaishiwuCom(Account):
"login[passwd]" : password})
if not 'var USER_PERMISSION = {' in html:
- self.login_fail()
+ self.fail_login()
diff --git a/module/plugins/accounts/ZeveraCom.py b/module/plugins/accounts/ZeveraCom.py
index 4138ba3cc..c94ad6db7 100644
--- a/module/plugins/accounts/ZeveraCom.py
+++ b/module/plugins/accounts/ZeveraCom.py
@@ -8,16 +8,25 @@ from module.plugins.internal.Account import Account
class ZeveraCom(Account):
__name__ = "ZeveraCom"
__type__ = "account"
- __version__ = "0.28"
+ __version__ = "0.30"
__status__ = "testing"
+ __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"),
+ ("mh_list" , "str" , "Hoster list (comma separated)", "" ),
+ ("mh_interval", "int" , "Reload interval in minutes" , 60 )]
+
__description__ = """Zevera.com account plugin"""
__license__ = "GPLv3"
__authors__ = [("zoidberg", "zoidberg@mujmail.cz"),
("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = "zevera.com"
+ PLUGIN_DOMAIN = "zevera.com"
+
+
+ def grab_hosters(self, user, password, data):
+ html = self.api_response(user, password, cmd="gethosters")
+ return [x.strip() for x in html.split(",")]
def __init__(self, manager, accounts): #@TODO: remove in 0.4.10
@@ -26,19 +35,19 @@ class ZeveraCom(Account):
def init(self):
- if not self.HOSTER_DOMAIN:
- self.log_error(_("Missing HOSTER_DOMAIN"))
+ if not self.PLUGIN_DOMAIN:
+ self.log_error(_("Missing PLUGIN_DOMAIN"))
if not hasattr(self, "API_URL"):
- self.API_URL = "http://api.%s/jDownloader.ashx" % (self.HOSTER_DOMAIN or "")
+ self.API_URL = "http://api.%s/jDownloader.ashx" % (self.PLUGIN_DOMAIN or "")
- def parse_info(self, user, password, data, req):
+ def grab_info(self, user, password, data):
validuntil = None
trafficleft = None
premium = False
- api = self.api_response(req)
+ api = self.api_response(user, password)
if "No trafic" not in api and api['endsubscriptiondate'] != "Expired!":
validuntil = time.mktime(time.strptime(api['endsubscriptiondate'], "%Y/%m/%d %H:%M:%S"))
@@ -48,18 +57,15 @@ class ZeveraCom(Account):
return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium}
- def login(self, user, password, data, req):
- self.user = user
- self.password = password
-
- if self.api_response(req) == "No trafic":
- self.login_fail()
+ def signin(self, user, password, data):
+ if self.api_response(user, password) == "No trafic":
+ self.fail_login()
- def api_response(self, req, just_header=False, **kwargs):
+ def api_response(self, user, password=None, just_header=False, **kwargs):
get_data = {'cmd' : "accountinfo",
- 'login': self.user,
- 'pass' : self.password}
+ 'login': user,
+ 'pass' : password}
get_data.update(kwargs)
diff --git a/module/plugins/captcha/AdYouLike.py b/module/plugins/captcha/AdYouLike.py
index f91b5805c..cac73774a 100644
--- a/module/plugins/captcha/AdYouLike.py
+++ b/module/plugins/captcha/AdYouLike.py
@@ -76,7 +76,7 @@ class AdYouLike(CaptchaService):
try:
instructions_visual = challenge['translations'][server['all']['lang']]['instructions_visual']
- result = re.search(u'«(.+?)»', instructions_visual).group(1).strip()
+ response = re.search(u'«(.+?)»', instructions_visual).group(1).strip()
except AttributeError:
self.fail(_("AdYouLike result not found"))
@@ -87,6 +87,6 @@ class AdYouLike(CaptchaService):
'_ayl_token_challenge': challenge['token'],
'_ayl_response' : response}
- self.log_debug("Result: %s" % result)
+ self.log_debug("Result: %s" % response)
return result
diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py
index 4d2e2bc34..a9ccecf3c 100644
--- a/module/plugins/captcha/LinksaveIn.py
+++ b/module/plugins/captcha/LinksaveIn.py
@@ -79,8 +79,10 @@ class LinksaveIn(OCR):
rgb_c = lut[pix[x, y]]
try:
cstat[rgb_c] += 1
+
except Exception:
cstat[rgb_c] = 1
+
if rgb_bg is rgb_c:
stat[bgpath] += 1
max_p = 0
diff --git a/module/plugins/captcha/ReCaptcha.py b/module/plugins/captcha/ReCaptcha.py
index 5931159c5..a3ac52cb1 100644
--- a/module/plugins/captcha/ReCaptcha.py
+++ b/module/plugins/captcha/ReCaptcha.py
@@ -31,7 +31,7 @@ class ReCaptcha(CaptchaService):
html = data or self.retrieve_data()
m = re.search(self.KEY_V2_PATTERN, html) or re.search(self.KEY_V1_PATTERN, html)
- if m:
+ if m is not None:
self.key = m.group(1).strip()
self.log_debug("Key: %s" % self.key)
return self.key
diff --git a/module/plugins/captcha/SolveMedia.py b/module/plugins/captcha/SolveMedia.py
index 870b5fc10..a5a49b68e 100644
--- a/module/plugins/captcha/SolveMedia.py
+++ b/module/plugins/captcha/SolveMedia.py
@@ -24,7 +24,7 @@ class SolveMedia(CaptchaService):
html = data or self.retrieve_data()
m = re.search(self.KEY_PATTERN, html)
- if m:
+ if m is not None:
self.key = m.group(1).strip()
self.log_debug("Key: %s" % self.key)
return self.key
diff --git a/module/plugins/container/DLC.py b/module/plugins/container/DLC.py
index 145322942..c92ba64c4 100644
--- a/module/plugins/container/DLC.py
+++ b/module/plugins/container/DLC.py
@@ -17,7 +17,7 @@ class DLC(Container):
__version__ = "0.26"
__status__ = "testing"
- __pattern__ = r'.+\.dlc$'
+ __pattern__ = r'(.+\.dlc|[\w+^_]+==[\w+^_/]+==)$'
__description__ = """DLC container decrypter plugin"""
__license__ = "GPLv3"
diff --git a/module/plugins/crypter/ChipDe.py b/module/plugins/crypter/ChipDe.py
index 3604635e5..8d823d88d 100644
--- a/module/plugins/crypter/ChipDe.py
+++ b/module/plugins/crypter/ChipDe.py
@@ -23,8 +23,10 @@ class ChipDe(Crypter):
self.html = self.load(pyfile.url)
try:
f = re.search(r'"(http://video\.chip\.de/.+)"', self.html)
+
except Exception:
self.fail(_("Failed to find the URL"))
+
else:
self.urls = [f.group(1)]
self.log_debug("The file URL is %s" % self.urls[0])
diff --git a/module/plugins/crypter/CloudzillaToFolder.py b/module/plugins/crypter/CloudzillaToFolder.py
index 09b4d4c08..dc0cdfef2 100644
--- a/module/plugins/crypter/CloudzillaToFolder.py
+++ b/module/plugins/crypter/CloudzillaToFolder.py
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
import re
-import urlparse
from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo
@@ -9,7 +8,7 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo
class CloudzillaToFolder(SimpleHoster):
__name__ = "CloudzillaToFolder"
__type__ = "crypter"
- __version__ = "0.03"
+ __version__ = "0.04"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?cloudzilla\.to/share/folder/(?P<ID>[\w^_]+)'
@@ -29,11 +28,11 @@ class CloudzillaToFolder(SimpleHoster):
def check_errors(self):
m = re.search(self.PASSWORD_PATTERN, self.html)
- if m:
+ if m is not None:
self.html = self.load(self.pyfile.url, get={'key': self.get_password()})
if re.search(self.PASSWORD_PATTERN, self.html):
- self.retry(reason="Wrong password")
+ self.retry(msg="Wrong password")
getInfo = create_getInfo(CloudzillaToFolder)
diff --git a/module/plugins/crypter/Dereferer.py b/module/plugins/crypter/Dereferer.py
index 9051abcc2..8ecc635ec 100644
--- a/module/plugins/crypter/Dereferer.py
+++ b/module/plugins/crypter/Dereferer.py
@@ -8,7 +8,7 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter
class Dereferer(SimpleCrypter):
__name__ = "Dereferer"
__type__ = "crypter"
- __version__ = "0.18"
+ __version__ = "0.19"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/.*?(?P<LINK>(?:ht|f)tps?://.+)'
@@ -20,12 +20,12 @@ class Dereferer(SimpleCrypter):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = None
- HOSTER_NAME = None
+ PLUGIN_DOMAIN = None
+ PLUGIN_NAME = None
def _log(self, level, plugintype, pluginname, messages):
- return super(Dereferer, self)._log(level, plugintype, pluginname, (self.HOSTER_NAME,) + messages)
+ return super(Dereferer, self)._log(level, plugintype, pluginname, (self.PLUGIN_NAME,) + messages)
def init(self):
@@ -33,9 +33,9 @@ class Dereferer(SimpleCrypter):
self.__pattern__ = self.pyload.pluginManager.crypterPlugins[self.__name__]['pattern'] #@TODO: Recheck in 0.4.10
- self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower()
- self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.')
+ self.PLUGIN_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower()
+ self.PLUGIN_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+)', self.PLUGIN_DOMAIN) if part != '.')
def get_links(self):
- return [re.match(self.__pattern__, self.pyfile.url).group('LINK').strip()]
+ return [re.match(self.__pattern__, self.pyfile.url).group('LINK')]
diff --git a/module/plugins/crypter/DevhostStFolder.py b/module/plugins/crypter/DevhostStFolder.py
index 8340adeb8..6c50c8480 100644
--- a/module/plugins/crypter/DevhostStFolder.py
+++ b/module/plugins/crypter/DevhostStFolder.py
@@ -42,7 +42,7 @@ class DevhostStFolder(SimpleCrypter):
p = r'href="(.+?)">Back to \w+<'
m = re.search(p, self.html)
- html = self.load(urlparse.urljoin("http://d-h.st", m.group(1)),
+ html = self.load(urlparse.urljoin("http://d-h.st/", m.group(1)),
cookies=False)
p = '\?fld_id=%s.*?">(.+?)<' % self.info['pattern']['ID']
diff --git a/module/plugins/crypter/DlProtectCom.py b/module/plugins/crypter/DlProtectCom.py
index 0c776ac61..ac45ee4c3 100644
--- a/module/plugins/crypter/DlProtectCom.py
+++ b/module/plugins/crypter/DlProtectCom.py
@@ -53,7 +53,7 @@ class DlProtectCom(SimpleCrypter):
if "Security Code" in self.html:
m = re.search(r'/captcha\.php\?key=(.+?)"', self.html)
- if m:
+ if m is not None:
captcha_code = self.captcha.decrypt("http://www.dl-protect.com/captcha.php?key=" + m.group(1), input_type="gif")
post_req['secure'] = captcha_code
diff --git a/module/plugins/crypter/EmbeduploadCom.py b/module/plugins/crypter/EmbeduploadCom.py
index 341b3e315..e4a9387ae 100644
--- a/module/plugins/crypter/EmbeduploadCom.py
+++ b/module/plugins/crypter/EmbeduploadCom.py
@@ -30,7 +30,7 @@ class EmbeduploadCom(Crypter):
tmp_links = []
m = re.findall(self.LINK_PATTERN, self.html)
- if m:
+ if m is not None:
prefered_set = set(self.get_config('preferedHoster').split('|'))
prefered_set = map(lambda s: s.lower().split('.')[0], prefered_set)
diff --git a/module/plugins/crypter/FilecryptCc.py b/module/plugins/crypter/FilecryptCc.py
index 9f4ad69aa..bb9aee1d7 100644
--- a/module/plugins/crypter/FilecryptCc.py
+++ b/module/plugins/crypter/FilecryptCc.py
@@ -11,28 +11,33 @@ from Crypto.Cipher import AES
from module.plugins.internal.Crypter import Crypter
from module.plugins.captcha.ReCaptcha import ReCaptcha
+from module.plugins.captcha.SolveMedia import SolveMedia
class FilecryptCc(Crypter):
__name__ = "FilecryptCc"
__type__ = "crypter"
- __version__ = "0.18"
+ __version__ = "0.20"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?filecrypt\.cc/Container/\w+'
__description__ = """Filecrypt.cc decrypter plugin"""
__license__ = "GPLv3"
- __authors__ = [("zapp-brannigan", "")]
+ __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de"),
+ ("GammaC0de" , None )]
# URL_REPLACEMENTS = [(r'.html$', ""), (r'$', ".html")] #@TODO: Extend SimpleCrypter
- DLC_LINK_PATTERN = r'<button class="dlcdownload" type="button" title="Download \*.dlc" onclick="DownloadDLC\(\'(.+)\'\);"><i></i><span>dlc<'
+ DLC_LINK_PATTERN = r'onclick="DownloadDLC\(\'(.+)\'\);">'
WEBLINK_PATTERN = r"openLink.?'([\w_-]*)',"
- CAPTCHA_PATTERN = r'<img id="nc" src="(.+?)"'
- CIRCLE_CAPTCHA_PATTERN = r'<input type="image" src="(.+?)"'
+ CAPTCHA_PATTERN = r'class="safety">Sicherheitsabfrage<'
+ INTERNAL_CAPTCHA_PATTERN = r'<img id="nc" src="(.+?)"'
+ CIRCLE_CAPTCHA_PATTERN = r'<input type="image" src="(.+?)"'
+ KEY_CAPTCHA_PATTERN = r"<script language=JavaScript src='(http://backs\.keycaptcha\.com/swfs/cap\.js)'"
+ SOLVE_MEDIA_PATTERN = r'<script type="text/javascript" src="(http://api\.solvemedia\.com/papi/challenge.+?)"'
MIRROR_PAGE_PATTERN = r'"[\w]*" href="(https?://(?:www\.)?filecrypt.cc/Container/\w+\.html\?mirror=\d+)">'
@@ -43,7 +48,6 @@ class FilecryptCc(Crypter):
def decrypt(self, pyfile):
self.html = self.load(pyfile.url)
- self.base_url = self.pyfile.url.split("Container")[0]
if "content notfound" in self.html: #@NOTE: "content notfound" is NOT a typo
self.offline()
@@ -86,62 +90,93 @@ class FilecryptCc(Crypter):
def handle_captcha(self):
- m = re.search(self.CAPTCHA_PATTERN, self.html)
- m2 = re.search(self.CIRCLE_CAPTCHA_PATTERN, self.html)
+ if re.search(self.CAPTCHA_PATTERN, self.html):
+ m1 = re.search(self.INTERNAL_CAPTCHA_PATTERN, self.html)
+ m2 = re.search(self.CIRCLE_CAPTCHA_PATTERN, self.html)
+ m3 = re.search(self.SOLVE_MEDIA_PATTERN, self.html)
+ m4 = re.search(self.KEY_CAPTCHA_PATTERN, self.html)
- if m: #: Normal captcha
- self.log_debug("Captcha-URL: %s" % m.group(1))
+ if m1: #: Normal captcha
+ self.log_debug("Internal Captcha URL: %s" % urlparse.urljoin(self.pyfile.url, m1.group(1)))
- captcha_code = self.captcha.decrypt(urlparse.urljoin(self.base_url, m.group(1)),
- input_type="gif")
+ captcha_code = self.captcha.decrypt(urlparse.urljoin(self.pyfile.url, m1.group(1)),
+ ref=True, input_type="gif")
- self.site_with_links = self.load(self.pyfile.url,
- post={'recaptcha_response_field': captcha_code})
- elif m2: #: Circle captcha
- self.log_debug("Captcha-URL: %s" % m2.group(1))
+ self.site_with_links = self.load(self.pyfile.url,
+ post={'recaptcha_response_field': captcha_code})
- captcha_code = self.captcha.decrypt('%s%s?c=abc' %(self.base_url, m2.group(1)),
- output_type='positional')
+ elif m2: #: Circle captcha
+ self.log_debug("Circle Captcha URL: %s" % urlparse.urljoin(self.pyfile.url, m2.group(1)))
- self.site_with_links = self.load(self.pyfile.url,
- post={'button.x': captcha_code[0], 'button.y': captcha_code[1]})
+ captcha_code = self.captcha.decrypt(urlparse.urljoin(self.pyfile.url, m2.group(1)),
+ input_type="png", output_type='positional')
- else:
- recaptcha = ReCaptcha(self)
- captcha_key = recaptcha.detect_key()
+ self.site_with_links = self.load(self.pyfile.url,
+ post={'button.x': captcha_code[0],
+ 'button.y': captcha_code[1]})
+
+ elif m3: #: Solvemedia captcha
+ self.log_debug("Solvemedia Captcha URL: %s" % urlparse.urljoin(self.pyfile.url, m3.group(1)))
+
+ solvemedia = SolveMedia(self)
+ captcha_key = solvemedia.detect_key()
+
+ if captcha_key:
+ response, challenge = solvemedia.challenge(captcha_key)
+ self.site_with_links = self.load(self.pyfile.url,
+ post={'adcopy_response' : response,
+ 'adcopy_challenge' : challenge})
+
+ elif m4: #: Keycaptcha captcha
+ self.log_debug("Keycaptcha Captcha URL: %s unsupported, retrying" % m4.group(1))
+ self.retry()
- if captcha_key:
- response, challenge = recaptcha.challenge(captcha_key)
- self.site_with_links = self.load(self.pyfile.url,
- post={'g-recaptcha-response': response})
else:
- self.log_info(_("No captcha found"))
- self.site_with_links = self.html
+ recaptcha = ReCaptcha(self)
+ captcha_key = recaptcha.detect_key()
+
+ if captcha_key:
+ try:
+ response, challenge = recaptcha.challenge(captcha_key)
+
+ except Exception:
+ self.retry_captcha()
+
+ self.site_with_links = self.load(self.pyfile.url,
+ post={'g-recaptcha-response': response})
+ else:
+ self.log_info(_("Unknown captcha found, retrying"))
+ self.retry()
+
+ if re.search(self.CAPTCHA_PATTERN, self.site_with_links):
+ self.retry_captcha()
+
+ else:
+ self.log_info(_("No captcha found"))
+ self.site_with_links = self.html
- if "recaptcha_image" in self.site_with_links or "data-sitekey" in self.site_with_links:
- self.captcha.invalid()
- self.retry()
def handle_dlc_container(self):
- dlc = re.findall(self.DLC_LINK_PATTERN, self.site_with_links)
+ dlcs = re.findall(self.DLC_LINK_PATTERN, self.site_with_links)
- if not dlc:
+ if not dlcs:
return
- for i in dlc:
- self.links.append("%s/DLC/%s.dlc" % (self.base_url, i))
+ for _dlc in dlcs:
+ self.links.append(urlparse.urljoin(self.pyfile.url, "/DLC/%s.dlc" % _dlc))
def handle_weblinks(self):
try:
- weblinks = re.findall(self.WEBLINK_PATTERN, self.site_with_links)
+ links = re.findall(self.WEBLINK_PATTERN, self.site_with_links)
- for link in weblinks:
- res = self.load("%s/Link/%s.html" % (self.base_url, link))
+ for _link in links:
+ res = self.load(urlparse.urljoin(self.pyfile.url, "/Link/%s.html" % _link))
link2 = re.search('<iframe noresize src="(.*)"></iframe>', res)
- res2 = self.load(link2.group(1), just_header=True)
- self.links.append(res2['location'])
+ if link2:
+ res2 = self.load(link2.group(1), just_header=True)
+ self.links.append(res2['location'])
except Exception, e:
self.log_debug("Error decrypting weblinks: %s" % e)
diff --git a/module/plugins/crypter/FreakhareComFolder.py b/module/plugins/crypter/FreakhareComFolder.py
index f7f1946f4..e939fe467 100644
--- a/module/plugins/crypter/FreakhareComFolder.py
+++ b/module/plugins/crypter/FreakhareComFolder.py
@@ -29,7 +29,7 @@ class FreakhareComFolder(SimpleCrypter):
def load_page(self, page_n):
if not hasattr(self, 'f_id') and not hasattr(self, 'f_md5'):
m = re.search(r'http://freakshare.com/\?x=folder&f_id=(\d+)&f_md5=(\w+)', self.html)
- if m:
+ if m is not None:
self.f_id = m.group(1)
self.f_md5 = m.group(2)
return self.load('http://freakshare.com/', get={'x': 'folder',
diff --git a/module/plugins/crypter/Go4UpCom.py b/module/plugins/crypter/Go4UpCom.py
index 026982014..2d423a1a9 100644..100755
--- a/module/plugins/crypter/Go4UpCom.py
+++ b/module/plugins/crypter/Go4UpCom.py
@@ -4,18 +4,20 @@ import re
import urlparse
from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo
+import json
class Go4UpCom(SimpleCrypter):
__name__ = "Go4UpCom"
__type__ = "crypter"
- __version__ = "0.13"
+ __version__ = "0.14"
__status__ = "testing"
__pattern__ = r'http://go4up\.com/(dl/\w{12}|rd/\w{12}/\d+)'
__config__ = [("use_premium" , "bool", "Use premium account if available" , True),
("use_subfolder" , "bool", "Save package to subfolder" , True),
- ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)]
+ ("subfolder_per_pack", "bool", "Create a subfolder for each package", True),
+ ("preferred_hoster" , "int" , "Id of preferred hoster or 0 for all", 0)]
__description__ = """Go4Up.com decrypter plugin"""
__license__ = "GPLv3"
@@ -32,19 +34,20 @@ class Go4UpCom(SimpleCrypter):
def get_links(self):
links = []
-
- m = re.search(r'(/download/gethosts/.+?)"', self.html)
- if m:
- self.html = self.load(urlparse.urljoin("http://go4up.com/", m.group(1)))
- pages = [self.load(url) for url in re.findall(self.LINK_PATTERN, self.html)]
- else:
- pages = [self.html]
-
- for html in pages:
- try:
- links.append(re.search(r'<b><a href="(.+?)"', html).group(1))
- except Exception:
- continue
+ preference = self.get_config("preferred_hoster")
+
+ hosterslink_re = re.search(r'(/download/gethosts/.+?)"', self.html)
+ if hosterslink_re:
+ hosters = self.load(urlparse.urljoin("http://go4up.com/", hosterslink_re.group(1)))
+ for hoster in json.loads(hosters):
+ if preference != 0 and preference != int(hoster["hostId"]):
+ continue
+ pagelink_re = re.search(self.LINK_PATTERN, hoster["link"])
+ if pagelink_re:
+ page = self.load(pagelink_re.group(1))
+ link_re = re.search(r'<b><a href="(.+?)"', page)
+ if link_re:
+ links.append(link_re.group(1))
return links
diff --git a/module/plugins/crypter/GoogledriveComFolder.py b/module/plugins/crypter/GoogledriveComFolder.py
index 88c7ebab2..e7a5bae2c 100644
--- a/module/plugins/crypter/GoogledriveComFolder.py
+++ b/module/plugins/crypter/GoogledriveComFolder.py
@@ -6,11 +6,11 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo
class GoogledriveComFolder(SimpleCrypter):
__name__ = "GoogledriveCom"
__type__ = "crypter"
- __version__ = "0.02"
+ __version__ = "0.03"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?drive\.google\.com/folderview\?.*id=\w+'
- __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides pyload.config['general']['folder_per_package']
+ __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True),
("subfolder_per_pack", "bool", "Create a subfolder for each package", True)]
__description__ = """Drive.google.com folder decrypter plugin"""
diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py
index af13f55f6..d61c9d3dd 100644
--- a/module/plugins/crypter/LinkCryptWs.py
+++ b/module/plugins/crypter/LinkCryptWs.py
@@ -14,7 +14,7 @@ from module.utils import html_unescape
class LinkCryptWs(Crypter):
__name__ = "LinkCryptWs"
__type__ = "crypter"
- __version__ = "0.10"
+ __version__ = "0.12"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?linkcrypt\.ws/(dir|container)/(?P<ID>\w+)'
@@ -31,7 +31,6 @@ class LinkCryptWs(Crypter):
def setup(self):
- self.captcha = False
self.links = []
self.sources = ['cnl', 'web', 'dlc', 'rsdf', 'ccf']
@@ -45,6 +44,7 @@ class LinkCryptWs(Crypter):
#: Request package
self.req.http.c.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko") #: Better chance to not get those key-captchas
self.html = self.load(self.pyfile.url)
+ self.html = self.load(self.pyfile.url)
def decrypt(self, pyfile):
@@ -60,7 +60,6 @@ class LinkCryptWs(Crypter):
self.retry(8, 15, _("Can't handle Key-Captcha"))
if self.is_captcha_protected():
- self.captcha = True
self.unlock_captcha_protection()
self.handle_captcha_errors()
@@ -154,23 +153,21 @@ class LinkCryptWs(Crypter):
unrarpw = sitein[indexi:indexe]
- if not (unrarpw == "Password" or "Dateipasswort") :
+ if unrarpw not in ("Password", "Dateipasswort"):
self.log_debug("File password set to: [%s]"% unrarpw)
self.pyfile.package().password = unrarpw
def handle_errors(self):
if self.is_password_protected():
- self.fail(_("Incorrect password"))
+ self.fail(_("Wrong password"))
def handle_captcha_errors(self):
- if self.captcha:
- if "Your choice was wrong!" in self.html:
- self.captcha.invalid()
- self.retry()
- else:
- self.captcha.correct()
+ if "Your choice was wrong" in self.html:
+ self.retry_captcha()
+ else:
+ self.captcha.correct()
def handle_link_source(self, type):
@@ -246,7 +243,7 @@ class LinkCryptWs(Crypter):
if not clink:
continue
- self.log_debug("clink avaible")
+ self.log_debug("clink found")
package_name, folder_name = self.get_package_info()
self.log_debug("Added package with name %s.%s and container link %s" %( package_name, type, clink.group(1)))
@@ -268,13 +265,14 @@ class LinkCryptWs(Crypter):
break
if cnl_line:
- self.log_debug("cnl_line gefunden")
+ self.log_debug("cnl_line found")
try:
cnl_section = self.handle_javascript(cnl_line)
(vcrypted, vjk) = self._get_cipher_params(cnl_section)
for (crypted, jk) in zip(vcrypted, vjk):
package_links.extend(self._get_links(crypted, jk))
+
except Exception:
self.log_error(_("Unable to decrypt CNL links (JS Error) try to get over links"))
return self.handle_web_links()
diff --git a/module/plugins/crypter/LinkdecrypterCom.py b/module/plugins/crypter/LinkdecrypterCom.py
index d8812dbd5..c16ec0b6e 100644
--- a/module/plugins/crypter/LinkdecrypterCom.py
+++ b/module/plugins/crypter/LinkdecrypterCom.py
@@ -8,7 +8,7 @@ from module.plugins.internal.MultiCrypter import MultiCrypter
class LinkdecrypterCom(MultiCrypter):
__name__ = "LinkdecrypterCom"
__type__ = "crypter"
- __version__ = "0.32"
+ __version__ = "0.33"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
@@ -28,7 +28,6 @@ class LinkdecrypterCom(MultiCrypter):
def setup(self):
- self.password = self.get_password()
self.req.setOption("timeout", 300)
@@ -40,11 +39,11 @@ class LinkdecrypterCom(MultiCrypter):
while retries:
m = re.search(self.TEXTAREA_PATTERN, self.html, re.S)
- if m:
+ if m is not None:
self.urls = [x for x in m.group(1).splitlines() if '[LINK-ERROR]' not in x]
m = re.search(self.CAPTCHA_PATTERN, self.html)
- if m:
+ if m is not None:
captcha_url = 'http://linkdecrypter.com/' + m.group(1)
result_type = "positional" if "getPos" in m.group(2) else "textual"
@@ -61,7 +60,8 @@ class LinkdecrypterCom(MultiCrypter):
elif self.PASSWORD_PATTERN in self.html:
if self.password:
self.log_info(_("Password protected link"))
- self.html = self.load('http://linkdecrypter.com/', post={'password': self.password})
+ self.html = self.load('http://linkdecrypter.com/',
+ post={'password': self.get_password()})
else:
self.fail(_("Missing password"))
diff --git a/module/plugins/crypter/LixIn.py b/module/plugins/crypter/LixIn.py
index 2d26564e8..ecc92a8d3 100644
--- a/module/plugins/crypter/LixIn.py
+++ b/module/plugins/crypter/LixIn.py
@@ -43,16 +43,13 @@ class LixIn(Crypter):
self.error(_("Link doesn't seem valid"))
m = re.search(self.CAPTCHA_PATTERN, self.html)
- if m:
- for _i in xrange(5):
- m = re.search(self.CAPTCHA_PATTERN, self.html)
- if m:
- self.log_debug("Trying captcha")
- captcharesult = self.captcha.decrypt(urlparse.urljoin("http://lix.in/", m.group(1)))
- self.html = self.load(url,
- post={'capt': captcharesult, 'submit': "submit", 'tiny': id})
- else:
- self.log_debug("No captcha/captcha solved")
+ if m is not None:
+ captcharesult = self.captcha.decrypt(urlparse.urljoin("http://lix.in/", m.group(1)))
+ self.html = self.load(url, post={'capt': captcharesult, 'submit': "submit", 'tiny': id})
+
+ if re.search(self.CAPTCHA_PATTERN, self.html):
+ self.fail(_("No captcha solved"))
+
else:
self.html = self.load(url, post={'submit': "submit", 'tiny': id})
diff --git a/module/plugins/crypter/MediafireComFolder.py b/module/plugins/crypter/MediafireComFolder.py
index 81d880725..f90bc04ea 100644
--- a/module/plugins/crypter/MediafireComFolder.py
+++ b/module/plugins/crypter/MediafireComFolder.py
@@ -33,13 +33,13 @@ class MediafireComFolder(Crypter):
#: Load and parse html
html = self.load(pyfile.url)
m = re.search(self.LINK_PATTERN, html)
- if m:
+ if m is not None:
#: File page
self.urls.append("http://www.mediafire.com/file/%s" % m.group(1))
else:
#: Folder page
m = re.search(self.FOLDER_KEY_PATTERN, html)
- if m:
+ if m is not None:
folder_key = m.group(1)
self.log_debug("FOLDER KEY: %s" % folder_key)
diff --git a/module/plugins/crypter/MultiUpOrg.py b/module/plugins/crypter/MultiUpOrg.py
index b4326b679..fb228c3cd 100644
--- a/module/plugins/crypter/MultiUpOrg.py
+++ b/module/plugins/crypter/MultiUpOrg.py
@@ -9,10 +9,10 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo
class MultiUpOrg(SimpleCrypter):
__name__ = "MultiUpOrg"
__type__ = "crypter"
- __version__ = "0.04"
+ __version__ = "0.05"
__status__ = "testing"
- __pattern__ = r'http://(?:www\.)?multiup\.org/(en|fr)/(?P<TYPE>project|download|miror)/\w+(/\w+)?'
+ __pattern__ = r'http://(?:www\.)?multiup\.org/(en|fr)/(?P<TYPE>project|download|mirror)/\w+(/\w+)?'
__config__ = [("use_premium" , "bool", "Use premium account if available" , True),
("use_subfolder" , "bool", "Save package to subfolder" , True),
("subfolder_per_pack", "bool", "Create a subfolder for each package", True)]
@@ -34,8 +34,8 @@ class MultiUpOrg(SimpleCrypter):
pattern = r'style="width:97%;text-align:left".*\n.*href="(.*)"'
if m_type == "download":
dl_pattern = r'href="(.*)">.*\n.*<h5>DOWNLOAD</h5>'
- miror_page = urlparse.urljoin("http://www.multiup.org", re.search(dl_pattern, self.html).group(1))
- self.html = self.load(miror_page)
+ mirror_page = urlparse.urljoin("http://www.multiup.org/", re.search(dl_pattern, self.html).group(1))
+ self.html = self.load(mirror_page)
return re.findall(pattern, self.html)
diff --git a/module/plugins/crypter/MultiloadCz.py b/module/plugins/crypter/MultiloadCz.py
index d9b6236be..72e9b3a8b 100644
--- a/module/plugins/crypter/MultiloadCz.py
+++ b/module/plugins/crypter/MultiloadCz.py
@@ -30,11 +30,11 @@ class MultiloadCz(Crypter):
if re.match(self.__pattern__, pyfile.url).group(1) == "slozka":
m = re.search(self.FOLDER_PATTERN, self.html)
- if m:
+ if m is not None:
self.urls.extend(m.group(1).split())
else:
m = re.findall(self.LINK_PATTERN, self.html)
- if m:
+ if m is not None:
prefered_set = set(self.get_config('usedHoster').split('|'))
self.urls.extend(x[1] for x in m if x[0] in prefered_set)
diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py
index d483be323..dddffbbf2 100644
--- a/module/plugins/crypter/NCryptIn.py
+++ b/module/plugins/crypter/NCryptIn.py
@@ -121,7 +121,7 @@ class NCryptIn(Crypter):
def get_package_info(self):
m = re.search(self.NAME_PATTERN, self.html)
- if m:
+ if m is not None:
name = folder = m.group('N').strip()
self.log_debug("Found name [%s] and folder [%s] in package info" % (name, folder))
else:
@@ -177,13 +177,11 @@ class NCryptIn(Crypter):
def handle_errors(self):
if self.protection_type == "password":
if "This password is invalid!" in self.cleaned_html:
- self.log_debug("Incorrect password, please set right password on 'Edit package' form and retry")
- self.fail(_("Incorrect password, please set right password on 'Edit package' form and retry"))
+ self.fail(_("Wrong password"))
if self.protection_type == "captcha":
- if "The securitycheck was wrong!" in self.cleaned_html:
- self.captcha.invalid()
- self.retry()
+ if "The securitycheck was wrong" in self.cleaned_html:
+ self.retry_captcha()
else:
self.captcha.correct()
@@ -229,6 +227,7 @@ class NCryptIn(Crypter):
(vcrypted, vjk) = self._get_cipher_params()
for (crypted, jk) in zip(vcrypted, vjk):
package_links.extend(self._get_links(crypted, jk))
+
except Exception:
self.fail(_("Unable to decrypt CNL2 links"))
@@ -270,6 +269,7 @@ class NCryptIn(Crypter):
url = link.replace("link-", "frame-")
link = self.load(url, just_header=True)['location']
return link
+
except Exception, detail:
self.log_debug("Error decrypting link %s, %s" % (link, detail))
diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py
index b3c13db5d..6d8383fee 100644
--- a/module/plugins/crypter/RelinkUs.py
+++ b/module/plugins/crypter/RelinkUs.py
@@ -154,7 +154,7 @@ class RelinkUs(Crypter):
#: Try to get info from web
m = re.search(self.FILE_TITLE_REGEX, self.html)
- if m:
+ if m is not None:
title = m.group(1).strip()
if not self.FILE_NOTITLE in title:
name = folder = title
@@ -172,14 +172,11 @@ class RelinkUs(Crypter):
def handle_errors(self):
if self.PASSWORD_ERROR_ROKEN in self.html:
- msg = "Incorrect password, please set right password on 'Edit package' form and retry"
- self.log_debug(msg)
- self.fail(_(msg))
+ self.fail(_("Wrong password"))
if self.captcha:
if self.CAPTCHA_ERROR_ROKEN in self.html:
- self.captcha.invalid()
- self.retry()
+ self.retry_captcha()
else:
self.captcha.correct()
@@ -199,14 +196,16 @@ class RelinkUs(Crypter):
self.log_debug("Search for CNL2 links")
package_links = []
m = re.search(self.CNL2_FORM_REGEX, self.html, re.S)
- if m:
+ if m is not None:
cnl2_form = m.group(1)
try:
(vcrypted, vjk) = self._get_cipher_params(cnl2_form)
for (crypted, jk) in zip(vcrypted, vjk):
package_links.extend(self._get_links(crypted, jk))
+
except Exception:
self.log_debug("Unable to decrypt CNL2 links")
+
return package_links
@@ -214,7 +213,7 @@ class RelinkUs(Crypter):
self.log_debug("Search for DLC links")
package_links = []
m = re.search(self.DLC_LINK_REGEX, self.html)
- if m:
+ if m is not None:
container_url = self.DLC_DOWNLOAD_URL + "?id=%s&dlc=1" % self.fileid
self.log_debug("Downloading DLC container link [%s]" % container_url)
try:
diff --git a/module/plugins/crypter/SafelinkingNet.py b/module/plugins/crypter/SafelinkingNet.py
index e2b8471ab..29e1cce4f 100644
--- a/module/plugins/crypter/SafelinkingNet.py
+++ b/module/plugins/crypter/SafelinkingNet.py
@@ -47,24 +47,25 @@ class SafelinkingNet(Crypter):
postData['link-password'] = self.get_password()
if "altcaptcha" in self.html:
- for _i in xrange(5):
- m = re.search(self.SOLVEMEDIA_PATTERN, self.html)
- if m:
- captchaKey = m.group(1)
- captcha = SolveMedia(self)
- captchaProvider = "Solvemedia"
- else:
- self.fail(_("Error parsing captcha"))
+ m = re.search(self.SOLVEMEDIA_PATTERN, self.html)
+ if m is not None:
+ captchaKey = m.group(1)
+ captcha = SolveMedia(self)
+ captchaProvider = "Solvemedia"
+ else:
+ self.fail(_("Error parsing captcha"))
+
+ response, challenge = captcha.challenge(captchaKey)
+ postData['adcopy_challenge'] = challenge
+ postData['adcopy_response'] = response
+
+ self.html = self.load(url, post=postData)
- response, challenge = captcha.challenge(captchaKey)
- postData['adcopy_challenge'] = challenge
- postData['adcopy_response'] = response
+ if "The CAPTCHA code you entered was wrong" in self.html:
+ self.retry_captcha()
- self.html = self.load(url, post=postData)
- if "The password you entered was incorrect" in self.html:
- self.fail(_("Incorrect Password"))
- if not "The CAPTCHA code you entered was wrong" in self.html:
- break
+ if "The password you entered was incorrect" in self.html:
+ self.fail(_("Wrong password"))
pyfile.package().password = ""
soup = BeautifulSoup.BeautifulSoup(self.html)
@@ -73,7 +74,7 @@ class SafelinkingNet(Crypter):
if "d_links" in s.text:
break
m = re.search('d_links":(\[.*?\])', s.text)
- if m:
+ if m is not None:
linkDict = json_loads(m.group(1))
for link in linkDict:
if not "http://" in link['full']:
diff --git a/module/plugins/crypter/SexuriaCom.py b/module/plugins/crypter/SexuriaCom.py
index 7942d5e42..24a5060b9 100644
--- a/module/plugins/crypter/SexuriaCom.py
+++ b/module/plugins/crypter/SexuriaCom.py
@@ -1,25 +1,23 @@
# -*- coding: utf-8 -*-
import re
-
from module.plugins.internal.Crypter import Crypter
-
class SexuriaCom(Crypter):
__name__ = "SexuriaCom"
__type__ = "crypter"
- __version__ = "0.04"
+ __version__ = "0.10"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?sexuria\.com/(v1/)?(Pornos_Kostenlos_.+?_(\d+)\.html|dl_links_\d+_\d+\.html|id=\d+\&part=\d+\&link=\d+)'
- __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True),
- ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)]
+ __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True),
+ ("subfolder_per_package", "bool", "Create a subfolder for each package", True)]
__description__ = """Sexuria.com decrypter plugin"""
__license__ = "GPLv3"
__authors__ = [("NETHead", "NETHead.AT.gmx.DOT.net")]
-
+ #: Constants
PATTERN_SUPPORTED_MAIN = r'http://(www\.)?sexuria\.com/(v1/)?Pornos_Kostenlos_.+?_(\d+)\.html'
PATTERN_SUPPORTED_CRYPT = r'http://(www\.)?sexuria\.com/(v1/)?dl_links_\d+_(?P<ID>\d+)\.html'
PATTERN_SUPPORTED_REDIRECT = r'http://(www\.)?sexuria\.com/out\.php\?id=(?P<ID>\d+)\&part=\d+\&link=\d+'
@@ -27,15 +25,17 @@ class SexuriaCom(Crypter):
PATTERN_PASSWORD = r'<strong>Passwort: </strong></div></td>.*?bgcolor="#EFEFEF">(?P<PWD>.*?)</td>'
PATTERN_DL_LINK_PAGE = r'"(dl_links_\d+_\d+\.html)"'
PATTERN_REDIRECT_LINKS = r'value="(http://sexuria\.com/out\.php\?id=\d+\&part=\d+\&link=\d+)" readonly'
-
+ LIST_PWDIGNORE = ["Kein Passwort", "-"]
def decrypt(self, pyfile):
#: Init
self.pyfile = pyfile
self.package = pyfile.package()
- #: Get package links
+ #: Decrypt and add links
package_name, self.links, folder_name, package_pwd = self.decrypt_links(self.pyfile.url)
+ if package_pwd:
+ self.pyfile.package().password = package_pwd
self.packages = [(package_name, self.links, folder_name)]
@@ -62,34 +62,45 @@ class SexuriaCom(Crypter):
#: Extract info from main file
id = re.search(self.PATTERN_SUPPORTED_CRYPT, url, re.I).group('ID')
html = self.load("http://sexuria.com/v1/Pornos_Kostenlos_info_%s.html" % id)
+ #: Webpage title / Package name
+ titledata = re.search(self.PATTERN_TITLE, html, re.I)
+ if not titledata:
+ self.log_warning("No title data found, has site changed?")
+ else:
+ title = titledata.group('TITLE').strip()
+ if title:
+ name = folder = title
+ self.log_debug("Package info found, name [%s] and folder [%s]" % (name, folder))
+ #: Password
+ pwddata = re.search(self.PATTERN_PASSWORD, html, re.I | re.S)
+ if not pwddata:
+ self.log_warning("No password data found, has site changed?")
+ else:
+ pwd = pwddata.group('PWD').strip()
+ if pwd and not (pwd in self.LIST_PWDIGNORE):
+ password = pwd
+ self.log_debug("Package info found, password [%s]" % password)
- title = re.search(self.PATTERN_TITLE, html, re.I).group('TITLE').strip()
- if title:
- name = folder = title
- self.log_debug("Package info found, name [%s] and folder [%s]" % (name, folder))
-
- pwd = re.search(self.PATTERN_PASSWORD, html, re.I | re.S).group('PWD')
- if pwd and pwd not in ("Kein Passwort", "-"):
- password = pwd.strip()
- self.log_debug("Password info [%s] found" % password)
-
- #: Process link (dl_link)
+ #: Process links (dl_link)
html = self.load(url)
links = re.findall(self.PATTERN_REDIRECT_LINKS, html, re.I)
- if len(links) == 0:
+ if not links:
self.log_error(_("Broken for link: %s") % link)
else:
for link in links:
link = link.replace("http://sexuria.com/", "http://www.sexuria.com/")
finallink = self.load(link, just_header=True)['location']
- if not finallink or "sexuria.com/" in finallink:
+ if not finallink or ("sexuria.com/" in finallink):
self.log_error(_("Broken for link: %s") % link)
else:
linklist.append(finallink)
- #: Debug log
- self.log_debug("%d supported links" % len(linklist))
- for i, link in enumerate(linklist):
- self.log_debug("Supported link %d, %s" % (i + 1, link))
+ #: Log result
+ if not linklist:
+ self.fail(_("Unable to extract links (maybe plugin out of date?)"))
+ else:
+ for i, link in enumerate(linklist):
+ self.log_debug("Supported link %d/%d: %s" % (i+1, len(linklist), link))
+ #: All done, return to caller
return name, linklist, folder, password
diff --git a/module/plugins/crypter/ShSt.py b/module/plugins/crypter/ShSt.py
index 754bc542c..43cc4e779 100644
--- a/module/plugins/crypter/ShSt.py
+++ b/module/plugins/crypter/ShSt.py
@@ -9,7 +9,7 @@ import re
class ShSt(Crypter):
__name__ = "ShSt"
__type__ = "crypter"
- __version__ = "0.04"
+ __version__ = "0.05"
__status__ = "testing"
__pattern__ = r'http://sh\.st/\w+'
@@ -19,7 +19,7 @@ class ShSt(Crypter):
__authors__ = [("Frederik Möllers", "fred-public@posteo.de")]
- NAME_PATTERN = r'<title>(?P<N>.+?) - .+</title>'
+ NAME_PATTERN = r'<title>(?P<N>.+?) -'
def decrypt(self, pyfile):
diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py
index 6fbe59b38..e372d7c6a 100644
--- a/module/plugins/crypter/ShareLinksBiz.py
+++ b/module/plugins/crypter/ShareLinksBiz.py
@@ -10,7 +10,7 @@ from module.plugins.internal.Crypter import Crypter
class ShareLinksBiz(Crypter):
__name__ = "ShareLinksBiz"
__type__ = "crypter"
- __version__ = "1.16"
+ __version__ = "1.18"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?(share-links|s2l)\.biz/(?P<ID>_?\w+)'
@@ -66,10 +66,18 @@ class ShareLinksBiz(Crypter):
def init_file(self, pyfile):
url = pyfile.url
+
if 's2l.biz' in url:
url = self.load(url, just_header=True)['location']
- self.base_url = "http://www.%s.biz" % re.match(self.__pattern__, url).group(1)
- self.file_id = re.match(self.__pattern__, url).group('ID')
+
+ if re.match(self.__pattern__, url):
+ self.base_url = "http://www.%s.biz" % re.match(self.__pattern__, url).group(1)
+ self.file_id = re.match(self.__pattern__, url).group('ID')
+
+ else:
+ self.log_debug("Could not initialize, URL [%s] does not match pattern [%s]" % (url, self.__pattern__))
+ self.fail(_("Unsupported download link"))
+
self.package = pyfile.package()
@@ -77,7 +85,8 @@ class ShareLinksBiz(Crypter):
if "No usable content was found" in self.html:
self.log_debug("File not found")
return False
- return True
+ else:
+ return True
def is_password_protected(self):
@@ -114,7 +123,11 @@ class ShareLinksBiz(Crypter):
self.log_debug("Captcha map with [%d] positions" % len(captchaMap.keys()))
#: Request user for captcha coords
- m = re.search(r'<img src="/captcha.gif\?d=(.*?)&amp;PHPSESSID=(.*?)&amp;legend=1"', self.html)
+ m = re.search(r'<img src="/captcha.gif\?d=(.+?)&PHPSESSID=(.+?)&legend=1"', self.html)
+ if not m:
+ self.log_debug("Captcha url data not found, maybe plugin out of date?")
+ self.fail(_("Captcha url data not found"))
+
captchaUrl = self.base_url + '/captcha.gif?d=%s&PHPSESSID=%s' % (m.group(1), m.group(2))
self.log_debug("Waiting user for correct position")
coords = self.captcha.decrypt(captchaUrl, input_type="gif", output_type='positional')
@@ -123,8 +136,8 @@ class ShareLinksBiz(Crypter):
#: Resolve captcha
href = self._resolve_coords(coords, captchaMap)
if href is None:
- self.captcha.invalid()
- self.retry(wait_time=5)
+ self.retry_captcha(wait=5)
+
url = self.base_url + href
self.html = self.load(url)
@@ -148,13 +161,11 @@ class ShareLinksBiz(Crypter):
def handle_errors(self):
if "The inserted password was wrong" in self.html:
- self.log_debug("Incorrect password, please set right password on 'Edit package' form and retry")
- self.fail(_("Incorrect password, please set right password on 'Edit package' form and retry"))
+ self.fail(_("Wrong password"))
if self.captcha:
if "Your choice was wrong" in self.html:
- self.captcha.invalid()
- self.retry(wait_time=5)
+ self.retry_captcha(wait=5)
else:
self.captcha.correct()
@@ -165,7 +176,7 @@ class ShareLinksBiz(Crypter):
#: Extract from web package header
title_re = r'<h2><img.*?/>(.*)</h2>'
m = re.search(title_re, self.html, re.S)
- if m:
+ if m is not None:
title = m.group(1).strip()
if 'unnamed' not in title:
name = folder = title
@@ -209,8 +220,10 @@ class ShareLinksBiz(Crypter):
self.log_debug("JsEngine returns value [%s] for redirection link" % dlLink)
package_links.append(dlLink)
+
except Exception, detail:
self.log_debug("Error decrypting Web link [%s], %s" % (ID, detail))
+
return package_links
@@ -235,8 +248,10 @@ class ShareLinksBiz(Crypter):
try:
(crypted, jk) = self._get_cipher_params()
package_links.extend(self._get_links(crypted, jk))
+
except Exception:
self.fail(_("Unable to decrypt CNL2 links"))
+
return package_links
diff --git a/module/plugins/crypter/TNTVillageScambioeticoOrg.py b/module/plugins/crypter/TNTVillageScambioeticoOrg.py
index 6ba1ee19b..e85a8fbb7 100644
--- a/module/plugins/crypter/TNTVillageScambioeticoOrg.py
+++ b/module/plugins/crypter/TNTVillageScambioeticoOrg.py
@@ -6,11 +6,11 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo
class TNTVillageScambioeticoOrg(SimpleCrypter):
__name__ = "TNTVillageScambioeticoOrg"
__type__ = "crypter"
- __version__ = "0.02"
+ __version__ = "0.03"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?forum\.tntvillage\.scambioetico\.org/index\.php\?.*showtopic=\d+'
- __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides pyload.config['general']['folder_per_package']
+ __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True),
("subfolder_per_pack", "bool", "Create a subfolder for each package", True)]
__description__ = """TNTVillage.scambioetico.org decrypter plugin"""
diff --git a/module/plugins/crypter/UlozToFolder.py b/module/plugins/crypter/UlozToFolder.py
index 19569ef31..f2d0e7c17 100644
--- a/module/plugins/crypter/UlozToFolder.py
+++ b/module/plugins/crypter/UlozToFolder.py
@@ -36,7 +36,7 @@ class UlozToFolder(Crypter):
new_links.extend(re.findall(self.LINK_PATTERN, m.group(1)))
m = re.search(self.NEXT_PAGE_PATTERN, html)
- if m:
+ if m is not None:
html = self.load("http://ulozto.net/" + m.group(1))
else:
break
diff --git a/module/plugins/crypter/UploadedToFolder.py b/module/plugins/crypter/UploadedToFolder.py
index 381d744fe..53fb5e4b9 100644
--- a/module/plugins/crypter/UploadedToFolder.py
+++ b/module/plugins/crypter/UploadedToFolder.py
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
import re
-import urlparse
from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo
diff --git a/module/plugins/crypter/XFileSharingProFolder.py b/module/plugins/crypter/XFileSharingProFolder.py
index 584cc7668..f693698bc 100644
--- a/module/plugins/crypter/XFileSharingProFolder.py
+++ b/module/plugins/crypter/XFileSharingProFolder.py
@@ -8,7 +8,7 @@ from module.plugins.internal.XFSCrypter import XFSCrypter, create_getInfo
class XFileSharingProFolder(XFSCrypter):
__name__ = "XFileSharingProFolder"
__type__ = "crypter"
- __version__ = "0.13"
+ __version__ = "0.14"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:user|folder)s?/\w+'
@@ -23,7 +23,7 @@ class XFileSharingProFolder(XFSCrypter):
def _log(self, level, plugintype, pluginname, messages):
return super(XFileSharingProFolder, self)._log(level,
plugintype,
- "%s: %s" % (pluginname, self.HOSTER_NAME),
+ "%s: %s" % (pluginname, self.PLUGIN_NAME),
messages)
@@ -32,18 +32,18 @@ class XFileSharingProFolder(XFSCrypter):
self.__pattern__ = self.pyload.pluginManager.crypterPlugins[self.__name__]['pattern']
- self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower()
- self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+|\-)', self.HOSTER_DOMAIN) if part != '.')
+ self.PLUGIN_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower()
+ self.PLUGIN_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+|\-)', self.PLUGIN_DOMAIN) if part != '.')
def _setup(self):
- account_name = self.__name__ if self.account.HOSTER_DOMAIN is None else self.HOSTER_NAME
+ account_name = self.__name__ if self.account.PLUGIN_DOMAIN is None else self.PLUGIN_NAME
self.chunk_limit = 1
self.multiDL = True
if self.account:
- self.req = self.pyload.requestFactory.getRequest(accountname, self.user)
- self.premium = self.account.is_premium(self.user)
+ self.req = self.pyload.requestFactory.getRequest(accountname, self.account.user)
+ self.premium = self.account.premium
self.resume_download = self.premium
else:
self.req = self.pyload.requestFactory.getRequest(account_name)
@@ -56,19 +56,19 @@ class XFileSharingProFolder(XFSCrypter):
self.req.close()
if not self.account:
- self.account = self.pyload.accountManager.getAccountPlugin(self.HOSTER_NAME)
+ self.account = self.pyload.accountManager.getAccountPlugin(self.PLUGIN_NAME)
if not self.account:
self.account = self.pyload.accountManager.getAccountPlugin(self.__name__)
if self.account:
- if not self.account.HOSTER_DOMAIN:
- self.account.HOSTER_DOMAIN = self.HOSTER_DOMAIN
+ if not self.account.PLUGIN_DOMAIN:
+ self.account.PLUGIN_DOMAIN = self.PLUGIN_DOMAIN
- if not self.user:
- self.user = self.account.select()[0]
+ if not self.account.user: #@TODO: Move to `Account` in 0.4.10
+ self.account.user = self.account.select()[0]
- if not self.user or not self.account.is_logged(self.user, True):
+ if not self.account.logged:
self.account = False
diff --git a/module/plugins/hooks/AlldebridComHook.py b/module/plugins/hooks/AlldebridComHook.py
deleted file mode 100644
index 402850d87..000000000
--- a/module/plugins/hooks/AlldebridComHook.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class AlldebridComHook(MultiHook):
- __name__ = "AlldebridComHook"
- __type__ = "hook"
- __version__ = "0.17"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """Alldebrid.com hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("Andy Voigt", "spamsales@online.de")]
-
-
- def get_hosters(self):
- html = self.load("https://www.alldebrid.com/api.php",
- get={'action': "get_host"}).replace("\"", "").strip()
- return [x.strip() for x in html.split(",") if x.strip()]
diff --git a/module/plugins/hooks/AntiStandby.py b/module/plugins/hooks/AntiStandby.py
index 48b86fa55..fbb7f6760 100644
--- a/module/plugins/hooks/AntiStandby.py
+++ b/module/plugins/hooks/AntiStandby.py
@@ -59,7 +59,7 @@ class AntiStandby(Addon):
self.interval = max(self.get_config('interval'), self.MIN_INTERVAL)
self.init_periodical(threaded=True)
- if os.name == "nt":
+ if os.name is "nt":
self.win_standby(system, display)
elif sys.platform == "darwin":
@@ -76,7 +76,7 @@ class AntiStandby(Addon):
except OSError:
pass
- if os.name == "nt":
+ if os.name is "nt":
self.win_standby(True)
elif sys.platform == "darwin":
diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py
index b58d0b61d..d7ec69031 100644
--- a/module/plugins/hooks/AntiVirus.py
+++ b/module/plugins/hooks/AntiVirus.py
@@ -10,23 +10,25 @@ except ImportError:
pass
from module.plugins.internal.Addon import Addon, Expose, threaded
+from module.plugins.internal.Plugin import exists
from module.utils import fs_encode, save_join as fs_join
class AntiVirus(Addon):
__name__ = "AntiVirus"
__type__ = "hook"
- __version__ = "0.12"
+ __version__ = "0.13"
__status__ = "testing"
#@TODO: add trash option (use Send2Trash lib)
- __config__ = [("action" , "Antivirus default;Delete;Quarantine", "Manage infected files" , "Antivirus default"),
- ("quardir" , "folder" , "Quarantine folder" , "" ),
- ("deltotrash", "bool" , "Move to trash (recycle bin) instead delete", True ),
- ("scanfailed", "bool" , "Scan incompleted files (failed downloads)" , False ),
- ("cmdfile" , "file" , "Antivirus executable" , "" ),
- ("cmdargs" , "str" , "Scan options" , "" ),
- ("ignore-err", "bool" , "Ignore scan errors" , False )]
+ __config__ = [("action" , "Antivirus default;Delete;Quarantine", "Manage infected files" , "Antivirus default"),
+ ("quardir" , "folder" , "Quarantine folder" , "" ),
+ ("deltotrash", "bool" , "Move to trash instead delete", True ),
+ ("scanfailed", "bool" , "Scan failed downloads" , False ),
+ ("avfile" , "file" , "Antivirus executable" , "" ),
+ ("avargs" , "str" , "Executable arguments" , "" ),
+ ("avtarget" , "file;folder" , "Scan target" , "file" ),
+ ("ignore-err", "bool" , "Ignore scan errors" , False )]
__description__ = """Scan downloaded files with antivirus program"""
__license__ = "GPLv3"
@@ -36,12 +38,24 @@ class AntiVirus(Addon):
@Expose
@threaded
def scan(self, pyfile, thread):
- file = fs_encode(pyfile.plugin.last_download)
- filename = os.path.basename(pyfile.plugin.last_download)
- cmdfile = fs_encode(self.get_config('cmdfile'))
- cmdargs = fs_encode(self.get_config('cmdargs').strip())
+ avfile = fs_encode(self.get_config('avfile'))
+ avargs = fs_encode(self.get_config('avargs').strip())
- if not os.path.isfile(file) or not os.path.isfile(cmdfile):
+ if not os.path.isfile(avfile):
+ self.fail(_("Antivirus executable not found"))
+
+ scanfolder = self.get_config('avtarget') is "folder"
+
+ if scanfolder:
+ download_folder = self.pyload.config.get("general", "download_folder")
+ package_folder = pyfile.package().folder if self.pyload.config.get("general", "folder_per_package") else ""
+ target = fs_join(download_folder, package_folder, pyfile.name)
+ target_repr = "Folder: " + package_folder or download_folder
+ else:
+ target = fs_encode(pyfile.plugin.last_download)
+ target_repr = "File: " + os.path.basename(pyfile.plugin.last_download)
+
+ if not exists(target):
return
thread.addActive(pyfile)
@@ -49,24 +63,34 @@ class AntiVirus(Addon):
pyfile.setProgress(0)
try:
- p = subprocess.Popen([cmdfile, cmdargs, file], bufsize=-1, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ p = subprocess.Popen([avfile, avargs, target],
+ bufsize=-1,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
out, err = map(str.strip, p.communicate())
if out:
- self.log_info(filename, out)
+ self.log_info(target_repr, out)
if err:
- self.log_warning(filename, err)
+ self.log_warning(target_repr, err)
if not self.get_config('ignore-err'):
- self.log_debug("Delete/Quarantine task is aborted")
+ self.log_debug("Delete/Quarantine task aborted due scan error")
return
if p.returncode:
- pyfile.error = _("Infected file")
action = self.get_config('action')
+
+ if scanfolder:
+ if action is "Antivirus default":
+ self.log_warning(_("Delete/Quarantine task skipped in folder scan mode")
+ return
+
+ pyfile.error = _("Infected file")
+
try:
- if action == "Delete":
+ if action is "Delete":
if not self.get_config('deltotrash'):
os.remove(file)
@@ -87,15 +111,15 @@ class AntiVirus(Addon):
else:
self.log_debug("Successfully moved file to trash")
- elif action == "Quarantine":
+ elif action is "Quarantine":
pyfile.setCustomStatus(_("file moving"))
shutil.move(file, self.get_config('quardir'))
except (IOError, shutil.Error), e:
- self.log_error(filename, action + " action failed!", e)
+ self.log_error(target_repr, action + " action failed!", e)
- elif not out and not err:
- self.log_debug(filename, "No infected file found")
+ elif not err:
+ self.log_debug(target_repr, "No infected file found")
finally:
pyfile.setProgress(100)
@@ -108,5 +132,5 @@ class AntiVirus(Addon):
def download_failed(self, pyfile):
#: Check if pyfile is still "failed", maybe might has been restarted in meantime
- if pyfile.status == 8 and self.get_config('scanfailed'):
+ if pyfile.status is 8 and self.get_config('scanfailed'):
return self.scan(pyfile)
diff --git a/module/plugins/hooks/Captcha9Kw.py b/module/plugins/hooks/Captcha9Kw.py
index 2e2685978..656497dd6 100644
--- a/module/plugins/hooks/Captcha9Kw.py
+++ b/module/plugins/hooks/Captcha9Kw.py
@@ -78,7 +78,6 @@ class Captcha9Kw(Hook):
'cpm' : self.get_config('captchapermin')}
for opt in str(self.get_config('hoster_options').split('|')):
-
details = map(str.strip, opt.split(':'))
if not details or details[0].lower() is not pluginname.lower():
@@ -149,6 +148,7 @@ class Captcha9Kw(Hook):
time.sleep(5)
else:
break
+
else:
self.log_debug("Could not send request: %s" % res)
result = None
@@ -184,6 +184,7 @@ class Captcha9Kw(Hook):
break
time.sleep(10)
+
else:
self.fail(_("Too many captchas in queue"))
@@ -196,9 +197,9 @@ class Captcha9Kw(Hook):
for d in details:
hosteroption = d.split("=")
- if len(hosteroption) > 1 \
- and hosteroption[0].lower() == "timeout" \
- and hosteroption[1].isdigit():
+ if len(hosteroption) > 1 and \
+ hosteroption[0].lower() == "timeout" and \
+ hosteroption[1].isdigit():
timeout = int(hosteroption[1])
break
diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py
index 0df1ab8a9..838c220f0 100644
--- a/module/plugins/hooks/CaptchaBrotherhood.py
+++ b/module/plugins/hooks/CaptchaBrotherhood.py
@@ -79,6 +79,7 @@ class CaptchaBrotherhood(Hook):
img.save(output, "JPEG")
data = output.getvalue()
output.close()
+
except Exception, e:
raise CaptchaBrotherhoodException("Reading or converting captcha image failed: %s" % e)
@@ -98,6 +99,7 @@ class CaptchaBrotherhood(Hook):
try:
req.c.perform()
res = req.getResponse()
+
except Exception, e:
raise CaptchaBrotherhoodException("Submit captcha image failed")
diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py
index 6ecbfcda2..2a650768e 100644
--- a/module/plugins/hooks/Checksum.py
+++ b/module/plugins/hooks/Checksum.py
@@ -38,7 +38,7 @@ def compute_checksum(local_file, algorithm):
class Checksum(Addon):
__name__ = "Checksum"
__type__ = "hook"
- __version__ = "0.19"
+ __version__ = "0.22"
__status__ = "testing"
__config__ = [("check_checksum", "bool" , "Check checksum? (If False only size will be verified)", True ),
@@ -114,7 +114,7 @@ class Checksum(Addon):
api_size = int(data['size'])
file_size = os.path.getsize(local_file)
- if api_size is not file_size:
+ if api_size != file_size:
self.log_warning(_("File %s has incorrect size: %d B (%d expected)") % (pyfile.name, file_size, api_size))
self.check_failed(pyfile, local_file, "Incorrect file size")
@@ -131,15 +131,15 @@ class Checksum(Addon):
for key in self.algorithms:
if key in data:
- checksum = computeChecksum(local_file, key.replace("-", "").lower())
+ checksum = compute_checksum(local_file, key.replace("-", "").lower())
if checksum:
- if checksum is data[key].lower():
+ if checksum == data[key].lower():
self.log_info(_('File integrity of "%s" verified by %s checksum (%s)') %
(pyfile.name, key.upper(), checksum))
break
else:
self.log_warning(_("%s checksum for file %s does not match (%s != %s)") %
- (key.upper(), pyfile.name, checksum, data[key]))
+ (key.upper(), pyfile.name, checksum, data[key].lower()))
self.check_failed(pyfile, local_file, "Checksums do not match")
else:
self.log_warning(_("Unsupported hashing algorithm"), key.upper())
@@ -160,7 +160,7 @@ class Checksum(Addon):
return
elif check_action == "nothing":
return
- pyfile.plugin.fail(reason=msg)
+ pyfile.plugin.fail(msg=msg)
def package_finished(self, pypack):
@@ -186,7 +186,7 @@ class Checksum(Addon):
local_file = fs_encode(fs_join(download_folder, data['NAME']))
algorithm = self.methods.get(file_type, file_type)
- checksum = computeChecksum(local_file, algorithm)
+ checksum = compute_checksum(local_file, algorithm)
if checksum is data['HASH']:
self.log_info(_('File integrity of "%s" verified by %s checksum (%s)') %
(data['NAME'], algorithm, checksum))
diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py
index ba03129e6..591be8b59 100644
--- a/module/plugins/hooks/ClickAndLoad.py
+++ b/module/plugins/hooks/ClickAndLoad.py
@@ -84,7 +84,7 @@ class ClickAndLoad(Addon):
server_socket = ssl.wrap_socket(server_socket)
except NameError:
- self.log_error(_("pyLoad's webinterface is configured to use HTTPS, Please install python's ssl lib or disable HTTPS"))
+ self.log_error(_("Missing SSL lib"), _("Please disable HTTPS in pyLoad settings"))
client_socket.close() #: Reset the connection.
continue
diff --git a/module/plugins/hooks/DebridItaliaComHook.py b/module/plugins/hooks/DebridItaliaComHook.py
deleted file mode 100644
index 1b000c665..000000000
--- a/module/plugins/hooks/DebridItaliaComHook.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import re
-
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class DebridItaliaComHook(MultiHook):
- __name__ = "DebridItaliaComHook"
- __type__ = "hook"
- __version__ = "0.13"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """Debriditalia.com hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("stickell" , "l.stickell@yahoo.it"),
- ("Walter Purcaro", "vuolter@gmail.com" )]
-
-
- def get_hosters(self):
- return self.load("http://debriditalia.com/api.php", get={'hosts': ""}).replace('"', '').split(',')
diff --git a/module/plugins/hooks/EasybytezComHook.py b/module/plugins/hooks/EasybytezComHook.py
deleted file mode 100644
index 6f53619ac..000000000
--- a/module/plugins/hooks/EasybytezComHook.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import re
-
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class EasybytezComHook(MultiHook):
- __name__ = "EasybytezComHook"
- __type__ = "hook"
- __version__ = "0.08"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """EasyBytez.com hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
-
-
- def get_hosters(self):
- user, info = self.account.select()
-
- html = self.load("http://www.easybytez.com",
- req=self.account.get_request(user))
-
- return re.search(r'</textarea>\s*Supported sites:(.*)', html).group(1).split(',')
diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py
index b7495136a..c752ce6ac 100644
--- a/module/plugins/hooks/ExternalScripts.py
+++ b/module/plugins/hooks/ExternalScripts.py
@@ -3,6 +3,7 @@
import os
import subprocess
+from module.plugins.internal.Plugin import encode
from module.plugins.internal.Addon import Addon, Expose
from module.utils import fs_encode, save_join as fs_join
@@ -10,7 +11,7 @@ from module.utils import fs_encode, save_join as fs_join
class ExternalScripts(Addon):
__name__ = "ExternalScripts"
__type__ = "hook"
- __version__ = "0.46"
+ __version__ = "0.47"
__status__ = "testing"
__config__ = [("activated", "bool", "Activated" , True ),
@@ -66,7 +67,8 @@ class ExternalScripts(Addon):
self.log_debug(e)
return
- for file in os.listdir(path):
+ for filename in os.listdir(path):
+ file = fs_join(path, filename)
if not os.path.isfile(file):
continue
@@ -77,13 +79,14 @@ class ExternalScripts(Addon):
self.log_warning(_("Script not executable: [%s] %s") % (name, file))
self.scripts[name].append(file)
+ self.log_info(_("Registered script: [%s] %s") % (name, file))
@Expose
def call(self, script, args=[], lock=False):
try:
script = os.path.abspath(script)
- args = [script] + map(encode, args)
+ args = [script] + map(lambda arg: encode(arg) if isinstance(arg, basestring) else encode(str(arg)), args)
self.log_info(_("EXECUTE [%s] %s") % (os.path.dirname(script), args))
p = subprocess.Popen(args, bufsize=-1) #@NOTE: output goes to pyload
@@ -91,7 +94,8 @@ class ExternalScripts(Addon):
p.communicate()
except Exception, e:
- self.log_error(_("Runtime error: %s") % script, e or _("Unknown error"))
+ self.log_error(_("Runtime error: %s") % script,
+ e or _("Unknown error"))
def pyload_start(self):
diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py
index eab196160..9c662a897 100644
--- a/module/plugins/hooks/ExtractArchive.py
+++ b/module/plugins/hooks/ExtractArchive.py
@@ -4,11 +4,10 @@ from __future__ import with_statement
import os
import sys
-import traceback
# monkey patch bug in python 2.6 and lower
# http://bugs.python.org/issue6122 , http://bugs.python.org/issue1236 , http://bugs.python.org/issue1731717
-if sys.version_info < (2, 7) and os.name != "nt":
+if sys.version_info < (2, 7) and os.name is not "nt":
import errno
import subprocess
@@ -51,7 +50,7 @@ except ImportError:
pass
from module.plugins.internal.Addon import Addon, Expose, threaded
-from module.plugins.internal.Plugin import replace_patterns
+from module.plugins.internal.Plugin import exists, replace_patterns
from module.plugins.internal.Extractor import ArchiveError, CRCError, PasswordError
from module.utils import fs_encode, save_join as fs_join, uniqify
@@ -66,6 +65,7 @@ class ArchiveQueue(object):
def get(self):
try:
return [int(pid) for pid in self.plugin.retrieve("ExtractArchive:%s" % self.storage, "").decode('base64').split()]
+
except Exception:
return []
@@ -107,26 +107,25 @@ class ArchiveQueue(object):
class ExtractArchive(Addon):
__name__ = "ExtractArchive"
__type__ = "hook"
- __version__ = "1.49"
+ __version__ = "1.51"
__status__ = "testing"
- __config__ = [("activated" , "bool" , "Activated" , True ),
- ("fullpath" , "bool" , "Extract with full paths" , True ),
- ("overwrite" , "bool" , "Overwrite files" , False ),
- ("keepbroken" , "bool" , "Try to extract broken archives" , False ),
- ("repair" , "bool" , "Repair broken archives (RAR required)" , False ),
- ("test" , "bool" , "Test archive before extracting" , False ),
- ("usepasswordfile", "bool" , "Use password file" , True ),
- ("passwordfile" , "file" , "Password file" , "passwords.txt" ),
- ("delete" , "bool" , "Delete archive after extraction" , True ),
- ("deltotrash" , "bool" , "Move to trash (recycle bin) instead delete", True ),
- ("subfolder" , "bool" , "Create subfolder for each package" , False ),
- ("destination" , "folder" , "Extract files to folder" , "" ),
- ("extensions" , "str" , "Extract archives ending with extension" , "7z,bz2,bzip2,gz,gzip,lha,lzh,lzma,rar,tar,taz,tbz,tbz2,tgz,xar,xz,z,zip"),
- ("excludefiles" , "str" , "Don't extract the following files" , "*.nfo,*.DS_Store,index.dat,thumb.db" ),
- ("recursive" , "bool" , "Extract archives in archives" , True ),
- ("waitall" , "bool" , "Run after all downloads was processed" , False ),
- ("renice" , "int" , "CPU priority" , 0 )]
+ __config__ = [("activated" , "bool" , "Activated" , True ),
+ ("fullpath" , "bool" , "Extract with full paths" , True ),
+ ("overwrite" , "bool" , "Overwrite files" , False ),
+ ("keepbroken" , "bool" , "Try to extract broken archives" , False ),
+ ("repair" , "bool" , "Repair broken archives (RAR required)" , False ),
+ ("usepasswordfile", "bool" , "Use password file" , True ),
+ ("passwordfile" , "file" , "Password file" , "passwords.txt" ),
+ ("delete" , "bool" , "Delete archive after extraction" , True ),
+ ("deltotrash" , "bool" , "Move to trash instead delete" , True ),
+ ("subfolder" , "bool" , "Create subfolder for each package" , False ),
+ ("destination" , "folder", "Extract files to folder" , "" ),
+ ("extensions" , "str" , "Extract archives ending with extension", "7z,bz2,bzip2,gz,gzip,lha,lzh,lzma,rar,tar,taz,tbz,tbz2,tgz,xar,xz,z,zip"),
+ ("excludefiles" , "str" , "Don't extract the following files" , "*.nfo,*.DS_Store,index.dat,thumb.db" ),
+ ("recursive" , "bool" , "Extract archives in archives" , True ),
+ ("waitall" , "bool" , "Run after all downloads was processed" , False ),
+ ("renice" , "int" , "CPU priority" , 0 )]
__description__ = """Extract different kind of archives"""
__license__ = "GPLv3"
@@ -167,13 +166,9 @@ class ExtractArchive(Addon):
self.log_warning(_("No %s installed") % p)
else:
self.log_warning(_("Could not activate: %s") % p, e)
- if self.pyload.debug:
- traceback.print_exc()
except Exception, e:
self.log_warning(_("Could not activate: %s") % p, e)
- if self.pyload.debug:
- traceback.print_exc()
if self.extractors:
self.log_debug(*["Found %s %s" % (Extractor.__name__, Extractor.VERSION) for Extractor in self.extractors])
@@ -288,7 +283,7 @@ class ExtractArchive(Addon):
if subfolder:
out = fs_join(out, pypack.folder)
- if not os.path.exists(out):
+ if not exists(out):
os.makedirs(out)
matched = False
@@ -313,7 +308,7 @@ class ExtractArchive(Addon):
for fname, fid, fout in targets:
name = os.path.basename(fname)
- if not os.path.exists(fname):
+ if not exists(fname):
self.log_debug(name, "File not found")
continue
@@ -348,7 +343,7 @@ class ExtractArchive(Addon):
#: Remove processed file and related multiparts from list
files_ids = [(fname, fid, fout) for fname, fid, fout in files_ids \
- if fname not in archive.get_delete_files()]
+ if fname not in archive.items()]
self.log_debug("Extracted files: %s" % new_files)
for file in new_files:
@@ -356,7 +351,7 @@ class ExtractArchive(Addon):
for filename in new_files:
file = fs_encode(fs_join(os.path.dirname(archive.filename), filename))
- if not os.path.exists(file):
+ if not exists(file):
self.log_debug("New file %s does not exists" % filename)
continue
@@ -403,18 +398,10 @@ class ExtractArchive(Addon):
passwords = uniqify([password] + self.get_passwords(False)) if self.get_config('usepasswordfile') else [password]
for pw in passwords:
try:
- if self.get_config('test') or self.repair:
- pyfile.setCustomStatus(_("archive testing"))
- if pw:
- self.log_debug("Testing with password: %s" % pw)
- pyfile.setProgress(0)
- archive.verify(pw)
- pyfile.setProgress(100)
- else:
- archive.check(pw)
-
- self.add_password(pw)
- break
+ pyfile.setCustomStatus(_("archive testing"))
+ pyfile.setProgress(0)
+ archive.verify(pw)
+ pyfile.setProgress(100)
except PasswordError:
if not encrypted:
@@ -425,9 +412,11 @@ class ExtractArchive(Addon):
self.log_debug(name, e)
self.log_info(name, _("CRC Error"))
- if self.repair:
- self.log_warning(name, _("Repairing..."))
+ if not self.repair:
+ raise CRCError("Archive damaged")
+ else:
+ self.log_warning(name, _("Repairing..."))
pyfile.setCustomStatus(_("archive repairing"))
pyfile.setProgress(0)
repaired = archive.repair()
@@ -436,15 +425,18 @@ class ExtractArchive(Addon):
if not repaired and not self.get_config('keepbroken'):
raise CRCError("Archive damaged")
- self.add_password(pw)
- break
-
- raise CRCError("Archive damaged")
+ else:
+ self.add_password(pw)
+ break
except ArchiveError, e:
raise ArchiveError(e)
- pyfile.setCustomStatus(_("extracting"))
+ else:
+ self.add_password(pw)
+ break
+
+ pyfile.setCustomStatus(_("archive extracting"))
pyfile.setProgress(0)
if not encrypted or not self.get_config('usepasswordfile'):
@@ -467,7 +459,7 @@ class ExtractArchive(Addon):
pyfile.setProgress(100)
pyfile.setStatus("processing")
- delfiles = archive.get_delete_files()
+ delfiles = archive.items()
self.log_debug("Would delete: " + ", ".join(delfiles))
if self.get_config('delete'):
@@ -476,7 +468,7 @@ class ExtractArchive(Addon):
deltotrash = self.get_config('deltotrash')
for f in delfiles:
file = fs_encode(f)
- if not os.path.exists(file):
+ if not exists(file):
continue
if not deltotrash:
@@ -513,8 +505,6 @@ class ExtractArchive(Addon):
except Exception, e:
self.log_error(name, _("Unknown error"), e)
- if self.pyload.debug:
- traceback.print_exc()
self.manager.dispatchEvent("archive_extract_failed", pyfile, archive)
diff --git a/module/plugins/hooks/FastixRuHook.py b/module/plugins/hooks/FastixRuHook.py
deleted file mode 100644
index 3fdb29409..000000000
--- a/module/plugins/hooks/FastixRuHook.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.common.json_layer import json_loads
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class FastixRuHook(MultiHook):
- __name__ = "FastixRuHook"
- __type__ = "hook"
- __version__ = "0.06"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """Fastix.ru hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")]
-
-
- def get_hosters(self):
- html = self.load("http://fastix.ru/api_v2",
- get={'apikey': "5182964c3f8f9a7f0b00000a_kelmFB4n1IrnCDYuIFn2y",
- 'sub' : "allowed_sources"})
- host_list = json_loads(html)
- host_list = host_list['allow']
- return host_list
diff --git a/module/plugins/hooks/FreeWayMeHook.py b/module/plugins/hooks/FreeWayMeHook.py
deleted file mode 100644
index 1380433bf..000000000
--- a/module/plugins/hooks/FreeWayMeHook.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class FreeWayMeHook(MultiHook):
- __name__ = "FreeWayMeHook"
- __type__ = "hook"
- __version__ = "0.18"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """FreeWay.me hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("Nicolas Giese", "james@free-way.me")]
-
-
- def get_hosters(self):
- user, info = self.account.select()
- hostis = self.load("http://www.free-way.bz/ajax/jd.php",
- get={'id' : 3,
- 'user': user,
- 'pass': info['login']['password']}).replace("\"", "") #@TODO: Revert to `https` in 0.4.10
- return [x.strip() for x in hostis.split(",") if x.strip()]
diff --git a/module/plugins/hooks/HighWayMeHook.py b/module/plugins/hooks/HighWayMeHook.py
deleted file mode 100644
index e9e62525d..000000000
--- a/module/plugins/hooks/HighWayMeHook.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.common.json_layer import json_loads
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class HighWayMeHook(MultiHook):
- __name__ = "HighWayMeHook"
- __type__ = "hook"
- __version__ = "0.04"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """High-Way.me hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("EvolutionClip", "evolutionclip@live.de")]
-
-
- def get_hosters(self):
- json_data = json_loads(self.load("https://high-way.me/api.php",
- get={'hoster': 1}))
- return [element['name'] for element in json_data['hoster']]
diff --git a/module/plugins/hooks/HotFolder.py b/module/plugins/hooks/HotFolder.py
index 84db4db17..5a65146b9 100644
--- a/module/plugins/hooks/HotFolder.py
+++ b/module/plugins/hooks/HotFolder.py
@@ -14,7 +14,7 @@ from module.utils import fs_encode, save_join as fs_join
class HotFolder(Addon):
__name__ = "HotFolder"
__type__ = "hook"
- __version__ = "0.16"
+ __version__ = "0.17"
__status__ = "testing"
__config__ = [("folder" , "str" , "Folder to observe" , "container"),
@@ -29,6 +29,7 @@ class HotFolder(Addon):
def init(self):
self.interval = 30
+ self.init_periodical()
def periodical(self):
diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py
index 08b1bad0c..c84c0439d 100644
--- a/module/plugins/hooks/IRCInterface.py
+++ b/module/plugins/hooks/IRCInterface.py
@@ -18,7 +18,7 @@ from module.utils import formatSize
class IRCInterface(Thread, Addon):
__name__ = "IRCInterface"
__type__ = "hook"
- __version__ = "0.15"
+ __version__ = "0.17"
__status__ = "testing"
__config__ = [("host" , "str" , "IRC-Server Address" , "Enter your server here!"),
@@ -40,7 +40,7 @@ class IRCInterface(Thread, Addon):
def __init__(self, core, manager):
Thread.__init__(self)
Addon.__init__(self, core, manager)
- self.set_daemon(True)
+ self.setDaemon(True)
def activate(self):
@@ -55,6 +55,7 @@ class IRCInterface(Thread, Addon):
try:
if self.get_config('info_pack'):
self.response(_("Package finished: %s") % pypack.name)
+
except Exception:
pass
@@ -64,6 +65,7 @@ class IRCInterface(Thread, Addon):
if self.get_config('info_file'):
self.response(
_("Download finished: %(name)s @ %(plugin)s ") % {'name': pyfile.name, 'plugin': pyfile.pluginname})
+
except Exception:
pass
@@ -103,7 +105,8 @@ class IRCInterface(Thread, Addon):
except IRCError, ex:
self.sock.send("QUIT :byebye\r\n")
- traceback.print_exc()
+ if self.pyload.debug:
+ traceback.print_exc()
self.sock.close()
@@ -177,6 +180,7 @@ class IRCInterface(Thread, Addon):
trigger = temp[0]
if len(temp) > 1:
args = temp[1:]
+
except Exception:
pass
@@ -185,6 +189,7 @@ class IRCInterface(Thread, Addon):
res = handler(args)
for line in res:
self.response(line, msg['origin'])
+
except Exception, e:
self.log_error(e)
diff --git a/module/plugins/hooks/ImageTyperz.py b/module/plugins/hooks/ImageTyperz.py
index 42ab99027..85c22f1da 100644
--- a/module/plugins/hooks/ImageTyperz.py
+++ b/module/plugins/hooks/ImageTyperz.py
@@ -61,6 +61,7 @@ class ImageTyperz(Hook):
try:
balance = float(res)
+
except Exception:
raise ImageTyperzException("Invalid response")
diff --git a/module/plugins/hooks/LinksnappyComHook.py b/module/plugins/hooks/LinksnappyComHook.py
deleted file mode 100644
index e46e480d6..000000000
--- a/module/plugins/hooks/LinksnappyComHook.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.common.json_layer import json_loads
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class LinksnappyComHook(MultiHook):
- __name__ = "LinksnappyComHook"
- __type__ = "hook"
- __version__ = "0.05"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """Linksnappy.com hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("stickell", "l.stickell@yahoo.it")]
-
-
- def get_hosters(self):
- json_data = self.load("http://gen.linksnappy.com/lseAPI.php", get={'act': "FILEHOSTS"})
- json_data = json_loads(json_data)
-
- return json_data['return'].keys()
diff --git a/module/plugins/hooks/MegaDebridEuHook.py b/module/plugins/hooks/MegaDebridEuHook.py
deleted file mode 100644
index 04f0be86f..000000000
--- a/module/plugins/hooks/MegaDebridEuHook.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.common.json_layer import json_loads
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class MegaDebridEuHook(MultiHook):
- __name__ = "MegaDebridEuHook"
- __type__ = "hook"
- __version__ = "0.06"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """Mega-debrid.eu hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")]
-
-
- def get_hosters(self):
- reponse = self.load("http://www.mega-debrid.eu/api.php", get={'action': "getHosters"})
- json_data = json_loads(reponse)
-
- if json_data['response_code'] == "ok":
- host_list = [element[0] for element in json_data['hosters']]
- else:
- self.log_error(_("Unable to retrieve hoster list"))
- host_list = []
-
- return host_list
diff --git a/module/plugins/hooks/MegaRapidoNetHook.py b/module/plugins/hooks/MegaRapidoNetHook.py
deleted file mode 100644
index 4956427ff..000000000
--- a/module/plugins/hooks/MegaRapidoNetHook.py
+++ /dev/null
@@ -1,82 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import re
-
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class MegaRapidoNetHook(MultiHook):
- __name__ = "MegaRapidoNetHook"
- __type__ = "hook"
- __version__ = "0.03"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """MegaRapido.net hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")]
-
-
- def get_hosters(self):
- hosters = {'1fichier' : [], # leave it there are so many possible addresses?
- '1st-files' : ['1st-files.com'],
- '2shared' : ['2shared.com'],
- '4shared' : ['4shared.com', '4shared-china.com'],
- 'asfile' : ['http://asfile.com/'],
- 'bitshare' : ['bitshare.com'],
- 'brupload' : ['brupload.net'],
- 'crocko' : ['crocko.com', 'easy-share.com'],
- 'dailymotion' : ['dailymotion.com'],
- 'depfile' : ['depfile.com'],
- 'depositfiles': ['depositfiles.com', 'dfiles.eu'],
- 'dizzcloud' : ['dizzcloud.com'],
- 'dl.dropbox' : [],
- 'extabit' : ['extabit.com'],
- 'extmatrix' : ['extmatrix.com'],
- 'facebook' : [],
- 'file4go' : ['file4go.com'],
- 'filecloud' : ['filecloud.io', 'ifile.it', 'mihd.net'],
- 'filefactory' : ['filefactory.com'],
- 'fileom' : ['fileom.com'],
- 'fileparadox' : ['fileparadox.in'],
- 'filepost' : ['filepost.com', 'fp.io'],
- 'filerio' : ['filerio.in', 'filerio.com', 'filekeen.com'],
- 'filesflash' : ['filesflash.com'],
- 'firedrive' : ['firedrive.com', 'putlocker.com'],
- 'flashx' : [],
- 'freakshare' : ['freakshare.net', 'freakshare.com'],
- 'gigasize' : ['gigasize.com'],
- 'hipfile' : ['hipfile.com'],
- 'junocloud' : ['junocloud.me'],
- 'letitbit' : ['letitbit.net', 'shareflare.net'],
- 'mediafire' : ['mediafire.com'],
- 'mega' : ['mega.co.nz'],
- 'megashares' : ['megashares.com'],
- 'metacafe' : ['metacafe.com'],
- 'netload' : ['netload.in'],
- 'oboom' : ['oboom.com'],
- 'rapidgator' : ['rapidgator.net'],
- 'rapidshare' : ['rapidshare.com'],
- 'rarefile' : ['rarefile.net'],
- 'ryushare' : ['ryushare.com'],
- 'sendspace' : ['sendspace.com'],
- 'turbobit' : ['turbobit.net', 'unextfiles.com'],
- 'uploadable' : ['uploadable.ch'],
- 'uploadbaz' : ['uploadbaz.com'],
- 'uploaded' : ['uploaded.to', 'uploaded.net', 'ul.to'],
- 'uploadhero' : ['uploadhero.com'],
- 'uploading' : ['uploading.com'],
- 'uptobox' : ['uptobox.com'],
- 'xvideos' : ['xvideos.com'],
- 'youtube' : ['youtube.com']}
-
- hoster_list = []
-
- for item in hosters.values():
- hoster_list.extend(item)
-
- return hoster_list
diff --git a/module/plugins/hooks/MergeFiles.py b/module/plugins/hooks/MergeFiles.py
index a76a578bf..c6405e5a3 100644
--- a/module/plugins/hooks/MergeFiles.py
+++ b/module/plugins/hooks/MergeFiles.py
@@ -4,7 +4,6 @@ from __future__ import with_statement
import os
import re
-import traceback
from module.plugins.internal.Addon import Addon, threaded
from module.utils import save_join as fs_join
@@ -13,7 +12,7 @@ from module.utils import save_join as fs_join
class MergeFiles(Addon):
__name__ = "MergeFiles"
__type__ = "hook"
- __version__ = "0.16"
+ __version__ = "0.17"
__status__ = "testing"
__config__ = [("activated", "bool", "Activated", True)]
@@ -69,7 +68,7 @@ class MergeFiles(Addon):
self.log_debug("Finished merging part", splitted_file)
except Exception, e:
- traceback.print_exc()
+ self.log_error(e)
finally:
pyfile.setProgress(100)
diff --git a/module/plugins/hooks/MultihostersComHook.py b/module/plugins/hooks/MultihostersComHook.py
deleted file mode 100644
index ec1cf9c85..000000000
--- a/module/plugins/hooks/MultihostersComHook.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.plugins.hooks.ZeveraComHook import ZeveraComHook
-
-
-class MultihostersComHook(ZeveraComHook):
- __name__ = "MultihostersComHook"
- __type__ = "hook"
- __version__ = "0.03"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """Multihosters.com hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("tjeh", "tjeh@gmx.net")]
diff --git a/module/plugins/hooks/MultishareCzHook.py b/module/plugins/hooks/MultishareCzHook.py
deleted file mode 100644
index 30f1e21b5..000000000
--- a/module/plugins/hooks/MultishareCzHook.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import re
-
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class MultishareCzHook(MultiHook):
- __name__ = "MultishareCzHook"
- __type__ = "hook"
- __version__ = "0.08"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """MultiShare.cz hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
-
-
- HOSTER_PATTERN = r'<img class="logo-shareserveru"[^>]*?alt="(.+?)"></td>\s*<td class="stav">[^>]*?alt="OK"'
-
-
- def get_hosters(self):
- html = self.load("http://www.multishare.cz/monitoring/")
- return re.findall(self.HOSTER_PATTERN, html)
diff --git a/module/plugins/hooks/MyfastfileComHook.py b/module/plugins/hooks/MyfastfileComHook.py
deleted file mode 100644
index 1eedd9238..000000000
--- a/module/plugins/hooks/MyfastfileComHook.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.common.json_layer import json_loads
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class MyfastfileComHook(MultiHook):
- __name__ = "MyfastfileComHook"
- __type__ = "hook"
- __version__ = "0.06"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """Myfastfile.com hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("stickell", "l.stickell@yahoo.it")]
-
-
- def get_hosters(self):
- json_data = self.load("http://myfastfile.com/api.php", get={'hosts': ""})
- self.log_debug("JSON data", json_data)
- json_data = json_loads(json_data)
-
- return json_data['hosts']
diff --git a/module/plugins/hooks/NoPremiumPlHook.py b/module/plugins/hooks/NoPremiumPlHook.py
deleted file mode 100644
index 7dbdf6a68..000000000
--- a/module/plugins/hooks/NoPremiumPlHook.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.common.json_layer import json_loads
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class NoPremiumPlHook(MultiHook):
- __name__ = "NoPremiumPlHook"
- __type__ = "hook"
- __version__ = "0.04"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """NoPremium.pl hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("goddie", "dev@nopremium.pl")]
-
-
- def get_hosters(self):
- hostings = json_loads(self.load("https://www.nopremium.pl/clipboard.php?json=3").strip())
- hostings_domains = [domain for row in hostings for domain in row['domains'] if row['sdownload'] == "0"]
-
- self.log_debug(hostings_domains)
-
- return hostings_domains
diff --git a/module/plugins/hooks/OverLoadMeHook.py b/module/plugins/hooks/OverLoadMeHook.py
deleted file mode 100644
index 5398fc17d..000000000
--- a/module/plugins/hooks/OverLoadMeHook.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class OverLoadMeHook(MultiHook):
- __name__ = "OverLoadMeHook"
- __type__ = "hook"
- __version__ = "0.05"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """Over-Load.me hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("marley", "marley@over-load.me")]
-
-
- def get_hosters(self):
- html = self.load("https://api.over-load.me/hoster.php",
- get={'auth': "0001-cb1f24dadb3aa487bda5afd3b76298935329be7700cd7-5329be77-00cf-1ca0135f"}).replace("\"", "").strip()
- return [x.strip() for x in html.split(",") if x.strip()]
diff --git a/module/plugins/hooks/PremiumToHook.py b/module/plugins/hooks/PremiumToHook.py
deleted file mode 100644
index bcd7a7aab..000000000
--- a/module/plugins/hooks/PremiumToHook.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class PremiumToHook(MultiHook):
- __name__ = "PremiumToHook"
- __type__ = "hook"
- __version__ = "0.11"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """Premium.to hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("RaNaN" , "RaNaN@pyload.org" ),
- ("zoidberg", "zoidberg@mujmail.cz"),
- ("stickell", "l.stickell@yahoo.it")]
-
-
- def get_hosters(self):
- user, info = self.account.select()
- html = self.load("http://premium.to/api/hosters.php",
- get={'username': user,
- 'password': info['login']['password']})
- return [x.strip() for x in html.replace("\"", "").split(";")]
diff --git a/module/plugins/hooks/PremiumizeMeHook.py b/module/plugins/hooks/PremiumizeMeHook.py
deleted file mode 100644
index 9a9a380af..000000000
--- a/module/plugins/hooks/PremiumizeMeHook.py
+++ /dev/null
@@ -1,40 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.common.json_layer import json_loads
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class PremiumizeMeHook(MultiHook):
- __name__ = "PremiumizeMeHook"
- __type__ = "hook"
- __version__ = "0.20"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """Premiumize.me hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")]
-
-
- def get_hosters(self):
- #: Get account data
- user, info = self.account.select()
-
- #: Get supported hosters list from premiumize.me using the
- #: json API v1 (see https://secure.premiumize.me/?show=api)
- answer = self.load("http://api.premiumize.me/pm-api/v1.php", #@TODO: Revert to `https` in 0.4.10
- get={'method' : "hosterlist",
- 'params[login]': user,
- 'params[pass]' : info['login']['password']})
- data = json_loads(answer)
-
- #: If account is not valid thera are no hosters available
- if data['status'] != 200:
- return []
-
- #: Extract hosters from json file
- return data['result']['hosterlist']
diff --git a/module/plugins/hooks/PutdriveComHook.py b/module/plugins/hooks/PutdriveComHook.py
deleted file mode 100644
index d206aaf88..000000000
--- a/module/plugins/hooks/PutdriveComHook.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.plugins.hooks.ZeveraComHook import ZeveraComHook
-
-
-class PutdriveComHook(ZeveraComHook):
- __name__ = "PutdriveComHook"
- __type__ = "hook"
- __version__ = "0.02"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """Putdrive.com hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
diff --git a/module/plugins/hooks/RPNetBizHook.py b/module/plugins/hooks/RPNetBizHook.py
deleted file mode 100644
index 5d26b7f09..000000000
--- a/module/plugins/hooks/RPNetBizHook.py
+++ /dev/null
@@ -1,38 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.common.json_layer import json_loads
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class RPNetBizHook(MultiHook):
- __name__ = "RPNetBizHook"
- __type__ = "hook"
- __version__ = "0.16"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """RPNet.biz hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("Dman", "dmanugm@gmail.com")]
-
-
- def get_hosters(self):
- #: Get account data
- user, info = self.account.select()
-
- res = self.load("https://premium.rpnet.biz/client_api.php",
- get={'username': user,
- 'password': info['login']['password'],
- 'action' : "showHosterList"})
- hoster_list = json_loads(res)
-
- #: If account is not valid thera are no hosters available
- if 'error' in hoster_list:
- return []
-
- #: Extract hosters from json file
- return hoster_list['hosters']
diff --git a/module/plugins/hooks/RapideoPlHook.py b/module/plugins/hooks/RapideoPlHook.py
deleted file mode 100644
index 130f73851..000000000
--- a/module/plugins/hooks/RapideoPlHook.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.common.json_layer import json_loads
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class RapideoPlHook(MultiHook):
- __name__ = "RapideoPlHook"
- __type__ = "hook"
- __version__ = "0.04"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """Rapideo.pl hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("goddie", "dev@rapideo.pl")]
-
-
- def get_hosters(self):
- hostings = json_loads(self.load("https://www.rapideo.pl/clipboard.php?json=3").strip())
- hostings_domains = [domain for row in hostings for domain in row['domains'] if row['sdownload'] == "0"]
-
- self.log_debug(hostings_domains)
-
- return hostings_domains
diff --git a/module/plugins/hooks/RealdebridComHook.py b/module/plugins/hooks/RealdebridComHook.py
deleted file mode 100644
index 01b9d165e..000000000
--- a/module/plugins/hooks/RealdebridComHook.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class RealdebridComHook(MultiHook):
- __name__ = "RealdebridComHook"
- __type__ = "hook"
- __version__ = "0.47"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """Real-Debrid.com hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")]
-
-
- def get_hosters(self):
- html = self.load("https://real-debrid.com/api/hosters.php").replace("\"", "").strip()
- return [x.strip() for x in html.split(",") if x.strip()]
diff --git a/module/plugins/hooks/RehostToHook.py b/module/plugins/hooks/RehostToHook.py
deleted file mode 100644
index 7bb27e820..000000000
--- a/module/plugins/hooks/RehostToHook.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class RehostToHook(MultiHook):
- __name__ = "RehostToHook"
- __type__ = "hook"
- __version__ = "0.51"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """Rehost.to hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("RaNaN", "RaNaN@pyload.org")]
-
-
- def get_hosters(self):
- user, info = self.account.select()
- html = self.load("http://rehost.to/api.php",
- get={'cmd' : "get_supported_och_dl",
- 'long_ses': self.account.get_data(user)['session']})
- return [x.strip() for x in html.replace("\"", "").split(",")]
diff --git a/module/plugins/hooks/SimplyPremiumComHook.py b/module/plugins/hooks/SimplyPremiumComHook.py
deleted file mode 100644
index 6fbd75c8a..000000000
--- a/module/plugins/hooks/SimplyPremiumComHook.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.common.json_layer import json_loads
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class SimplyPremiumComHook(MultiHook):
- __name__ = "SimplyPremiumComHook"
- __type__ = "hook"
- __version__ = "0.06"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """Simply-Premium.com hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("EvolutionClip", "evolutionclip@live.de")]
-
-
- def get_hosters(self):
- json_data = self.load("http://www.simply-premium.com/api/hosts.php", get={'format': "json", 'online': 1})
- json_data = json_loads(json_data)
-
- host_list = [element['regex'] for element in json_data['result']]
-
- return host_list
diff --git a/module/plugins/hooks/SimplydebridComHook.py b/module/plugins/hooks/SimplydebridComHook.py
deleted file mode 100644
index 0da7ec719..000000000
--- a/module/plugins/hooks/SimplydebridComHook.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class SimplydebridComHook(MultiHook):
- __name__ = "SimplydebridComHook"
- __type__ = "hook"
- __version__ = "0.05"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """Simply-Debrid.com hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")]
-
-
- def get_hosters(self):
- html = self.load("http://simply-debrid.com/api.php", get={'list': 1})
- return [x.strip() for x in html.rstrip(';').replace("\"", "").split(";")]
diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py
index a1ddc3094..5f9cfa452 100644
--- a/module/plugins/hooks/SkipRev.py
+++ b/module/plugins/hooks/SkipRev.py
@@ -2,7 +2,6 @@
import re
import urllib
-import urlparse
from types import MethodType
@@ -13,7 +12,7 @@ from module.plugins.internal.Addon import Addon
class SkipRev(Addon):
__name__ = "SkipRev"
__type__ = "hook"
- __version__ = "0.33"
+ __version__ = "0.34"
__status__ = "testing"
__config__ = [("mode" , "Auto;Manual", "Choose recovery archives to skip" , "Auto"),
@@ -24,13 +23,6 @@ class SkipRev(Addon):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- @staticmethod
- def _init(self):
- self.pyfile.plugin._init()
- if self.pyfile.hasStatus("skipped"):
- self.skip(self.pyfile.statusname or self.pyfile.pluginname)
-
-
def _name(self, pyfile):
return pyfile.pluginclass.get_info(pyfile.url)['name']
@@ -68,11 +60,6 @@ class SkipRev(Addon):
pyfile.setCustomStatus("SkipRev", "skipped")
- if not hasattr(pyfile.plugin, "_init"):
- #: Work-around: inject status checker inside the preprocessing routine of the plugin
- pyfile.plugin._init = pyfile.plugin.init
- pyfile.plugin.init = MethodType(self._init, pyfile.plugin)
-
def download_failed(self, pyfile):
#: Check if pyfile is still "failed", maybe might has been restarted in meantime
diff --git a/module/plugins/hooks/SmoozedComHook.py b/module/plugins/hooks/SmoozedComHook.py
deleted file mode 100644
index b9825b223..000000000
--- a/module/plugins/hooks/SmoozedComHook.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class SmoozedComHook(MultiHook):
- __name__ = "SmoozedComHook"
- __type__ = "hook"
- __version__ = "0.04"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """Smoozed.com hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("", "")]
-
-
- def get_hosters(self):
- user, info = self.account.select()
- return self.account.get_data(user)['hosters']
diff --git a/module/plugins/hooks/TransmissionRPC.py b/module/plugins/hooks/TransmissionRPC.py
new file mode 100644
index 000000000..715f82edb
--- /dev/null
+++ b/module/plugins/hooks/TransmissionRPC.py
@@ -0,0 +1,84 @@
+# -*- coding: utf-8 -*-
+
+import random
+import re
+
+import pycurl
+
+from module.common.json_layer import json_loads, json_dumps
+from module.network.HTTPRequest import BadHeader
+from module.network.RequestFactory import getRequest as get_request
+from module.plugins.internal.Addon import Addon
+
+
+class TransmissionRPC(Addon):
+ __name__ = "TransmissionRPC"
+ __type__ = "hook"
+ __version__ = "0.12"
+ __status__ = "testing"
+
+ __pattern__ = r"https?://.+\.torrent|magnet:\?.+"
+ __config__ = [("rpc_url", "str", "Transmission RPC URL", "http://127.0.0.1:9091/transmission/rpc")]
+
+ __description__ = """Send torrent and magnet URLs to Transmission Bittorent daemon via RPC"""
+ __license__ = "GPLv3"
+ __authors__ = [("GammaC0de", None)]
+
+
+ def init(self):
+ self.event_map = {'linksAdded': "links_added"}
+
+
+ def links_added(self, links, pid):
+ pattern = re.compile(self.__pattern__)
+ urls = [link for link in links if pattern.match(link)]
+
+ for url in urls:
+ self.log_debug("Sending link: %s" % url)
+ self.send_to_transmission(url)
+ links.remove(url)
+
+
+ def send_to_transmission(self, url):
+ transmission_rpc_url = self.get_config('rpc_url')
+ client_request_id = self.__name__ + "".join(random.choice('0123456789ABCDEF') for _i in xrange(4))
+ req = get_request()
+
+ try:
+ response = self.load(transmission_rpc_url,
+ post=json_dumps({'arguments': {'filename': url},
+ 'method' : 'torrent-add',
+ 'tag' : client_request_id}),
+ req=req)
+
+ except BadHeader, e:
+ if e.code == 409:
+ headers = dict(re.findall(r"(?P<name>.+?): (?P<value>.+?)\r?\n", req.header))
+ session_id = headers['X-Transmission-Session-Id']
+ req.c.setopt(pycurl.HTTPHEADER, ["X-Transmission-Session-Id: %s" % session_id])
+ try:
+ response = self.load(transmission_rpc_url,
+ post=json_dumps({'arguments': {'filename': url},
+ 'method' : 'torrent-add',
+ 'tag' : client_request_id}),
+ req=req)
+
+ except Exception, e:
+ self.log_error(e)
+ return
+
+ else:
+ self.log_error(e)
+ return
+
+ except Exception, e:
+ self.log_error(e)
+ return
+
+ try:
+ res = json_loads(response)
+ if "result" in res:
+ self.log_debug("Result: %s" % res['result'])
+
+ except Exception, e:
+ self.log_error(e)
diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py
index 117da0633..312355675 100644
--- a/module/plugins/hooks/UpdateManager.py
+++ b/module/plugins/hooks/UpdateManager.py
@@ -7,7 +7,6 @@ import os
import re
import sys
import time
-import traceback
from module.plugins.internal.Addon import Expose, Addon, threaded
from module.plugins.internal.Plugin import exists
@@ -17,7 +16,7 @@ from module.utils import fs_encode, save_join as fs_join
class UpdateManager(Addon):
__name__ = "UpdateManager"
__type__ = "hook"
- __version__ = "0.55"
+ __version__ = "0.56"
__status__ = "testing"
__config__ = [("activated" , "bool", "Activated" , True ),
@@ -80,8 +79,8 @@ class UpdateManager(Addon):
if self.get_config('nodebugupdate'):
return
- if self.get_config('checkperiod') \
- and time.time() - max(self.MIN_CHECK_INTERVAL, self.get_config('checkinterval') * 60 * 60) > self.info['last_check']:
+ if self.get_config('checkperiod') and \
+ time.time() - max(self.MIN_CHECK_INTERVAL, self.get_config('checkinterval') * 60 * 60) > self.info['last_check']:
self.update()
@@ -268,9 +267,7 @@ class UpdateManager(Addon):
raise Exception(_("Version mismatch"))
except Exception, e:
- self.log_error(_("Error updating plugin: %s") % filename, e)
- if self.pyload.debug:
- traceback.print_exc()
+ self.log_error(_("Error updating plugin: [%s] %s") % (type, name), e)
if updated:
self.log_info(_("*** Plugins updated ***"))
@@ -278,7 +275,7 @@ class UpdateManager(Addon):
if self.pyload.pluginManager.reloadPlugins(updated):
exitcode = 1
else:
- self.log_warning(_("pyLoad restart required to reload the updated plugins"))
+ self.log_warning(_("You have to restart pyLoad to reload the updated plugins"))
self.info['plugins'] = True
exitcode = 2
@@ -337,8 +334,6 @@ class UpdateManager(Addon):
except OSError, e:
self.log_warning(_("Error removing: %s") % filename, e)
- if self.pyload.debug:
- traceback.print_exc()
else:
id = (type, name)
diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py
index 7567a31a3..70bafba67 100644
--- a/module/plugins/hooks/XFileSharingPro.py
+++ b/module/plugins/hooks/XFileSharingPro.py
@@ -8,7 +8,7 @@ from module.plugins.internal.Hook import Hook
class XFileSharingPro(Hook):
__name__ = "XFileSharingPro"
__type__ = "hook"
- __version__ = "0.42"
+ __version__ = "0.43"
__status__ = "testing"
__config__ = [("activated" , "bool", "Activated" , True ),
@@ -28,20 +28,22 @@ class XFileSharingPro(Hook):
'crypter': (r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:user|folder)s?/\w+',
r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:user|folder)s?/\w+')}
- HOSTER_BUILTIN = [#WORKING HOSTERS:
- "ani-stream.com", "backin.net", "cloudsix.me", "eyesfile.ca", "file4safe.com",
- "fileband.com", "filedwon.com", "fileparadox.in", "filevice.com",
- "hostingbulk.com", "junkyvideo.com", "linestorage.com", "ravishare.com",
- "ryushare.com", "salefiles.com", "sendmyway.com", "sharebeast.com",
- "sharesix.com", "thefile.me", "verzend.be", "worldbytez.com", "xvidstage.com",
- #: NOT TESTED:
- "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com",
- "linkzhost.com", "mightyupload.com", "rockdizfile.com", "sharerepo.com",
- "shareswift.com", "uploadbaz.com", "uploadc.com", "vidbull.com",
- "zalaa.com", "zomgupload.com",
- #: NOT WORKING:
- "amonshare.com", "banicrazy.info", "boosterking.com", "host4desi.com", "laoupload.com", "rd-fs.com"]
- CRYPTER_BUILTIN = ["junocloud.me", "rapidfileshare.net"]
+ BUILTIN_HOSTERS = [#WORKING HOSTERS:
+ "ani-stream.com", "backin.net", "cloudsix.me", "eyesfile.ca",
+ "file4safe.com", "fileband.com", "filedwon.com", "fileparadox.in",
+ "filevice.com", "hostingbulk.com", "junkyvideo.com", "ravishare.com",
+ "ryushare.com", "salefiles.com", "sendmyway.com", "sharebeast.com",
+ "sharesix.com", "thefile.me", "verzend.be", "worldbytez.com",
+ "xvidstage.com",
+ #: NOT TESTED:
+ "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com",
+ "linkzhost.com", "mightyupload.com", "rockdizfile.com", "sharerepo.com",
+ "shareswift.com", "uploadbaz.com", "uploadc.com", "vidbull.com",
+ "zalaa.com", "zomgupload.com",
+ #: NOT WORKING:
+ "amonshare.com", "banicrazy.info", "boosterking.com", "host4desi.com",
+ "laoupload.com", "rd-fs.com"]
+ BUILTIN_CRYPTERS = ["junocloud.me", "rapidfileshare.net"]
# def plugin_config_changed(self, plugin, name, value):
@@ -71,7 +73,7 @@ class XFileSharingPro(Hook):
plugin_set = set(plugins.replace(' ', '').replace('\\', '').replace('|', ',').replace(';', ',').lower().split(','))
if use_builtin_list:
- plugin_set |= set(x.lower() for x in getattr(self, "%s_BUILTIN" % type.upper()))
+ plugin_set |= set(x.lower() for x in getattr(self, "BUILTIN_%sS" % type.upper()))
plugin_set -= set(('', u''))
diff --git a/module/plugins/hooks/XMPPInterface.py b/module/plugins/hooks/XMPPInterface.py
index 50dd40774..77e20cdd4 100644
--- a/module/plugins/hooks/XMPPInterface.py
+++ b/module/plugins/hooks/XMPPInterface.py
@@ -70,6 +70,7 @@ class XMPPInterface(IRCInterface, JabberClient):
try:
if self.get_config('info_pack'):
self.announce(_("Package finished: %s") % pypack.name)
+
except Exception:
pass
@@ -79,6 +80,7 @@ class XMPPInterface(IRCInterface, JabberClient):
if self.get_config('info_file'):
self.announce(
_("Download finished: %(name)s @ %(plugin)s") % {'name': pyfile.name, 'plugin': pyfile.pluginname})
+
except Exception:
pass
@@ -88,6 +90,7 @@ class XMPPInterface(IRCInterface, JabberClient):
self.connect()
try:
self.loop()
+
except Exception, ex:
self.log_error(ex)
@@ -159,6 +162,7 @@ class XMPPInterface(IRCInterface, JabberClient):
trigger = temp[0]
if len(temp) > 1:
args = temp[1:]
+
except Exception:
pass
@@ -174,6 +178,7 @@ class XMPPInterface(IRCInterface, JabberClient):
body=line)
messages.append(m)
+
except Exception, e:
self.log_error(e)
diff --git a/module/plugins/hooks/ZeveraComHook.py b/module/plugins/hooks/ZeveraComHook.py
deleted file mode 100644
index 395c67802..000000000
--- a/module/plugins/hooks/ZeveraComHook.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from module.plugins.internal.MultiHook import MultiHook
-
-
-class ZeveraComHook(MultiHook):
- __name__ = "ZeveraComHook"
- __type__ = "hook"
- __version__ = "0.06"
- __status__ = "testing"
-
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
-
- __description__ = """Zevera.com hook plugin"""
- __license__ = "GPLv3"
- __authors__ = [("zoidberg" , "zoidberg@mujmail.cz"),
- ("Walter Purcaro", "vuolter@gmail.com" )]
-
-
- def get_hosters(self):
- html = self.account.api_response(pyreq.getHTTPRequest(timeout=120), cmd="gethosters")
- return [x.strip() for x in html.split(",")]
diff --git a/module/plugins/hoster/AndroidfilehostCom.py b/module/plugins/hoster/AndroidfilehostCom.py
index 3fb77f83e..38f3b8392 100644
--- a/module/plugins/hoster/AndroidfilehostCom.py
+++ b/module/plugins/hoster/AndroidfilehostCom.py
@@ -42,7 +42,7 @@ class AndroidfilehostCom(SimpleHoster):
self.log_debug("Waiting time: %s seconds" % wait.group(1))
fid = re.search(r'id="fid" value="(\d+)" />', self.html).group(1)
- self.log_debug("fid: %s" % fid)
+ self.log_debug("FID: %s" % fid)
html = self.load("https://www.androidfilehost.com/libs/otf/mirrors.otf.php",
post={'submit': 'submit',
diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py
index 2e9ae4e48..1952309fe 100644
--- a/module/plugins/hoster/BasePlugin.py
+++ b/module/plugins/hoster/BasePlugin.py
@@ -12,7 +12,7 @@ from module.plugins.internal.Hoster import Hoster
class BasePlugin(Hoster):
__name__ = "BasePlugin"
__type__ = "hoster"
- __version__ = "0.45"
+ __version__ = "0.46"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
@@ -23,18 +23,6 @@ class BasePlugin(Hoster):
("Walter Purcaro", "vuolter@gmail.com")]
- @classmethod
- def get_info(cls, url="", html=""): #@TODO: Move to hoster class in 0.4.10
- url = urllib.unquote(url)
- url_p = urlparse.urlparse(url)
- return {'name' : (url_p.path.split('/')[-1]
- or url_p.query.split('=', 1)[::-1][0].split('&', 1)[0]
- or url_p.netloc.split('.', 1)[0]),
- 'size' : 0,
- 'status': 3 if url else 8,
- 'url' : url}
-
-
def setup(self):
self.chunk_limit = -1
self.multiDL = True
@@ -45,48 +33,48 @@ class BasePlugin(Hoster):
"""
Main function
"""
+ netloc = urlparse.urlparse(pyfile.url).netloc
+
pyfile.name = self.get_info(pyfile.url)['name']
if not pyfile.url.startswith("http"):
self.fail(_("No plugin matched"))
- for _i in xrange(5):
- try:
- link = self.direct_link(urllib.unquote(pyfile.url))
+ try:
+ link = self.direct_link(urllib.unquote(pyfile.url))
- if link:
- self.download(link, ref=False, disposition=True)
- else:
- self.fail(_("File not found"))
+ if link:
+ self.download(link, ref=False, disposition=True)
+ else:
+ self.fail(_("File not found"))
- except BadHeader, e:
- if e.code == 404:
- self.offline()
+ except BadHeader, e:
+ if e.code == 404:
+ self.offline()
- elif e.code in (401, 403):
- self.log_debug("Auth required", "Received HTTP status code: %d" % e.code)
+ elif e.code in (401, 403):
+ self.log_debug("Auth required", "Received HTTP status code: %d" % e.code)
- account = self.pyload.accountManager.getAccountPlugin('Http')
- servers = [x['login'] for x in account.getAllAccounts()] #@TODO: Recheck in 0.4.10
- server = urlparse.urlparse(pyfile.url).netloc
+ #@TODO: Recheck in 0.4.10
+ if self.account:
+ servers = [x['login'] for x in self.account.getAllAccounts()]
+ else:
+ servers = []
+
+ if netloc in servers:
+ self.log_debug("Logging on to %s" % netloc)
+ self.req.addAuth(self.account.get_login('password'))
- if server in servers:
- self.log_debug("Logging on to %s" % server)
- self.req.addAuth(account.get_info(server)['login']['password'])
- else:
- pwd = self.get_password()
- if ':' in pwd:
- self.req.addAuth(pwd)
- else:
- self.fail(_("Authorization required"))
else:
- self.fail(e)
+ pwd = self.get_password()
+ if ':' in pwd:
+ self.req.addAuth(pwd)
+ else:
+ self.fail(_("Authorization required"))
else:
- break
- else:
- self.fail(_("No file downloaded")) #@TODO: Move to hoster class in 0.4.10
+ self.fail(e)
- errmsg = self.check_download({'Empty file' : re.compile(r'\A\s*\Z'),
+ errmsg = self.check_file({'Empty file' : re.compile(r'\A\s*\Z'),
'Html error' : re.compile(r'\A(?:\s*<.+>)?((?:[\w\s]*(?:[Ee]rror|ERROR)\s*\:?)?\s*\d{3})(?:\Z|\s+)'),
'Html file' : re.compile(r'\A\s*<!DOCTYPE html'),
'Request error': re.compile(r'([Aa]n error occured while processing your request)')})
@@ -95,6 +83,7 @@ class BasePlugin(Hoster):
try:
errmsg += " | " + self.last_check.group(1).strip()
+
except Exception:
pass
diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py
index d2af8272a..204c981c6 100644
--- a/module/plugins/hoster/BezvadataCz.py
+++ b/module/plugins/hoster/BezvadataCz.py
@@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class BezvadataCz(SimpleHoster):
__name__ = "BezvadataCz"
__type__ = "hoster"
- __version__ = "0.29"
+ __version__ = "0.30"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?bezvadata\.cz/stahnout/.+'
@@ -39,24 +39,16 @@ class BezvadataCz(SimpleHoster):
#: Captcha form
self.html = self.load(url)
self.check_errors()
- for _i in xrange(5):
- action, inputs = self.parse_html_form('frm-stahnoutFreeForm')
- if not inputs:
- self.error(_("FreeForm"))
-
- m = re.search(r'<img src="data:image/png;base64,(.*?)"', self.html)
- if m is None:
- self.error(_("Wrong captcha image"))
-
- inputs['captcha'] = self.captcha._decrypt(m.group(1).decode('base64'), input_type='png')
-
- if '<img src="data:image/png;base64' in self.html:
- self.captcha.invalid()
- else:
- self.captcha.correct()
- break
- else:
- self.fail(_("No valid captcha code entered"))
+
+ action, inputs = self.parse_html_form('frm-stahnoutFreeForm')
+ if not inputs:
+ self.error(_("FreeForm"))
+
+ m = re.search(r'<img src="data:image/png;base64,(.*?)"', self.html)
+ if m is None:
+ self.retry_captcha()
+
+ inputs['captcha'] = self.captcha.decrypt_image(m.group(1).decode('base64'), input_type='png')
#: Download url
self.html = self.load("http://bezvadata.cz%s" % action, post=inputs)
diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py
index b975a8ab0..e426de092 100644
--- a/module/plugins/hoster/BitshareCom.py
+++ b/module/plugins/hoster/BitshareCom.py
@@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class BitshareCom(SimpleHoster):
__name__ = "BitshareCom"
__type__ = "hoster"
- __version__ = "0.55"
+ __version__ = "0.56"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?bitshare\.com/(files/)?(?(1)|\?f=)(?P<ID>\w+)(?(1)/(?P<NAME>.+?)\.html)'
@@ -39,7 +39,7 @@ class BitshareCom(SimpleHoster):
def process(self, pyfile):
if self.premium:
- self.account.relogin(self.user)
+ self.account.relogin()
#: File id
m = re.match(self.__pattern__, pyfile.url)
@@ -75,7 +75,7 @@ class BitshareCom(SimpleHoster):
#: This may either download our file or forward us to an error page
self.link = self.get_download_url()
- if self.check_download({'error': ">Error occured<"}):
+ if self.check_file({'error': ">Error occured<"}):
self.retry(5, 5 * 60, "Bitshare host : Error occured")
@@ -114,16 +114,14 @@ class BitshareCom(SimpleHoster):
self.log_debug("File is captcha protected")
recaptcha = ReCaptcha(self)
- #: Try up to 3 times
- for i in xrange(3):
- response, challenge = recaptcha.challenge()
- res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html",
- post={'request' : "validateCaptcha",
- 'ajaxid' : self.ajaxid,
- 'recaptcha_challenge_field': challenge,
- 'recaptcha_response_field' : response})
- if self.handle_captcha_errors(res):
- break
+ response, challenge = recaptcha.challenge()
+ res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html",
+ post={'request' : "validateCaptcha",
+ 'ajaxid' : self.ajaxid,
+ 'recaptcha_challenge_field': challenge,
+ 'recaptcha_response_field' : response})
+
+ self.handle_captcha_errors(res)
#: Get download URL
self.log_debug("Getting download url")
@@ -141,6 +139,7 @@ class BitshareCom(SimpleHoster):
self.log_debug("Checking response [%s]" % res)
if "ERROR:Session timed out" in res:
self.retry()
+
elif "ERROR" in res:
msg = res.split(separator)[-1]
self.fail(msg)
@@ -150,11 +149,12 @@ class BitshareCom(SimpleHoster):
self.log_debug("Result of captcha resolving [%s]" % res)
if "SUCCESS" in res:
self.captcha.correct()
- return True
+
elif "ERROR:SESSION ERROR" in res:
self.retry()
- self.captcha.invalid()
+ else:
+ self.retry_captcha()
getInfo = create_getInfo(BitshareCom)
diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py
index 5b7d61e05..c2b8d9257 100644
--- a/module/plugins/hoster/CatShareNet.py
+++ b/module/plugins/hoster/CatShareNet.py
@@ -46,7 +46,7 @@ class CatShareNet(SimpleHoster):
'recaptcha_response_field' : response})
m = re.search(self.LINK_FREE_PATTERN, self.html)
- if m:
+ if m is not None:
self.link = m.group(1)
diff --git a/module/plugins/hoster/CloudzillaTo.py b/module/plugins/hoster/CloudzillaTo.py
index 60c66960d..d9466c954 100644
--- a/module/plugins/hoster/CloudzillaTo.py
+++ b/module/plugins/hoster/CloudzillaTo.py
@@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class CloudzillaTo(SimpleHoster):
__name__ = "CloudzillaTo"
__type__ = "hoster"
- __version__ = "0.08"
+ __version__ = "0.09"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?cloudzilla\.to/share/file/(?P<ID>[\w^_]+)'
@@ -34,7 +34,7 @@ class CloudzillaTo(SimpleHoster):
self.fail(_("Missing password"))
if re.search(self.PASSWORD_PATTERN, self.html):
- self.retry(reason="Wrong password")
+ self.retry(msg="Wrong password")
else:
return super(CloudzillaTo, self).check_errors()
@@ -49,7 +49,7 @@ class CloudzillaTo(SimpleHoster):
if 'error' in ticket:
if "File is password protected" in ticket['error']:
- self.retry(reason="Wrong password")
+ self.retry(msg="Wrong password")
else:
self.fail(ticket['error'])
diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py
index 8f092ad0c..70f2be6fb 100644
--- a/module/plugins/hoster/CrockoCom.py
+++ b/module/plugins/hoster/CrockoCom.py
@@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class CrockoCom(SimpleHoster):
__name__ = "CrockoCom"
__type__ = "hoster"
- __version__ = "0.21"
+ __version__ = "0.22"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?(crocko|easy-share)\.com/\w+'
@@ -39,8 +39,8 @@ class CrockoCom(SimpleHoster):
for _i in xrange(5):
m = re.search(self.CAPTCHA_PATTERN, self.html)
- if m:
- url = urlparse.urljoin("http://crocko.com", m.group(1))
+ if m is not None:
+ url = urlparse.urljoin("http://crocko.com/", m.group(1))
self.wait(m.group(2))
self.html = self.load(url)
else:
@@ -54,16 +54,11 @@ class CrockoCom(SimpleHoster):
inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form))
recaptcha = ReCaptcha(self)
- for _i in xrange(5):
- inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge()
- self.download(action, post=inputs)
+ inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge()
+ self.download(action, post=inputs)
- if self.check_download({'captcha': recaptcha.KEY_AJAX_PATTERN}):
- self.captcha.invalid()
- else:
- break
- else:
- self.fail(_("No valid captcha solution received"))
+ if self.check_file({'captcha': recaptcha.KEY_AJAX_PATTERN}):
+ self.retry_captcha()
getInfo = create_getInfo(CrockoCom)
diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py
index 3d2de5f7f..d678f25fa 100644
--- a/module/plugins/hoster/CzshareCom.py
+++ b/module/plugins/hoster/CzshareCom.py
@@ -12,7 +12,7 @@ from module.utils import parseFileSize as parse_size
class CzshareCom(SimpleHoster):
__name__ = "CzshareCom"
__type__ = "hoster"
- __version__ = "1.02"
+ __version__ = "1.04"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).+'
@@ -40,11 +40,11 @@ class CzshareCom(SimpleHoster):
USER_CREDIT_PATTERN = r'<div class="credit">\s*kredit: <strong>([\d .,]+)(\w+)</strong>\s*</div><!-- .credit -->'
- def check_traffic_left(self):
+ def check_traffic(self):
#: Check if user logged in
m = re.search(self.USER_CREDIT_PATTERN, self.html)
if m is None:
- self.account.relogin(self.user)
+ self.account.relogin()
self.html = self.load(self.pyfile.url)
m = re.search(self.USER_CREDIT_PATTERN, self.html)
if m is None:
@@ -54,10 +54,11 @@ class CzshareCom(SimpleHoster):
try:
credit = parse_size(m.group(1).replace(' ', ''), m.group(2))
self.log_info(_("Premium download for %i KiB of Credit") % (self.pyfile.size / 1024))
- self.log_info(_("User %s has %i KiB left") % (self.user, credit / 1024))
+ self.log_info(_("User %s has %i KiB left") % (self.account.user, credit / 1024))
if credit < self.pyfile.size:
self.log_info(_("Not enough credit to download file: %s") % self.pyfile.name)
return False
+
except Exception, e:
#: let's continue and see what happens...
self.log_error(e)
@@ -66,13 +67,13 @@ class CzshareCom(SimpleHoster):
def handle_premium(self, pyfile):
- #: Parse download link
try:
form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.S).group(1)
inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form))
+
except Exception, e:
self.log_error(e)
- self.restart(nopremium=True)
+ self.restart()
#: Download the file, destination is determined by pyLoad
self.download("http://sdilej.cz/profi_down.php", post=inputs, disposition=True)
@@ -104,21 +105,17 @@ class CzshareCom(SimpleHoster):
#: Get and decrypt captcha
captcha_url = 'http://sdilej.cz/captcha.php'
- for _i in xrange(5):
- inputs['captchastring2'] = self.captcha.decrypt(captcha_url)
- self.html = self.load(parsed_url, post=inputs)
+ inputs['captchastring2'] = self.captcha.decrypt(captcha_url)
+ self.html = self.load(parsed_url, post=inputs)
- if u"<li>ZadanÃœ ověřovací kód nesouhlasí!</li>" in self.html:
- self.captcha.invalid()
+ if u"<li>ZadanÃœ ověřovací kód nesouhlasí!</li>" in self.html:
+ self.retry_captcha()
- elif re.search(self.MULTIDL_PATTERN, self.html):
- self.wait(5 * 60, 12, _("Download limit reached"))
+ elif re.search(self.MULTIDL_PATTERN, self.html):
+ self.wait(5 * 60, 12, _("Download limit reached"))
- else:
- self.captcha.correct()
- break
else:
- self.fail(_("No valid captcha code entered"))
+ self.captcha.correct()
m = re.search("countdown_number = (\d+);", self.html)
self.set_wait(int(m.group(1)) if m else 50)
@@ -135,9 +132,9 @@ class CzshareCom(SimpleHoster):
self.wait()
- def check_file(self):
+ def check_download(self):
#: Check download
- check = self.check_download({
+ check = self.check_file({
"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),
@@ -148,16 +145,15 @@ class CzshareCom(SimpleHoster):
self.fail(_("File not available - try later"))
elif check == "credit":
- self.restart(nopremium=True)
+ self.restart()
elif check == "multi-dl":
self.wait(5 * 60, 12, _("Download limit reached"))
elif check == "captcha":
- self.captcha.invalid()
- self.retry()
+ self.retry_captcha()
- return super(CzshareCom, self).check_file()
+ return super(CzshareCom, self).check_download()
getInfo = create_getInfo(CzshareCom)
diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py
index 15caae1f7..fe304fdea 100644
--- a/module/plugins/hoster/DataportCz.py
+++ b/module/plugins/hoster/DataportCz.py
@@ -6,7 +6,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class DataportCz(SimpleHoster):
__name__ = "DataportCz"
__type__ = "hoster"
- __version__ = "0.42"
+ __version__ = "0.43"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?dataport\.cz/file/(.+)'
@@ -28,32 +28,26 @@ class DataportCz(SimpleHoster):
def handle_free(self, pyfile):
captchas = {'1': "jkeG", '2': "hMJQ", '3': "vmEK", '4': "ePQM", '5': "blBd"}
- for _i in xrange(60):
- action, inputs = self.parse_html_form('free_download_form')
- self.log_debug(action, inputs)
- if not action or not inputs:
- self.error(_("free_download_form"))
+ action, inputs = self.parse_html_form('free_download_form')
+ self.log_debug(action, inputs)
+ if not action or not inputs:
+ self.error(_("free_download_form"))
- if "captchaId" in inputs and inputs['captchaId'] in captchas:
- inputs['captchaCode'] = captchas[inputs['captchaId']]
- else:
- self.error(_("captcha"))
+ if "captchaId" in inputs and inputs['captchaId'] in captchas:
+ inputs['captchaCode'] = captchas[inputs['captchaId']]
+ else:
+ self.error(_("Captcha not found"))
- self.download("http://www.dataport.cz%s" % action, post=inputs)
+ self.download("http://www.dataport.cz%s" % action, post=inputs)
- check = self.check_download({'captcha': 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");',
- 'slot' : 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'})
- if check == "captcha":
- self.error(_("invalid captcha"))
+ check = self.check_file({'captcha': 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");',
+ 'slot' : 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'})
+ if check == "captcha":
+ self.retry_captcha()
- elif check == "slot":
- self.log_debug("No free slots - wait 60s and retry")
- self.wait(60, False)
- self.html = self.load(pyfile.url)
- continue
-
- else:
- break
+ elif check == "slot":
+ self.log_debug("No free slots - wait 60s and retry")
+ self.retry(wait=60)
getInfo = create_getInfo(DataportCz)
diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py
index d90fc5864..42aed2c77 100644
--- a/module/plugins/hoster/DateiTo.py
+++ b/module/plugins/hoster/DateiTo.py
@@ -49,7 +49,8 @@ class DateiTo(SimpleHoster):
m = re.search(self.DATA_PATTERN, self.html)
if m is None:
- self.error(_("data"))
+ self.error(_("Data pattern not found"))
+
url = 'http://datei.to/' + m.group(1)
data = dict(x.split('=') for x in m.group(2).split('&'))
diff --git a/module/plugins/hoster/DebridItaliaCom.py b/module/plugins/hoster/DebridItaliaCom.py
index 7cf7c4663..ca6603a87 100644
--- a/module/plugins/hoster/DebridItaliaCom.py
+++ b/module/plugins/hoster/DebridItaliaCom.py
@@ -29,7 +29,7 @@ class DebridItaliaCom(MultiHoster):
get={'generate': "on", 'link': pyfile.url, 'p': self.get_password()})
if "ERROR:" not in self.html:
- self.link = self.html.strip()
+ self.link = self.html
else:
self.info['error'] = re.search(r'ERROR:(.*)', self.html).group(1).strip()
diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py
index 9d42935cb..b3854f581 100644
--- a/module/plugins/hoster/DepositfilesCom.py
+++ b/module/plugins/hoster/DepositfilesCom.py
@@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class DepositfilesCom(SimpleHoster):
__name__ = "DepositfilesCom"
__type__ = "hoster"
- __version__ = "0.57"
+ __version__ = "0.58"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?(depositfiles\.com|dfiles\.(eu|ru))(/\w{1,3})?/files/(?P<ID>\w+)'
@@ -48,7 +48,7 @@ class DepositfilesCom(SimpleHoster):
m = re.search(r"var fid = '(\w+)';", self.html)
if m is None:
- self.retry(wait_time=5)
+ self.retry(wait=5)
params = {'fid': m.group(1)}
self.log_debug("FID: %s" % params['fid'])
@@ -66,7 +66,7 @@ class DepositfilesCom(SimpleHoster):
self.html = self.load("https://dfiles.eu/get_file.php", get=params)
m = re.search(self.LINK_FREE_PATTERN, self.html)
- if m:
+ if m is not None:
self.link = urllib.unquote(m.group(1))
@@ -76,7 +76,7 @@ class DepositfilesCom(SimpleHoster):
self.retry(25, 60 * 60, "Download limit reached")
elif 'onClick="show_gold_offer' in self.html:
- self.account.relogin(self.user)
+ self.account.relogin()
self.retry()
else:
diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py
index f9d427c1b..f77b9596a 100644
--- a/module/plugins/hoster/DlFreeFr.py
+++ b/module/plugins/hoster/DlFreeFr.py
@@ -100,15 +100,16 @@ class DlFreeFr(SimpleHoster):
if headers.get("code") == 302 and "set-cookie" in headers and "location" in headers:
m = re.search("(.*?)=(.*?); path=(.*?); domain=(.*)", headers.get("set-cookie"))
cj = CookieJar(self.__name__)
- if m:
+ if m is not None:
cj.setCookie(m.group(4), m.group(1), m.group(2), m.group(3))
else:
self.fail(_("Cookie error"))
self.link = headers.get("location")
self.req.setCookieJar(cj)
+
else:
- self.fail(_("Invalid response"))
+ self.fail(_("Bad header"))
def get_last_headers(self):
diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py
index 53ac9ff06..3cfa014dd 100644
--- a/module/plugins/hoster/EuroshareEu.py
+++ b/module/plugins/hoster/EuroshareEu.py
@@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class EuroshareEu(SimpleHoster):
__name__ = "EuroshareEu"
__type__ = "hoster"
- __version__ = "0.30"
+ __version__ = "0.32"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?euroshare\.(eu|sk|cz|hu|pl)/file/.+'
@@ -32,17 +32,17 @@ class EuroshareEu(SimpleHoster):
def handle_premium(self, pyfile):
if self.ERROR_PATTERN in self.html:
- self.account.relogin(self.user)
- self.retry(reason=_("User not logged in"))
+ self.account.relogin()
+ self.retry(msg=_("User not logged in"))
self.link = pyfile.url.rstrip('/') + "/download/"
- check = self.check_download({'login': re.compile(self.ERROR_PATTERN),
+ check = self.check_file({'login': re.compile(self.ERROR_PATTERN),
'json' : re.compile(r'\{"status":"error".*?"message":"(.*?)"')})
if check == "login" or (check == "json" and self.last_check.group(1) == "Access token expired"):
- self.account.relogin(self.user)
- self.retry(reason=_("Access token expired"))
+ self.account.relogin()
+ self.retry(msg=_("Access token expired"))
elif check == "json":
self.fail(self.last_check.group(1))
diff --git a/module/plugins/hoster/ExashareCom.py b/module/plugins/hoster/ExashareCom.py
index 19cd1b46c..c3a4b43dc 100644
--- a/module/plugins/hoster/ExashareCom.py
+++ b/module/plugins/hoster/ExashareCom.py
@@ -28,11 +28,7 @@ class ExashareCom(XFSHoster):
def handle_free(self, pyfile):
- m = re.search(self.LINK_FREE_PATTERN, self.html)
- if m is None:
- self.error(_("Free download link not found"))
- else:
- self.link = m.group(1)
+ return super(XFSHoster, self).handle_free(pyfile)
getInfo = create_getInfo(ExashareCom)
diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py
index 3442e7d27..b21db38bb 100644
--- a/module/plugins/hoster/ExtabitCom.py
+++ b/module/plugins/hoster/ExtabitCom.py
@@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, s
class ExtabitCom(SimpleHoster):
__name__ = "ExtabitCom"
__type__ = "hoster"
- __version__ = "0.67"
+ __version__ = "0.68"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?extabit\.com/(file|go|fid)/(?P<ID>\w+)'
@@ -35,32 +35,30 @@ class ExtabitCom(SimpleHoster):
self.fail(_("Only premium users can download this file"))
m = re.search(r"Next free download from your ip will be available in <b>(\d+)\s*minutes", self.html)
- if m:
+ if m is not None:
self.wait(int(m.group(1)) * 60, True)
elif "The daily downloads limit from your IP is exceeded" in self.html:
self.log_warning(_("You have reached your daily downloads limit for today"))
- self.wait(seconds_to_midnight(gmt=2), True)
+ self.wait(seconds_to_midnight(), True)
self.log_debug("URL: " + self.req.http.lastEffectiveURL)
m = re.match(self.__pattern__, self.req.http.lastEffectiveURL)
fileID = m.group('ID') if m else self.info['pattern']['ID']
m = re.search(r'recaptcha/api/challenge\?k=(\w+)', self.html)
- if m:
+ if m is not None:
recaptcha = ReCaptcha(self)
captcha_key = m.group(1)
- for _i in xrange(5):
- get_data = {'type': "recaptcha"}
- get_data['capture'], get_data['challenge'] = recaptcha.challenge(captcha_key)
- res = json_loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data))
- if "ok" in res:
- self.captcha.correct()
- break
- else:
- self.captcha.invalid()
+ get_data = {'type': "recaptcha"}
+ get_data['capture'], get_data['challenge'] = recaptcha.challenge(captcha_key)
+
+ res = json_loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data))
+
+ if "ok" in res:
+ self.captcha.correct()
else:
- self.fail(_("Invalid captcha"))
+ self.retry_captcha()
else:
self.error(_("Captcha"))
diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py
index 0019cf3c2..d932bb22e 100644
--- a/module/plugins/hoster/FastixRu.py
+++ b/module/plugins/hoster/FastixRu.py
@@ -10,7 +10,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
class FastixRu(MultiHoster):
__name__ = "FastixRu"
__type__ = "hoster"
- __version__ = "0.13"
+ __version__ = "0.15"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/\w{24}'
@@ -27,13 +27,11 @@ class FastixRu(MultiHoster):
def handle_premium(self, pyfile):
- api_key = self.account.get_data(self.user)
- api_key = api_key['api']
-
- self.html = self.load("http://fastix.ru/api_v2/",
- get={'apikey': api_key, 'sub': "getdirectlink", 'link': pyfile.url})
-
- data = json_loads(self.html)
+ self.html = json_loads(self.load("http://fastix.ru/api_v2/",
+ get={'apikey': self.account.get_data('apikey'),
+ 'sub' : "getdirectlink",
+ 'link' : pyfile.url})
+ data = self.html)
self.log_debug("Json data", data)
diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py
index 485d69d15..b05edfb27 100644
--- a/module/plugins/hoster/FastshareCz.py
+++ b/module/plugins/hoster/FastshareCz.py
@@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class FastshareCz(SimpleHoster):
__name__ = "FastshareCz"
__type__ = "hoster"
- __version__ = "0.32"
+ __version__ = "0.35"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?fastshare\.cz/\d+/.+'
@@ -42,14 +42,14 @@ class FastshareCz(SimpleHoster):
if self.CREDIT_ERROR in self.html:
errmsg = self.info['error'] = _("Not enough traffic left")
self.log_warning(errmsg)
- self.restart(nopremium=True)
+ self.restart()
self.info.pop('error', None)
def handle_free(self, pyfile):
m = re.search(self.FREE_URL_PATTERN, self.html)
- if m:
+ if m is not None:
action, captcha_src = m.groups()
else:
self.error(_("FREE_URL_PATTERN not found"))
@@ -59,8 +59,8 @@ class FastshareCz(SimpleHoster):
self.download(urlparse.urljoin(baseurl, action), post={'code': captcha, 'btn.x': 77, 'btn.y': 18})
- def check_file(self):
- check = self.check_download({
+ def check_download(self):
+ check = self.check_file({
'paralell-dl' : re.compile(r"<title>FastShare.cz</title>|<script>alert\('Pres FREE muzete stahovat jen jeden soubor najednou.'\)"),
'wrong captcha': re.compile(r'Download for FREE'),
'credit' : re.compile(self.CREDIT_ERROR)
@@ -70,12 +70,12 @@ class FastshareCz(SimpleHoster):
self.retry(6, 10 * 60, _("Paralell download"))
elif check == "wrong captcha":
- self.retry(max_tries=5, reason=_("Wrong captcha"))
+ self.retry_captcha()
elif check == "credit":
- self.restart(nopremium=True)
+ self.restart()
- return super(FastshareCz, self).check_file()
+ return super(FastshareCz, self).check_download()
getInfo = create_getInfo(FastshareCz)
diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py
index 62a7a553f..23aa7ea61 100644
--- a/module/plugins/hoster/FileSharkPl.py
+++ b/module/plugins/hoster/FileSharkPl.py
@@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class FileSharkPl(SimpleHoster):
__name__ = "FileSharkPl"
__type__ = "hoster"
- __version__ = "0.13"
+ __version__ = "0.15"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?fileshark\.pl/pobierz/\d+/\w+'
@@ -50,12 +50,12 @@ class FileSharkPl(SimpleHoster):
def check_errors(self):
#: Check if file is now available for download (-> file name can be found in html body)
m = re.search(self.WAIT_PATTERN, self.html)
- if m:
+ if m is not None:
errmsg = self.info['error'] = _("Another download already run")
self.retry(15, int(m.group(1)), errmsg)
m = re.search(self.ERROR_PATTERN, self.html)
- if m:
+ if m is not None:
alert = m.group(1)
if re.match(self.IP_ERROR_PATTERN, alert):
@@ -78,12 +78,12 @@ class FileSharkPl(SimpleHoster):
if m is None:
self.error(_("Download url not found"))
- link = urlparse.urljoin("http://fileshark.pl", m.group(1))
+ link = urlparse.urljoin("http://fileshark.pl/", m.group(1))
self.html = self.load(link)
m = re.search(self.WAIT_PATTERN, self.html)
- if m:
+ if m is not None:
seconds = int(m.group(1))
self.log_debug("Wait %s seconds" % seconds)
self.wait(seconds)
@@ -92,15 +92,15 @@ class FileSharkPl(SimpleHoster):
m = re.search(self.TOKEN_PATTERN, self.html)
if m is None:
- self.retry(reason=_("Captcha form not found"))
+ self.retry(msg=_("Captcha form not found"))
inputs['form[_token]'] = m.group(1)
m = re.search(self.CAPTCHA_PATTERN, self.html)
if m is None:
- self.retry(reason=_("Captcha image not found"))
+ self.retry(msg=_("Captcha image not found"))
- inputs['form[captcha]'] = self.captcha._decrypt(m.group(1).decode('base64'), input_type='jpeg')
+ inputs['form[captcha]'] = self.captcha.decrypt_image(m.group(1).decode('base64'), input_type='jpeg')
inputs['form[start]'] = ""
self.download(link, post=inputs, disposition=True)
diff --git a/module/plugins/hoster/FileboomMe.py b/module/plugins/hoster/FileboomMe.py
index 2798d9eda..1a2c89b0b 100644
--- a/module/plugins/hoster/FileboomMe.py
+++ b/module/plugins/hoster/FileboomMe.py
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
import re
-
-from urlparse import urljoin
+import urlparse
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
@@ -37,67 +36,53 @@ class FileboomMe(SimpleHoster):
def handle_free(self, pyfile):
- post_url = urljoin(pyfile.url, "/file/" + self.info['pattern']['ID'])
+ post_url = urlparse.urljoin(pyfile.url, "file/" + self.info['pattern']['ID'])
m = re.search(r'data-slow-id="(\w+)"', self.html)
- if m:
+ if m is not None:
self.html = self.load(post_url,
post={'slow_id': m.group(1)})
m = re.search(self.LINK_PATTERN, self.html)
- if m:
- self.link = urljoin(pyfile.url, m.group(0))
+ if m is not None:
+ self.link = urlparse.urljoin(pyfile.url, m.group(0))
else:
- for _i in xrange(5):
- m = re.search(r'<input type="hidden" name="uniqueId" value="(\w+)">', self.html)
- if m:
- uniqueId = m.group(1)
-
- m = re.search(self.CAPTCHA_PATTERN, self.html)
- if m:
- captcha = self.captcha.decrypt(urljoin(pyfile.url, m.group(1)))
-
- self.html = self.load(post_url,
- post={'CaptchaForm[code]' : captcha,
- 'free' : 1,
- 'freeDownloadRequest': 1,
- 'uniqueId' : uniqueId})
-
- if 'The verification code is incorrect' in self.html:
- self.captcha.invalid()
-
- else:
- self.check_errors()
+ m = re.search(r'<input type="hidden" name="uniqueId" value="(\w+)">', self.html)
+ if m is None:
+ m = re.search(r'>\s*Please wait ([\d:]+)', self.html)
+ if m is not None:
+ wait_time = 0
+ for v in re.findall(r'(\d+)', m.group(1), re.I):
+ wait_time = 60 * wait_time + int(v)
+ self.wait(wait_time)
+ self.retry()
- self.html = self.load(post_url,
- post={'free' : 1,
- 'uniqueId': uniqueId})
-
- m = re.search(self.LINK_PATTERN, self.html)
- if m:
- self.link = urljoin(pyfile.url, m.group(0))
+ else:
+ uniqueId = m.group(1)
- else:
- self.captcha.invalid()
+ m = re.search(self.CAPTCHA_PATTERN, self.html)
+ if m is not None:
+ captcha = self.captcha.decrypt(urlparse.urljoin(pyfile.url, m.group(1)))
+ self.html = self.load(post_url,
+ post={'CaptchaForm[code]' : captcha,
+ 'free' : 1,
+ 'freeDownloadRequest': 1,
+ 'uniqueId' : uniqueId})
- break
+ if 'The verification code is incorrect' in self.html:
+ self.retry_captcha()
else:
- self.fail(_("Captcha not found"))
-
- else:
- m = re.search(r'>\s*Please wait ([\d:]+)', self.html)
- if m:
- wait_time = 0
- for v in re.findall(r'(\d+)', m.group(1), re.I):
- wait_time = 60 * wait_time + int(v)
- self.wait(wait_time)
- self.retry()
- break
+ self.check_errors()
- else:
- self.fail(_("Invalid captcha"))
+ self.html = self.load(post_url,
+ post={'free' : 1,
+ 'uniqueId': uniqueId})
+
+ m = re.search(self.LINK_PATTERN, self.html)
+ if m is not None:
+ self.link = urlparse.urljoin(pyfile.url, m.group(0))
getInfo = create_getInfo(FileboomMe)
diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py
index 21654fee3..da81d3f37 100644
--- a/module/plugins/hoster/FilecloudIo.py
+++ b/module/plugins/hoster/FilecloudIo.py
@@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class FilecloudIo(SimpleHoster):
__name__ = "FilecloudIo"
__type__ = "hoster"
- __version__ = "0.10"
+ __version__ = "0.11"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P<ID>\w+)'
@@ -64,7 +64,7 @@ class FilecloudIo(SimpleHoster):
response, challenge = recaptcha.challenge(captcha_key)
self.account.form_data = {'recaptcha_challenge_field': challenge,
'recaptcha_response_field' : response}
- self.account.relogin(self.user)
+ self.account.relogin()
self.retry(2)
json_url = "http://filecloud.io/download-request.json"
@@ -78,22 +78,18 @@ class FilecloudIo(SimpleHoster):
self.log_debug(res)
if res['captcha']:
data['ctype'] = "recaptcha"
+ data['recaptcha_response'], data['recaptcha_challenge'] = recaptcha.challenge(captcha_key)
- for _i in xrange(5):
- data['recaptcha_response'], data['recaptcha_challenge'] = recaptcha.challenge(captcha_key)
+ json_url = "http://filecloud.io/download-request.json"
+ res = self.load(json_url, post=data)
+ self.log_debug(res)
+ res = json_loads(res)
- json_url = "http://filecloud.io/download-request.json"
- res = self.load(json_url, post=data)
- self.log_debug(res)
- res = json_loads(res)
-
- if "retry" in res and res['retry']:
- self.captcha.invalid()
- else:
- self.captcha.correct()
- break
+ if "retry" in res and res['retry']:
+ self.retry_captcha()
else:
- self.fail(_("Incorrect captcha"))
+ self.captcha.correct()
+
if res['dl']:
self.html = self.load('http://filecloud.io/download.html')
@@ -111,7 +107,7 @@ class FilecloudIo(SimpleHoster):
def handle_premium(self, pyfile):
- akey = self.account.get_data(self.user)['akey']
+ akey = self.account.get_data('akey')
ukey = self.info['pattern']['ID']
self.log_debug("Akey: %s | Ukey: %s" % (akey, ukey))
rep = self.load("http://api.filecloud.io/api-fetch_download_url.api",
diff --git a/module/plugins/hoster/FiledropperCom.py b/module/plugins/hoster/FiledropperCom.py
index 3f5e2b761..8cef6c709 100644
--- a/module/plugins/hoster/FiledropperCom.py
+++ b/module/plugins/hoster/FiledropperCom.py
@@ -32,16 +32,14 @@ class FiledropperCom(SimpleHoster):
def handle_free(self, pyfile):
m = re.search(r'img id="img" src="(.+?)"', self.html)
if m is None:
- self.fail("Captcha not found")
+ self.fail(_("Captcha not found"))
captcha_code = self.captcha.decrypt("http://www.filedropper.com/%s" % m.group(1))
m = re.search(r'method="post" action="(.+?)"', self.html)
- if m is None:
- self.fail("Download link not found")
-
- self.download(urlparse.urljoin("http://www.filedropper.com/", m.group(1)),
- post={'code': captcha_code})
+ if m is not None:
+ self.download(urlparse.urljoin("http://www.filedropper.com/", m.group(1)),
+ post={'code': captcha_code})
getInfo = create_getInfo(FiledropperCom)
diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py
index 325b4bb27..637f3b2e0 100644
--- a/module/plugins/hoster/FilefactoryCom.py
+++ b/module/plugins/hoster/FilefactoryCom.py
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
import re
-import urlparse
from module.network.RequestFactory import getURL as get_url
from module.plugins.internal.SimpleHoster import SimpleHoster, parse_fileInfo
@@ -20,7 +19,7 @@ def get_info(urls):
class FilefactoryCom(SimpleHoster):
__name__ = "FilefactoryCom"
__type__ = "hoster"
- __version__ = "0.57"
+ __version__ = "0.59"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?filefactory\.com/(file|trafficshare/\w+)/\w+'
@@ -51,36 +50,24 @@ class FilefactoryCom(SimpleHoster):
m = re.search(self.LINK_FREE_PATTERN, self.html)
if m is None:
- self.error(_("Free download link not found"))
+ return
self.link = m.group(1)
m = re.search(self.WAIT_PATTERN, self.html)
- if m:
+ if m is not None:
self.wait(m.group(1))
- def check_file(self):
- check = self.check_download({'multiple': "You are currently downloading too many files at once.",
+ def check_download(self):
+ check = self.check_file({'multiple': "You are currently downloading too many files at once.",
'error' : '<div id="errorMessage">'})
if check == "multiple":
self.log_debug("Parallel downloads detected; waiting 15 minutes")
- self.retry(wait_time=15 * 60, reason=_("Parallel downloads"))
+ self.retry(wait=15 * 60, msg=_("Parallel downloads"))
elif check == "error":
self.error(_("Unknown error"))
- return super(FilefactoryCom, self).check_file()
-
-
- def handle_premium(self, pyfile):
- self.link = self.direct_link(self.load(pyfile.url, just_header=True))
-
- if not self.link:
- html = self.load(pyfile.url)
- m = re.search(self.LINK_PREMIUM_PATTERN, html)
- if m:
- self.link = m.group(1)
- else:
- self.error(_("Premium download link not found"))
+ return super(FilefactoryCom, self).check_download()
diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py
index d8c626ef2..3d42bebed 100644
--- a/module/plugins/hoster/FilepostCom.py
+++ b/module/plugins/hoster/FilepostCom.py
@@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class FilepostCom(SimpleHoster):
__name__ = "FilepostCom"
__type__ = "hoster"
- __version__ = "0.35"
+ __version__ = "0.36"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp\.io)/(?P<ID>[^/]+)'
@@ -64,27 +64,20 @@ class FilepostCom(SimpleHoster):
self.link = self.get_json_response(get_dict, post_dict, 'link')
if not self.link:
- self.fail(_("Incorrect password"))
+ self.fail(_("Wrong password"))
else:
self.fail(_("No password found"))
else:
- #: Solve recaptcha
- recaptcha = ReCaptcha(self)
-
- for i in xrange(5):
- get_dict['JsHttpRequest'] = str(int(time.time() * 10000)) + '-xml'
- if i:
- post_dict['recaptcha_response_field'], post_dict['recaptcha_challenge_field'] = recaptcha.challenge(
- captcha_key)
- self.log_debug(u"RECAPTCHA: %s : %s : %s" % (
- captcha_key, post_dict['recaptcha_challenge_field'], post_dict['recaptcha_response_field']))
+ get_dict['JsHttpRequest'] = str(int(time.time() * 10000)) + '-xml'
+ self.link = self.get_json_response(get_dict, post_dict, 'link')
+ if not self.link:
+ #: Solve recaptcha
+ recaptcha = ReCaptcha(self)
+ post_dict['recaptcha_response_field'], post_dict['recaptcha_challenge_field'] = recaptcha.challenge(captcha_key)
self.link = self.get_json_response(get_dict, post_dict, 'link')
- else:
- self.fail(_("Invalid captcha"))
-
def get_json_response(self, get_dict, post_dict, field):
res = json_loads(self.load('https://filepost.com/files/get/', get=get_dict, post=post_dict))
@@ -101,8 +94,8 @@ class FilepostCom(SimpleHoster):
if 'error' in res['js']:
if res['js']['error'] == "download_delay":
- self.retry(wait_time=res['js']['params']['next_download'])
- #: ~? self.retry(wait_time=js_answer['params']['next_download'])
+ self.retry(wait=res['js']['params']['next_download'])
+ #: ~? self.retry(wait=js_answer['params']['next_download'])
elif 'Wrong file password' in res['js']['error'] \
or 'You entered a wrong CAPTCHA code' in res['js']['error'] \
diff --git a/module/plugins/hoster/FilepupNet.py b/module/plugins/hoster/FilepupNet.py
index 8bb23adb1..7793afe53 100644
--- a/module/plugins/hoster/FilepupNet.py
+++ b/module/plugins/hoster/FilepupNet.py
@@ -39,11 +39,9 @@ class FilepupNet(SimpleHoster):
def handle_free(self, pyfile):
m = re.search(self.LINK_FREE_PATTERN, self.html)
- if m is None:
- self.error(_("Download link not found"))
-
- dl_link = m.group(1)
- self.download(dl_link, post={'task': "download"})
+ if m is not None:
+ dl_link = m.group(1)
+ self.download(dl_link, post={'task': "download"})
getInfo = create_getInfo(FilepupNet)
diff --git a/module/plugins/hoster/FilerNet.py b/module/plugins/hoster/FilerNet.py
index f8c41f4d1..37c88dec7 100644
--- a/module/plugins/hoster/FilerNet.py
+++ b/module/plugins/hoster/FilerNet.py
@@ -6,7 +6,6 @@
import pycurl
import re
-import urlparse
from module.plugins.captcha.ReCaptcha import ReCaptcha
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
@@ -58,10 +57,10 @@ class FilerNet(SimpleHoster):
self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1)
if 'location' in self.req.http.header.lower():
- self.link = re.search(r'location: (\S+)', self.req.http.header, re.I).group(1)
self.captcha.correct()
+ self.link = re.search(r'location: (\S+)', self.req.http.header, re.I).group(1)
else:
- self.captcha.invalid()
+ self.retry_captcha()
getInfo = create_getInfo(FilerNet)
diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py
index a6dd56152..fcb29b922 100644
--- a/module/plugins/hoster/FilesMailRu.py
+++ b/module/plugins/hoster/FilesMailRu.py
@@ -21,6 +21,7 @@ def get_info(urls):
url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>'
file_name = re.search(url_pattern, html).group(0).split(', event)">')[1].split('</a>')[0]
result.append((file_name, 0, 2, url))
+
except Exception:
pass
@@ -32,7 +33,7 @@ def get_info(urls):
class FilesMailRu(Hoster):
__name__ = "FilesMailRu"
__type__ = "hoster"
- __version__ = "0.34"
+ __version__ = "0.35"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?files\.mail\.ru/.+'
@@ -103,7 +104,7 @@ class FilesMailRu(Hoster):
#: so i set it to check every download because sometimes there are downloads
#: that contain the HTML-Text and 60MB ZEROs after that in a xyzfile.part1.rar file
#: (Loading 100MB in to ram is not an option)
- check = self.check_download({'html': "<meta name="}, read_size=50000)
+ check = self.check_file({'html': "<meta name="}, read_size=50000)
if check == "html":
self.log_info(_(
"There was HTML Code in the Downloaded File (%s)...redirect error? The Download will be restarted." %
diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py
index a74589cff..277d4f2a8 100644
--- a/module/plugins/hoster/FileserveCom.py
+++ b/module/plugins/hoster/FileserveCom.py
@@ -24,6 +24,7 @@ def check_file(plugin, urls):
parse_size(cols[2]) if cols[2] != '--' else 0,
2 if cols[3].startswith('Available') else 1,
cols[0]))
+
except Exception, e:
continue
@@ -33,7 +34,7 @@ def check_file(plugin, urls):
class FileserveCom(Hoster):
__name__ = "FileserveCom"
__type__ = "hoster"
- __version__ = "0.58"
+ __version__ = "0.61"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P<ID>[^/]+)'
@@ -94,7 +95,7 @@ class FileserveCom(Hoster):
elif action['fail'] == "parallelDownload":
self.log_warning(_("Parallel download error, now waiting 60s"))
- self.retry(wait_time=60, reason=_("parallelDownload"))
+ self.retry(wait=60, msg=_("parallelDownload"))
else:
self.fail(_("Download check returned: %s") % action['fail'])
@@ -119,7 +120,7 @@ class FileserveCom(Hoster):
self.download(self.url, post={'download': "normal"})
self.log_debug(self.req.http.lastEffectiveURL)
- check = self.check_download({'expired': self.LINK_EXPIRED_PATTERN,
+ check = self.check_file({'expired': self.LINK_EXPIRED_PATTERN,
'wait' : re.compile(self.LONG_WAIT_PATTERN),
'limit' : self.DL_LIMIT_PATTERN})
@@ -132,7 +133,7 @@ class FileserveCom(Hoster):
elif check == "limit":
self.log_warning(_("Download limited reached for today"))
- self.wait(seconds_to_midnight(gmt=2), True)
+ self.wait(seconds_to_midnight(), True)
self.retry()
self.thread.m.reconnecting.wait(3) #: Ease issue with later downloads appearing to be in parallel
@@ -160,19 +161,15 @@ class FileserveCom(Hoster):
captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group(1)
recaptcha = ReCaptcha(self)
- for _i in xrange(5):
- response, challenge = recaptcha.challenge(captcha_key)
- res = json_loads(self.load(self.URLS[2],
- post={'recaptcha_challenge_field' : challenge,
- 'recaptcha_response_field' : response,
- 'recaptcha_shortencode_field': self.file_id}))
- if not res['success']:
- self.captcha.invalid()
- else:
- self.captcha.correct()
- break
+ response, challenge = recaptcha.challenge(captcha_key)
+ res = json_loads(self.load(self.URLS[2],
+ post={'recaptcha_challenge_field' : challenge,
+ 'recaptcha_response_field' : response,
+ 'recaptcha_shortencode_field': self.file_id}))
+ if res['success']:
+ self.captcha.correct()
else:
- self.fail(_("Invalid captcha"))
+ self.retry_captcha()
def do_long_wait(self, m):
@@ -186,8 +183,8 @@ class FileserveCom(Hoster):
if self.__name__ == "FileserveCom":
#: Try api download
res = self.load("http://app.fileserve.com/api/download/premium/",
- post={'username': self.user,
- 'password': self.account.get_info(self.user)['login']['password'],
+ post={'username': self.account.user,
+ 'password': self.account.get_login('password'),
'shorten': self.file_id})
if res:
res = json_loads(res)
@@ -196,7 +193,7 @@ class FileserveCom(Hoster):
elif res['error_code'] in ["305", "500"]:
self.temp_offline()
elif res['error_code'] in ["403", "605"]:
- self.restart(nopremium=True)
+ self.restart()
elif res['error_code'] in ["606", "607", "608"]:
self.offline()
else:
@@ -204,9 +201,9 @@ class FileserveCom(Hoster):
self.download(premium_url or self.pyfile.url)
- if not premium_url and self.check_download({'login': re.compile(self.NOT_LOGGED_IN_PATTERN)}):
- self.account.relogin(self.user)
- self.retry(reason=_("Not logged in"))
+ if not premium_url and self.check_file({'login': re.compile(self.NOT_LOGGED_IN_PATTERN)}):
+ self.account.relogin()
+ self.retry(msg=_("Not logged in"))
def get_info(urls):
diff --git a/module/plugins/hoster/FourSharedCom.py b/module/plugins/hoster/FourSharedCom.py
index e5b309dc1..d767f4ca1 100644
--- a/module/plugins/hoster/FourSharedCom.py
+++ b/module/plugins/hoster/FourSharedCom.py
@@ -38,7 +38,7 @@ class FourSharedCom(SimpleHoster):
def handle_free(self, pyfile):
m = re.search(self.LINK_BTN_PATTERN, self.html)
- if m:
+ if m is not None:
link = m.group(1)
else:
link = re.sub(r'/(download|get|file|document|photo|video|audio)/', r'/get/', pyfile.url)
@@ -47,7 +47,7 @@ class FourSharedCom(SimpleHoster):
m = re.search(self.LINK_FREE_PATTERN, self.html)
if m is None:
- self.error(_("Download link"))
+ return
self.link = m.group(1)
@@ -55,6 +55,7 @@ class FourSharedCom(SimpleHoster):
m = re.search(self.ID_PATTERN, self.html)
res = self.load('http://www.4shared.com/web/d2/getFreeDownloadLimitInfo?fileId=%s' % m.group(1))
self.log_debug(res)
+
except Exception:
pass
diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py
index 4564ee03e..450f11095 100644
--- a/module/plugins/hoster/FreakshareCom.py
+++ b/module/plugins/hoster/FreakshareCom.py
@@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import seconds_to_midnight
class FreakshareCom(Hoster):
__name__ = "FreakshareCom"
__type__ = "hoster"
- __version__ = "0.43"
+ __version__ = "0.44"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?freakshare\.(net|com)/files/\S*?/'
@@ -44,7 +44,7 @@ class FreakshareCom(Hoster):
self.download(pyfile.url, post=self.req_opts)
- check = self.check_download({'bad' : "bad try",
+ check = self.check_file({'bad' : "bad try",
'paralell' : "> Sorry, you cant download more then 1 files at time. <",
'empty' : "Warning: Unknown: Filename cannot be empty",
'wrong_captcha' : "Wrong Captcha!",
@@ -61,8 +61,7 @@ class FreakshareCom(Hoster):
self.fail(_("File not downloadable"))
elif check == "wrong_captcha":
- self.captcha.invalid()
- self.retry()
+ self.retry_captcha()
elif check == "downloadserver":
self.retry(5, 15 * 60, _("No Download server"))
@@ -111,7 +110,7 @@ class FreakshareCom(Hoster):
if not self.wantReconnect:
m = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">([^ ]+)", self.html)
- if m:
+ if m is not None:
file_name = m.group(1)
else:
file_name = self.pyfile.url
@@ -128,7 +127,7 @@ class FreakshareCom(Hoster):
if not self.wantReconnect:
m = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">[^ ]+ - ([^ ]+) (\w\w)yte", self.html)
- if m:
+ if m is not None:
units = float(m.group(1).replace(",", ""))
pow = {'KB': 1, 'MB': 2, 'GB': 3}[m.group(2)]
size = int(units * 1024 ** pow)
@@ -142,7 +141,7 @@ class FreakshareCom(Hoster):
if "Your Traffic is used up for today" in self.html:
self.wantReconnect = True
- return seconds_to_midnight(gmt=2)
+ return seconds_to_midnight()
timestring = re.search('\s*var\s(?:downloadWait|time)\s=\s(\d*)[\d.]*;', self.html)
if timestring:
diff --git a/module/plugins/hoster/FreeWayMe.py b/module/plugins/hoster/FreeWayMe.py
index ed7c4bf7f..c0053fc76 100644
--- a/module/plugins/hoster/FreeWayMe.py
+++ b/module/plugins/hoster/FreeWayMe.py
@@ -6,7 +6,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
class FreeWayMe(MultiHoster):
__name__ = "FreeWayMe"
__type__ = "hoster"
- __version__ = "0.19"
+ __version__ = "0.20"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?free-way\.(bz|me)/.+'
@@ -33,7 +33,7 @@ class FreeWayMe(MultiHoster):
get={'multiget': 7,
'url' : pyfile.url,
'user' : user,
- 'pw' : self.account.get_info(self.user)['login']['password'],
+ 'pw' : self.account.get_login('password'),
'json' : ""},
just_header=True)
diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py
index a5aac222c..b387151f7 100644
--- a/module/plugins/hoster/FshareVn.py
+++ b/module/plugins/hoster/FshareVn.py
@@ -68,7 +68,7 @@ class FshareVn(SimpleHoster):
self.html = self.load(url, post=inputs)
if 'name="link_file_pwd_dl"' in self.html:
- self.fail(_("Incorrect password"))
+ self.fail(_("Wrong password"))
else:
self.fail(_("No password found"))
@@ -93,7 +93,7 @@ class FshareVn(SimpleHoster):
self.offline()
m = re.search(self.WAIT_PATTERN, self.html)
- if m:
+ if m is not None:
self.log_info(_("Wait until %s ICT") % m.group(1))
wait_until = time.mktime.time(time.strptime.time(m.group(1), "%d/%m/%Y %H:%M"))
self.wait(wait_until - time.mktime.time(time.gmtime.time()) - 7 * 60 * 60, True)
diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py
index 25eb44604..2ff1755f4 100644
--- a/module/plugins/hoster/Ftp.py
+++ b/module/plugins/hoster/Ftp.py
@@ -11,7 +11,7 @@ from module.plugins.internal.Hoster import Hoster
class Ftp(Hoster):
__name__ = "Ftp"
__type__ = "hoster"
- __version__ = "0.54"
+ __version__ = "0.55"
__status__ = "testing"
__pattern__ = r'(?:ftps?|sftp)://([\w.-]+(:[\w.-]+)?@)?[\w.-]+(:\d+)?/.+'
@@ -29,30 +29,41 @@ class Ftp(Hoster):
def process(self, pyfile):
- parsed_url = urlparse.urlparse(pyfile.url)
- netloc = parsed_url.netloc
+ p_url = urlparse.urlparse(pyfile.url)
+ netloc = p_url.netloc
- pyfile.name = parsed_url.path.rpartition('/')[2]
+ pyfile.name = p_url.path.rpartition('/')[2]
try:
pyfile.name = urllib.unquote(str(pyfile.name)).decode('utf8')
+
except Exception:
pass
if not "@" in netloc:
- servers = [x['login'] for x in self.account.getAllAccounts()] if self.account else []
+ self.log_debug("Auth required")
+
+ #@TODO: Recheck in 0.4.10
+ if self.account:
+ servers = [x['login'] for x in self.account.getAllAccounts()]
+ else:
+ servers = []
if netloc in servers:
self.log_debug("Logging on to %s" % netloc)
- self.req.addAuth(self.account.get_info(netloc)['login']['password'])
+ self.req.addAuth(self.account.get_login('password'))
+
else:
pwd = self.get_password()
if ':' in pwd:
self.req.addAuth(pwd)
+ else:
+ self.fail(_("Authorization required"))
self.req.http.c.setopt(pycurl.NOBODY, 1)
try:
res = self.load(pyfile.url)
+
except pycurl.error, e:
self.fail(_("Error %d: %s") % e.args)
@@ -60,19 +71,25 @@ class Ftp(Hoster):
self.log_debug(self.req.http.header)
m = re.search(r"Content-Length:\s*(\d+)", res)
- if m:
+ if m is not None:
pyfile.size = int(m.group(1))
self.download(pyfile.url)
+
else:
#: Naive ftp directory listing
if re.search(r'^25\d.*?"', self.req.http.header, re.M):
pyfile.url = pyfile.url.rstrip('/')
pkgname = "/".join([pyfile.package().name, urlparse.urlparse(pyfile.url).path.rpartition('/')[2]])
+
pyfile.url += '/'
+
self.req.http.c.setopt(48, 1) #: CURLOPT_DIRLISTONLY
res = self.load(pyfile.url, decode=False)
+
links = [pyfile.url + x for x in res.splitlines()]
self.log_debug("LINKS", links)
+
self.pyload.api.addPackage(pkgname, links)
+
else:
self.fail(_("Unexpected server response"))
diff --git a/module/plugins/hoster/GigapetaCom.py b/module/plugins/hoster/GigapetaCom.py
index 381c39a21..85e5e4843 100644
--- a/module/plugins/hoster/GigapetaCom.py
+++ b/module/plugins/hoster/GigapetaCom.py
@@ -36,23 +36,22 @@ class GigapetaCom(SimpleHoster):
self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0)
- for _i in xrange(5):
- self.check_errors()
-
- captcha = self.captcha.decrypt(captcha_url)
- self.html = self.load(pyfile.url, post={
- 'captcha_key': captcha_key,
- 'captcha': captcha,
- 'download': "Download"})
-
- m = re.search(r'Location\s*:\s*(.+)', self.req.http.header, re.I)
- if m:
- self.link = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10
- break
- elif "Entered figures don&#96;t coincide with the picture" in self.html:
- self.captcha.invalid()
- else:
- self.fail(_("No valid captcha code entered"))
+ self.check_errors()
+
+ captcha = self.captcha.decrypt(captcha_url)
+ self.html = self.load(pyfile.url, post={
+ 'captcha_key': captcha_key,
+ 'captcha': captcha,
+ 'download': "Download"})
+
+ m = re.search(r'Location\s*:\s*(.+)', self.req.http.header, re.I)
+ if m is not None:
+ self.captcha.correct()
+ self.link = m.group(1)
+
+ elif "Entered figures don&#96;t coincide with the picture" in self.html:
+ self.retry_captcha()
+
self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1)
diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py
index 903b5361e..c6b84b776 100644
--- a/module/plugins/hoster/GoogledriveCom.py
+++ b/module/plugins/hoster/GoogledriveCom.py
@@ -41,19 +41,16 @@ class GoogledriveCom(SimpleHoster):
m = re.search(self.LINK_FREE_PATTERN, self.html)
if m is None:
- self.error(_("Free download link not found"))
+ return
+ link = self.fixurl(link, "https://docs.google.com/")
+ direct_link = self.direct_link(link, False)
+
+ if not direct_link:
+ self.html = self.load(link)
else:
- link = html_unescape(m.group(1).decode('unicode-escape'))
- if not urlparse.urlparse(link).scheme:
- link = urlparse.urljoin("https://docs.google.com/", link)
-
- direct_link = self.direct_link(link, False)
- if not direct_link:
- self.html = self.load(link)
- else:
- self.link = direct_link
- break
+ self.link = direct_link
+ break
getInfo = create_getInfo(GoogledriveCom)
diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py
index eab819ad9..012b6be63 100644
--- a/module/plugins/hoster/HellshareCz.py
+++ b/module/plugins/hoster/HellshareCz.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
-import urlparse
-
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
diff --git a/module/plugins/hoster/HighWayMe.py b/module/plugins/hoster/HighWayMe.py
index 119ddb70e..53a8960c1 100644
--- a/module/plugins/hoster/HighWayMe.py
+++ b/module/plugins/hoster/HighWayMe.py
@@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import seconds_to_midnight
class HighWayMe(MultiHoster):
__name__ = "HighWayMe"
__type__ = "hoster"
- __version__ = "0.13"
+ __version__ = "0.15"
__status__ = "testing"
__pattern__ = r'https?://.+high-way\.my'
@@ -27,7 +27,7 @@ class HighWayMe(MultiHoster):
def check_errors(self):
if self.html.get('code') == 302: #@NOTE: This is not working. It should by if 302 Moved Temporarily then... But I don't now how to implement it.
- self.account.relogin(self.user)
+ self.account.relogin()
self.retry()
elif "<code>9</code>" in self.html:
@@ -39,7 +39,7 @@ class HighWayMe(MultiHoster):
elif "trafficlimit" in self.html:
self.log_warning(_("Reached daily limit"))
- self.retry(wait_time=seconds_to_midnight(gmt=2), reason="Daily limit for this host reached")
+ self.retry(wait=seconds_to_midnight(), msg="Daily limit for this host reached")
elif "<code>8</code>" in self.html:
self.log_warning(_("Hoster temporarily unavailable, waiting 1 minute and retry"))
diff --git a/module/plugins/hoster/HostujeNet.py b/module/plugins/hoster/HostujeNet.py
index 4dbf550b3..3c0a53535 100644
--- a/module/plugins/hoster/HostujeNet.py
+++ b/module/plugins/hoster/HostujeNet.py
@@ -30,19 +30,19 @@ class HostujeNet(SimpleHoster):
def handle_free(self, pyfile):
m = re.search(r'<script src="([\w^_]+.php)"></script>', self.html)
- if m:
+ if m is not None:
jscript = self.load("http://hostuje.net/" + m.group(1))
m = re.search(r"\('(\w+\.php\?i=\w+)'\);", jscript)
- if m:
+ if m is not None:
self.load("http://hostuje.net/" + m.group(1))
else:
- self.error(_("unexpected javascript format"))
+ self.error(_("Unexpected javascript format"))
else:
- self.error(_("script not found"))
+ self.error(_("Script not found"))
action, inputs = self.parse_html_form(pyfile.url.replace(".", "\.").replace( "?", "\?"))
if not action:
- self.error(_("form not found"))
+ self.error(_("Form not found"))
self.download(action, post=inputs)
diff --git a/module/plugins/hoster/IfolderRu.py b/module/plugins/hoster/IfolderRu.py
index 85d03489d..08e22a9df 100644
--- a/module/plugins/hoster/IfolderRu.py
+++ b/module/plugins/hoster/IfolderRu.py
@@ -45,21 +45,16 @@ class IfolderRu(SimpleHoster):
self.get_fileInfo()
session_id = re.search(self.SESSION_ID_PATTERN, self.html).groups()
-
captcha_url = "http://ints.rusfolder.com/random/images/?session=%s" % session_id
- for _i in xrange(5):
- action, inputs = self.parse_html_form('id="download-step-one-form"')
- inputs['confirmed_number'] = self.captcha.decrypt(captcha_url, cookies=True)
- inputs['action'] = '1'
- self.log_debug(inputs)
-
- self.html = self.load(url, post=inputs)
- if self.WRONG_CAPTCHA_PATTERN in self.html:
- self.captcha.invalid()
- else:
- break
- else:
- self.fail(_("Invalid captcha"))
+
+ action, inputs = self.parse_html_form('id="download-step-one-form"')
+ inputs['confirmed_number'] = self.captcha.decrypt(captcha_url, cookies=True)
+ inputs['action'] = '1'
+ self.log_debug(inputs)
+
+ self.html = self.load(url, post=inputs)
+ if self.WRONG_CAPTCHA_PATTERN in self.html:
+ self.retry_captcha()
self.link = re.search(self.LINK_FREE_PATTERN, self.html).group(1)
diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py
index bf4b157cb..427dbbec7 100644
--- a/module/plugins/hoster/Keep2ShareCc.py
+++ b/module/plugins/hoster/Keep2ShareCc.py
@@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class Keep2ShareCc(SimpleHoster):
__name__ = "Keep2ShareCc"
__type__ = "hoster"
- __version__ = "0.24"
+ __version__ = "0.26"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P<ID>\w+)'
@@ -42,18 +42,18 @@ class Keep2ShareCc(SimpleHoster):
def check_errors(self):
m = re.search(self.TEMP_ERROR_PATTERN, self.html)
- if m:
+ if m is not None:
self.info['error'] = m.group(1)
self.wantReconnect = True
- self.retry(wait_time=30 * 60, reason=m.group(0))
+ self.retry(wait=30 * 60, msg=m.group(0))
m = re.search(self.ERROR_PATTERN, self.html)
- if m:
+ if m is not None:
errmsg = self.info['error'] = m.group(1)
self.error(errmsg)
m = re.search(self.WAIT_PATTERN, self.html)
- if m:
+ if m is not None:
self.log_debug("Hoster told us to wait for %s" % m.group(1))
#: String to time convert courtesy of https://stackoverflow.com/questions/10663720
@@ -61,7 +61,7 @@ class Keep2ShareCc(SimpleHoster):
wait_time = sum(a * b for a, b in zip(ftr, map(int, m.group(1).split(':'))))
self.wantReconnect = True
- self.retry(wait_time=wait_time, reason="Please wait to download this file")
+ self.retry(wait=wait_time, msg="Please wait to download this file")
self.info.pop('error', None)
@@ -95,11 +95,11 @@ class Keep2ShareCc(SimpleHoster):
'yt0' : ''}
m = re.search(r'id="(captcha\-form)"', self.html)
- self.log_debug("captcha-form found %s" % m)
+ self.log_debug("Captcha form found", m)
m = re.search(self.CAPTCHA_PATTERN, self.html)
self.log_debug("CAPTCHA_PATTERN found %s" % m)
- if m:
+ if m is not None:
captcha_url = urlparse.urljoin("http://keep2s.cc/", m.group(1))
post_data['CaptchaForm[code]'] = self.captcha.decrypt(captcha_url)
else:
@@ -110,10 +110,10 @@ class Keep2ShareCc(SimpleHoster):
self.html = self.load(self.pyfile.url, post=post_data)
- if 'verification code is incorrect' not in self.html:
- self.captcha.correct()
+ if 'verification code is incorrect' in self.html:
+ self.retry_captcha()
else:
- self.captcha.invalid()
+ self.captcha.correct()
getInfo = create_getInfo(Keep2ShareCc)
diff --git a/module/plugins/hoster/KingfilesNet.py b/module/plugins/hoster/KingfilesNet.py
index 98f74ad0d..3f7b0bfb9 100644
--- a/module/plugins/hoster/KingfilesNet.py
+++ b/module/plugins/hoster/KingfilesNet.py
@@ -56,7 +56,7 @@ class KingfilesNet(SimpleHoster):
self.error(_("Random key not found"))
rand = m.group(1)
- self.log_debug("rand = ", rand)
+ self.log_debug("rand = " + rand)
post_data = {'op' : "download2",
'id' : self.info['pattern']['ID'],
diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py
index e93b60460..b8a563007 100644
--- a/module/plugins/hoster/LetitbitNet.py
+++ b/module/plugins/hoster/LetitbitNet.py
@@ -35,7 +35,7 @@ def get_info(urls):
class LetitbitNet(SimpleHoster):
__name__ = "LetitbitNet"
__type__ = "hoster"
- __version__ = "0.32"
+ __version__ = "0.33"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?(letitbit|shareflare)\.net/download/.+'
@@ -60,7 +60,7 @@ class LetitbitNet(SimpleHoster):
def handle_free(self, pyfile):
action, inputs = self.parse_html_form('id="ifree_form"')
if not action:
- self.error(_("ifree_form"))
+ self.error(_("Form not found"))
pyfile.size = float(inputs['sssize'])
self.log_debug(action, inputs)
@@ -99,16 +99,12 @@ class LetitbitNet(SimpleHoster):
self.log_debug(res)
- if not res:
- self.captcha.invalid()
+ if not res or res == "error_wrong_captcha":
+ self.retry_captcha()
- if res == "error_free_download_blocked":
+ elif res == "error_free_download_blocked":
self.log_warning(_("Daily limit reached"))
- self.wait(seconds_to_midnight(gmt=2), True)
-
- if res == "error_wrong_captcha":
- self.captcha.invalid()
- self.retry()
+ self.wait(seconds_to_midnight(), True)
elif res.startswith('['):
urls = json_loads(res)
@@ -123,10 +119,9 @@ class LetitbitNet(SimpleHoster):
def handle_premium(self, pyfile):
- api_key = self.user
- premium_key = self.account.get_info(self.user)['login']['password']
+ premium_key = self.account.get_login('password')
- json_data = [api_key, ["download/direct_links", {'pass': premium_key, 'link': pyfile.url}]]
+ json_data = [self.account.user, ["download/direct_links", {'pass': premium_key, 'link': pyfile.url}]]
api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)})
self.log_debug("API Data: " + api_rep)
api_rep = json_loads(api_rep)
diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py
index 1c3f86d4a..f92681f60 100644
--- a/module/plugins/hoster/LinksnappyCom.py
+++ b/module/plugins/hoster/LinksnappyCom.py
@@ -10,7 +10,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
class LinksnappyCom(MultiHoster):
__name__ = "LinksnappyCom"
__type__ = "hoster"
- __version__ = "0.11"
+ __version__ = "0.12"
__status__ = "testing"
__pattern__ = r'https?://(?:[^/]+\.)?linksnappy\.com'
@@ -26,8 +26,8 @@ class LinksnappyCom(MultiHoster):
host = self._get_host(pyfile.url)
json_params = json_dumps({'link' : pyfile.url,
'type' : host,
- 'username': self.user,
- 'password': self.account.get_info(self.user)['login']['password']})
+ 'username': self.account.user,
+ 'password': self.account.get_login('password')})
r = self.load("http://linksnappy.com/api/linkgen",
post={'genLinks': json_params})
diff --git a/module/plugins/hoster/LoadTo.py b/module/plugins/hoster/LoadTo.py
index 7a42e0360..722f0e518 100644
--- a/module/plugins/hoster/LoadTo.py
+++ b/module/plugins/hoster/LoadTo.py
@@ -50,7 +50,7 @@ class LoadTo(SimpleHoster):
#: Set Timer - may be obsolete
m = re.search(self.WAIT_PATTERN, self.html)
- if m:
+ if m is not None:
self.wait(m.group(1))
#: Load.to is using solvemedia captchas since ~july 2014:
diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py
index 788c1aca8..f9c7a89ef 100644
--- a/module/plugins/hoster/LuckyShareNet.py
+++ b/module/plugins/hoster/LuckyShareNet.py
@@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class LuckyShareNet(SimpleHoster):
__name__ = "LuckyShareNet"
__type__ = "hoster"
- __version__ = "0.08"
+ __version__ = "0.10"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?luckyshare\.net/(?P<ID>\d{10,})'
@@ -29,14 +29,14 @@ class LuckyShareNet(SimpleHoster):
if 'AJAX Error' in rep:
html = self.load(self.pyfile.url)
m = re.search(r"waitingtime = (\d+);", html)
- if m:
+ if m is not None:
seconds = int(m.group(1))
self.log_debug("You have to wait %d seconds between free downloads" % seconds)
- self.retry(wait_time=seconds)
+ self.retry(wait=seconds)
else:
self.error(_("Unable to detect wait time between free downloads"))
elif 'Hash expired' in rep:
- self.retry(reason=_("Hash expired"))
+ self.retry(msg=_("Hash expired"))
return json_loads(rep)
@@ -52,24 +52,20 @@ class LuckyShareNet(SimpleHoster):
recaptcha = ReCaptcha(self)
- for _i in xrange(5):
- response, challenge = recaptcha.challenge()
- rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" %
- (challenge, response, json['hash']))
- self.log_debug("JSON: " + rep)
- if 'link' in rep:
- json.update(self.parse_json(rep))
- self.captcha.correct()
- break
- elif 'Verification failed' in rep:
- self.captcha.invalid()
- else:
- self.error(_("Unable to get downlaod link"))
+ response, challenge = recaptcha.challenge()
+ rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" %
+ (challenge, response, json['hash']))
+
+ self.log_debug("JSON: " + rep)
- if not json['link']:
- self.fail(_("No Download url retrieved/all captcha attempts failed"))
+ if 'Verification failed' in rep:
+ self.retry_captcha()
- self.link = json['link']
+ elif 'link' in rep:
+ self.captcha.correct()
+ json.update(self.parse_json(rep))
+ if json['link']:
+ self.link = json['link']
getInfo = create_getInfo(LuckyShareNet)
diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py
index 3ba191160..1abe87cd2 100644
--- a/module/plugins/hoster/MediafireCom.py
+++ b/module/plugins/hoster/MediafireCom.py
@@ -8,10 +8,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class MediafireCom(SimpleHoster):
__name__ = "MediafireCom"
__type__ = "hoster"
- __version__ = "0.90"
+ __version__ = "0.91"
__status__ = "testing"
- __pattern__ = r'https?://(?:www\.)?mediafire\.com/(file/|view/\??|download(\.php\?|/)|\?)(?P<ID>\w{15})'
+ __pattern__ = r'https?://(?:www\.)?mediafire\.com/(file/|view/\??|download(\.php\?|/)|\?)(?P<ID>\w+)'
__config__ = [("use_premium", "bool", "Use premium account if available", True)]
__description__ = """Mediafire.com hoster plugin"""
@@ -69,7 +69,7 @@ class MediafireCom(SimpleHoster):
self.html = self.load(self.link, post={'downloadp': password})
if self.PASSWORD_PATTERN in self.html:
- self.fail(_("Incorrect password"))
+ self.fail(_("Wrong password"))
return super(MediafireCom, self).handle_free(pyfile)
diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py
index 4afba0a3a..0dfc16c34 100644
--- a/module/plugins/hoster/MegaDebridEu.py
+++ b/module/plugins/hoster/MegaDebridEu.py
@@ -48,7 +48,7 @@ class MegaDebridEu(MultiHoster):
Return The debrided link if succeed or original link if fail
"""
if not self.api_load():
- self.error("Unable to connect to remote API")
+ self.error(_("Unable to connect to remote API"))
jsonResponse = self.load(self.API_URL,
get={'action': 'getLink', 'token': self.token},
diff --git a/module/plugins/hoster/MegaRapidCz.py b/module/plugins/hoster/MegaRapidCz.py
index 13f462585..69c1c411b 100644
--- a/module/plugins/hoster/MegaRapidCz.py
+++ b/module/plugins/hoster/MegaRapidCz.py
@@ -22,7 +22,7 @@ def get_info(urls):
class MegaRapidCz(SimpleHoster):
__name__ = "MegaRapidCz"
__type__ = "hoster"
- __version__ = "0.57"
+ __version__ = "0.59"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?(share|mega)rapid\.cz/soubor/\d+/.+'
@@ -54,15 +54,12 @@ class MegaRapidCz(SimpleHoster):
def handle_premium(self, pyfile):
m = re.search(self.LINK_PREMIUM_PATTERN, self.html)
- if m:
+ if m is not None:
self.link = m.group(1)
- else:
- if re.search(self.ERR_LOGIN_PATTERN, self.html):
- self.relogin(self.user)
- self.retry(wait_time=60, reason=_("User login failed"))
- elif re.search(self.ERR_CREDIT_PATTERN, self.html):
- self.fail(_("Not enough credit left"))
+ elif re.search(self.ERR_LOGIN_PATTERN, self.html):
+ self.relogin()
+ self.retry(wait=60, msg=_("User login failed"))
- else:
- self.fail(_("Download link not found"))
+ elif re.search(self.ERR_CREDIT_PATTERN, self.html):
+ self.fail(_("Not enough credit left"))
diff --git a/module/plugins/hoster/MegaRapidoNet.py b/module/plugins/hoster/MegaRapidoNet.py
index 6676a565d..573586639 100644
--- a/module/plugins/hoster/MegaRapidoNet.py
+++ b/module/plugins/hoster/MegaRapidoNet.py
@@ -23,7 +23,7 @@ def random_with_n_digits(n):
class MegaRapidoNet(MultiHoster):
__name__ = "MegaRapidoNet"
__type__ = "hoster"
- __version__ = "0.04"
+ __version__ = "0.05"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?\w+\.megarapido\.net/\?file=\w+'
@@ -42,15 +42,15 @@ class MegaRapidoNet(MultiHoster):
def handle_premium(self, pyfile):
self.html = self.load("http://megarapido.net/gerar.php",
- post={'rand' :random_with_N_digits(16),
- 'urllist' : pyfile.url,
- 'links' : pyfile.url,
- 'exibir' : "normal",
- 'usar' : "premium",
- 'user' : self.account.get_data(self.user).get('sid', None),
- 'autoreset': ""})
+ post={'rand' :random_with_N_digits(16),
+ 'urllist' : pyfile.url,
+ 'links' : pyfile.url,
+ 'exibir' : "normal",
+ 'usar' : "premium",
+ 'user' : self.account.get_data('sid'),
+ 'autoreset': ""})
if "desloga e loga novamente para gerar seus links" in self.html.lower():
- self.error("You have logged in at another place")
+ self.error(_("You have logged in at another place"))
return super(MegaRapidoNet, self).handle_premium(pyfile)
diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py
index b6692263f..b183b882d 100644
--- a/module/plugins/hoster/MegasharesCom.py
+++ b/module/plugins/hoster/MegasharesCom.py
@@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class MegasharesCom(SimpleHoster):
__name__ = "MegasharesCom"
__type__ = "hoster"
- __version__ = "0.29"
+ __version__ = "0.32"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?(d\d{2}\.)?megashares\.com/((index\.php)?\?d\d{2}=|dl/)\w+'
@@ -46,43 +46,40 @@ class MegasharesCom(SimpleHoster):
def handle_free(self, pyfile):
if self.NO_SLOTS_PATTERN in self.html:
- self.retry(wait_time=5 * 60)
+ self.retry(wait=5 * 60)
m = re.search(self.REACTIVATE_PASSPORT_PATTERN, self.html)
- if m:
+ if m is not None:
passport_num = m.group(1)
request_uri = re.search(self.REQUEST_URI_PATTERN, self.html).group(1)
- for _i in xrange(5):
- random_num = re.search(self.REACTIVATE_NUM_PATTERN, self.html).group(1)
+ random_num = re.search(self.REACTIVATE_NUM_PATTERN, self.html).group(1)
- verifyinput = self.captcha.decrypt("http://d01.megashares.com/index.php",
- get={'secgfx': "gfx", 'random_num': random_num})
+ verifyinput = self.captcha.decrypt("http://d01.megashares.com/index.php",
+ get={'secgfx': "gfx", 'random_num': random_num})
- self.log_info(_("Reactivating passport %s: %s %s") % (passport_num, random_num, verifyinput))
+ self.log_info(_("Reactivating passport %s: %s %s") % (passport_num, random_num, verifyinput))
- res = self.load("http://d01.megashares.com%s" % request_uri,
- get={'rs' : "check_passport_renewal",
- 'rsargs[]': verifyinput,
- 'rsargs[]': random_num,
- 'rsargs[]': passport_num,
- 'rsargs[]': "replace_sec_pprenewal",
- 'rsrnd[]' : str(int(time.time() * 1000))})
+ res = self.load("http://d01.megashares.com%s" % request_uri,
+ get={'rs' : "check_passport_renewal",
+ 'rsargs[]': verifyinput,
+ 'rsargs[]': random_num,
+ 'rsargs[]': passport_num,
+ 'rsargs[]': "replace_sec_pprenewal",
+ 'rsrnd[]' : str(int(time.time() * 1000))})
- if 'Thank you for reactivating your passport.' in res:
- self.captcha.correct()
- self.retry()
- else:
- self.captcha.invalid()
+ if 'Thank you for reactivating your passport' in res:
+ self.captcha.correct()
+ self.restart(premium=True)
else:
- self.fail(_("Failed to reactivate passport"))
+ self.retry_captcha(msg=_("Failed to reactivate passport"))
m = re.search(self.PASSPORT_RENEW_PATTERN, self.html)
- if m:
+ if m is not None:
time = [int(x) for x in m.groups()]
renew = time[0] + (time[1] * 60) + (time[2] * 60)
self.log_debug("Waiting %d seconds for a new passport" % renew)
- self.retry(wait_time=renew, reason=_("Passport renewal"))
+ self.retry(wait=renew, msg=_("Passport renewal"))
#: Check traffic left on passport
m = re.search(self.PASSPORT_LEFT_PATTERN, self.html, re.M | re.S)
@@ -94,13 +91,12 @@ class MegasharesCom(SimpleHoster):
self.log_info(_("Data left: %s %s (%d MB needed)") % (m.group(2), m.group(3), self.pyfile.size / 1048576))
if not data_left:
- self.retry(wait_time=600, reason=_("Passport renewal"))
+ self.retry(wait=600, msg=_("Passport renewal"))
self.handle_download(False)
def handle_download(self, premium=False):
- #: Find download link
m = re.search(self.LINK_PATTERN % (1 if premium else 2), self.html)
msg = _('%s download URL' % ('Premium' if premium else 'Free'))
if m is None:
diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py
index 6b69fa9c2..1124dadce 100644
--- a/module/plugins/hoster/MultishareCz.py
+++ b/module/plugins/hoster/MultishareCz.py
@@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class MultishareCz(SimpleHoster):
__name__ = "MultishareCz"
__type__ = "hoster"
- __version__ = "0.42"
+ __version__ = "0.43"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?multishare\.cz/stahnout/(?P<ID>\d+)'
@@ -42,7 +42,7 @@ class MultishareCz(SimpleHoster):
self.check_info()
- if not self.check_traffic_left():
+ if not self.check_traffic():
self.fail(_("Not enough credit left to download file"))
self.download("http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random.random() * 10000 * random.random()),
diff --git a/module/plugins/hoster/MyfastfileCom.py b/module/plugins/hoster/MyfastfileCom.py
index bbd678ba0..ff28d5dfd 100644
--- a/module/plugins/hoster/MyfastfileCom.py
+++ b/module/plugins/hoster/MyfastfileCom.py
@@ -9,7 +9,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
class MyfastfileCom(MultiHoster):
__name__ = "MyfastfileCom"
__type__ = "hoster"
- __version__ = "0.10"
+ __version__ = "0.11"
__status__ = "testing"
__pattern__ = r'http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/dl/'
@@ -27,7 +27,8 @@ class MyfastfileCom(MultiHoster):
def handle_premium(self, pyfile):
self.html = self.load('http://myfastfile.com/api.php',
- get={'user': self.user, 'pass': self.account.get_info(self.user)['login']['password'],
+ get={'user': self.account.user,
+ 'pass': self.account.get_login('password'),
'link': pyfile.url})
self.log_debug("JSON data: " + self.html)
diff --git a/module/plugins/hoster/MystoreTo.py b/module/plugins/hoster/MystoreTo.py
index e4432f491..b23ca10bd 100644
--- a/module/plugins/hoster/MystoreTo.py
+++ b/module/plugins/hoster/MystoreTo.py
@@ -19,7 +19,7 @@ class MystoreTo(SimpleHoster):
__description__ = """Mystore.to hoster plugin"""
__license__ = "GPLv3"
- __authors__ = [("zapp-brannigan", "")]
+ __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")]
NAME_PATTERN = r'<h1>(?P<N>.+?)<'
diff --git a/module/plugins/hoster/NarodRu.py b/module/plugins/hoster/NarodRu.py
index b0d4a4960..bea04c9cd 100644
--- a/module/plugins/hoster/NarodRu.py
+++ b/module/plugins/hoster/NarodRu.py
@@ -34,33 +34,25 @@ class NarodRu(SimpleHoster):
def handle_free(self, pyfile):
- for _i in xrange(5):
- self.html = self.load('http://narod.ru/disk/getcapchaxml/?rnd=%d' % int(random.random() * 777))
+ self.html = self.load('http://narod.ru/disk/getcapchaxml/?rnd=%d' % int(random.random() * 777))
- m = re.search(self.CAPTCHA_PATTERN, self.html)
- if m is None:
- self.error(_("Captcha"))
+ m = re.search(self.CAPTCHA_PATTERN, self.html)
+ if m is None:
+ self.error(_("Captcha"))
- post_data = {'action': "sendcapcha"}
- captcha_url, post_data['key'] = m.groups()
- post_data['rep'] = self.captcha.decrypt(captcha_url)
+ post_data = {'action': "sendcapcha"}
+ captcha_url, post_data['key'] = m.groups()
+ post_data['rep'] = self.captcha.decrypt(captcha_url)
- self.html = self.load(pyfile.url, post=post_data)
+ self.html = self.load(pyfile.url, post=post_data)
- m = re.search(self.LINK_FREE_PATTERN, self.html)
- if m:
- self.link = urlparse.urljoin("http://narod.ru", m.group(1))
- self.captcha.correct()
- break
+ m = re.search(self.LINK_FREE_PATTERN, self.html)
+ if m is not None:
+ self.captcha.correct()
+ self.link = urlparse.urljoin("http://narod.ru/", m.group(1))
- elif u'<b class="error-msg"><strong>ОшОблОсь?</strong>' in self.html:
- self.captcha.invalid()
-
- else:
- self.error(_("Download link"))
-
- else:
- self.fail(_("No valid captcha code entered"))
+ elif u'<b class="error-msg"><strong>ОшОблОсь?</strong>' in self.html:
+ self.retry_captcha()
getInfo = create_getInfo(NarodRu)
diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py
index 9e2a5a93c..8657d4527 100644
--- a/module/plugins/hoster/NoPremiumPl.py
+++ b/module/plugins/hoster/NoPremiumPl.py
@@ -7,7 +7,7 @@ from module.plugins.internal.MultiHoster import MultiHoster
class NoPremiumPl(MultiHoster):
__name__ = "NoPremiumPl"
__type__ = "hoster"
- __version__ = "0.04"
+ __version__ = "0.05"
__status__ = "testing"
__pattern__ = r'https?://direct\.nopremium\.pl.+'
@@ -39,7 +39,7 @@ class NoPremiumPl(MultiHoster):
def prepare(self):
super(NoPremiumPl, self).prepare()
- data = self.account.get_data(self.user)
+ data = self.account.get_data()
self.usr = data['usr']
self.pwd = data['pwd']
@@ -66,14 +66,14 @@ class NoPremiumPl(MultiHoster):
data = self.run_file_query(pyfile.url, 'fileinfo')
except Exception:
- self.log_debug("runFileQuery error")
+ self.log_debug("Query error #1")
self.temp_offline()
try:
parsed = json_loads(data)
except Exception:
- self.log_debug("loads error")
+ self.log_debug("Data not found")
self.temp_offline()
self.log_debug(parsed)
@@ -84,10 +84,8 @@ class NoPremiumPl(MultiHoster):
self.fail(self.ERROR_CODES[parsed['errno']] % self.__name__)
else:
#: Error code isn't yet added to plugin
- self.fail(
- parsed['errstring']
- or _("Unknown error (code: %s)") % parsed['errno']
- )
+ self.fail(parsed['errstring'] or
+ _("Unknown error (code: %s)") % parsed['errno'])
if "sdownload" in parsed:
if parsed['sdownload'] == "1":
@@ -102,5 +100,5 @@ class NoPremiumPl(MultiHoster):
self.link = self.run_file_query(pyfile.url, 'filedownload')
except Exception:
- self.log_debug("runFileQuery error #2")
+ self.log_debug("Query error #2")
self.temp_offline()
diff --git a/module/plugins/hoster/NosuploadCom.py b/module/plugins/hoster/NosuploadCom.py
index 7de26f3fb..45521eebf 100644
--- a/module/plugins/hoster/NosuploadCom.py
+++ b/module/plugins/hoster/NosuploadCom.py
@@ -25,18 +25,18 @@ class NosuploadCom(XFSHoster):
def get_download_link(self):
- #: stage1: press the "Free Download" button
+ #: Stage1: press the "Free Download" button
data = self.get_post_parameters()
self.html = self.load(self.pyfile.url, post=data)
- #: stage2: wait some time and press the "Download File" button
+ #: Stage2: wait some time and press the "Download File" button
data = self.get_post_parameters()
wait_time = re.search(self.WAIT_PATTERN, self.html, re.M | re.S).group(1)
self.log_debug("Hoster told us to wait %s seconds" % wait_time)
self.wait(wait_time)
self.html = self.load(self.pyfile.url, post=data)
- #: stage3: get the download link
+ #: Stage3: get the download link
return re.search(self.LINK_PATTERN, self.html, re.S).group(1)
diff --git a/module/plugins/hoster/NowDownloadSx.py b/module/plugins/hoster/NowDownloadSx.py
index 876a7bcb5..73b0efeaa 100644
--- a/module/plugins/hoster/NowDownloadSx.py
+++ b/module/plugins/hoster/NowDownloadSx.py
@@ -3,7 +3,6 @@
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
-from module.utils import fixup
class NowDownloadSx(SimpleHoster):
@@ -29,7 +28,7 @@ class NowDownloadSx(SimpleHoster):
WAIT_PATTERN = r'\.countdown\(\{until: \+(\d+),'
LINK_FREE_PATTERN = r'(http://s\d+(?:\.coolcdn\.info|\.mighycdndelivery\.com)/nowdownload/.+?)["\']'
- NAME_REPLACEMENTS = [("&#?\w+;", fixup), (r'<.*?>', '')]
+ NAME_REPLACEMENTS = [(r'<.*?>', '')]
def setup(self):
@@ -45,7 +44,7 @@ class NowDownloadSx(SimpleHoster):
self.error()
m = re.search(self.WAIT_PATTERN, self.html)
- if m:
+ if m is not None:
wait = int(m.group(1))
else:
wait = 60
@@ -57,10 +56,8 @@ class NowDownloadSx(SimpleHoster):
self.html = self.load(baseurl + str(continuelink.group(1)))
m = re.search(self.LINK_FREE_PATTERN, self.html)
- if m is None:
- self.error(_("Download link not found"))
-
- self.link = m.group(1)
+ if m is not None:
+ self.link = m.group(1)
getInfo = create_getInfo(NowDownloadSx)
diff --git a/module/plugins/hoster/NowVideoSx.py b/module/plugins/hoster/NowVideoSx.py
index c1f369f2a..b919d74ab 100644
--- a/module/plugins/hoster/NowVideoSx.py
+++ b/module/plugins/hoster/NowVideoSx.py
@@ -37,10 +37,8 @@ class NowVideoSx(SimpleHoster):
self.html = self.load("http://www.nowvideo.sx/mobile/video.php", get={'id': self.info['pattern']['ID']})
m = re.search(self.LINK_FREE_PATTERN, self.html)
- if m is None:
- self.error(_("Free download link not found"))
-
- self.link = m.group(1)
+ if m is not None:
+ self.link = m.group(1)
getInfo = create_getInfo(NowVideoSx)
diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py
index 8420c6f02..77cf6b68f 100644
--- a/module/plugins/hoster/OboomCom.py
+++ b/module/plugins/hoster/OboomCom.py
@@ -13,7 +13,7 @@ from module.plugins.captcha.ReCaptcha import ReCaptcha
class OboomCom(Hoster):
__name__ = "OboomCom"
__type__ = "hoster"
- __version__ = "0.36"
+ __version__ = "0.38"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?oboom\.com/(?:#(?:id=|/)?)?(?P<ID>\w{8})'
@@ -58,7 +58,7 @@ class OboomCom(Hoster):
def get_session_token(self):
if self.premium:
- accountInfo = self.account.get_data(self.user, True)
+ accountInfo = self.account.get_data()
if "session" in accountInfo:
self.session_token = accountInfo['session']
else:
@@ -74,41 +74,36 @@ class OboomCom(Hoster):
def solve_captcha(self):
recaptcha = ReCaptcha(self)
+ response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY)
- for _i in xrange(5):
- response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY)
- apiUrl = "http://www.oboom.com/1.0/download/ticket"
- params = {'recaptcha_challenge_field': challenge,
- 'recaptcha_response_field': response,
- 'download_id': self.file_id,
- 'token': self.session_token}
- result = self.load_url(apiUrl, params)
+ apiUrl = "http://www.oboom.com/1.0/download/ticket"
+ params = {'recaptcha_challenge_field': challenge,
+ 'recaptcha_response_field': response,
+ 'download_id': self.file_id,
+ 'token': self.session_token}
- if result[0] == 200:
- self.download_token = result[1]
- self.download_auth = result[2]
- self.captcha.correct()
- self.wait(30)
- break
-
- elif result[0] == 400:
- if result[1] == "incorrect-captcha-sol":
- self.captcha.invalid()
- elif result[1] == "captcha-timeout":
- self.captcha.invalid()
- elif result[1] == "forbidden":
- self.retry(5, 15 * 60, _("Service unavailable"))
-
- elif result[0] == 403:
+ result = self.load_url(apiUrl, params)
+
+ if result[0] == 200:
+ self.download_token = result[1]
+ self.download_auth = result[2]
+ self.captcha.correct()
+ self.wait(30)
+
+ else:
+ if result[0] == 403:
if result[1] == -1: #: Another download is running
self.set_wait(15 * 60)
else:
self.set_wait(result[1], True)
+
self.wait()
self.retry(5)
- else:
- self.captcha.invalid()
- self.fail(_("Received invalid captcha 5 times"))
+
+ elif result[0] == 400 and result[1] == "forbidden":
+ self.retry(5, 15 * 60, _("Service unavailable"))
+
+ self.retry_captcha()
def get_fileInfo(self, token, fileId):
@@ -141,6 +136,6 @@ class OboomCom(Hoster):
self.download_domain = result[1]
self.download_ticket = result[2]
elif result[0] == 421:
- self.retry(wait_time=result[2] + 60, reason=_("Connection limit exceeded"))
+ self.retry(wait=result[2] + 60, msg=_("Connection limit exceeded"))
else:
self.fail(_("Could not retrieve download ticket. Error code: %s") % result[0])
diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py
index c564dc677..f525e5b33 100644
--- a/module/plugins/hoster/OneFichierCom.py
+++ b/module/plugins/hoster/OneFichierCom.py
@@ -2,13 +2,14 @@
import re
+from module.network.RequestFactory import getURL as get_url
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class OneFichierCom(SimpleHoster):
__name__ = "OneFichierCom"
__type__ = "hoster"
- __version__ = "0.86"
+ __version__ = "0.90"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?(?:(?P<ID1>\w+)\.)?(?P<HOST>1fichier\.com|alterupload\.com|cjoint\.net|d(es)?fichiers\.com|dl4free\.com|megadl\.fr|mesfichiers\.org|piecejointe\.net|pjointe\.com|tenvoi\.com)(?:/\?(?P<ID2>\w+))?'
@@ -28,7 +29,9 @@ class OneFichierCom(SimpleHoster):
COOKIES = [("1fichier.com", "LG", "en")]
- NAME_PATTERN = r'>FileName :</td>\s*<td.*>(?P<N>.+?)<'
+ DIRECT_LINK = True
+
+ NAME_PATTERN = r'>File\s*Name :</td>\s*<td.*>(?P<N>.+?)<'
SIZE_PATTERN = r'>Size :</td>\s*<td.*>(?P<S>[\d.,]+) (?P<U>[\w^_]+)'
OFFLINE_PATTERN = r'File not found !\s*<'
@@ -40,12 +43,66 @@ class OneFichierCom(SimpleHoster):
self.resume_download = True
+ @classmethod
+ def get_info(cls, url="", html=""):
+ redirect = url
+ for i in xrange(10):
+ try:
+ headers = dict(re.findall(r"(?P<name>.+?): (?P<value>.+?)\r?\n", get_url(redirect, just_header=True).lower()))
+ if 'location' in headers and headers['location']:
+ redirect = headers['location']
+ else:
+ if 'content-type' in headers and headers['content-type'] == "application/octet-stream":
+ if "filename=" in headers.get('content-disposition'):
+ name = dict(_i.split("=") for _i in map(str.strip, headers['content-disposition'].split(";"))[1:])['filename'].strip("\"'")
+ else:
+ name = url
+
+ info = {'name' : name,
+ 'size' : long(headers.get('content-length')),
+ 'status': 3,
+ 'url' : url}
+
+ else:
+ info = super(OneFichierCom, cls).get_info(url, html)
+
+ break
+
+ except Exception, e:
+ info = {'status' : 8,
+ 'error' : e.message}
+
+ else:
+ info = {'status' : 8,
+ 'error' : _("Too many redirects")}
+
+ return info
+
+
+ def handle_direct(self, pyfile):
+ redirect = pyfile.url
+ for i in xrange(self.get_config("maxredirs", plugin="UserAgentSwitcher")):
+
+ headers = self.load(redirect, just_header=True)
+ if 'location' in headers and headers['location']:
+ self.log_debug("Redirect #%d to: %s" % (i, redirect))
+ redirect = headers['location']
+ else:
+ if 'content-type' in headers and headers['content-type'] == "application/octet-stream":
+ self.link = pyfile.url
+ break
+ else:
+ self.fail(_("Too many redirects"))
+
+
def handle_free(self, pyfile):
+ self.check_errors()
+
id = self.info['pattern']['ID1'] or self.info['pattern']['ID2']
url, inputs = self.parse_html_form('action="https://1fichier.com/\?%s' % id)
if not url:
- self.fail(_("Download link not found"))
+ return
if "pass" in inputs:
inputs['pass'] = self.get_password()
diff --git a/module/plugins/hoster/OpenloadIo.py b/module/plugins/hoster/OpenloadIo.py
index c46462344..6213a9c09 100644
--- a/module/plugins/hoster/OpenloadIo.py
+++ b/module/plugins/hoster/OpenloadIo.py
@@ -1,31 +1,74 @@
# -*- coding: utf-8 -*-
+import json
+import re
+
+from module.network.RequestFactory import getURL
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class OpenloadIo(SimpleHoster):
__name__ = "OpenloadIo"
__type__ = "hoster"
- __version__ = "0.04"
+ __version__ = "0.07"
__status__ = "testing"
- __pattern__ = r'https?://(?:www\.)?openload\.io/f/[\w_-]{11}'
+ __pattern__ = r'https?://(?:www\.)?openload\.(?:co|io)/f/([\w-_]+)'
- __description__ = """Openload.io hoster plugin"""
+ __description__ = """Openload.co hoster plugin"""
__license__ = "GPLv3"
__authors__ = [(None, None)]
- NAME_PATTERN = r'<span id="filename">(?P<N>.+?)</'
- SIZE_PATTERN = r'<span class="count">(?P<S>[\d.,]+) (?P<U>[\w^_]+)<'
- OFFLINE_PATTERN = r">(We can't find the file you are looking for)"
+ # The API reference, that this implementation uses is available at https://openload.co/api
+ API_URL = 'https://api.openload.co/1'
+
+ _FILE_ID_PATTERN = '/f/([\w-_]+)'
+
+ _DOWNLOAD_TICKET_URI_PATTERN = '/file/dlticket?file={0}'
+ _DOWNLOAD_FILE_URI_PATTERN = '/file/dl?file={0}&ticket={1}'
+ _FILE_INFO_URI_PATTERN = '/file/info?file={0}'
+
+
+ @classmethod
+ def _load_json(cls, uri):
+ return json.loads(getURL(cls.API_URL + uri))
+
+
+ @classmethod
+ def get_info(cls, url="", html=""):
+ file_id = re.findall(cls._FILE_ID_PATTERN, url, re.I)
+ if not file_id:
+ return super(OpenloadIo, cls).get_info(url)
- LINK_FREE_PATTERN = r'id="real\w*download"><a href="(https?://[\w\.]+\.openload\.io/dl/.*?)"'
+ file_id = file_id[0]
+ info_json = cls._load_json(cls._FILE_INFO_URI_PATTERN.format(file_id))
+ file_info = info_json['result'][file_id]
+
+ return {'name' : file_info['name'],
+ 'size' : file_info['size'],
+ 'status': 3 if url.strip() else 8,
+ 'url' : url}
def setup(self):
- self.multiDL = True
+ self.multiDL = True
self.chunk_limit = 1
+ def handle_free(self, pyfile):
+ # If the link is being handled here, then it matches the file_id_pattern,
+ # therefore, we can call [0] safely.
+ file_id = re.findall(self._FILE_ID_PATTERN, pyfile.url, re.I)[0]
+
+ ticket_json = self._load_json(self._DOWNLOAD_TICKET_URI_PATTERN.format(file_id))
+
+ self.wait(ticket_json['result']['wait_time'])
+
+ ticket = ticket_json['result']['ticket']
+
+ download_json = self._load_json(self._DOWNLOAD_FILE_URI_PATTERN.format(file_id, ticket))
+ self.link = download_json['result']['url']
+
+
getInfo = create_getInfo(OpenloadIo)
diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py
index 0b5bab6a5..a2bbfc701 100644
--- a/module/plugins/hoster/OverLoadMe.py
+++ b/module/plugins/hoster/OverLoadMe.py
@@ -11,7 +11,7 @@ from module.utils import parseFileSize as parse_size
class OverLoadMe(MultiHoster):
__name__ = "OverLoadMe"
__type__ = "hoster"
- __version__ = "0.13"
+ __version__ = "0.14"
__status__ = "testing"
__pattern__ = r'https?://.*overload\.me/.+'
@@ -28,7 +28,7 @@ class OverLoadMe(MultiHoster):
def handle_premium(self, pyfile):
- data = self.account.get_data(self.user)
+ data = self.account.get_data()
page = self.load("https://api.over-load.me/getdownload.php",
get={'auth': data['password'],
'link': pyfile.url})
diff --git a/module/plugins/hoster/PornhostCom.py b/module/plugins/hoster/PornhostCom.py
index 8b0a80c7f..e9d199a2e 100644
--- a/module/plugins/hoster/PornhostCom.py
+++ b/module/plugins/hoster/PornhostCom.py
@@ -49,7 +49,7 @@ class PornhostCom(Hoster):
url = re.search(r'"http://file\d+\.pornhost\.com/\d+/.*?"',
self.html) #@TODO: fix this one since it doesn't match
- return url.group(1).strip()
+ return url.group(1)
def get_file_name(self):
diff --git a/module/plugins/hoster/PornhubCom.py b/module/plugins/hoster/PornhubCom.py
index 5345566a1..ce6badedd 100644
--- a/module/plugins/hoster/PornhubCom.py
+++ b/module/plugins/hoster/PornhubCom.py
@@ -67,7 +67,7 @@ class PornhubCom(Hoster):
self.download_html()
m = re.search(r'<title.+?>([^<]+) - ', self.html)
- if m:
+ if m is not None:
name = m.group(1)
else:
matches = re.findall('<h1>(.*?)</h1>', self.html)
diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py
index ec02bb12d..8186c6224 100644
--- a/module/plugins/hoster/PremiumTo.py
+++ b/module/plugins/hoster/PremiumTo.py
@@ -11,7 +11,7 @@ from module.utils import fs_encode
class PremiumTo(MultiHoster):
__name__ = "PremiumTo"
__type__ = "hoster"
- __version__ = "0.25"
+ __version__ = "0.26"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
@@ -37,8 +37,8 @@ class PremiumTo(MultiHoster):
disposition=True)
- def check_file(self):
- if self.check_download({'nopremium': "No premium account available"}):
+ def check_download(self):
+ if self.check_file({'nopremium': "No premium account available"}):
self.retry(60, 5 * 60, "No premium account available")
err = ""
@@ -52,7 +52,7 @@ class PremiumTo(MultiHoster):
if err:
self.fail(err)
- return super(PremiumTo, self).check_file()
+ return super(PremiumTo, self).check_download()
getInfo = create_getInfo(PremiumTo)
diff --git a/module/plugins/hoster/PremiumizeMe.py b/module/plugins/hoster/PremiumizeMe.py
index d968eccec..16c252dc1 100644
--- a/module/plugins/hoster/PremiumizeMe.py
+++ b/module/plugins/hoster/PremiumizeMe.py
@@ -7,7 +7,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
class PremiumizeMe(MultiHoster):
__name__ = "PremiumizeMe"
__type__ = "hoster"
- __version__ = "0.20"
+ __version__ = "0.21"
__status__ = "testing"
__pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate
@@ -44,11 +44,17 @@ class PremiumizeMe(MultiHoster):
status = data['status']
if status == 200:
+ if 'filename' in data['result']:
+ self.pyfile.name = data['result']['filename']
+
+ if 'filesize' in data['result']:
+ self.pyfile.size = data['result']['filesize']
+
self.link = data['result']['location']
return
elif status == 400:
- self.fail(_("Invalid link"))
+ self.fail(_("Invalid url"))
elif status == 404:
self.offline()
diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py
index 4311a82aa..62240667c 100644
--- a/module/plugins/hoster/QuickshareCz.py
+++ b/module/plugins/hoster/QuickshareCz.py
@@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class QuickshareCz(SimpleHoster):
__name__ = "QuickshareCz"
__type__ = "hoster"
- __version__ = "0.57"
+ __version__ = "0.58"
__status__ = "testing"
__pattern__ = r'http://(?:[^/]*\.)?quickshare\.cz/stahnout-soubor/.+'
@@ -39,7 +39,7 @@ class QuickshareCz(SimpleHoster):
if 'UU_prihlasen' in self.jsvars:
if self.jsvars['UU_prihlasen'] == "0":
self.log_warning(_("User not logged in"))
- self.relogin(self.user)
+ self.relogin()
self.retry()
elif float(self.jsvars['UU_kredit']) < float(self.jsvars['kredit_odecet']):
self.log_warning(_("Not enough credit left"))
@@ -50,7 +50,7 @@ class QuickshareCz(SimpleHoster):
else:
self.handle_free(pyfile)
- if self.check_download({'error': re.compile(r"\AChyba!")}, max_size=100):
+ if self.check_file({'error': re.compile(r"\AChyba!")}, max_size=100):
self.fail(_("File not m or plugin defect"))
@@ -69,12 +69,12 @@ class QuickshareCz(SimpleHoster):
if m is None:
self.fail(_("File not found"))
- self.link = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10
+ self.link = m.group(1)
self.log_debug("FREE URL2:" + self.link)
#: Check errors
m = re.search(r'/chyba/(\d+)', self.link)
- if m:
+ if m is not None:
if m.group(1) == "1":
self.retry(60, 2 * 60, "This IP is already downloading")
elif m.group(1) == "2":
diff --git a/module/plugins/hoster/RPNetBiz.py b/module/plugins/hoster/RPNetBiz.py
index 62e6bee4e..cbe3e2a52 100644
--- a/module/plugins/hoster/RPNetBiz.py
+++ b/module/plugins/hoster/RPNetBiz.py
@@ -28,7 +28,6 @@ class RPNetBiz(MultiHoster):
def handle_premium(self, pyfile):
user, info = self.account.select()
- #: Get the download link
res = self.load("https://premium.rpnet.biz/client_api.php",
get={'username': user,
'password': info['login']['password'],
@@ -44,10 +43,10 @@ class RPNetBiz(MultiHoster):
self.wait(30) #: Wait for 30 seconds
#: Lets query the server again asking for the status on the link,
#: We need to keep doing this until we reach 100
- max_tries = 30
+ attemps = 30
my_try = 0
- while (my_try <= max_tries):
- self.log_debug("Try: %d ; Max Tries: %d" % (my_try, max_tries))
+ while (my_try <= attemps):
+ self.log_debug("Try: %d ; Max Tries: %d" % (my_try, attemps))
res = self.load("https://premium.rpnet.biz/client_api.php",
get={'username': user,
'password': info['login']['password'],
@@ -66,7 +65,7 @@ class RPNetBiz(MultiHoster):
self.wait(30)
my_try += 1
- if my_try > max_tries: #: We went over the limit!
+ if my_try > attemps: #: We went over the limit!
self.fail(_("Waited for about 15 minutes for download to finish but failed"))
if 'generated' in link_status:
diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py
index e1a0d278f..a43440e61 100644
--- a/module/plugins/hoster/RapideoPl.py
+++ b/module/plugins/hoster/RapideoPl.py
@@ -7,7 +7,7 @@ from module.plugins.internal.MultiHoster import MultiHoster
class RapideoPl(MultiHoster):
__name__ = "RapideoPl"
__type__ = "hoster"
- __version__ = "0.04"
+ __version__ = "0.05"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
@@ -39,7 +39,7 @@ class RapideoPl(MultiHoster):
def prepare(self):
super(RapideoPl, self).prepare()
- data = self.account.get_data(self.user)
+ data = self.account.get_data()
self.usr = data['usr']
self.pwd = data['pwd']
@@ -84,10 +84,8 @@ class RapideoPl(MultiHoster):
self.fail(self.ERROR_CODES[parsed['errno']] % self.__name__)
else:
#: Error code isn't yet added to plugin
- self.fail(
- parsed['errstring']
- or _("Unknown error (code: %s)") % parsed['errno']
- )
+ self.fail(parsed['errstring'] or
+ _("Unknown error (code: %s)") % parsed['errno'])
if "sdownload" in parsed:
if parsed['sdownload'] == "1":
diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py
index 636ea1bcc..711f33e87 100644
--- a/module/plugins/hoster/RapidgatorNet.py
+++ b/module/plugins/hoster/RapidgatorNet.py
@@ -14,7 +14,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class RapidgatorNet(SimpleHoster):
__name__ = "RapidgatorNet"
__type__ = "hoster"
- __version__ = "0.35"
+ __version__ = "0.36"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?(rapidgator\.net|rg\.to)/file/\w+'
@@ -51,7 +51,7 @@ class RapidgatorNet(SimpleHoster):
def setup(self):
if self.account:
- self.sid = self.account.get_data(self.user).get('sid', None)
+ self.sid = self.account.get_data('sid')
else:
self.sid = None
@@ -81,12 +81,12 @@ class RapidgatorNet(SimpleHoster):
return json['response']
elif status == 423:
- self.account.empty(self.user)
+ self.account.empty()
self.retry()
else:
- self.account.relogin(self.user)
- self.retry(wait_time=60)
+ self.account.relogin()
+ self.retry(wait=60)
def handle_premium(self, pyfile):
@@ -122,29 +122,25 @@ class RapidgatorNet(SimpleHoster):
url = "http://rapidgator.net%s" % jsvars.get('captchaUrl', '/download/captcha')
self.html = self.load(url)
- for _i in xrange(5):
- m = re.search(self.LINK_FREE_PATTERN, self.html)
- if m:
- self.link = m.group(1)
- break
- else:
- captcha = self.handle_captcha()
+ m = re.search(self.LINK_FREE_PATTERN, self.html)
+ if m is not None:
+ self.link = m.group(1)
+ else:
+ captcha = self.handle_captcha()
- if not captcha:
- self.error(_("Captcha pattern not found"))
+ if not captcha:
+ self.error(_("Captcha pattern not found"))
- response, challenge = captcha.challenge()
+ response, challenge = captcha.challenge()
- self.html = self.load(url, post={'DownloadCaptchaForm[captcha]': "",
- 'adcopy_challenge' : challenge,
- 'adcopy_response' : response})
+ self.html = self.load(url, post={'DownloadCaptchaForm[captcha]': "",
+ 'adcopy_challenge' : challenge,
+ 'adcopy_response' : response})
- if "The verification code is incorrect" in self.html:
- self.captcha.invalid()
- else:
- self.captcha.correct()
- else:
- self.error(_("Download link"))
+ if "The verification code is incorrect" in self.html:
+ self.retry_captcha()
+ else:
+ self.captcha.correct()
def handle_captcha(self):
diff --git a/module/plugins/hoster/RapiduNet.py b/module/plugins/hoster/RapiduNet.py
index 267f41f36..99c877226 100644
--- a/module/plugins/hoster/RapiduNet.py
+++ b/module/plugins/hoster/RapiduNet.py
@@ -20,7 +20,7 @@ class RapiduNet(SimpleHoster):
__description__ = """Rapidu.net hoster plugin"""
__license__ = "GPLv3"
- __authors__ = [("prOq", "")]
+ __authors__ = [("prOq", None)]
COOKIES = [("rapidu.net", "rapidu_lang", "en")]
diff --git a/module/plugins/hoster/RehostTo.py b/module/plugins/hoster/RehostTo.py
index 6f0645e9f..af8ba3fd9 100644
--- a/module/plugins/hoster/RehostTo.py
+++ b/module/plugins/hoster/RehostTo.py
@@ -8,7 +8,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
class RehostTo(MultiHoster):
__name__ = "RehostTo"
__type__ = "hoster"
- __version__ = "0.23"
+ __version__ = "0.24"
__status__ = "testing"
__pattern__ = r'https?://.*rehost\.to\..+'
@@ -23,7 +23,7 @@ class RehostTo(MultiHoster):
def handle_premium(self, pyfile):
self.download("http://rehost.to/process_download.php",
get={'user': "cookie",
- 'pass': self.account.get_data(self.user)['session'],
+ 'pass': self.account.get_data('session'),
'dl' : pyfile.url},
disposition=True)
diff --git a/module/plugins/hoster/SendspaceCom.py b/module/plugins/hoster/SendspaceCom.py
index 13dd20b7c..ece048ed9 100644
--- a/module/plugins/hoster/SendspaceCom.py
+++ b/module/plugins/hoster/SendspaceCom.py
@@ -30,32 +30,31 @@ class SendspaceCom(SimpleHoster):
def handle_free(self, pyfile):
- params = {}
- for _i in xrange(3):
- m = re.search(self.LINK_FREE_PATTERN, self.html)
- if m:
- if 'captcha_hash' in params:
- self.captcha.correct()
- self.link = m.group(1)
- break
+ m = re.search(self.LINK_FREE_PATTERN, self.html)
+ if m is not None:
+ self.link = m.group(1)
+ else:
m = re.search(self.CAPTCHA_PATTERN, self.html)
- if m:
- if 'captcha_hash' in params:
- self.captcha.invalid()
+ if m is None:
+ params = {'download': "Regular Download"}
+ else:
captcha_url1 = "http://www.sendspace.com/" + m.group(1)
m = re.search(self.USER_CAPTCHA_PATTERN, self.html)
captcha_url2 = "http://www.sendspace.com/" + m.group(1)
params = {'captcha_hash': m.group(2),
'captcha_submit': 'Verify',
'captcha_answer': self.captcha.decrypt(captcha_url1) + " " + self.captcha.decrypt(captcha_url2)}
- else:
- params = {'download': "Regular Download"}
self.log_debug(params)
+
self.html = self.load(pyfile.url, post=params)
- else:
- self.fail(_("Download link not found"))
+
+ m = re.search(self.LINK_FREE_PATTERN, self.html)
+ if m is None:
+ self.retry_captcha()
+ else:
+ self.link = m.group(1)
getInfo = create_getInfo(SendspaceCom)
diff --git a/module/plugins/hoster/Share4WebCom.py b/module/plugins/hoster/Share4WebCom.py
index 3f128be5e..898e12927 100644
--- a/module/plugins/hoster/Share4WebCom.py
+++ b/module/plugins/hoster/Share4WebCom.py
@@ -7,7 +7,7 @@ from module.plugins.internal.SimpleHoster import create_getInfo
class Share4WebCom(UnibytesCom):
__name__ = "Share4WebCom"
__type__ = "hoster"
- __version__ = "0.12"
+ __version__ = "0.13"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?share4web\.com/get/\w+'
@@ -17,7 +17,7 @@ class Share4WebCom(UnibytesCom):
__authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
- HOSTER_DOMAIN = "share4web.com"
+ PLUGIN_DOMAIN = "share4web.com"
getInfo = create_getInfo(Share4WebCom)
diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py
index b5af3ea35..2223068e5 100644
--- a/module/plugins/hoster/ShareonlineBiz.py
+++ b/module/plugins/hoster/ShareonlineBiz.py
@@ -3,7 +3,6 @@
import re
import time
import urllib
-import urlparse
from module.network.RequestFactory import getURL as get_url
from module.plugins.captcha.ReCaptcha import ReCaptcha
@@ -13,7 +12,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class ShareonlineBiz(SimpleHoster):
__name__ = "ShareonlineBiz"
__type__ = "hoster"
- __version__ = "0.55"
+ __version__ = "0.58"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P<ID>\w+)'
@@ -68,25 +67,20 @@ class ShareonlineBiz(SimpleHoster):
def handle_captcha(self):
recaptcha = ReCaptcha(self)
-
- for _i in xrange(5):
- response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY)
-
- m = re.search(r'var wait=(\d+);', self.html)
- self.set_wait(int(m.group(1)) if m else 30)
-
- res = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time.time() * 1000)),
- post={'dl_free' : "1",
- 'recaptcha_challenge_field': challenge,
- 'recaptcha_response_field' : response})
- if not res == "0":
- self.captcha.correct()
- return res
- else:
- self.captcha.invalid()
+ response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY)
+
+ m = re.search(r'var wait=(\d+);', self.html)
+ self.set_wait(int(m.group(1)) if m else 30)
+
+ res = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time.time() * 1000)),
+ post={'dl_free' : "1",
+ 'recaptcha_challenge_field': challenge,
+ 'recaptcha_response_field' : response})
+ if res != "0":
+ self.captcha.correct()
+ return res
else:
- self.captcha.invalid()
- self.fail(_("No valid captcha solution received"))
+ self.retry_captcha()
def handle_free(self, pyfile):
@@ -101,30 +95,28 @@ class ShareonlineBiz(SimpleHoster):
self.link = res.decode('base64')
if not self.link.startswith("http://"):
- self.error(_("Wrong download url"))
+ self.error(_("Invalid url"))
self.wait()
- def check_file(self):
- check = self.check_download({'cookie': re.compile(r'<div id="dl_failure"'),
+ def check_download(self):
+ check = self.check_file({'cookie': re.compile(r'<div id="dl_failure"'),
'fail' : re.compile(r"<title>Share-Online")})
if check == "cookie":
- self.captcha.invalid()
- self.retry(5, 60, _("Cookie failure"))
+ self.retry_captcha(5, 60, _("Cookie failure"))
elif check == "fail":
- self.captcha.invalid()
- self.retry(5, 5 * 60, _("Download failed"))
+ self.retry_captcha(5, 5 * 60, _("Download failed"))
- return super(ShareonlineBiz, self).check_file()
+ return super(ShareonlineBiz, self).check_download()
def handle_premium(self, pyfile): #: Should be working better loading (account) api internally
html = self.load("https://api.share-online.biz/account.php",
- get={'username': self.user,
- 'password': self.account.get_info(self.user)['login']['password'],
+ get={'username': self.account.user,
+ 'password': self.account.get_login('password'),
'act' : "download",
'lid' : self.info['fileid']})
@@ -136,7 +128,7 @@ class ShareonlineBiz(SimpleHoster):
self.log_debug(dlinfo)
- if not dlinfo['status'] == "online":
+ if dlinfo['status'] != "online":
self.offline()
else:
pyfile.name = dlinfo['name']
@@ -160,6 +152,7 @@ class ShareonlineBiz(SimpleHoster):
try:
self.log_error(errmsg, re.search(self.ERROR_PATTERN, self.html).group(1))
+
except Exception:
self.log_error(_("Unknown error occurred"), errmsg)
@@ -170,18 +163,18 @@ class ShareonlineBiz(SimpleHoster):
self.fail(_("Premium account needed"))
elif errmsg in ("expired", "server"):
- self.retry(wait_time=600, reason=errmsg)
+ self.retry(wait=600, msg=errmsg)
elif errmsg == "full":
self.retry(10, 600, _("Server is full"))
elif 'slot' in errmsg:
- self.wantReconnect = True
- self.retry(24, 3600, errmsg)
+ self.wait(3600, reconnect=True)
+ self.restart(errmsg, premium=True)
else:
- self.wantReconnect = True
- self.retry(wait_time=60, reason=errmsg)
+ self.wait(60, reconnect=True)
+ self.restart(errmsg, premium=True)
getInfo = create_getInfo(ShareonlineBiz)
diff --git a/module/plugins/hoster/ShareplaceCom.py b/module/plugins/hoster/ShareplaceCom.py
index 11aef0c90..6b4cfed2b 100644
--- a/module/plugins/hoster/ShareplaceCom.py
+++ b/module/plugins/hoster/ShareplaceCom.py
@@ -40,7 +40,7 @@ class ShareplaceCom(Hoster):
#: var zzipitime = 15
m = re.search(r'var zzipitime = (\d+);', self.html)
- if m:
+ if m is not None:
sec = int(m.group(1))
else:
sec = 0
diff --git a/module/plugins/hoster/SimplyPremiumCom.py b/module/plugins/hoster/SimplyPremiumCom.py
index be1578bfb..8e3890fb8 100644
--- a/module/plugins/hoster/SimplyPremiumCom.py
+++ b/module/plugins/hoster/SimplyPremiumCom.py
@@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import seconds_to_midnight
class SimplyPremiumCom(MultiHoster):
__name__ = "SimplyPremiumCom"
__type__ = "hoster"
- __version__ = "0.10"
+ __version__ = "0.12"
__status__ = "testing"
__pattern__ = r'https?://.+simply-premium\.com'
@@ -28,7 +28,7 @@ class SimplyPremiumCom(MultiHoster):
def check_errors(self):
if '<valid>0</valid>' in self.html or (
"You are not allowed to download from this host" in self.html and self.premium):
- self.account.relogin(self.user)
+ self.account.relogin()
self.retry()
elif "NOTFOUND" in self.html:
@@ -40,7 +40,7 @@ class SimplyPremiumCom(MultiHoster):
elif "trafficlimit" in self.html:
self.log_warning(_("Reached daily limit for this host"))
- self.retry(wait_time=seconds_to_midnight(gmt=2), reason="Daily limit for this host reached")
+ self.retry(wait=seconds_to_midnight(), msg="Daily limit for this host reached")
elif "hostererror" in self.html:
self.log_warning(_("Hoster temporarily unavailable, waiting 1 minute and retry"))
diff --git a/module/plugins/hoster/SimplydebridCom.py b/module/plugins/hoster/SimplydebridCom.py
index 829609228..d26439d68 100644
--- a/module/plugins/hoster/SimplydebridCom.py
+++ b/module/plugins/hoster/SimplydebridCom.py
@@ -8,7 +8,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo, rep
class SimplydebridCom(MultiHoster):
__name__ = "SimplydebridCom"
__type__ = "hoster"
- __version__ = "0.20"
+ __version__ = "0.21"
__status__ = "testing"
__pattern__ = r'http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/sd\.php'
@@ -41,11 +41,11 @@ class SimplydebridCom(MultiHoster):
self.wait(5)
- def check_file(self):
- if self.check_download({'error': "No address associated with hostname"}):
+ def check_download(self):
+ if self.check_file({'error': "No address associated with hostname"}):
self.retry(24, 3 * 60, _("Bad file downloaded"))
- return super(SimplydebridCom, self).check_file()
+ return super(SimplydebridCom, self).check_download()
getInfo = create_getInfo(SimplydebridCom)
diff --git a/module/plugins/hoster/SizedriveCom.py b/module/plugins/hoster/SizedriveCom.py
index 8bfe46e86..d0db9985b 100644
--- a/module/plugins/hoster/SizedriveCom.py
+++ b/module/plugins/hoster/SizedriveCom.py
@@ -35,7 +35,7 @@ class SizedriveCom(SimpleHoster):
post={'id': self.info['pattern']['ID']})
m = re.search(r'<span id="boton_download" ><a href="(.+?)"', self.html)
- if m:
+ if m is not None:
self.link = m.group(1)
diff --git a/module/plugins/hoster/SmoozedCom.py b/module/plugins/hoster/SmoozedCom.py
index 33d098a00..e864bb2c0 100644
--- a/module/plugins/hoster/SmoozedCom.py
+++ b/module/plugins/hoster/SmoozedCom.py
@@ -7,7 +7,7 @@ from module.plugins.internal.MultiHoster import MultiHoster
class SmoozedCom(MultiHoster):
__name__ = "SmoozedCom"
__type__ = "hoster"
- __version__ = "0.08"
+ __version__ = "0.09"
__status__ = "testing"
__pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate
@@ -16,7 +16,7 @@ class SmoozedCom(MultiHoster):
__description__ = """Smoozed.com hoster plugin"""
__license__ = "GPLv3"
- __authors__ = [("", "")]
+ __authors__ = [(None, None)]
FILE_ERRORS = [("Error", r'{"state":"error"}'),
@@ -36,7 +36,7 @@ class SmoozedCom(MultiHoster):
pyfile.name = ".".join(temp)
#: Check the link
- get_data = {'session_key': self.account.get_data(self.user)['session'],
+ get_data = {'session_key': self.account.get_data('session'),
'url' : pyfile.url}
data = json_loads(self.load("http://www2.smoozed.com/api/check", get=get_data))
diff --git a/module/plugins/hoster/SpeedyshareCom.py b/module/plugins/hoster/SpeedyshareCom.py
index 7d7a60f04..4a71c179d 100644
--- a/module/plugins/hoster/SpeedyshareCom.py
+++ b/module/plugins/hoster/SpeedyshareCom.py
@@ -4,7 +4,6 @@
# http://speedy.sh/ep2qY/Zapp-Brannigan.jpg
import re
-import urlparse
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py
index d323a214b..d20d1cadd 100644
--- a/module/plugins/hoster/TurbobitNet.py
+++ b/module/plugins/hoster/TurbobitNet.py
@@ -10,13 +10,14 @@ import urllib
from Crypto.Cipher import ARC4
from module.plugins.captcha.ReCaptcha import ReCaptcha
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp
+from module.plugins.internal.Plugin import timestamp
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class TurbobitNet(SimpleHoster):
__name__ = "TurbobitNet"
__type__ = "hoster"
- __version__ = "0.21"
+ __version__ = "0.22"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?turbobit\.net/(?:download/free/)?(?P<ID>\w+)'
@@ -56,64 +57,64 @@ class TurbobitNet(SimpleHoster):
self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With:"])
m = re.search(self.LINK_FREE_PATTERN, self.html)
- if m:
+ if m is not None:
self.link = m.group(1)
def solve_captcha(self):
- for _i in xrange(5):
- m = re.search(self.LIMIT_WAIT_PATTERN, self.html)
- if m:
- wait_time = int(m.group(1))
- self.wait(wait_time, wait_time > 60)
- self.retry()
+ m = re.search(self.LIMIT_WAIT_PATTERN, self.html)
+ if m is not None:
+ wait_time = int(m.group(1))
+ self.wait(wait_time, wait_time > 60)
+ self.retry()
- action, inputs = self.parse_html_form("action='#'")
- if not inputs:
- self.error(_("Captcha form not found"))
- self.log_debug(inputs)
+ action, inputs = self.parse_html_form("action='#'")
+ if not inputs:
+ self.error(_("Captcha form not found"))
- if inputs['captcha_type'] == "recaptcha":
- recaptcha = ReCaptcha(self)
- inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge()
- else:
- m = re.search(self.CAPTCHA_PATTERN, self.html)
- if m is None:
- self.error(_("captcha"))
- captcha_url = m.group(1)
- inputs['captcha_response'] = self.captcha.decrypt(captcha_url)
+ self.log_debug(inputs)
- self.log_debug(inputs)
- self.html = self.load(self.url, post=inputs)
+ if inputs['captcha_type'] == "recaptcha":
+ recaptcha = ReCaptcha(self)
+ inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge()
+ else:
+ m = re.search(self.CAPTCHA_PATTERN, self.html)
+ if m is None:
+ self.error(_("Captcha pattern not found"))
+ captcha_url = m.group(1)
+ inputs['captcha_response'] = self.captcha.decrypt(captcha_url)
- if '<div class="captcha-error">Incorrect, try again!<' in self.html:
- self.captcha.invalid()
- else:
- self.captcha.correct()
- break
+ self.log_debug(inputs)
+
+ self.html = self.load(self.url, post=inputs)
+
+ if '<div class="captcha-error">Incorrect, try again' in self.html:
+ self.retry_captcha()
else:
- self.fail(_("Invalid captcha"))
+ self.captcha.correct()
def get_rt_update(self):
rtUpdate = self.retrieve("rtUpdate")
- if not rtUpdate:
- if self.retrieve("version") is not self.__version__ \
- or int(self.retrieve("timestamp", 0)) + 86400000 < timestamp():
- #: that's right, we are even using jdownloader updates
- rtUpdate = self.load("http://update0.jdownloader.org/pluginstuff/tbupdate.js")
- rtUpdate = self.decrypt(rtUpdate.splitlines()[1])
- #: But we still need to fix the syntax to work with other engines than rhino
- rtUpdate = re.sub(r'for each\(var (\w+) in(\[[^\]]+\])\)\{',
- r'zza=\2;for(var zzi=0;zzi<zza.length;zzi++){\1=zza[zzi];', rtUpdate)
- rtUpdate = re.sub(r"for\((\w+)=", r"for(var \1=", rtUpdate)
-
- self.store("rtUpdate", rtUpdate)
- self.store("timestamp", timestamp())
- self.store("version", self.__version__)
- else:
- self.log_error(_("Unable to download, wait for update..."))
- self.temp_offline()
+ if rtUpdate:
+ return rtUpdate
+
+ if self.retrieve("version") is not self.__version__ or \
+ int(self.retrieve("timestamp", 0)) + 86400000 < timestamp():
+ #: that's right, we are even using jdownloader updates
+ rtUpdate = self.load("http://update0.jdownloader.org/pluginstuff/tbupdate.js")
+ rtUpdate = self.decrypt(rtUpdate.splitlines()[1])
+ #: But we still need to fix the syntax to work with other engines than rhino
+ rtUpdate = re.sub(r'for each\(var (\w+) in(\[[^\]]+\])\)\{',
+ r'zza=\2;for(var zzi=0;zzi<zza.length;zzi++){\1=zza[zzi];', rtUpdate)
+ rtUpdate = re.sub(r"for\((\w+)=", r"for(var \1=", rtUpdate)
+
+ self.store("rtUpdate", rtUpdate)
+ self.store("timestamp", timestamp())
+ self.store("version", self.__version__)
+ else:
+ self.log_error(_("Unable to download, wait for update..."))
+ self.temp_offline()
return rtUpdate
@@ -122,7 +123,7 @@ class TurbobitNet(SimpleHoster):
self.req.http.lastURL = self.url
m = re.search("(/\w+/timeout\.js\?\w+=)([^\"\'<>]+)", self.html)
- if m:
+ if m is not None:
url = "http://turbobit.net%s%s" % m.groups()
else:
url = "http://turbobit.net/files/timeout.js?ver=%s" % "".join(random.choice('0123456789ABCDEF') for _i in xrange(32))
diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py
index b402433a4..cc07770d4 100644
--- a/module/plugins/hoster/UlozTo.py
+++ b/module/plugins/hoster/UlozTo.py
@@ -15,7 +15,7 @@ def convert_decimal_prefix(m):
class UlozTo(SimpleHoster):
__name__ = "UlozTo"
__type__ = "hoster"
- __version__ = "1.13"
+ __version__ = "1.16"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(?:live/)?(?P<ID>\w+/[^/?]*)'
@@ -26,8 +26,7 @@ class UlozTo(SimpleHoster):
__authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
- INFO_PATTERN = r'<p>File <strong>(?P<N>[^<]+)</strong> is password protected</p>'
- NAME_PATTERN = r'<title>(?P<N>[^<]+) \| Uloz\.to</title>'
+ NAME_PATTERN = r'(<p>File <strong>|<title>)(?P<N>.+?)(<| \|)'
SIZE_PATTERN = r'<span id="fileSize">.*?(?P<S>[\d.,]+\s[kMG]?B)</span>'
OFFLINE_PATTERN = r'<title>404 - Page not found</title>|<h1 class="h1">File (has been deleted|was banned)</h1>'
@@ -53,7 +52,7 @@ class UlozTo(SimpleHoster):
if not action or not inputs:
self.error(_("Free download form not found"))
- self.log_debug("inputs.keys = " + str(inputs.keys()))
+ self.log_debug("inputs.keys = %s" % inputs.keys())
#: Get and decrypt captcha
if all(key in inputs for key in ("captcha_value", "captcha_id", "captcha_key")):
#: Old version - last seen 9.12.2013
@@ -68,8 +67,10 @@ class UlozTo(SimpleHoster):
#: New version - better to get new parameters (like captcha reload) because of image url - since 6.12.2013
self.log_debug('Using "new" version')
- xapca = self.load("http://www.ulozto.net/reloadXapca.php", get={'rnd': str(int(time.time()))})
- self.log_debug("xapca = " + str(xapca))
+ xapca = self.load("http://www.ulozto.net/reloadXapca.php",
+ get={'rnd': str(int(time.time()))})
+ xapca = xapca.replace('sound":"', 'sound":"http:').replace('image":"', 'image":"http:')
+ self.log_debug("xapca = %s" % xapca)
data = json_loads(xapca)
captcha_value = self.captcha.decrypt(str(data['image']))
@@ -109,7 +110,7 @@ class UlozTo(SimpleHoster):
post={'password': password, 'password_send': 'Send'})
if self.PASSWD_PATTERN in self.html:
- self.fail(_("Incorrect password"))
+ self.fail(_("Wrong password"))
else:
self.fail(_("No password found"))
@@ -119,9 +120,9 @@ class UlozTo(SimpleHoster):
return super(UlozTo, self).check_errors()
- def check_file(self):
- check = self.check_download({
- 'wrong_captcha': re.compile(r'<ul class="error">\s*<li>Error rewriting the text.</li>'),
+ def check_download(self):
+ check = self.check_file({
+ 'wrong_captcha': ">An error ocurred while verifying the user",
'offline' : re.compile(self.OFFLINE_PATTERN),
'passwd' : self.PASSWD_PATTERN,
'server_error' : 'src="http://img.ulozto.cz/error403/vykricnik.jpg"', #: Paralell dl, server overload etc.
@@ -129,8 +130,7 @@ class UlozTo(SimpleHoster):
})
if check == "wrong_captcha":
- self.captcha.invalid()
- self.retry(reason=_("Wrong captcha code"))
+ self.retry_captcha()
elif check == "offline":
self.offline()
@@ -147,7 +147,7 @@ class UlozTo(SimpleHoster):
elif check == "not_found":
self.fail(_("Server error, file not downloadable"))
- return super(UlozTo, self).check_file()
+ return super(UlozTo, self).check_download()
getInfo = create_getInfo(UlozTo)
diff --git a/module/plugins/hoster/UloziskoSk.py b/module/plugins/hoster/UloziskoSk.py
index 7cbcb4d40..5bbbb1f7c 100644
--- a/module/plugins/hoster/UloziskoSk.py
+++ b/module/plugins/hoster/UloziskoSk.py
@@ -35,7 +35,7 @@ class UloziskoSk(SimpleHoster):
self.get_fileInfo()
m = re.search(self.IMG_PATTERN, self.html)
- if m:
+ if m is not None:
self.link = "http://ulozisko.sk" + m.group(1)
else:
self.handle_free(pyfile)
@@ -58,7 +58,7 @@ class UloziskoSk(SimpleHoster):
if m is None:
self.error(_("CAPTCHA_PATTERN not found"))
- captcha_url = urlparse.urljoin("http://www.ulozisko.sk", m.group(1))
+ captcha_url = urlparse.urljoin("http://www.ulozisko.sk/", m.group(1))
captcha = self.captcha.decrypt(captcha_url, cookies=True)
self.log_debug("CAPTCHA_URL:" + captcha_url + ' CAPTCHA:' + captcha)
diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py
index ac2589f47..50006dd27 100644
--- a/module/plugins/hoster/UnibytesCom.py
+++ b/module/plugins/hoster/UnibytesCom.py
@@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class UnibytesCom(SimpleHoster):
__name__ = "UnibytesCom"
__type__ = "hoster"
- __version__ = "0.14"
+ __version__ = "0.15"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?unibytes\.com/[\w .-]{11}B'
@@ -21,7 +21,7 @@ class UnibytesCom(SimpleHoster):
__authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
- HOSTER_DOMAIN = "unibytes.com"
+ PLUGIN_DOMAIN = "unibytes.com"
INFO_PATTERN = r'<span[^>]*?id="fileName".*?>(?P<N>[^>]+)</span>\s*\((?P<S>\d.*?)\)'
@@ -30,7 +30,7 @@ class UnibytesCom(SimpleHoster):
def handle_free(self, pyfile):
- domain = "http://www.%s/" % self.HOSTER_DOMAIN
+ domain = "http://www.%s/" % self.PLUGIN_DOMAIN
action, post_data = self.parse_html_form('id="startForm"')
self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0)
@@ -40,7 +40,7 @@ class UnibytesCom(SimpleHoster):
self.html = self.load(urlparse.urljoin(domain, action), post=post_data)
m = re.search(r'location:\s*(\S+)', self.req.http.header, re.I)
- if m:
+ if m is not None:
self.link = m.group(1)
break
@@ -50,12 +50,12 @@ class UnibytesCom(SimpleHoster):
if post_data['step'] == "last":
m = re.search(self.LINK_FREE_PATTERN, self.html)
- if m:
- self.link = m.group(1)
+ if m is not None:
self.captcha.correct()
+ self.link = m.group(1)
break
else:
- self.captcha.invalid()
+ self.retry_captcha()
last_step = post_data['step']
action, post_data = self.parse_html_form('id="stepForm"')
@@ -65,7 +65,7 @@ class UnibytesCom(SimpleHoster):
self.wait(m.group(1) if m else 60, False)
elif last_step in ("captcha", "last"):
- post_data['captcha'] = self.captcha.decrypt(urlparse.urljoin(domain, "/captcha.jpg"))
+ post_data['captcha'] = self.captcha.decrypt(urlparse.urljoin(domain, "captcha.jpg"))
else:
self.fail(_("No valid captcha code entered"))
diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py
index db9517f42..9c422ce01 100644
--- a/module/plugins/hoster/UpleaCom.py
+++ b/module/plugins/hoster/UpleaCom.py
@@ -9,7 +9,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo
class UpleaCom(XFSHoster):
__name__ = "UpleaCom"
__type__ = "hoster"
- __version__ = "0.12"
+ __version__ = "0.13"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?uplea\.com/dl/\w{15}'
@@ -20,7 +20,7 @@ class UpleaCom(XFSHoster):
("GammaC0de", None)]
- HOSTER_DOMAIN = "uplea.com"
+ PLUGIN_DOMAIN = "uplea.com"
SIZE_REPLACEMENTS = [('ko','KB'), ('mo','MB'), ('go','GB'), ('Ko','KB'), ('Mo','MB'), ('Go','GB')]
@@ -49,7 +49,7 @@ class UpleaCom(XFSHoster):
self.html = self.load(urlparse.urljoin("http://uplea.com/", m.group(1)))
m = re.search(self.WAIT_PATTERN, self.html)
- if m:
+ if m is not None:
self.log_debug("Waiting %s seconds" % m.group(1))
self.wait(m.group(1), True)
self.retry()
diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py
index 88d79e9ba..a3d54e8ef 100644
--- a/module/plugins/hoster/UploadableCh.py
+++ b/module/plugins/hoster/UploadableCh.py
@@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class UploadableCh(SimpleHoster):
__name__ = "UploadableCh"
__type__ = "hoster"
- __version__ = "0.12"
+ __version__ = "0.13"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?uploadable\.ch/file/(?P<ID>\w+)'
@@ -65,13 +65,13 @@ class UploadableCh(SimpleHoster):
self.download(pyfile.url, post={'download': "normal"}, disposition=True)
- def check_file(self):
- if self.check_download({'wait': re.compile("Please wait for")}):
+ def check_download(self):
+ if self.check_file({'wait': re.compile("Please wait for")}):
self.log_info(_("Downloadlimit reached, please wait or reconnect"))
self.wait(60 * 60, True)
self.retry()
- return super(UploadableCh, self).check_file()
+ return super(UploadableCh, self).check_download()
getInfo = create_getInfo(UploadableCh)
diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py
index c90f2bb0f..a3b9fbc2f 100644
--- a/module/plugins/hoster/UploadedTo.py
+++ b/module/plugins/hoster/UploadedTo.py
@@ -2,7 +2,6 @@
import re
import time
-import urlparse
from module.network.RequestFactory import getURL as get_url
from module.plugins.captcha.ReCaptcha import ReCaptcha
@@ -12,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class UploadedTo(SimpleHoster):
__name__ = "UploadedTo"
__type__ = "hoster"
- __version__ = "0.96"
+ __version__ = "0.97"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P<ID>\w+)'
@@ -31,6 +30,7 @@ class UploadedTo(SimpleHoster):
OFFLINE_PATTERN = r'>Page not found'
TEMP_OFFLINE_PATTERN = r'<title>uploaded\.net - Maintenance'
+ PREMIUM_ONLY_PATTERN = r'This file exceeds the max\. filesize which can be downloaded by free users'
LINK_FREE_PATTERN = r"url:\s*'(.+?)'"
LINK_PREMIUM_PATTERN = r'<div class="tfree".*\s*<form method="post" action="(.+?)"'
@@ -77,6 +77,7 @@ class UploadedTo(SimpleHoster):
self.html = self.load("http://uploaded.net/io/ticket/captcha/%s" % self.info['pattern']['ID'],
post={'recaptcha_challenge_field': challenge,
'recaptcha_response_field' : response})
+ self.check_errors()
super(UploadedTo, self).handle_free(pyfile)
self.check_errors()
diff --git a/module/plugins/hoster/UploadheroCom.py b/module/plugins/hoster/UploadheroCom.py
index 2af0f32fc..517ed293a 100644
--- a/module/plugins/hoster/UploadheroCom.py
+++ b/module/plugins/hoster/UploadheroCom.py
@@ -44,21 +44,21 @@ class UploadheroCom(SimpleHoster):
if m is None:
self.error(_("Captcha not found"))
- captcha = self.captcha.decrypt(urlparse.urljoin("http://uploadhero.co", m.group(1)))
+ captcha = self.captcha.decrypt(urlparse.urljoin("http://uploadhero.co/", m.group(1)))
self.html = self.load(pyfile.url,
get={'code': captcha})
m = re.search(self.LINK_FREE_PATTERN, self.html)
- if m:
+ if m is not None:
self.link = m.group(1) or m.group(2)
self.wait(50)
def check_errors(self):
m = re.search(self.IP_BLOCKED_PATTERN, self.html)
- if m:
- self.html = self.load(urlparse.urljoin("http://uploadhero.co", m.group(1)))
+ if m is not None:
+ self.html = self.load(urlparse.urljoin("http://uploadhero.co/", m.group(1)))
m = re.search(self.IP_WAIT_PATTERN, self.html)
wait_time = (int(m.group(1)) * 60 + int(m.group(2))) if m else 5 * 60
diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py
index 36f0c766e..c8f8a8169 100644
--- a/module/plugins/hoster/UploadingCom.py
+++ b/module/plugins/hoster/UploadingCom.py
@@ -4,14 +4,14 @@ import pycurl
import re
from module.common.json_layer import json_loads
-from module.plugins.internal.Plugin import encode
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp
+from module.plugins.internal.Plugin import encode, timestamp
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class UploadingCom(SimpleHoster):
__name__ = "UploadingCom"
__type__ = "hoster"
- __version__ = "0.43"
+ __version__ = "0.44"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?uploading\.com/files/(?:get/)?(?P<ID>\w+)'
@@ -61,7 +61,7 @@ class UploadingCom(SimpleHoster):
def handle_free(self, pyfile):
m = re.search('<h2>((Daily )?Download Limit)</h2>', self.html)
- if m:
+ if m is not None:
pyfile.error = encode(m.group(1))
self.log_warning(pyfile.error)
self.retry(6, (6 * 60 if m.group(2) else 15) * 60, pyfile.error)
@@ -88,7 +88,7 @@ class UploadingCom(SimpleHoster):
self.html = self.load(url)
m = re.search(r'<form id="file_form" action="(.*?)"', self.html)
- if m:
+ if m is not None:
url = m.group(1)
else:
self.error(_("No URL"))
diff --git a/module/plugins/hoster/UpstoreNet.py b/module/plugins/hoster/UpstoreNet.py
index 12c667efb..caa12e8af 100644
--- a/module/plugins/hoster/UpstoreNet.py
+++ b/module/plugins/hoster/UpstoreNet.py
@@ -62,13 +62,11 @@ class UpstoreNet(SimpleHoster):
#: STAGE 3: get direct link
m = re.search(self.LINK_FREE_PATTERN, self.html, re.S)
- if m:
+ if m is not None:
break
- if m is None:
- self.error(_("Download link not found"))
-
- self.link = m.group(1)
+ if m is not None:
+ self.link = m.group(1)
getInfo = create_getInfo(UpstoreNet)
diff --git a/module/plugins/hoster/UptoboxCom.py b/module/plugins/hoster/UptoboxCom.py
index d6baa3990..4f29b24b7 100644
--- a/module/plugins/hoster/UptoboxCom.py
+++ b/module/plugins/hoster/UptoboxCom.py
@@ -6,7 +6,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo
class UptoboxCom(XFSHoster):
__name__ = "UptoboxCom"
__type__ = "hoster"
- __version__ = "0.21"
+ __version__ = "0.22"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?(uptobox|uptostream)\.com/\w{12}'
@@ -22,6 +22,8 @@ class UptoboxCom(XFSHoster):
LINK_PATTERN = r'"(https?://\w+\.uptobox\.com/d/.*?)"'
+ DL_LIMIT_PATTERN = r'>You have to wait (.+) to launch a new download<'
+
def setup(self):
self.multiDL = True
diff --git a/module/plugins/hoster/UserscloudCom.py b/module/plugins/hoster/UserscloudCom.py
new file mode 100644
index 000000000..ebaed4859
--- /dev/null
+++ b/module/plugins/hoster/UserscloudCom.py
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class UserscloudCom(SimpleHoster):
+ __name__ = "UserscloudCom"
+ __type__ = "hoster"
+ __version__ = "0.01"
+ __status__ = "testing"
+
+ __pattern__ = r'https?://(?:www\.)?userscloud\.com/\w{12}'
+
+ __description__ = """Userscloud.com hoster plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("GammaC0de", None)]
+
+
+ NAME_PATTERN = r'<h2 class="strong margin-none">(?P<N>.+?)<'
+ SIZE_PATTERN = r'<div class="ribbon">(?P<S>[\d.,]+) (?P<U>[\w^_]+)<'
+ OFFLINE_PATTERN = r'The file you are trying to download is no longer available'
+
+
+ def setup(self):
+ self.multiDL = True
+ self.resume_download = False
+ self.chunk_limit = 1
+
+
+ def handle_free(self, pyfile):
+ self.download(pyfile.url,
+ post=dict(re.findall(r'<input type="hidden" name="(.+?)" value="(.*?)">', self.html)))
+
+
+getInfo = create_getInfo(UserscloudCom)
diff --git a/module/plugins/hoster/VeohCom.py b/module/plugins/hoster/VeohCom.py
index 7d46ee335..ba18fd529 100644
--- a/module/plugins/hoster/VeohCom.py
+++ b/module/plugins/hoster/VeohCom.py
@@ -42,7 +42,7 @@ class VeohCom(SimpleHoster):
for q in quality:
pattern = r'"fullPreviewHash%sPath":"(.+?)"' % q
m = re.search(pattern, self.html)
- if m:
+ if m is not None:
pyfile.name += ".mp4"
self.link = m.group(1).replace("\\", "")
return
diff --git a/module/plugins/hoster/WebshareCz.py b/module/plugins/hoster/WebshareCz.py
index 0a89363f8..a11b59492 100644
--- a/module/plugins/hoster/WebshareCz.py
+++ b/module/plugins/hoster/WebshareCz.py
@@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class WebshareCz(SimpleHoster):
__name__ = "WebshareCz"
__type__ = "hoster"
- __version__ = "0.19"
+ __version__ = "0.20"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?(en\.)?webshare\.cz/(?:#/)?file/(?P<ID>\w+)'
@@ -41,7 +41,7 @@ class WebshareCz(SimpleHoster):
def handle_free(self, pyfile):
- wst = self.account.get_data(self.user).get('wst', None) if self.account else None
+ wst = self.account.get_data('wst') if self.account else None
api_data = get_url("https://webshare.cz/api/file_link/",
post={'ident': self.info['pattern']['ID'], 'wst': wst})
@@ -49,7 +49,7 @@ class WebshareCz(SimpleHoster):
self.log_debug("API data: " + api_data)
m = re.search('<link>(.+)</link>', api_data)
- if m:
+ if m is not None:
self.link = m.group(1)
diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py
index 8ede709de..c7d8a7761 100644
--- a/module/plugins/hoster/XFileSharingPro.py
+++ b/module/plugins/hoster/XFileSharingPro.py
@@ -8,7 +8,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo
class XFileSharingPro(XFSHoster):
__name__ = "XFileSharingPro"
__type__ = "hoster"
- __version__ = "0.53"
+ __version__ = "0.54"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)'
@@ -24,25 +24,25 @@ class XFileSharingPro(XFSHoster):
def _log(self, level, plugintype, pluginname, messages):
return super(XFileSharingPro, self)._log(level,
plugintype,
- "%s: %s" % (pluginname, self.HOSTER_NAME),
+ "%s: %s" % (pluginname, self.PLUGIN_NAME),
messages)
def init(self):
self.__pattern__ = self.pyload.pluginManager.hosterPlugins[self.__name__]['pattern']
- self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower()
- self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+|\-)', self.HOSTER_DOMAIN) if part != '.')
+ self.PLUGIN_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower()
+ self.PLUGIN_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+|\-)', self.PLUGIN_DOMAIN) if part != '.')
def _setup(self):
- account_name = self.__name__ if self.account.HOSTER_DOMAIN is None else self.HOSTER_NAME
+ account_name = self.__name__ if self.account.PLUGIN_DOMAIN is None else self.PLUGIN_NAME
self.chunk_limit = 1
self.multiDL = True
if self.account:
- self.req = self.pyload.requestFactory.getRequest(accountname, self.user)
- self.premium = self.account.is_premium(self.user)
+ self.req = self.pyload.requestFactory.getRequest(accountname, self.account.user)
+ self.premium = self.account.premium
self.resume_download = self.premium
else:
self.req = self.pyload.requestFactory.getRequest(account_name)
@@ -55,19 +55,19 @@ class XFileSharingPro(XFSHoster):
self.req.close()
if not self.account:
- self.account = self.pyload.accountManager.getAccountPlugin(self.HOSTER_NAME)
+ self.account = self.pyload.accountManager.getAccountPlugin(self.PLUGIN_NAME)
if not self.account:
self.account = self.pyload.accountManager.getAccountPlugin(self.__name__)
if self.account:
- if not self.account.HOSTER_DOMAIN:
- self.account.HOSTER_DOMAIN = self.HOSTER_DOMAIN
+ if not self.account.PLUGIN_DOMAIN:
+ self.account.PLUGIN_DOMAIN = self.PLUGIN_DOMAIN
- if not self.user:
- self.user = self.account.select()[0]
+ if not self.account.user: #@TODO: Move to `Account` in 0.4.10
+ self.account.user = self.account.select()[0]
- if not self.user or not self.account.is_logged(self.user, True):
+ if not self.account.logged:
self.account = False
diff --git a/module/plugins/hoster/XHamsterCom.py b/module/plugins/hoster/XHamsterCom.py
index 8df1a441f..576451644 100644
--- a/module/plugins/hoster/XHamsterCom.py
+++ b/module/plugins/hoster/XHamsterCom.py
@@ -79,6 +79,7 @@ class XHamsterCom(Hoster):
file_url = re.search(r"<a href=\"" + srv_url + "(.+?)\"", self.html)
if file_url is None:
self.error(_("file_url not found"))
+
file_url = file_url.group(1)
long_url = srv_url + file_url
self.log_debug("long_url = " + long_url)
diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py
index aba66ee94..098143751 100644
--- a/module/plugins/hoster/Xdcc.py
+++ b/module/plugins/hoster/Xdcc.py
@@ -172,10 +172,10 @@ class Xdcc(Hoster):
retry = time.time() + 300
if "you must be on a known channel to request a pack" in msg['text']:
- self.fail(_("Wrong channel"))
+ self.fail(_("Invalid channel"))
m = re.match('\x01DCC SEND (.*?) (\d+) (\d+)(?: (\d+))?\x01', msg['text'])
- if m:
+ if m is not None:
done = True
#: Get connection data
diff --git a/module/plugins/hoster/YadiSk.py b/module/plugins/hoster/YadiSk.py
index a907cd282..354ba1b4c 100644
--- a/module/plugins/hoster/YadiSk.py
+++ b/module/plugins/hoster/YadiSk.py
@@ -34,7 +34,7 @@ class YadiSk(SimpleHoster):
info ['idclient'] += random.choice('0123456abcdef')
m = re.search(r'<script id="models-client" type="application/json">(.+?)</script>', html)
- if m:
+ if m is not None:
api_data = json_loads(m.group(1))
try:
for sect in api_data:
diff --git a/module/plugins/hoster/YibaishiwuCom.py b/module/plugins/hoster/YibaishiwuCom.py
index e0e90a311..b68e87ba6 100644
--- a/module/plugins/hoster/YibaishiwuCom.py
+++ b/module/plugins/hoster/YibaishiwuCom.py
@@ -37,7 +37,7 @@ class YibaishiwuCom(SimpleHoster):
self.log_debug(('FREEUSER' if m.group(2) == "download" else 'GUEST') + ' URL', url)
- res = json_loads(self.load(urlparse.urljoin("http://115.com", url), decode=False))
+ res = json_loads(self.load(urlparse.urljoin("http://115.com/", url), decode=False))
if "urls" in res:
mirrors = res['urls']
@@ -52,8 +52,9 @@ class YibaishiwuCom(SimpleHoster):
self.link = mr['url'].replace("\\", "")
self.log_debug("Trying URL: " + self.link)
break
+
except Exception:
- continue
+ pass
else:
self.fail(_("No working link found"))
diff --git a/module/plugins/hoster/YourfilesTo.py b/module/plugins/hoster/YourfilesTo.py
index a75bbcc94..cdf69afbe 100644
--- a/module/plugins/hoster/YourfilesTo.py
+++ b/module/plugins/hoster/YourfilesTo.py
@@ -41,7 +41,7 @@ class YourfilesTo(Hoster):
#: var zzipitime = 15
m = re.search(r'var zzipitime = (\d+);', self.html)
- if m:
+ if m is not None:
sec = int(m.group(1))
else:
sec = 0
diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py
index 865eeef2e..5c7c13962 100644
--- a/module/plugins/hoster/YoutubeCom.py
+++ b/module/plugins/hoster/YoutubeCom.py
@@ -6,37 +6,17 @@ import subprocess
import urllib
from module.plugins.internal.Hoster import Hoster
-from module.plugins.internal.Plugin import replace_patterns
+from module.plugins.internal.Plugin import replace_patterns, which
from module.utils import html_unescape
-def which(program):
- """
- Works exactly like the unix command which
- Courtesy of http://stackoverflow.com/a/377028/675646
- """
- isExe = lambda x: os.path.isfile(x) and os.access(x, os.X_OK)
-
- fpath, fname = os.path.split(program)
-
- if fpath:
- if isExe(program):
- return program
- else:
- for path in os.environ['PATH'].split(os.pathsep):
- path = path.strip('"')
- exe_file = os.path.join(path, program)
- if isExe(exe_file):
- return exe_file
-
-
class YoutubeCom(Hoster):
__name__ = "YoutubeCom"
__type__ = "hoster"
- __version__ = "0.44"
+ __version__ = "0.46"
__status__ = "testing"
- __pattern__ = r'https?://(?:[^/]*\.)?(youtube\.com|youtu\.be)/watch\?(?:.*&)?v=.+'
+ __pattern__ = r'https?://(?:[^/]*\.)?(youtu\.be/|youtube\.com/watch\?(?:.*&)?v=)\w+'
__config__ = [("quality", "sd;hd;fullhd;240p;360p;480p;720p;1080p;3072p", "Quality Setting" , "hd" ),
("fmt" , "int" , "FMT/ITAG Number (0 for auto)", 0 ),
(".mp4" , "bool" , "Allow .mp4" , True ),
@@ -51,10 +31,10 @@ class YoutubeCom(Hoster):
("zoidberg", "zoidberg@mujmail.cz")]
- URL_REPLACEMENTS = [(r'youtu\.be/', 'youtube.com/')]
+ URL_REPLACEMENTS = [(r'youtu\.be/', 'youtube.com/watch?v=')]
#: Invalid characters that must be removed from the file name
- invalidChars = u'\u2605:?><"|\\'
+ invalid_chars = u'\u2605:?><"|\\'
#: name, width, height, quality ranking, 3D
formats = {5 : (".flv" , 400 , 240 , 1 , False),
diff --git a/module/plugins/hoster/ZeveraCom.py b/module/plugins/hoster/ZeveraCom.py
index ff3a43e6d..9f3fea189 100644
--- a/module/plugins/hoster/ZeveraCom.py
+++ b/module/plugins/hoster/ZeveraCom.py
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
import re
-import urlparse
from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
@@ -9,7 +8,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
class ZeveraCom(MultiHoster):
__name__ = "ZeveraCom"
__type__ = "hoster"
- __version__ = "0.32"
+ __version__ = "0.33"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)zevera\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+'
@@ -26,7 +25,7 @@ class ZeveraCom(MultiHoster):
def handle_premium(self, pyfile):
- self.link = "https://%s/getFiles.ashx?ourl=%s" % (self.account.HOSTER_DOMAIN, pyfile.url)
+ self.link = "https://%s/getFiles.ashx?ourl=%s" % (self.account.PLUGIN_DOMAIN, pyfile.url)
getInfo = create_getInfo(ZeveraCom)
diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py
index 1b29948ce..221ec8c42 100644
--- a/module/plugins/hoster/ZippyshareCom.py
+++ b/module/plugins/hoster/ZippyshareCom.py
@@ -12,7 +12,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class ZippyshareCom(SimpleHoster):
__name__ = "ZippyshareCom"
__type__ = "hoster"
- __version__ = "0.82"
+ __version__ = "0.83"
__status__ = "testing"
__pattern__ = r'http://www\d{0,3}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P<KEY>[\w^_]+)'
@@ -52,7 +52,7 @@ class ZippyshareCom(SimpleHoster):
self.error(e)
else:
- self.link = self.get_link()
+ self.link = self.fixurl(self.get_link())
if self.link and pyfile.name == "file.html":
pyfile.name = urllib.unquote(self.link.split('/')[-1])
diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py
index 2713e8da4..ad78403de 100644
--- a/module/plugins/internal/Account.py
+++ b/module/plugins/internal/Account.py
@@ -1,19 +1,18 @@
# -*- coding: utf-8 -*-
-import copy
import random
import time
import threading
-import traceback
-from module.plugins.internal.Plugin import Plugin
-from module.utils import compare_time, lock, parseFileSize as parse_size
+from module.plugins.Plugin import SkipDownload as Skip
+from module.plugins.internal.Plugin import Plugin, parse_size
+from module.utils import compare_time, lock
class Account(Plugin):
__name__ = "Account"
__type__ = "account"
- __version__ = "0.17"
+ __version__ = "0.53"
__status__ = "testing"
__description__ = """Base account plugin"""
@@ -21,18 +20,23 @@ class Account(Plugin):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- LOGIN_TIMEOUT = 10 * 60 #: After that time (in minutes) pyload will relogin the account
- INFO_THRESHOLD = 30 * 60 #: After that time (in minutes) account data will be reloaded
+ LOGIN_TIMEOUT = 10 * 60 #: Relogin accounts every 10 minutes
+ AUTO_TIMEOUT = True #: Automatically adjust relogin interval
def __init__(self, manager, accounts):
self._init(manager.core)
- self.lock = threading.RLock()
- self.accounts = accounts #@TODO: Remove in 0.4.10
+ self.manager = manager
+ self.lock = threading.RLock()
+
+ self.accounts = accounts #@TODO: Recheck in 0.4.10
+ self.user = None
+
+ self.interval = self.LOGIN_TIMEOUT
+ self.auto_timeout = self.interval if self.AUTO_TIMEOUT else False
self.init()
- self.init_accounts(accounts)
def init(self):
@@ -42,218 +46,172 @@ class Account(Plugin):
pass
- def login(self, user, password, data, req):
+ @property
+ def logged(self):
"""
- Login into account, the cookies will be saved so user can be recognized
+ Checks if user is still logged in
"""
- pass
-
-
- @lock
- def _login(self, user):
- try:
- info = self.info[user]
- info['login']['timestamp'] = time.time() #: Set timestamp for login
-
- self.req = self.get_request(user)
- self.login(user, info['login']['password'], info['data'], self.req)
-
- except Exception, e:
- self.log_warning(_("Could not login user `%s`") % user, e)
- res = info['login']['valid'] = False
- self.accounts[user]['valid'] = False #@TODO: Remove in 0.4.10
+ if not self.user:
+ return False
- if self.pyload.debug:
- traceback.print_exc()
+ self.sync()
+ if self.info['login']['timestamp'] + self.interval < time.time():
+ self.log_debug("Reached login timeout for user `%s`" % self.user)
+ return False
else:
- res = info['login']['valid'] = True
- self.accounts[user]['valid'] = True #@TODO: Remove in 0.4.10
-
- finally:
- self.clean()
- return res
-
+ return True
- def relogin(self, user):
- self.log_info(_("Relogin user `%s`...") % user)
- req = self.get_request(user)
- if req:
- req.clearCookies()
- self.clean()
+ @property
+ def premium(self):
+ return bool(self.get_data('premium'))
- return self._login(user)
+ def signin(self, user, password, data):
+ """
+ Login into account, the cookies will be saved so user can be recognized
+ """
+ pass
- #@TODO: Rewrite in 0.4.10
- def init_accounts(self, accounts):
- for user, data in accounts.items():
- self.add(user, data['password'], data['options'])
+ def login(self):
+ if not self.req:
+ self.log_info(_("Login user `%s`...") % self.user)
+ else:
+ self.log_info(_("Relogin user `%s`...") % self.user)
+ self.clean()
- @lock
- def add(self, user, password=None, options={}):
- if user not in self.info:
- self.info[user] = {'login': {'valid' : None,
- 'password' : password or "",
- 'timestamp': 0},
- 'data' : {'options' : options,
- 'premium' : None,
- 'validuntil' : None,
- 'trafficleft': None,
- 'maxtraffic' : None}}
-
- #@TODO: Remove in 0.4.10
- self.accounts[user] = self.info[user]['data']
- self.accounts[user].update({'login' : user,
- 'type' : self.__name__,
- 'valid' : self.info[user]['login']['valid'],
- 'password': self.info[user]['login']['password']})
-
- self.log_info(_("Login user `%s`...") % user)
- self._login(user)
- return True
+ self.req = self.pyload.requestFactory.getRequest(self.__name__, self.user)
- else:
- self.log_error(_("Error adding user `%s`") % user, _("User already exists"))
+ self.sync()
+ try:
+ self.info['login']['timestamp'] = time.time() #: Set timestamp for login
+ self.signin(self.user, self.info['login']['password'], self.info['data'])
- @lock
- def update(self, user, password=None, options={}):
- """
- Updates account and return true if anything changed
- """
- if not (password or options):
- return
+ except Skip:
+ self.info['login']['valid'] = True
+ if self.auto_timeout:
+ self.auto_timeout *= 2
+ self.interval = self.auto_timeout
- if user not in self.info:
- return self.add(user, password, options)
+ except Exception, e:
+ self.log_error(_("Could not login user `%s`") % user, e)
+ self.info['login']['valid'] = False
else:
- if password:
- self.info[user]['login']['password'] = password
- self.accounts[user]['password'] = password #@TODO: Remove in 0.4.10
- self.relogin(user)
+ self.info['login']['valid'] = True
+ if self.interval is self.auto_timeout:
+ self.interval = self.auto_timeout / 2
+ self.auto_timeout = False
- if options:
- before = self.info[user]['data']['options']
- self.info[user]['data']['options'].update(options)
- return self.info[user]['data']['options'] != before
+ finally:
+ self.syncback()
+ return bool(self.info['login']['valid'])
- return True
+ #@TODO: Recheck in 0.4.10
+ def syncback(self):
+ return self.sync(reverse=True)
- #: Deprecated method, use `update` instead (Remove in 0.4.10)
- def updateAccounts(self, *args, **kwargs):
- return self.update(*args, **kwargs)
+ #@TODO: Recheck in 0.4.10
+ def sync(self, reverse=False):
+ if not self.user:
+ return
- def remove(self, user=None): # -> def remove
- if not user:
- self.info.clear()
- self.accounts.clear() #@TODO: Remove in 0.4.10
+ u = self.accounts[self.user]
- elif user in self.info:
- self.info.pop(user, None)
- self.accounts.pop(user, None) #@TODO: Remove in 0.4.10
+ if reverse:
+ u.update(self.info['data'])
+ u.update(self.info['login'])
+ else:
+ d = {'login': {'password' : u['password'],
+ 'timestamp': u['timestamp'],
+ 'valid' : u['valid']},
+ 'data' : {'maxtraffic' : u['maxtraffic'],
+ 'options' : u['options'],
+ 'premium' : u['premium'],
+ 'trafficleft': u['trafficleft'],
+ 'validuntil' : u['validuntil']}}
- #: Deprecated method, use `remove` instead (Remove in 0.4.10)
- def removeAccount(self, *args, **kwargs):
- return self.remove(*args, **kwargs)
+ self.info.update(d)
- #@NOTE: Remove in 0.4.10?
- def get_data(self, user, reload=False):
- if not user:
- return
+ def relogin(self):
+ return self.login()
- info = self.get_info(user, reload)
- if info and 'data' in info:
- return info['data']
+ def reset(self):
+ self.sync()
- #: Deprecated method, use `get_data` instead (Remove in 0.4.10)
- def getAccountData(self, *args, **kwargs):
- if 'force' in kwargs:
- kwargs['reload'] = kwargs['force']
- kwargs.pop('force', None)
+ d = {'maxtraffic' : None,
+ 'options' : {'limitdl': ['0']},
+ 'premium' : None,
+ 'trafficleft': None,
+ 'validuntil' : None}
- data = self.get_data(*args, **kwargs) or {}
- if 'options' not in data:
- data['options'] = {'limitdl': ['0']}
+ self.info['data'].update(d)
- return data
+ self.syncback()
- def get_info(self, user, reload=False):
+ def get_info(self, refresh=True):
"""
- Retrieve account infos for an user, do **not** overwrite this method!\\
- just use it to retrieve infos in hoster plugins. see `parse_info`
+ Retrieve account infos for an user, do **not** overwrite this method!
+ just use it to retrieve infos in hoster plugins. see `grab_info`
:param user: username
- :param reload: reloads cached account information
+ :param relogin: reloads cached account information
:return: dictionary with information
"""
- if user not in self.info:
- self.log_error(_("User `%s` not found while retrieving account info") % user)
- return
+ if not self.logged:
+ if self.relogin():
+ refresh = True
+ else:
+ refresh = False
+ self.reset()
- elif reload:
- self.log_info(_("Parsing account info for user `%s`...") % user)
- info = self._parse_info(user)
+ if refresh:
+ self.log_info(_("Grabbing account info for user `%s`...") % self.user)
+ self.info = self._grab_info()
- safe_info = copy.deepcopy(info)
- safe_info['login']['password'] = "**********"
- safe_info['data']['password'] = "**********" #@TODO: Remove in 0.4.10
- self.log_debug("Account info for user `%s`: %s" % (user, safe_info))
+ self.syncback()
- elif self.INFO_THRESHOLD > 0 and self.info[user]['login']['timestamp'] + self.INFO_THRESHOLD < time.time():
- self.log_debug("Reached data timeout for %s" % user)
- info = self.get_info(user, True)
+ safe_info = dict(self.info)
+ safe_info['login']['password'] = "**********"
+ self.log_debug("Account info for user `%s`: %s" % (self.user, safe_info))
- else:
- info = self.info[user]
+ return self.info
- return info
+ def get_login(self, key=None, default=None):
+ d = self.get_info()['login']
+ return d.get(key, default) if key else d
- def is_premium(self, user):
- if not user:
- return False
- info = self.get_info(user)
- return info['data']['premium']
+ def get_data(self, key=None, default=None):
+ d = self.get_info()['data']
+ return d.get(key, default) if key else d
- def _parse_info(self, user):
- info = self.info[user]
-
- if not info['login']['valid']:
- return info
-
+ def _grab_info(self):
try:
- self.req = self.get_request(user)
- extra_info = self.parse_info(user, info['login']['password'], info, self.req)
+ data = self.grab_info(self.user, self.info['login']['password'], self.info['data'])
- if extra_info and isinstance(extra_info, dict):
- info['data'].update(extra_info)
+ if data and isinstance(data, dict):
+ self.info['data'].update(data)
- except (Fail, Exception), e:
- self.log_warning(_("Error loading info for user `%s`") % user, e)
-
- if self.pyload.debug:
- traceback.print_exc()
+ except Exception, e:
+ self.log_warning(_("Error loading info for user `%s`") % self.user, e)
finally:
- self.clean()
-
- self.info[user].update(info)
- return info
+ return self.info
- def parse_info(self, user, password, info, req):
+ def grab_info(self, user, password, data):
"""
This should be overwritten in account plugin
and retrieving account information for user
@@ -265,43 +223,105 @@ class Account(Plugin):
pass
- #: Remove in 0.4.10
- def getAllAccounts(self, *args, **kwargs):
- return [self.getAccountData(user, *args, **kwargs) for user, info in self.info.items()]
+ ###########################################################################
+ #@TODO: Recheck and move to `AccountManager` in 0.4.10 ####################
+ ###########################################################################
+ @lock
+ def init_accounts(self):
+ accounts = dict(self.accounts)
+ self.accounts.clear()
- def login_fail(self, reason=_("Login handshake has failed")):
- return self.fail(reason)
+ for user, info in accounts.items():
+ self.add(user, info['password'], info['options'])
- def get_request(self, user=None):
- if not user:
- user, info = self.select()
+ @lock
+ def getAccountData(self, user, force=False):
+ self.accounts[user]['plugin'].get_info()
+ return self.accounts[user]
- return self.pyload.requestFactory.getRequest(self.__name__, user)
+ @lock
+ def getAllAccounts(self, force=False):
+ if force:
+ self.init_accounts() #@TODO: Recheck in 0.4.10
- def get_cookies(self, user=None):
- if not user:
- user, info = self.select()
+ return [self.getAccountData(user, force) for user in self.accounts]
- return self.pyload.requestFactory.getCookieJar(self.__name__, user)
+ #@TODO: Remove in 0.4.10
+ @lock
+ def scheduleRefresh(self, user, force=False):
+ pass
- def select(self):
+
+ @lock
+ def add(self, user, password=None, options={}):
+ self.log_info(_("Adding user `%s`...") % user)
+
+ if user in self.accounts:
+ self.log_error(_("Error adding user `%s`") % user, _("User already exists"))
+ return False
+
+ d = {'login' : user,
+ 'maxtraffic' : None,
+ 'options' : options or {'limitdl': ['0']},
+ 'password' : password or "",
+ 'plugin' : self.__class__(self.manager, self.accounts),
+ 'premium' : None,
+ 'timestamp' : 0,
+ 'trafficleft': None,
+ 'type' : self.__name__,
+ 'valid' : None,
+ 'validuntil' : None}
+
+ u = self.accounts[user] = d
+ return u['plugin'].choose(user)
+
+
+ @lock
+ def updateAccounts(self, user, password=None, options={}):
"""
- Returns a valid account name and info
+ Updates account and return true if anything changed
"""
+ if user in self.accounts:
+ self.log_info(_("Updating account info for user `%s`...") % user)
+
+ u = self.accounts[user]
+ if password:
+ u['password'] = password
+
+ if options:
+ u['options'].update(options)
+
+ u['plugin'].relogin()
+
+ else:
+ self.add(user, password, options)
+
+
+ @lock
+ def removeAccount(self, user):
+ self.log_info(_("Removing user `%s`...") % user)
+ self.accounts.pop(user, None)
+ if user is self.user:
+ self.choose()
+
+
+ @lock
+ def select(self):
free_accounts = {}
premium_accounts = {}
- for user, info in self.info.items():
+ for user in self.accounts:
+ info = self.accounts[user]['plugin'].get_info()
+ data = info['data']
+
if not info['login']['valid']:
continue
- data = info['data']
-
- if "time" in data['options'] and data['options']['time']:
+ if data['options'].get('time'):
time_data = ""
try:
time_data = data['options']['time'][0]
@@ -311,7 +331,8 @@ class Account(Plugin):
continue
except Exception:
- self.log_warning(_("Wrong time format `%s` for account `%s`, use 1:22-3:44") % (user, time_data))
+ self.log_warning(_("Invalid time format `%s` for account `%s`, use 1:22-3:44")
+ % (user, time_data))
if data['trafficleft'] == 0:
continue
@@ -330,68 +351,54 @@ class Account(Plugin):
if not account_list:
return None, None
- validuntil_list = [(user, info) for user, info in account_list if info['data']['validuntil']]
+ validuntil_list = [(user, info) for user, info in account_list \
+ if info['data']['validuntil']]
if not validuntil_list:
- return random.choice(account_list) #@TODO: Random account?! Recheck in 0.4.10
+ return random.choice(account_list) #@TODO: Random account?! Rewrite in 0.4.10
return sorted(validuntil_list,
key=lambda a: a[1]['data']['validuntil'],
reverse=True)[0]
- def parse_traffic(self, value, unit=None): #: Return kilobytes
- if not unit and not isinstance(value, basestring):
- unit = "KB"
-
- return parse_size(value, unit)
-
-
- def empty(self, user):
- if user not in self.info:
- return
+ @lock
+ def choose(self, user=None):
+ """
+ Choose a valid account
+ """
+ if not user:
+ user = self.select()[0]
- self.log_warning(_("Account `%s` has not enough traffic") % user, _("Checking again in 30 minutes"))
+ elif user not in self.accounts:
+ self.log_error(_("Error choosing user `%s`") % user, _("User not exists"))
+ return False
- self.info[user]['data']['trafficleft'] = 0
- self.schedule_refresh(user, 30 * 60)
+ if user is self.user:
+ return True
+ self.user = user
+ self.info.clear()
+ self.clean()
- def expired(self, user):
- if user not in self.info:
- return
+ if self.user is not None:
+ self.login()
+ return True
- self.log_warning(_("Account `%s` is expired") % user, _("Checking again in 60 minutes"))
+ else:
+ return False
- self.info[user]['data']['validuntil'] = time.time() - 1
- self.schedule_refresh(user, 60 * 60)
+ ###########################################################################
- def schedule_refresh(self, user, time=0):
- """
- Add task to refresh account info to sheduler
- """
- self.log_debug("Scheduled refresh for user `%s` in %s seconds" % (user, time))
- self.pyload.scheduler.addJob(time, self.get_info, [user, True])
+ def parse_traffic(self, size, unit="KB"): #@NOTE: Returns kilobytes in 0.4.9
+ size = re.search(r'(\d*[\.,]?\d+)', size).group(1) #@TODO: Recjeck in 0.4.10
+ return parse_size(size, unit) / 1024 #@TODO: Remove `/ 1024` in 0.4.10
- #: Deprecated method, use `schedule_refresh` instead (Remove in 0.4.10)
- def scheduleRefresh(self, *args, **kwargs):
- if 'force' in kwargs:
- kwargs.pop('force', None) #@TODO: Recheck in 0.4.10
- return self.schedule_refresh(*args, **kwargs)
+ def fail_login(self, msg=_("Login handshake has failed")):
+ return self.fail(msg)
- @lock
- def is_logged(self, user, relogin=False):
- """
- Checks if user is still logged in
- """
- if user in self.info:
- if self.LOGIN_TIMEOUT > 0 and self.info[user]['login']['timestamp'] + self.LOGIN_TIMEOUT < time.time():
- self.log_debug("Reached login timeout for %s" % user)
- return self.relogin(user) if relogin else False
- else:
- return True
- else:
- return False
+ def skip_login(self, msg=_("Already signed in")):
+ return self.skip(msg)
diff --git a/module/plugins/internal/Addon.py b/module/plugins/internal/Addon.py
index 45ca98eac..3a252fdfb 100644
--- a/module/plugins/internal/Addon.py
+++ b/module/plugins/internal/Addon.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
-import traceback
-
from module.plugins.internal.Plugin import Plugin
@@ -25,10 +23,9 @@ def threaded(fn):
class Addon(Plugin):
__name__ = "Addon"
__type__ = "hook" #@TODO: Change to `addon` in 0.4.10
- __version__ = "0.04"
+ __version__ = "0.06"
__status__ = "testing"
- __config__ = [] #: [("name", "type", "desc", "default")]
__threaded__ = [] #@TODO: Remove in 0.4.10
__description__ = """Base addon plugin"""
@@ -57,6 +54,12 @@ class Addon(Plugin):
self.init_events()
+ #@TODO: Remove in 0.4.10
+ def _log(self, level, plugintype, pluginname, messages):
+ plugintype = "addon" if plugintype is "hook" else plugintype
+ return super(Addon, self)._log(level, plugintype, pluginname, messages)
+
+
def init_events(self):
if self.event_map:
for event, funcs in self.event_map.items():
@@ -97,8 +100,6 @@ class Addon(Plugin):
except Exception, e:
self.log_error(_("Error executing periodical task: %s") % e)
- if self.pyload.debug:
- traceback.print_exc()
self.cb = self.pyload.scheduler.addJob(self.interval, self._periodical, [threaded], threaded=threaded)
@@ -107,20 +108,17 @@ class Addon(Plugin):
pass
- def __repr__(self):
- return "<Addon %s>" % self.__name__
-
-
- def is_activated(self):
+ @property
+ def activated(self):
"""
Checks if addon is activated
"""
return self.get_config("activated")
- #: Deprecated method, use `is_activated` instead (Remove in 0.4.10)
+ #: Deprecated method, use `activated` property instead (Remove in 0.4.10)
def isActivated(self, *args, **kwargs):
- return self.is_activated(*args, **kwargs)
+ return self.activated
def deactivate(self):
diff --git a/module/plugins/internal/Base.py b/module/plugins/internal/Base.py
new file mode 100644
index 000000000..bc9ef9158
--- /dev/null
+++ b/module/plugins/internal/Base.py
@@ -0,0 +1,503 @@
+# -*- coding: utf-8 -*-
+
+import inspect
+import mimetypes
+import os
+import time
+import urlparse
+
+from module.plugins.internal.Captcha import Captcha
+from module.plugins.internal.Plugin import (Plugin, Abort, Fail, Reconnect, Retry, Skip,
+ decode, encode, fixurl, parse_html_form,
+ parse_name, replace_patterns)
+
+
+#@TODO: Remove in 0.4.10
+def getInfo(urls):
+ #: result = [ .. (name, size, status, url) .. ]
+ pass
+
+
+#@TODO: Remove in 0.4.10
+def parse_fileInfo(klass, url="", html=""):
+ info = klass.get_info(url, html)
+ return encode(info['name']), info['size'], info['status'], info['url']
+
+
+#@TODO: Remove in 0.4.10
+def create_getInfo(klass):
+ def get_info(urls):
+ for url in urls:
+ try:
+ url = replace_patterns(url, klass.URL_REPLACEMENTS)
+
+ except Exception:
+ pass
+
+ yield parse_fileInfo(klass, url)
+
+ return get_info
+
+
+#@NOTE: `check_abort` decorator
+def check_abort(fn):
+
+ def wrapper(self, *args, **kwargs):
+ self.check_abort()
+ return fn(self, *args, **kwargs)
+
+ return wrapper
+
+
+class Base(Plugin):
+ __name__ = "Base"
+ __type__ = "base"
+ __version__ = "0.02"
+ __status__ = "testing"
+
+ __pattern__ = r'^unmatchable$'
+ __config__ = [("use_premium", "bool", "Use premium account if available", True)]
+
+ __description__ = """Base plugin for Hoster and Crypter"""
+ __license__ = "GPLv3"
+ __authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
+
+
+ def __init__(self, pyfile):
+ self._init(pyfile.m.core)
+
+ #: Engage wan reconnection
+ self.wantReconnect = False #@TODO: Change to `want_reconnect` in 0.4.10
+
+ #: Enable simultaneous processing of multiple downloads
+ self.multiDL = True #@TODO: Change to `multi_dl` in 0.4.10
+
+ #: time.time() + wait in seconds
+ self.wait_until = 0
+ self.waiting = False
+
+ #: Account handler instance, see :py:class:`Account`
+ self.account = None
+ self.user = None #@TODO: Remove in 0.4.10
+
+ #: Associated pyfile instance, see `PyFile`
+ self.pyfile = pyfile
+
+ self.thread = None #: Holds thread in future
+
+ #: Js engine, see `JsEngine`
+ self.js = self.pyload.js
+
+ #: Captcha stuff
+ self.captcha = Captcha(self)
+
+ #: Some plugins store html code here
+ self.html = None
+
+ #: Dict of the amount of retries already made
+ self.retries = {}
+
+
+ def _log(self, level, plugintype, pluginname, messages):
+ log = getattr(self.pyload.log, level)
+ msg = u" | ".join(decode(a).strip() for a in messages if a)
+ log("%(plugintype)s %(pluginname)s[%(id)s]: %(msg)s"
+ % {'plugintype': plugintype.upper(),
+ 'pluginname': pluginname,
+ 'id' : self.pyfile.id,
+ 'msg' : msg})
+
+
+ @classmethod
+ def get_info(cls, url="", html=""):
+ url = fixurl(url)
+ info = {'name' : parse_name(url),
+ 'size' : 0,
+ 'status': 3 if url else 8,
+ 'url' : url}
+
+ return info
+
+
+ def init(self):
+ """
+ Initialize the plugin (in addition to `__init__`)
+ """
+ pass
+
+
+ def setup(self):
+ """
+ Setup for enviroment and other things, called before downloading (possibly more than one time)
+ """
+ pass
+
+
+ def _setup(self):
+ #@TODO: Remove in 0.4.10
+ self.html = ""
+ self.pyfile.error = ""
+ self.last_html = None
+
+ if self.get_config('use_premium', True):
+ self.load_account() #@TODO: Move to PluginThread in 0.4.10
+ else:
+ self.account = False
+ self.user = None #@TODO: Remove in 0.4.10
+
+ try:
+ self.req.close()
+ except Exception:
+ pass
+
+ if self.account:
+ self.req = self.pyload.requestFactory.getRequest(self.__name__, self.account.user)
+ self.chunk_limit = -1 #: -1 for unlimited
+ self.resume_download = True
+ self.premium = self.account.premium
+ else:
+ self.req = self.pyload.requestFactory.getRequest(self.__name__)
+ self.chunk_limit = 1
+ self.resume_download = False
+ self.premium = False
+
+ self.setup()
+
+
+ def load_account(self):
+ if not self.account:
+ self.account = self.pyload.accountManager.getAccountPlugin(self.__name__)
+
+ if not self.account:
+ self.account = False
+ self.user = None #@TODO: Remove in 0.4.10
+
+ else:
+ self.account.choose()
+ self.user = self.account.user #@TODO: Remove in 0.4.10
+ if self.account.user is None:
+ self.account = False
+
+
+ def _process(self, thread):
+ """
+ Handles important things to do before starting
+ """
+ self.thread = thread
+
+ self._setup()
+
+ # self.pyload.hookManager.downloadPreparing(self.pyfile) #@TODO: Recheck in 0.4.10
+ self.check_abort()
+
+ self.pyfile.setStatus("starting")
+
+ self.log_debug("PROCESS URL " + self.pyfile.url, "PLUGIN VERSION %s" % self.__version__)
+ self.process(self.pyfile)
+
+
+ #: Deprecated method, use `_process` instead (Remove in 0.4.10)
+ def preprocessing(self, *args, **kwargs):
+ return self._process(*args, **kwargs)
+
+
+ def process(self, pyfile):
+ """
+ The "main" method of every hoster plugin, you **have to** overwrite it
+ """
+ raise NotImplementedError
+
+
+ def set_reconnect(self, reconnect):
+ self.log_debug("RECONNECT %s required" % ("" if reconnect else "not"),
+ "Previous wantReconnect: %s" % self.wantReconnect)
+ self.wantReconnect = bool(reconnect)
+
+
+ def set_wait(self, seconds, reconnect=None):
+ """
+ Set a specific wait time later used with `wait`
+
+ :param seconds: wait time in seconds
+ :param reconnect: True if a reconnect would avoid wait time
+ """
+ wait_time = max(int(seconds), 1)
+ wait_until = time.time() + wait_time + 1
+
+ self.log_debug("WAIT set to %d seconds" % wait_time,
+ "Previous waitUntil: %f" % self.pyfile.waitUntil)
+
+ self.pyfile.waitUntil = wait_until
+
+ if reconnect is not None:
+ self.set_reconnect(reconnect)
+
+
+ def wait(self, seconds=None, reconnect=None):
+ """
+ Waits the time previously set
+ """
+ pyfile = self.pyfile
+
+ if seconds is not None:
+ self.set_wait(seconds)
+
+ if reconnect is not None:
+ self.set_reconnect(reconnect)
+
+ self.waiting = True
+
+ status = pyfile.status #@NOTE: Recheck in 0.4.10
+ pyfile.setStatus("waiting")
+
+ self.log_info(_("Waiting %d seconds...") % (pyfile.waitUntil - time.time()))
+
+ if self.wantReconnect:
+ self.log_info(_("Requiring reconnection..."))
+ if self.account:
+ self.log_warning("Ignore reconnection due logged account")
+
+ if not self.wantReconnect or self.account:
+ while pyfile.waitUntil > time.time():
+ self.check_abort()
+ time.sleep(2)
+
+ else:
+ while pyfile.waitUntil > time.time():
+ self.check_abort()
+ self.thread.m.reconnecting.wait(1)
+
+ if self.thread.m.reconnecting.isSet():
+ self.waiting = False
+ self.wantReconnect = False
+ raise Reconnect
+
+ time.sleep(2)
+
+ self.waiting = False
+ pyfile.status = status #@NOTE: Recheck in 0.4.10
+
+
+ def skip(self, msg=""):
+ """
+ Skip and give msg
+ """
+ raise Skip(encode(msg or self.pyfile.error or self.pyfile.pluginname)) #@TODO: Remove `encode` in 0.4.10
+
+
+ #@TODO: Remove in 0.4.10
+ def fail(self, msg):
+ """
+ Fail and give msg
+ """
+ msg = msg.strip()
+
+ if msg:
+ self.pyfile.error = msg
+ else:
+ msg = self.pyfile.error or (self.info['error'] if 'error' in self.info else self.pyfile.getStatusName())
+
+ raise Fail(encode(msg)) #@TODO: Remove `encode` in 0.4.10
+
+
+ def error(self, msg="", type=_("Parse")):
+ type = _("%s error") % type.strip().capitalize() if type else _("Unknown")
+ msg = _("%(type)s: %(msg)s | Plugin may be out of date"
+ % {'type': type, 'msg': msg or self.pyfile.error})
+
+ self.fail(msg)
+
+
+ def abort(self, msg=""):
+ """
+ Abort and give msg
+ """
+ if msg: #@TODO: Remove in 0.4.10
+ self.pyfile.error = encode(msg)
+
+ raise Abort
+
+
+ #@TODO: Recheck in 0.4.10
+ def offline(self, msg=""):
+ """
+ Fail and indicate file is offline
+ """
+ self.fail("offline")
+
+
+ #@TODO: Recheck in 0.4.10
+ def temp_offline(self, msg=""):
+ """
+ Fail and indicates file ist temporary offline, the core may take consequences
+ """
+ self.fail("temp. offline")
+
+
+ def retry(self, attemps=5, wait=1, msg=""):
+ """
+ Retries and begin again from the beginning
+
+ :param attemps: number of maximum retries
+ :param wait: time to wait in seconds before retry
+ :param msg: message passed to fail if attemps value was reached
+ """
+ id = inspect.currentframe().f_back.f_lineno
+ if id not in self.retries:
+ self.retries[id] = 0
+
+ if 0 < attemps <= self.retries[id]:
+ self.fail(msg or _("Max retries reached"))
+
+ self.wait(wait, False)
+
+ self.retries[id] += 1
+ raise Retry(encode(msg)) #@TODO: Remove `encode` in 0.4.10
+
+
+ def retry_captcha(self, attemps=10, wait=1, msg=_("Max captcha retries reached")):
+ self.captcha.invalid()
+ self.retry(attemps, wait, msg)
+
+
+ def fixurl(self, url, baseurl=None, unquote=True):
+ url = fixurl(url)
+
+ if not baseurl:
+ baseurl = fixurl(self.pyfile.url)
+
+ if not urlparse.urlparse(url).scheme:
+ url_p = urlparse.urlparse(baseurl)
+ baseurl = "%s://%s" % (url_p.scheme, url_p.netloc)
+ url = urlparse.urljoin(baseurl, url)
+
+ return fixurl(url, unquote)
+
+
+ @check_abort
+ def load(self, *args, **kwargs):
+ return super(Base, self).load(*args, **kwargs)
+
+
+ def check_abort(self):
+ if not self.pyfile.abort:
+ return
+
+ if self.pyfile.status is 8:
+ self.fail()
+
+ elif self.pyfile.status is 4:
+ self.skip(self.pyfile.statusname)
+
+ elif self.pyfile.status is 1:
+ self.offline()
+
+ elif self.pyfile.status is 6:
+ self.temp_offline()
+
+ else:
+ self.abort()
+
+
+ def direct_link(self, url, follow_location=None):
+ link = ""
+
+ if follow_location is None:
+ redirect = 1
+
+ elif type(follow_location) is int:
+ redirect = max(follow_location, 1)
+
+ else:
+ redirect = self.get_config("maxredirs", 10, "UserAgentSwitcher")
+
+ for i in xrange(redirect):
+ try:
+ self.log_debug("Redirect #%d to: %s" % (i, url))
+ header = self.load(url, just_header=True)
+
+ except Exception: #: Bad bad bad... rewrite this part in 0.4.10
+ res = self.load(url,
+ just_header=True,
+ req=self.pyload.requestFactory.getRequest(self.__name__))
+
+ header = {'code': req.code}
+ for line in res.splitlines():
+ line = line.strip()
+ if not line or ":" not in line:
+ continue
+
+ key, none, value = line.partition(":")
+ key = key.lower().strip()
+ value = value.strip()
+
+ if key in header:
+ if type(header[key]) is list:
+ header[key].append(value)
+ else:
+ header[key] = [header[key], value]
+ else:
+ header[key] = value
+
+ if 'content-disposition' in header:
+ link = url
+
+ elif header.get('location'):
+ location = self.fixurl(header['location'], url)
+
+ if header.get('code') == 302:
+ link = location
+
+ if follow_location:
+ url = location
+ continue
+
+ else:
+ extension = os.path.splitext(parse_name(url))[-1]
+
+ if header.get('content-type'):
+ mimetype = header['content-type'].split(';')[0].strip()
+
+ elif extension:
+ mimetype = mimetypes.guess_type(extension, False)[0] or "application/octet-stream"
+
+ else:
+ mimetype = ""
+
+ if mimetype and (link or 'html' not in mimetype):
+ link = url
+ else:
+ link = ""
+
+ break
+
+ else:
+ try:
+ self.log_error(_("Too many redirects"))
+
+ except Exception:
+ pass
+
+ return link
+
+
+ def parse_html_form(self, attr_str="", input_names={}):
+ return parse_html_form(attr_str, self.html, input_names)
+
+
+ def get_password(self):
+ """
+ Get the password the user provided in the package
+ """
+ return self.pyfile.package().password or ""
+
+
+ def clean(self):
+ """
+ Clean everything and remove references
+ """
+ super(Base, self).clean()
+
+ for attr in ("account", "html", "pyfile", "thread"):
+ if hasattr(self, attr):
+ setattr(self, attr, None)
diff --git a/module/plugins/internal/Captcha.py b/module/plugins/internal/Captcha.py
index c08050ee8..a8f48b5e4 100644
--- a/module/plugins/internal/Captcha.py
+++ b/module/plugins/internal/Captcha.py
@@ -4,7 +4,6 @@ from __future__ import with_statement
import os
import time
-import traceback
from module.plugins.internal.Plugin import Plugin
@@ -12,7 +11,7 @@ from module.plugins.internal.Plugin import Plugin
class Captcha(Plugin):
__name__ = "Captcha"
__type__ = "captcha"
- __version__ = "0.42"
+ __version__ = "0.46"
__status__ = "testing"
__description__ = """Base anti-captcha plugin"""
@@ -50,18 +49,17 @@ class Captcha(Plugin):
pass
- def decrypt(self, url, get={}, post={}, ref=False, cookies=False, decode=False,
+ def decrypt(self, url, get={}, post={}, ref=False, cookies=True, decode=False, req=None,
input_type='jpg', output_type='textual', ocr=True, timeout=120):
- img = self.load(url, get=get, post=post, ref=ref, cookies=cookies, decode=decode)
- return self._decrypt(img, input_type, output_type, ocr, timeout)
+ img = self.load(url, get=get, post=post, ref=ref, cookies=cookies, decode=decode, req=req or self.plugin.req)
+ return self.decrypt_image(img, input_type, output_type, ocr, timeout)
- #@TODO: Definitely choose a better name for this method!
- def _decrypt(self, raw, input_type='jpg', output_type='textual', ocr=False, timeout=120):
+ def decrypt_image(self, data, input_type='jpg', output_type='textual', ocr=False, timeout=120):
"""
Loads a captcha and decrypts it with ocr, plugin, user input
- :param raw: image raw data
+ :param data: image raw data
:param get: get part for request
:param post: post part for request
:param cookies: True if cookies should be enabled
@@ -77,7 +75,7 @@ class Captcha(Plugin):
time_ref = ("%.2f" % time.time())[-6:].replace(".", "")
with open(os.path.join("tmp", "captcha_image_%s_%s.%s" % (self.plugin.__name__, time_ref, input_type)), "wb") as tmp_img:
- tmp_img.write(raw)
+ tmp_img.write(data)
if ocr:
if isinstance(ocr, basestring):
@@ -90,14 +88,13 @@ class Captcha(Plugin):
captchaManager = self.pyload.captchaManager
try:
- self.task = captchaManager.newTask(raw, input_type, tmp_img.name, output_type)
+ self.task = captchaManager.newTask(data, input_type, tmp_img.name, output_type)
captchaManager.handleCaptcha(self.task)
self.task.setWaiting(max(timeout, 50)) #@TODO: Move to `CaptchaManager` in 0.4.10
while self.task.isWaiting():
- if self.plugin.pyfile.abort:
- self.plugin.abort()
+ self.plugin.check_abort()
time.sleep(1)
finally:
@@ -107,8 +104,7 @@ class Captcha(Plugin):
self.fail(self.task.error)
elif not self.task.result:
- self.invalid()
- self.plugin.retry(reason=_("No captcha result obtained in appropiate time"))
+ self.plugin.retry_captcha(msg=_("No captcha result obtained in appropriate time"))
result = self.task.result
@@ -118,9 +114,8 @@ class Captcha(Plugin):
except OSError, e:
self.log_warning(_("Error removing: %s") % tmp_img.name, e)
- traceback.print_exc()
- self.log_info(_("Captcha result: ") + result) #@TODO: Remove from here?
+ #self.log_info(_("Captcha result: ") + result) #@TODO: Remove from here?
return result
diff --git a/module/plugins/internal/Container.py b/module/plugins/internal/Container.py
index 729592a0d..2300c4cab 100644
--- a/module/plugins/internal/Container.py
+++ b/module/plugins/internal/Container.py
@@ -4,7 +4,6 @@ from __future__ import with_statement
import os
import re
-import traceback
from module.plugins.internal.Crypter import Crypter
from module.plugins.internal.Plugin import exists
@@ -14,15 +13,15 @@ from module.utils import save_join as fs_join
class Container(Crypter):
__name__ = "Container"
__type__ = "container"
- __version__ = "0.06"
+ __version__ = "0.07"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
- __config__ = [] #: [("name", "type", "desc", "default")]
__description__ = """Base container decrypter plugin"""
__license__ = "GPLv3"
- __authors__ = [("mkaay", "mkaay@mkaay.de")]
+ __authors__ = [("mkaay" , "mkaay@mkaay.de" ),
+ ("Walter Purcaro", "vuolter@gmail.com")]
def process(self, pyfile):
@@ -44,11 +43,6 @@ class Container(Crypter):
self._create_packages()
- #: Deprecated method, use `_load2disk` instead (Remove in 0.4.10)
- def loadToDisk(self, *args, **kwargs):
- return self._load2disk(*args, **kwargs)
-
-
def _load2disk(self):
"""
Loads container to disk if its stored remotely and overwrite url,
@@ -63,20 +57,18 @@ class Container(Crypter):
f.write(content)
except IOError, e:
- self.fail(str(e)) #@TODO: Remove `str` in 0.4.10
+ self.fail(e)
else:
self.pyfile.name = os.path.basename(self.pyfile.url)
+
if not exists(self.pyfile.url):
if exists(fs_join(pypath, self.pyfile.url)):
self.pyfile.url = fs_join(pypath, self.pyfile.url)
else:
self.fail(_("File not exists"))
-
-
- #: Deprecated method, use `delete_tmp` instead (Remove in 0.4.10)
- def deleteTmp(self, *args, **kwargs):
- return self.delete_tmp(*args, **kwargs)
+ else:
+ self.data = self.pyfile.url
def delete_tmp(self):
@@ -87,5 +79,3 @@ class Container(Crypter):
os.remove(self.pyfile.url)
except OSError, e:
self.log_warning(_("Error removing: %s") % self.pyfile.url, e)
- if self.pyload.debug:
- traceback.print_exc()
diff --git a/module/plugins/internal/Crypter.py b/module/plugins/internal/Crypter.py
index d0e8eb1b4..a5c88aed9 100644
--- a/module/plugins/internal/Crypter.py
+++ b/module/plugins/internal/Crypter.py
@@ -1,19 +1,18 @@
# -*- coding: utf-8 -*-
-import urlparse
-
-from module.plugins.internal.Hoster import Hoster, _fixurl
+from module.plugins.internal.Base import Base, parse_name
from module.utils import save_path as safe_filename
-class Crypter(Hoster):
+class Crypter(Base):
__name__ = "Crypter"
__type__ = "crypter"
- __version__ = "0.07"
+ __version__ = "0.11"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
- __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), #: Overrides pyload.config.get("general", "folder_per_package")
+ __config__ = [("use_premium" , "bool", "Use premium account if available" , True),
+ ("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides pyload.config.get("general", "folder_per_package")
("subfolder_per_package", "bool", "Create a subfolder for each package", True)]
__description__ = """Base decrypter plugin"""
@@ -21,9 +20,6 @@ class Crypter(Hoster):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- html = None #: Last html loaded #@TODO: Move to Hoster
-
-
def __init__(self, pyfile):
super(Crypter, self).__init__(pyfile)
@@ -33,6 +29,16 @@ class Crypter(Hoster):
#: List of urls, pyLoad will generate packagenames
self.urls = []
+ self._setup()
+ self.init()
+
+
+ def _setup(self):
+ super(Crypter, self)._setup()
+
+ self.packages = []
+ self.urls = []
+
def process(self, pyfile):
"""
@@ -50,6 +56,9 @@ class Crypter(Hoster):
def decrypt(self, pyfile):
+ """
+ The "main" method of every crypter plugin, you **have to** overwrite it
+ """
raise NotImplementedError
@@ -78,13 +87,15 @@ class Crypter(Hoster):
"%d links" % len(links),
"Saved to folder: %s" % folder if folder else "Saved to download folder")
- pid = self.pyload.api.addPackage(name, map(self.fixurl, links), package_queue)
+ links = map(self.fixurl, links)
+
+ pid = self.pyload.api.addPackage(name, links, package_queue)
if package_password:
self.pyload.api.setPackageData(pid, {'password': package_password})
#: Workaround to do not break API addPackage method
- set_folder = lambda x: self.pyload.api.setPackageData(pid, {'folder': x or ""})
+ set_folder = lambda x="": self.pyload.api.setPackageData(pid, {'folder': safe_filename(x)})
if use_subfolder:
if not subfolder_per_package:
@@ -93,10 +104,10 @@ class Crypter(Hoster):
elif not folder_per_package or name is not folder:
if not folder:
- folder = urlparse.urlparse(_fixurl(name)).path.split("/")[-1]
+ folder = parse_name(name)
- set_folder(safe_filename(folder))
+ set_folder(folder)
self.log_debug("Set package %(name)s folder to: %(folder)s" % {'name': name, 'folder': folder})
elif folder_per_package:
- set_folder(None)
+ set_folder()
diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py
index 7f5212090..3ab5d6a0d 100644
--- a/module/plugins/internal/Extractor.py
+++ b/module/plugins/internal/Extractor.py
@@ -5,6 +5,7 @@ import re
from module.PyFile import PyFile
from module.plugins.internal.Plugin import Plugin
+from module.utils import fs_encode
class ArchiveError(Exception):
@@ -22,7 +23,7 @@ class PasswordError(Exception):
class Extractor(Plugin):
__name__ = "Extractor"
__type__ = "extractor"
- __version__ = "0.33"
+ __version__ = "0.35"
__status__ = "testing"
__description__ = """Base extractor plugin"""
@@ -43,15 +44,9 @@ class Extractor(Plugin):
@classmethod
- def is_multipart(cls, filename):
- return False
-
-
- @classmethod
def find(cls):
"""
Check if system statisfy dependencies
- :return: boolean
"""
pass
@@ -72,9 +67,15 @@ class Extractor(Plugin):
if pname not in processed:
processed.append(pname)
targets.append((fname, id, fout))
+
return targets
+ @property
+ def target(self):
+ return fs_encode(self.filename)
+
+
def __init__(self, plugin, filename, out,
fullpath=True,
overwrite=False,
@@ -119,53 +120,29 @@ class Extractor(Plugin):
(self.__name__,) + messages)
- def check(self):
+ def verify(self, password=None):
"""
- Quick Check by listing content of archive.
- Raises error if password is needed, integrity is questionable or else.
-
- :raises PasswordError
- :raises CRCError
- :raises ArchiveError
+ Testing with Extractors built-in method
+ Raise error if password is needed, integrity is questionable or else
"""
- raise NotImplementedError
-
-
- def verify(self):
- """
- Testing with Extractors buildt-in method
- Raises error if password is needed, integrity is questionable or else.
-
- :raises PasswordError
- :raises CRCError
- :raises ArchiveError
- """
- raise NotImplementedError
+ pass
def repair(self):
- return None
+ return False
def extract(self, password=None):
"""
- Extract the archive. Raise specific errors in case of failure.
-
- :param progress: Progress function, call this to update status
- :param password password to use
- :raises PasswordError
- :raises CRCError
- :raises ArchiveError
- :return:
+ Extract the archive
+ Raise specific errors in case of failure
"""
raise NotImplementedError
- def get_delete_files(self):
+ def items(self):
"""
- Return list of files to delete, do *not* delete them here.
-
- :return: List with paths of files to delete
+ Return list of archive parts
"""
return [self.filename]
diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py
index 1f566f824..8ae731a7f 100644
--- a/module/plugins/internal/Hook.py
+++ b/module/plugins/internal/Hook.py
@@ -9,8 +9,6 @@ class Hook(Addon):
__version__ = "0.13"
__status__ = "testing"
- __config__ = [] #: [("name", "type", "desc", "default")]
-
__description__ = """Base hook plugin"""
__license__ = "GPLv3"
__authors__ = [("mkaay" , "mkaay@mkaay.de" ),
diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py
index a0cdb1e2e..26da436a5 100644
--- a/module/plugins/internal/Hoster.py
+++ b/module/plugins/internal/Hoster.py
@@ -2,352 +2,111 @@
from __future__ import with_statement
-import inspect
import os
-import random
-import time
-import traceback
-import urlparse
-
-from module.plugins.internal.Captcha import Captcha
-from module.plugins.internal.Plugin import (Plugin, Abort, Fail, Reconnect, Retry, Skip,
- chunks, encode, exists, fixurl as _fixurl, replace_patterns,
- seconds_to_midnight, set_cookie, set_cookies, parse_html_form,
- parse_html_tag_attr_value, timestamp)
-from module.utils import fs_decode, fs_encode, save_join as fs_join, save_path as safe_filename
-
-
-#@TODO: Remove in 0.4.10
-def parse_fileInfo(klass, url="", html=""):
- info = klass.get_info(url, html)
- return info['name'], info['size'], info['status'], info['url']
-
-
-#@TODO: Remove in 0.4.10
-def getInfo(urls):
- #: result = [ .. (name, size, status, url) .. ]
- pass
+import re
-
-#@TODO: Remove in 0.4.10
-def create_getInfo(klass):
- def get_info(urls):
- for url in urls:
- if hasattr(klass, "URL_REPLACEMENTS"):
- url = replace_patterns(url, klass.URL_REPLACEMENTS)
- yield parse_fileInfo(klass, url)
-
- return get_info
+from module.plugins.internal.Base import Base, check_abort, create_getInfo, getInfo, parse_fileInfo
+from module.plugins.internal.Plugin import Fail, Retry, encode, exists, fixurl, parse_name
+from module.utils import fs_decode, fs_encode, save_join as fs_join, save_path as safe_filename
-class Hoster(Plugin):
+class Hoster(Base):
__name__ = "Hoster"
__type__ = "hoster"
- __version__ = "0.19"
+ __version__ = "0.34"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
- __config__ = [] #: [("name", "type", "desc", "default")]
+ __config__ = [("use_premium" , "bool", "Use premium account if available" , True),
+ ("fallback_premium", "bool", "Fallback to free download if premium fails", True),
+ ("chk_filesize" , "bool", "Check file size" , True)]
__description__ = """Base hoster plugin"""
__license__ = "GPLv3"
- __authors__ = [("RaNaN" , "RaNaN@pyload.org" ),
- ("spoob" , "spoob@pyload.org" ),
- ("mkaay" , "mkaay@mkaay.de" ),
- ("Walter Purcaro", "vuolter@gmail.com")]
+ __authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
def __init__(self, pyfile):
- self._init(pyfile.m.core)
-
- #: Engage wan reconnection
- self.wantReconnect = False #@TODO: Change to `want_reconnect` in 0.4.10
+ super(Hoster, self).__init__(pyfile)
#: Enable simultaneous processing of multiple downloads
- self.multiDL = True #@TODO: Change to `multi_dl` in 0.4.10
self.limitDL = 0 #@TODO: Change to `limit_dl` in 0.4.10
- #: time.time() + wait in seconds
- self.wait_until = 0
- self.waiting = False
-
- #: Account handler instance, see :py:class:`Account`
- self.account = None
- self.user = None
- self.req = None #: Browser instance, see `network.Browser`
-
- #: Associated pyfile instance, see `PyFile`
- self.pyfile = pyfile
-
- self.thread = None #: Holds thread in future
-
#: Location where the last call to download was saved
- self.last_download = ""
+ self.last_download = None
#: Re match of the last call to `checkDownload`
self.last_check = None
- #: Js engine, see `JsEngine`
- self.js = self.pyload.js
-
- #: Captcha stuff
- self.captcha = Captcha(self)
-
- #: Some plugins store html code here
- self.html = None
-
- #: Dict of the amount of retries already made
- self.retries = {}
- self.retry_free = False #@TODO: Recheck in 0.4.10
+ #: Restart flag
+ self.rst_free = False #@TODO: Recheck in 0.4.10
self._setup()
self.init()
- @classmethod
- def get_info(cls, url="", html=""):
- url = _fixurl(url)
- url_p = urlparse.urlparse(url)
- return {'name' : (url_p.path.split('/')[-1] or
- url_p.query.split('=', 1)[::-1][0].split('&', 1)[0] or
- url_p.netloc.split('.', 1)[0]),
- 'size' : 0,
- 'status': 3 if url else 8,
- 'url' : url}
-
-
- def init(self):
- """
- Initialize the plugin (in addition to `__init__`)
- """
- pass
-
-
- def setup(self):
- """
- Setup for enviroment and other things, called before downloading (possibly more than one time)
- """
- pass
-
-
def _setup(self):
- if self.account:
- self.req = self.pyload.requestFactory.getRequest(self.__name__, self.user)
- self.chunk_limit = -1 #: -1 for unlimited
- self.resume_download = True
- self.premium = self.account.is_premium(self.user)
- else:
- self.req = self.pyload.requestFactory.getRequest(self.__name__)
- self.chunk_limit = 1
- self.resume_download = False
- self.premium = False
-
-
- def load_account(self):
- if self.req:
- self.req.close()
+ super(Hoster, self)._setup()
- if not self.account:
- self.account = self.pyload.accountManager.getAccountPlugin(self.__name__)
+ self.last_download = None
+ self.last_check = None
+ self.rst_free = False
- if self.account:
- if not self.user:
- self.user = self.account.select()[0]
- if not self.user or not self.account.is_logged(self.user, True):
- self.account = False
+ def load_account(self):
+ if self.rst_free:
+ self.account = False
+ self.user = None #@TODO: Remove in 0.4.10
+ else:
+ super(Hoster, self).load_account()
+ # self.rst_free = False
- def preprocessing(self, thread):
+ def _process(self, thread):
"""
Handles important things to do before starting
"""
self.thread = thread
- if self.retry_free:
- self.account = False
- else:
- self.load_account() #@TODO: Move to PluginThread in 0.4.10
- self.retry_free = False
-
self._setup()
- self.setup()
-
- self.pyload.hookManager.downloadPreparing(self.pyfile) #@TODO: Recheck in 0.4.10
- if self.pyfile.abort:
- self.abort()
+ # self.pyload.hookManager.downloadPreparing(self.pyfile) #@TODO: Recheck in 0.4.10
+ self.check_abort()
self.pyfile.setStatus("starting")
- self.log_debug("PROCESS URL " + self.pyfile.url, "PLUGIN VERSION %s" % self.__version__)
-
- return self.process(self.pyfile)
-
-
- def process(self, pyfile):
- """
- The 'main' method of every plugin, you **have to** overwrite it
- """
- raise NotImplementedError
-
-
- def set_reconnect(self, reconnect):
- reconnect = bool(reconnect)
-
- self.log_info(_("RECONNECT ") + ("enabled" if reconnect else "disabled"))
- self.log_debug("Previous wantReconnect: %s" % self.wantReconnect)
-
- self.wantReconnect = reconnect
-
-
- def set_wait(self, seconds, reconnect=None):
- """
- Set a specific wait time later used with `wait`
-
- :param seconds: wait time in seconds
- :param reconnect: True if a reconnect would avoid wait time
- """
- wait_time = max(int(seconds), 1)
- wait_until = time.time() + wait_time + 1
-
- self.log_info(_("WAIT %d seconds") % wait_time)
- self.log_debug("Previous waitUntil: %f" % self.pyfile.waitUntil)
-
- self.pyfile.waitUntil = wait_until
-
- if reconnect is not None:
- self.set_reconnect(reconnect)
-
-
- def wait(self, seconds=None, reconnect=None):
- """
- Waits the time previously set
- """
- pyfile = self.pyfile
-
- if seconds is not None:
- self.set_wait(seconds)
-
- if reconnect is not None:
- self.set_reconnect(reconnect)
-
- self.waiting = True
-
- status = pyfile.status #@NOTE: Remove in 0.4.10
- pyfile.setStatus("waiting")
-
- if not self.wantReconnect or self.account:
- if self.account:
- self.log_warning("Ignore reconnection due logged account")
-
- while pyfile.waitUntil > time.time():
- if pyfile.abort:
- self.abort()
-
- time.sleep(2)
-
- else:
- while pyfile.waitUntil > time.time():
- if pyfile.abort:
- self.abort()
-
- if self.thread.m.reconnecting.isSet():
- self.waiting = False
- self.wantReconnect = False
- raise Reconnect
-
- self.thread.m.reconnecting.wait(2)
- time.sleep(2)
-
- self.waiting = False
- pyfile.status = status #@NOTE: Remove in 0.4.10
-
-
- def skip(self, reason=""):
- """
- Skip and give reason
- """
- raise Skip(encode(reason)) #@TODO: Remove `encode` in 0.4.10
-
-
- def abort(self, reason=""):
- """
- Abort and give reason
- """
- #@TODO: Remove in 0.4.10
- if reason:
- self.pyfile.error = encode(reason)
-
- raise Abort
-
-
- def offline(self, reason=""):
- """
- Fail and indicate file is offline
- """
- #@TODO: Remove in 0.4.10
- if reason:
- self.pyfile.error = encode(reason)
-
- raise Fail("offline")
-
-
- def temp_offline(self, reason=""):
- """
- Fail and indicates file ist temporary offline, the core may take consequences
- """
- #@TODO: Remove in 0.4.10
- if reason:
- self.pyfile.error = encode(reason)
-
- raise Fail("temp. offline")
+ try:
+ self.log_debug("PROCESS URL " + self.pyfile.url, "PLUGIN VERSION %s" % self.__version__) #@TODO: Remove in 0.4.10
+ self.process(self.pyfile)
- def retry(self, max_tries=5, wait_time=1, reason=""):
- """
- Retries and begin again from the beginning
+ self.check_abort()
- :param max_tries: number of maximum retries
- :param wait_time: time to wait in seconds
- :param reason: reason for retrying, will be passed to fail if max_tries reached
- """
- id = inspect.currentframe().f_back.f_lineno
- if id not in self.retries:
- self.retries[id] = 0
+ self.log_debug("CHECK DOWNLOAD") #@TODO: Recheck in 0.4.10
+ self._check_download()
- if 0 < max_tries <= self.retries[id]:
- self.fail(reason or _("Max retries reached"))
+ except Fail, e: #@TODO: Move to PluginThread in 0.4.10
+ if self.get_config('fallback_premium', True) and self.premium:
+ self.log_warning(_("Premium download failed"), e)
+ self.restart()
- self.wait(wait_time, False)
-
- self.retries[id] += 1
- raise Retry(encode(reason)) #@TODO: Remove `encode` in 0.4.10
+ else:
+ raise Fail(e)
- def restart(self, reason=None, nopremium=False):
- if not reason:
- reason = _("Fallback to free download") if nopremium else _("Restart")
+ def restart(self, msg="", premium=False):
+ if not msg:
+ msg = _("Simple restart") if premium else _("Fallback to free download")
- if nopremium:
+ if not premium:
if self.premium:
- self.retry_free = True
+ self.rst_free = True
else:
- self.fail("%s | %s" % (reason, _("Download was already free")))
+ self.fail("%s | %s" % (msg, _("Download was already free")))
- raise Retry(encode(reason)) #@TODO: Remove `encode` in 0.4.10
-
-
- def fixurl(self, url):
- url = _fixurl(url)
-
- if not urlparse.urlparse(url).scheme:
- url_p = urlparse.urlparse(self.pyfile.url)
- baseurl = "%s://%s" % (url_p.scheme, url_p.netloc)
- url = urlparse.urljoin(baseurl, url)
-
- return url
+ raise Retry(encode(msg)) #@TODO: Remove `encode` in 0.4.10
+ @check_abort
def download(self, url, get={}, post={}, ref=True, cookies=True, disposition=True):
"""
Downloads the content at url to download folder
@@ -361,23 +120,18 @@ class Hoster(Plugin):
the filename will be changed if needed
:return: The location where the file was saved
"""
- if self.pyfile.abort:
- self.abort()
-
- url = self.fixurl(url)
-
- if not url or not isinstance(url, basestring):
- self.fail(_("No url given"))
-
if self.pyload.debug:
self.log_debug("DOWNLOAD URL " + url,
- *["%s=%s" % (key, val) for key, val in locals().items() if key not in ("self", "url")])
+ *["%s=%s" % (key, val) for key, val in locals().items() if key not in ("self", "url", "_[1]")])
+
+ url = self.fixurl(url)
- name = _fixurl(self.pyfile.name)
- self.pyfile.name = urlparse.urlparse(name).path.split('/')[-1] or name
+ self.pyfile.name = parse_name(self.pyfile.name) #: Safe check
self.captcha.correct()
- self.check_for_same_files()
+
+ if self.pyload.config.get("download", "skip_existing"):
+ self.check_filedupe()
self.pyfile.setStatus("downloading")
@@ -387,6 +141,7 @@ class Hoster(Plugin):
if not exists(download_location):
try:
os.makedirs(download_location)
+
except Exception, e:
self.fail(e)
@@ -397,8 +152,7 @@ class Hoster(Plugin):
self.pyload.hookManager.dispatchEvent("download_start", self.pyfile, url, filename)
- if self.pyfile.abort:
- self.abort()
+ self.check_abort()
try:
newname = self.req.httpDownload(url, filename, get=get, post=post, ref=ref, cookies=cookies,
@@ -409,30 +163,60 @@ class Hoster(Plugin):
#@TODO: Recheck in 0.4.10
if disposition and newname:
- finalname = urlparse.urlparse(newname).path.split('/')[-1].split(' filename*=')[0]
+ finalname = parse_name(newname).split(' filename*=')[0]
- if finalname != newname != self.pyfile.name:
+ if finalname != newname:
try:
- os.rename(fs_join(location, newname), fs_join(location, finalname))
+ oldname_enc = fs_join(download_location, newname)
+ newname_enc = fs_join(download_location, finalname)
+ os.rename(oldname_enc, newname_enc)
except OSError, e:
self.log_warning(_("Error renaming `%s` to `%s`") % (newname, finalname), e)
finalname = newname
self.log_info(_("`%s` saved as `%s`") % (self.pyfile.name, finalname))
- self.pyfile.name = finalname
- filename = os.path.join(location, finalname)
+
+ self.pyfile.name = finalname
+ filename = os.path.join(location, finalname)
self.set_permissions(fs_encode(filename))
self.last_download = filename
- return self.last_download
+ return filename
+
+
+ def check_filesize(self, file_size, size_tolerance=1024):
+ """
+ Checks the file size of the last downloaded file
+
+ :param file_size: expected file size
+ :param size_tolerance: size check tolerance
+ """
+ if not self.last_download:
+ return
+
+ download_location = fs_encode(self.last_download)
+ download_size = os.stat(download_location).st_size
+
+ if download_size < 1:
+ self.fail(_("Empty file"))
+
+ elif file_size > 0:
+ diff = abs(file_size - download_size)
+
+ if diff > size_tolerance:
+ self.fail(_("File size mismatch | Expected file size: %s | Downloaded file size: %s")
+ % (file_size, download_size))
+
+ elif diff != 0:
+ self.log_warning(_("File size is not equal to expected size"))
- def check_download(self, rules, delete=False, file_size=0, size_tolerance=1024, read_size=1048576):
+ def check_file(self, rules, delete=False, read_size=1048576, file_size=0, size_tolerance=1024):
"""
- Checks the content of the last downloaded file, re match is saved to `lastCheck`
+ Checks the content of the last downloaded file, re match is saved to `last_check`
:param rules: dict with names and rules to match (compiled regexp or strings)
:param delete: delete if matched
@@ -442,29 +226,13 @@ class Hoster(Plugin):
:return: dictionary key of the first rule that matched
"""
do_delete = False
- last_download = fs_encode(self.last_download)
+ last_download = fs_encode(self.last_download) #@TODO: Recheck in 0.4.10
if not self.last_download or not exists(last_download):
- self.last_download = ""
self.fail(self.pyfile.error or _("No file downloaded"))
try:
- download_size = os.stat(last_download).st_size
-
- if download_size < 1:
- do_delete = True
- self.fail(_("Empty file"))
-
- elif file_size > 0:
- diff = abs(file_size - download_size)
-
- if diff > size_tolerance:
- do_delete = True
- self.fail(_("File size mismatch | Expected file size: %s | Downloaded file size: %s")
- % (file_size, download_size))
-
- elif diff != 0:
- self.log_warning(_("File size is not equal to expected size"))
+ self.check_filesize(file_size, size_tolerance)
with open(last_download, "rb") as f:
content = f.read(read_size)
@@ -479,7 +247,7 @@ class Hoster(Plugin):
elif hasattr(rule, "search"):
m = rule.search(content)
- if m:
+ if m is not None:
do_delete = True
self.last_check = m
return name
@@ -490,133 +258,45 @@ class Hoster(Plugin):
except OSError, e:
self.log_warning(_("Error removing: %s") % last_download, e)
- if self.pyload.debug:
- traceback.print_exc()
else:
- self.last_download = ""
- self.log_info(_("File deleted"))
-
-
- def direct_link(self, url, follow_location=None):
- link = ""
-
- if follow_location is None:
- redirect = 1
-
- elif type(follow_location) is int:
- redirect = max(follow_location, 1)
-
- else:
- redirect = self.get_config("maxredirs", 10, "UserAgentSwitcher")
+ self.log_info(_("File deleted: ") + self.last_download)
+ self.last_download = "" #: Recheck in 0.4.10
- for i in xrange(redirect):
- try:
- self.log_debug("Redirect #%d to: %s" % (i, url))
- header = self.load(url, just_header=True)
-
- except Exception: #: Bad bad bad... rewrite this part in 0.4.10
- res = self.load(url,
- just_header=True,
- req=self.pyload.requestFactory.getRequest())
-
- header = {'code': req.code}
- for line in res.splitlines():
- line = line.strip()
- if not line or ":" not in line:
- continue
-
- key, none, value = line.partition(":")
- key = key.lower().strip()
- value = value.strip()
-
- if key in header:
- if type(header[key]) is list:
- header[key].append(value)
- else:
- header[key] = [header[key], value]
- else:
- header[key] = value
-
- if 'content-disposition' in header:
- link = url
-
- elif 'location' in header and header['location']:
- location = header['location']
-
- if not urlparse.urlparse(location).scheme:
- url_p = urlparse.urlparse(url)
- baseurl = "%s://%s" % (url_p.scheme, url_p.netloc)
- location = urlparse.urljoin(baseurl, location)
-
- if 'code' in header and header['code'] == 302:
- link = location
-
- if follow_location:
- url = location
- continue
-
- else:
- extension = os.path.splitext(urlparse.urlparse(url).path.split('/')[-1])[-1]
-
- if 'content-type' in header and header['content-type']:
- mimetype = header['content-type'].split(';')[0].strip()
-
- elif extension:
- mimetype = mimetypes.guess_type(extension, False)[0] or "application/octet-stream"
- else:
- mimetype = ""
-
- if mimetype and (link or 'html' not in mimetype):
- link = url
- else:
- link = ""
+ def _check_download(self):
+ if self.captcha.task and not self.last_download:
+ self.retry_captcha()
- break
+ elif self.check_file({'Empty file': re.compile(r'\A((.|)(\2|\s)*)\Z')},
+ delete=True):
+ self.error(_("Empty file"))
- else:
- try:
- self.log_error(_("Too many redirects"))
- except Exception:
- pass
+ elif self.get_config('chk_filesize', False) and self.info.get('size'):
+ # 10485760 is 10MB, tolerance is used when comparing displayed size on the hoster website to real size
+ # For example displayed size can be 1.46GB for example, but real size can be 1.4649853GB
+ self.check_filesize(self.info['size'], size_tolerance=10485760)
- return link
-
- def parse_html_form(self, attr_str="", input_names={}):
- return parse_html_form(attr_str, self.html, input_names)
-
-
- def check_traffic_left(self):
+ def check_traffic(self):
if not self.account:
return True
- traffic = self.account.get_data(self.user, True)['trafficleft']
+ traffic = self.account.get_data('trafficleft')
if traffic is None:
return False
- elif traffic == -1:
+
+ elif traffic is -1:
return True
+
else:
- size = self.pyfile.size / 1024
- self.log_info(_("Filesize: %s KiB, Traffic left for user %s: %s KiB") % (size, self.user, traffic))
+ size = self.pyfile.size / 1024 #@TODO: Remove in 0.4.10
+ self.log_info(_("Filesize: %s KiB, Traffic left for user %s: %s KiB") % (size, self.account.user, traffic)) #@TODO: Rewrite in 0.4.10
return size <= traffic
- def get_password(self):
- """
- Get the password the user provided in the package
- """
- return self.pyfile.package().password or ""
-
-
- #: Deprecated method, use `check_for_same_files` instead (Remove in 0.4.10)
- def checkForSameFiles(self, *args, **kwargs):
- return self.check_for_same_files(*args, **kwargs)
-
-
- def check_for_same_files(self, starting=False):
+ def check_filedupe(self):
"""
Checks if same file was/is downloaded within same package
@@ -626,23 +306,32 @@ class Hoster(Plugin):
pack = self.pyfile.package()
for pyfile in self.pyload.files.cache.values():
- if pyfile != self.pyfile and pyfile.name is self.pyfile.name and pyfile.package().folder is pack.folder:
- if pyfile.status in (0, 12): #: Finished or downloading
- self.skip(pyfile.pluginname)
- elif pyfile.status in (5, 7) and starting: #: A download is waiting/starting and was appenrently started before
- self.skip(pyfile.pluginname)
+ if pyfile is self.pyfile:
+ continue
- download_folder = self.pyload.config.get("general", "download_folder")
- location = fs_join(download_folder, pack.folder, self.pyfile.name)
+ if pyfile.name != self.pyfile.name or pyfile.package().folder != pack.folder:
+ continue
- if starting and self.pyload.config.get("download", "skip_existing") and exists(location):
- size = os.stat(location).st_size
- if size >= self.pyfile.size:
- self.skip("File exists")
+ if pyfile.status in (0, 5, 7, 12): #: (finished, waiting, starting, downloading)
+ self.skip(pyfile.pluginname)
- pyfile = self.pyload.db.findDuplicates(self.pyfile.id, self.pyfile.package().folder, self.pyfile.name)
+ download_folder = self.pyload.config.get("general", "download_folder")
+ package_folder = pack.folder if self.pyload.config.get("general", "folder_per_package") else ""
+ download_location = fs_join(download_folder, package_folder, self.pyfile.name)
+
+ if not exists(download_location):
+ return
+
+ pyfile = self.pyload.db.findDuplicates(self.pyfile.id, package_folder, self.pyfile.name)
if pyfile:
- if exists(location):
- self.skip(pyfile[0])
+ self.skip(pyfile[0])
+
+ size = os.stat(download_location).st_size
+ if size >= self.pyfile.size:
+ self.skip(_("File exists"))
- self.log_debug("File %s not skipped, because it does not exists." % self.pyfile.name)
+
+ #: Deprecated method, use `check_filedupe` instead (Remove in 0.4.10)
+ def checkForSameFiles(self, *args, **kwargs):
+ if self.pyload.config.get("download", "skip_existing"):
+ return self.check_filedupe()
diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiAccount.py
index 42a1985b5..b38670ce7 100644
--- a/module/plugins/internal/MultiHook.py
+++ b/module/plugins/internal/MultiAccount.py
@@ -2,30 +2,29 @@
import re
import time
-import traceback
-from module.plugins.internal.Hook import Hook
+from module.plugins.internal.Account import Account
from module.utils import decode, remove_chars
-class MultiHook(Hook):
- __name__ = "MultiHook"
- __type__ = "hook"
- __version__ = "0.54"
+class MultiAccount(Account):
+ __name__ = "MultiAccount"
+ __type__ = "account"
+ __version__ = "0.02"
__status__ = "testing"
- __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
- ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
- ("reload" , "bool" , "Reload plugin list" , True ),
- ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
+ __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
+ ("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
+ ("reload" , "bool" , "Reload plugin list" , True ),
+ ("reloadinterval", "int" , "Reload interval in hours" , 12 )]
- __description__ = """Hook plugin for multi hoster/crypter"""
+ __description__ = """Multi hoster account plugin"""
__license__ = "GPLv3"
__authors__ = [("pyLoad Team" , "admin@pyload.org" ),
("Walter Purcaro", "vuolter@gmail.com")]
- MIN_RELOAD_INTERVAL = 1 * 60 * 60 #: 1 hour
+ REFRESH_INTERVAL = 1 * 60 * 60 #: 1 hour
DOMAIN_REPLACEMENTS = [(r'180upload\.com' , "hundredeightyupload.com"),
(r'bayfiles\.net' , "bayfiles.com" ),
@@ -55,6 +54,34 @@ class MultiHook(Hook):
(r'^0' , "zero" )]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
def init(self):
self.plugins = []
self.supported = []
@@ -102,7 +129,7 @@ class MultiHook(Hook):
for _i in xrange(5):
try:
- pluginset = self._plugin_set(self.get_hosters())
+ pluginset = self._plugin_set(self.grab_hosters())
break
except Exception, e:
@@ -110,7 +137,7 @@ class MultiHook(Hook):
time.sleep(60)
else:
self.log_error(_("No hoster list retrieved"))
- self.interval = self.MIN_RELOAD_INTERVAL
+ self.interval = self.REFRESH_INTERVAL
return list()
try:
@@ -144,7 +171,7 @@ class MultiHook(Hook):
return set(plugins)
- def get_hosters(self):
+ def grab_hosters(self, user, password, data):
"""
Load list of supported hoster
@@ -160,7 +187,7 @@ class MultiHook(Hook):
self.load_account()
if self.get_config('reload', True):
- self.interval = max(self.get_config('reloadinterval', 12) * 60 * 60, self.MIN_RELOAD_INTERVAL)
+ self.interval = max(self.get_config('reloadinterval', 12) * 60 * 60, self.REFRESH_INTERVAL)
else:
self.pyload.scheduler.removeJob(self.cb)
self.cb = None
diff --git a/module/plugins/internal/MultiCrypter.py b/module/plugins/internal/MultiCrypter.py
index ca7b03941..9d4ac3ab9 100644
--- a/module/plugins/internal/MultiCrypter.py
+++ b/module/plugins/internal/MultiCrypter.py
@@ -6,12 +6,13 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter
class MultiCrypter(SimpleCrypter):
__name__ = "MultiCrypter"
__type__ = "hoster"
- __version__ = "0.02"
+ __version__ = "0.03"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
- __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True),
- ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)]
+ __config__ = [("use_premium" , "bool", "Use premium account if available" , True),
+ ("use_subfolder" , "bool", "Save package to subfolder" , True),
+ ("subfolder_per_package", "bool", "Create a subfolder for each package", True)]
__description__ = """Multi decrypter plugin"""
__license__ = "GPLv3"
@@ -19,7 +20,7 @@ class MultiCrypter(SimpleCrypter):
def init(self):
- self.CRYPTER_NAME = self.pyload.pluginManager.crypterPlugins[self.__name__]['name']
+ self.PLUGIN_NAME = self.pyload.pluginManager.crypterPlugins[self.__name__]['name']
def _log(self, level, plugintype, pluginname, messages):
diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py
index c0c928a45..d7d3c5ccd 100644
--- a/module/plugins/internal/MultiHoster.py
+++ b/module/plugins/internal/MultiHoster.py
@@ -9,33 +9,35 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, r
class MultiHoster(SimpleHoster):
__name__ = "MultiHoster"
__type__ = "hoster"
- __version__ = "0.50"
+ __version__ = "0.52"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
- __config__ = [("use_premium" , "bool", "Use premium account if available" , True),
- ("revertfailed", "bool", "Revert to standard download if fails", True)]
+ __config__ = [("use_premium" , "bool", "Use premium account if available" , True),
+ ("fallback_premium", "bool", "Fallback to free download if premium fails", True),
+ ("chk_filesize" , "bool", "Check file size" , True),
+ ("revertfailed" , "bool", "Revert to standard download if fails" , True)]
__description__ = """Multi hoster plugin"""
__license__ = "GPLv3"
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_NAME = None
+ PLUGIN_NAME = None
LEECH_HOSTER = False
LOGIN_ACCOUNT = True
def init(self):
- self.HOSTER_NAME = self.pyload.pluginManager.hosterPlugins[self.__name__]['name']
+ self.PLUGIN_NAME = self.pyload.pluginManager.hosterPlugins[self.__name__]['name']
def _log(self, level, plugintype, pluginname, messages):
return super(MultiHoster, self)._log(level,
plugintype,
pluginname,
- (self.HOSTER_NAME,) + messages)
+ (self.PLUGIN_NAME,) + messages)
def setup(self):
@@ -83,11 +85,11 @@ class MultiHoster(SimpleHoster):
self.check_errors()
self.check_status(getinfo=False)
- if self.premium and (not self.CHECK_TRAFFIC or self.check_traffic_left()):
+ if self.premium and (not self.CHECK_TRAFFIC or self.check_traffic()):
self.log_info(_("Processing as premium download..."))
self.handle_premium(pyfile)
- elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.check_traffic_left()):
+ elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.check_traffic()):
self.log_info(_("Processing as free download..."))
self.handle_free(pyfile)
@@ -95,12 +97,12 @@ class MultiHoster(SimpleHoster):
self.log_info(_("Downloading file..."))
self.download(self.link, disposition=self.DISPOSITION)
- self.check_file()
+ self.check_download()
except Fail, e: #@TODO: Move to PluginThread in 0.4.10
if self.premium:
self.log_warning(_("Premium download failed"))
- self.restart(nopremium=True)
+ self.restart()
elif self.get_config("revertfailed", True) \
and "new_module" in self.pyload.pluginManager.hosterPlugins[self.__name__]:
@@ -116,7 +118,7 @@ class MultiHoster(SimpleHoster):
hdict['new_module'] = tmp_module
hdict['new_name'] = tmp_name
- self.restart(_("Revert to original hoster plugin"))
+ self.restart(_("Revert to original hoster plugin"), premium=True)
else:
raise Fail(encode(e)) #@TODO: Remove `encode` in 0.4.10
diff --git a/module/plugins/internal/OCR.py b/module/plugins/internal/OCR.py
index b24b3058b..884639b6b 100644
--- a/module/plugins/internal/OCR.py
+++ b/module/plugins/internal/OCR.py
@@ -12,7 +12,6 @@ import logging
import os
import subprocess
# import tempfile
-import traceback
from module.plugins.internal.Plugin import Plugin
from module.utils import save_join as fs_join
@@ -95,7 +94,7 @@ class OCR(Plugin):
self.pyload.log_debug("Saving tiff...")
self.image.save(tmpTif.name, 'TIFF')
- if os.name == "nt":
+ if os.name is "nt":
tessparams = [os.path.join(pypath, "tesseract", "tesseract.exe")]
else:
tessparams = ["tesseract"]
@@ -128,6 +127,7 @@ class OCR(Plugin):
try:
with open(tmpTxt.name, 'r') as f:
self.result_captcha = f.read().replace("\n", "")
+
except Exception:
self.result_captcha = ""
@@ -137,10 +137,9 @@ class OCR(Plugin):
os.remove(tmpTxt.name)
if subset and (digits or lowercase or uppercase):
os.remove(tmpSub.name)
+
except OSError, e:
self.log_warning(e)
- if self.pyload.debug:
- traceback.print_exc()
def recognize(self, name):
@@ -194,6 +193,7 @@ class OCR(Plugin):
count += 1
if pixels[x, y - 1] != 255:
count += 1
+
except Exception:
pass
diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py
index 7b45c40a8..6d94ca1e4 100644
--- a/module/plugins/internal/Plugin.py
+++ b/module/plugins/internal/Plugin.py
@@ -6,14 +6,17 @@ import datetime
import inspect
import os
import re
+import time
+import traceback
import urllib
+import urlparse
-if os.name != "nt":
+if os.name is not "nt":
import grp
import pwd
from module.plugins.Plugin import Abort, Fail, Reconnect, Retry, SkipDownload as Skip #@TODO: Remove in 0.4.10
-from module.utils import fs_encode, fs_decode, html_unescape, save_join as fs_join
+from module.utils import fs_encode, fs_decode, html_unescape, parseFileSize as parse_size, save_join as fs_join
#@TODO: Move to utils in 0.4.10
@@ -22,7 +25,12 @@ def decode(string, encoding='utf8'):
if type(string) is str:
return string.decode(encoding, "replace")
else:
- return string
+ return unicode(string)
+
+
+#@TODO: Remove in 0.4.10
+def _decode(*args, **kwargs):
+ return decode(*args, **kwargs)
#@TODO: Move to utils in 0.4.10
@@ -31,14 +39,14 @@ def encode(string, encoding='utf8'):
if type(string) is unicode:
return string.encode(encoding, "replace")
else:
- return string
+ return str(string)
#@TODO: Move to utils in 0.4.10
def exists(path):
if os.path.exists(path):
- if os.name == "nt":
- dir, name = os.path.split(path)
+ if os.name is "nt":
+ dir, name = os.path.split(path.rstrip(os.sep))
return name in os.listdir(dir)
else:
return True
@@ -46,9 +54,69 @@ def exists(path):
return False
+def fixurl(url, unquote=None):
+ newurl = urllib.unquote(url)
+
+ if unquote is None:
+ unquote = newurl == url
+
+ newurl = html_unescape(newurl.decode('unicode-escape'))
+ newurl = re.sub(r'[^:]/{2,}', '/', newurl).strip().lstrip('.')
+
+ if not unquote:
+ newurl = urllib.quote(newurl)
+
+ return newurl
+
+
+def parse_name(string):
+ path = fixurl(decode(string), unquote=False)
+ url_p = urlparse.urlparse(path.rstrip('/'))
+ name = (url_p.path.split('/')[-1] or
+ url_p.query.split('=', 1)[::-1][0].split('&', 1)[0] or
+ url_p.netloc.split('.', 1)[0])
+
+ return urllib.unquote(name)
+
+
#@TODO: Move to utils in 0.4.10
-def fixurl(url):
- return html_unescape(urllib.unquote(url.decode('unicode-escape'))).strip().rstrip('/')
+def str2int(string):
+ try:
+ return int(string)
+ except:
+ pass
+
+ ones = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight",
+ "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen",
+ "sixteen", "seventeen", "eighteen", "nineteen"]
+ tens = ["", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy",
+ "eighty", "ninety"]
+
+ o_tuple = [(w, i) for i, w in enumerate(ones)]
+ t_tuple = [(w, i * 10) for i, w in enumerate(tens)]
+
+ numwords = dict(o_tuple + t_tuple)
+ tokens = re.split(r"[\s-]+", string.lower())
+
+ try:
+ return sum(numwords[word] for word in tokens)
+ except:
+ return 0
+
+
+def parse_time(string):
+ if re.search("da(il)?y|today", string):
+ time = seconds_to_midnight()
+
+ else:
+ this = re.compile("this", re.I)
+ regex = re.compile(r'(\d+|\w+)\s*(hr|hour|min|sec|)', re.I)
+
+ time = sum(1 if this.match(v) else str2int(v) *
+ {'hr': 3600, 'hour': 3600, 'min': 60, 'sec': 1, '': 1}[u.lower()]
+ for v, u in regex.findall(string))
+
+ return time
#@TODO: Move to utils in 0.4.10
@@ -56,22 +124,35 @@ def timestamp():
return int(time.time() * 1000)
-def seconds_to_midnight(gmt=0):
- now = datetime.datetime.utcnow() + datetime.timedelta(hours=gmt)
-
- if now.hour == 0 and now.minute < 10:
- midnight = now
+#@TODO: Move to utils in 0.4.10
+def which(program):
+ """
+ Works exactly like the unix command which
+ Courtesy of http://stackoverflow.com/a/377028/675646
+ """
+ isExe = lambda x: os.path.isfile(x) and os.access(x, os.X_OK)
+
+ fpath, fname = os.path.split(program)
+
+ if fpath:
+ if isExe(program):
+ return program
else:
- midnight = now + datetime.timedelta(days=1)
+ for path in os.environ['PATH'].split(os.pathsep):
+ exe_file = os.path.join(path.strip('"'), program)
+ if isExe(exe_file):
+ return exe_file
+
- td = midnight.replace(hour=0, minute=10, second=0, microsecond=0) - now
+def seconds_to_midnight(utc=None):
+ if utc is None:
+ now = datetime.datetime.today()
+ else:
+ now = datetime.datetime.utcnow() + datetime.timedelta(hours=utc)
- if hasattr(td, 'total_seconds'):
- res = td.total_seconds()
- else: #@NOTE: work-around for python 2.5 and 2.6 missing datetime.timedelta.total_seconds
- res = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
+ midnight = now.replace(hour=0, minute=1, second=0, microsecond=0) + datetime.timedelta(days=1)
- return int(res)
+ return (midnight - now).seconds
def replace_patterns(string, ruleslist):
@@ -112,7 +193,10 @@ def parse_html_form(attr_str, html, input_names={}):
else:
inputs[name] = value
- if input_names:
+ if not input_names:
+ #: No attribute check
+ return action, inputs
+ else:
#: Check input attributes
for key, val in input_names.items():
if key in inputs:
@@ -122,14 +206,12 @@ def parse_html_form(attr_str, html, input_names={}):
continue
elif hasattr(val, "search") and re.match(val, inputs[key]):
continue
- break #: Attibute value does not match
+ else:
+ break #: Attibute value does not match
else:
break #: Attibute name does not match
else:
return action, inputs #: Passed attribute check
- else:
- #: No attribute check
- return action, inputs
return {}, None #: No matching form found
@@ -145,8 +227,8 @@ def chunks(iterable, size):
class Plugin(object):
__name__ = "Plugin"
- __type__ = "hoster"
- __version__ = "0.30"
+ __type__ = "plugin"
+ __version__ = "0.44"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
@@ -154,10 +236,7 @@ class Plugin(object):
__description__ = """Base plugin"""
__license__ = "GPLv3"
- __authors__ = [("RaNaN" , "RaNaN@pyload.org" ),
- ("spoob" , "spoob@pyload.org" ),
- ("mkaay" , "mkaay@mkaay.de" ),
- ("Walter Purcaro", "vuolter@gmail.com")]
+ __authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
def __init__(self, core):
@@ -165,10 +244,16 @@ class Plugin(object):
self.init()
+ def __repr__(self):
+ return "<%(type)s %(name)s>" % {'type': self.__type__.capitalize(),
+ 'name': self.__name__}
+
+
def _init(self, core):
- self.pyload = core
- self.info = {} #: Provide information in dict here
- self.req = None
+ self.pyload = core
+ self.info = {} #: Provide information in dict here
+ self.req = None #: Browser instance, see `network.Browser`
+ self.last_html = None
def init(self):
@@ -180,33 +265,37 @@ class Plugin(object):
def _log(self, level, plugintype, pluginname, messages):
log = getattr(self.pyload.log, level)
- msg = encode(" | ".join((a if isinstance(a, basestring) else str(a)).strip() for a in messages if a))
- log("%(plugintype)s %(pluginname)s%(id)s: %(msg)s"
+ msg = u" | ".join(decode(a).strip() for a in messages if a)
+ log("%(plugintype)s %(pluginname)s: %(msg)s"
% {'plugintype': plugintype.upper(),
'pluginname': pluginname,
- 'id' : ("[%s]" % self.pyfile.id) if hasattr(self, 'pyfile') else "",
'msg' : msg})
def log_debug(self, *args):
- if self.pyload.debug:
- return self._log("debug", self.__type__, self.__name__, args)
+ if not self.pyload.debug:
+ return
+ self._log("debug", self.__type__, self.__name__, args)
def log_info(self, *args):
- return self._log("info", self.__type__, self.__name__, args)
+ self._log("info", self.__type__, self.__name__, args)
def log_warning(self, *args):
- return self._log("warning", self.__type__, self.__name__, args)
+ self._log("warning", self.__type__, self.__name__, args)
def log_error(self, *args):
- return self._log("error", self.__type__, self.__name__, args)
+ self._log("error", self.__type__, self.__name__, args)
+ if self.pyload.debug:
+ traceback.print_exc()
def log_critical(self, *args):
return self._log("critical", self.__type__, self.__name__, args)
+ if self.pyload.debug:
+ traceback.print_exc()
def set_permissions(self, path):
@@ -225,7 +314,7 @@ class Plugin(object):
self.log_warning(_("Setting path mode failed"), e)
try:
- if os.name != "nt" and self.pyload.config.get("permission", "change_dl"):
+ if os.name is not "nt" and self.pyload.config.get("permission", "change_dl"):
uid = pwd.getpwnam(self.pyload.config.get("permission", "user"))[2]
gid = grp.getgrnam(self.pyload.config.get("permission", "group"))[2]
os.chown(path, uid, gid)
@@ -240,7 +329,7 @@ class Plugin(object):
return min(self.pyload.config.get("download", "chunks"), self.chunk_limit)
- def set_config(self, option, value):
+ def set_config(self, option, value, plugin=None):
"""
Set config value for current plugin
@@ -248,7 +337,7 @@ class Plugin(object):
:param value:
:return:
"""
- self.pyload.config.setPlugin(self.__name__, option, value)
+ self.pyload.config.setPlugin(plugin or self.__name__, option, value)
def get_config(self, option, default="", plugin=None):
@@ -287,21 +376,10 @@ class Plugin(object):
self.pyload.db.delStorage(self.__name__, key)
- def fail(self, reason):
+ def fail(self, msg):
"""
- Fail and give reason
+ Fail and give msg
"""
- raise Fail(encode(reason)) #@TODO: Remove `encode` in 0.4.10
-
-
- def error(self, reason="", type=_("Parse")):
- if not reason:
- type = _("Unknown")
-
- msg = _("%s error") % type.strip().capitalize() if type else _("Error")
- msg += (": %s" % reason.strip()) if reason else ""
- msg += _(" | Plugin may be out of date")
-
raise Fail(encode(msg)) #@TODO: Remove `encode` in 0.4.10
@@ -318,17 +396,11 @@ class Plugin(object):
:param decode: Wether to decode the output according to http header, should be True in most cases
:return: Loaded content
"""
- if hasattr(self, 'pyfile') and self.pyfile.abort:
- self.abort()
-
- url = fixurl(url)
-
- if not url or not isinstance(url, basestring):
- self.fail(_("No url given"))
-
if self.pyload.debug:
self.log_debug("LOAD URL " + url,
- *["%s=%s" % (key, val) for key, val in locals().items() if key not in ("self", "url")])
+ *["%s=%s" % (key, val) for key, val in locals().items() if key not in ("self", "url", "_[1]")])
+
+ url = fixurl(url) #: Recheck in 0.4.10
if req is None:
req = self.req or self.pyload.requestFactory.getRequest(self.__name__)
@@ -337,15 +409,17 @@ class Plugin(object):
if isinstance(cookies, list):
set_cookies(req.cj, cookies)
- res = req.load(url, get, post, ref, bool(cookies), just_header, multipart, decode is True) #@TODO: Fix network multipart in 0.4.10
+ html = req.load(url, get, post, ref, bool(cookies), just_header, multipart, decode is True) #@TODO: Fix network multipart in 0.4.10
#@TODO: Move to network in 0.4.10
if decode:
- res = html_unescape(res)
+ html = html_unescape(html)
#@TODO: Move to network in 0.4.10
if isinstance(decode, basestring):
- res = decode(res, decode)
+ html = _decode(html, decode) #@NOTE: Use `utils.decode()` in 0.4.10
+
+ self.last_html = html
if self.pyload.debug:
frame = inspect.currentframe()
@@ -356,15 +430,18 @@ class Plugin(object):
with open(framefile, "wb") as f:
del frame #: Delete the frame or it wont be cleaned
- f.write(encode(res))
+ f.write(encode(html))
except IOError, e:
self.log_error(e)
- if just_header:
- #: Parse header
+ if not just_header:
+ return html
+
+ else:
+ #@TODO: Move to network in 0.4.10
header = {'code': req.code}
- for line in res.splitlines():
+ for line in html.splitlines():
line = line.strip()
if not line or ":" not in line:
continue
@@ -380,20 +457,20 @@ class Plugin(object):
header[key] = [header[key], value]
else:
header[key] = value
- res = header
- return res
+ return header
def clean(self):
"""
- Clean everything and remove references
+ Remove references
"""
try:
+ self.req.clearCookies()
self.req.close()
+
except Exception:
pass
- for a in ("pyfile", "thread", "html", "req"):
- if hasattr(self, a):
- setattr(self, a, None)
+ else:
+ self.req = None
diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py
index 5811c28de..f73e935e8 100644
--- a/module/plugins/internal/SevenZip.py
+++ b/module/plugins/internal/SevenZip.py
@@ -5,18 +5,18 @@ import re
import subprocess
from module.plugins.internal.UnRar import ArchiveError, CRCError, PasswordError, UnRar, renice
-from module.utils import fs_encode, save_join as fs_join
+from module.utils import save_join as fs_join
class SevenZip(UnRar):
__name__ = "SevenZip"
- __version__ = "0.14"
+ __version__ = "0.16"
__status__ = "testing"
__description__ = """7-Zip extractor plugin"""
__license__ = "GPLv3"
- __authors__ = [("Michael Nowak" , "" ),
- ("Walter Purcaro", "vuolter@gmail.com")]
+ __authors__ = [("Walter Purcaro", "vuolter@gmail.com"),
+ ("Michael Nowak" , None )]
CMD = "7z"
@@ -38,7 +38,7 @@ class SevenZip(UnRar):
@classmethod
def find(cls):
try:
- if os.name == "nt":
+ if os.name is "nt":
cls.CMD = os.path.join(pypath, "7z.exe")
p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -55,42 +55,28 @@ class SevenZip(UnRar):
return True
- def verify(self, password):
+ def verify(self, password=None):
#: 7z can't distinguish crc and pw error in test
- p = self.call_cmd("l", "-slt", fs_encode(self.filename))
+ p = self.call_cmd("l", "-slt", self.target)
out, err = p.communicate()
if self.re_wrongpwd.search(out):
raise PasswordError
- if self.re_wrongpwd.search(err):
+ elif self.re_wrongpwd.search(err):
raise PasswordError
- if self.re_wrongcrc.search(err):
- raise CRCError(err)
-
-
-
- def check(self, password):
- p = self.call_cmd("l", "-slt", fs_encode(self.filename))
- out, err = p.communicate()
-
- #: Check if output or error macthes the 'wrong password'-Regexp
- if self.re_wrongpwd.search(out):
- raise PasswordError
-
- if self.re_wrongcrc.search(out):
+ elif self.re_wrongcrc.search(out):
raise CRCError(_("Header protected"))
-
- def repair(self):
- return False
+ elif self.re_wrongcrc.search(err):
+ raise CRCError(err)
def extract(self, password=None):
command = "x" if self.fullpath else "e"
- p = self.call_cmd(command, '-o' + self.out, fs_encode(self.filename), password=password)
+ p = self.call_cmd(command, '-o' + self.out, self.target, password=password)
renice(p.pid, self.renice)
@@ -117,7 +103,7 @@ class SevenZip(UnRar):
def list(self, password=None):
command = "l" if self.fullpath else "l"
- p = self.call_cmd(command, fs_encode(self.filename), password=password)
+ p = self.call_cmd(command, self.target, password=password)
out, err = p.communicate()
if "Can not open" in err:
@@ -142,7 +128,7 @@ class SevenZip(UnRar):
args.append("-y")
#: Set a password
- if "password" in kwargs and kwargs['password']:
+ if kwargs.get('password'):
args.append("-p%s" % kwargs['password'])
else:
args.append("-p-")
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py
index 6a3f91a5b..20e91ac1e 100644
--- a/module/plugins/internal/SimpleCrypter.py
+++ b/module/plugins/internal/SimpleCrypter.py
@@ -3,19 +3,20 @@
import re
from module.plugins.internal.Crypter import Crypter
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns, set_cookie, set_cookies
-from module.utils import fixup, html_unescape
+from module.plugins.internal.Plugin import replace_patterns, set_cookie, set_cookies
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class SimpleCrypter(Crypter, SimpleHoster):
__name__ = "SimpleCrypter"
__type__ = "crypter"
- __version__ = "0.60"
+ __version__ = "0.64"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
- __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides pyload.config['general']['folder_per_package']
- ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)]
+ __config__ = [("use_premium" , "bool", "Use premium account if available" , True),
+ ("use_subfolder" , "bool", "Save package to subfolder" , True),
+ ("subfolder_per_package", "bool", "Create a subfolder for each package", True)]
__description__ = """Simple decrypter plugin"""
__license__ = "GPLv3"
@@ -47,13 +48,35 @@ class SimpleCrypter(Crypter, SimpleHoster):
and its loadPage method:
-
def load_page(self, page_n):
return the html of the page number page_n
"""
- DIRECT_LINK = True
- LEECH_HOSTER = False
+ NAME_REPLACEMENTS = []
+ URL_REPLACEMENTS = []
+
+ COOKIES = True #: or False or list of tuples [(domain, name, value)]
+ DIRECT_LINK = True #: Set to True to looking for direct link (as defined in handle_direct method), set to None to do it if self.account is True else False
+ LOGIN_ACCOUNT = False #: Set to True to require account login
+ LOGIN_PREMIUM = False #: Set to True to require premium account login
+ # LEECH_HOSTER = False #: Set to True to leech other hoster link (as defined in handle_multi method)
+ TEXT_ENCODING = True #: Set to encoding name if encoding value in http header is not correct
+ PAGES_PATTERN = None
+
+ LINK_PATTERN = None
+
+ NAME_PATTERN = None
+ HASHSUM_PATTERN = None
+ OFFLINE_PATTERN = None
+ TEMP_OFFLINE_PATTERN = None
+
+ WAIT_PATTERN = None
+ PREMIUM_ONLY_PATTERN = None
+ HAPPY_HOUR_PATTERN = None
+ IP_BLOCKED_PATTERN = None
+ DL_LIMIT_PATTERN = None
+ SIZE_LIMIT_PATTERN = None
+ ERROR_PATTERN = None
#@TODO: Remove in 0.4.10
@@ -82,7 +105,7 @@ class SimpleCrypter(Crypter, SimpleHoster):
self.log_debug("Redirect #%d to: %s" % (i, redirect))
header = self.load(redirect, just_header=True)
- if 'location' in header and header['location']:
+ if header.get('location'):
self.link = header['location']
else:
break
@@ -90,6 +113,11 @@ class SimpleCrypter(Crypter, SimpleHoster):
self.log_error(_("Too many redirects"))
+ def prepare(self):
+ self.links = []
+ return super(SimpleCrypter, self).prepare()
+
+
def decrypt(self, pyfile):
self.prepare()
self.check_info() #@TODO: Remove in 0.4.10
@@ -108,7 +136,7 @@ class SimpleCrypter(Crypter, SimpleHoster):
self.links = self.get_links() or list()
- if hasattr(self, 'PAGES_PATTERN') and hasattr(self, 'loadPage'):
+ if self.PAGES_PATTERN:
self.handle_pages(pyfile)
self.log_debug("Package has %d links" % len(self.links))
@@ -129,9 +157,14 @@ class SimpleCrypter(Crypter, SimpleHoster):
return re.findall(self.LINK_PATTERN, self.html)
+ def load_page(self, number)
+ raise NotImplementedError
+
+
def handle_pages(self, pyfile):
try:
pages = int(re.search(self.PAGES_PATTERN, self.html).group(1))
+
except Exception:
pages = 1
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index 9c310ca27..e5526a7bd 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -2,33 +2,27 @@
from __future__ import with_statement
-import mimetypes
import os
import re
import time
-import urlparse
-from module.PyFile import statusMap as _statusMap
from module.network.HTTPRequest import BadHeader
from module.network.RequestFactory import getURL as get_url
from module.plugins.internal.Hoster import Hoster, create_getInfo, parse_fileInfo
-from module.plugins.internal.Plugin import Fail, encode, fixurl, replace_patterns, seconds_to_midnight, set_cookie, set_cookies
+from module.plugins.internal.Plugin import Fail, encode, parse_name, parse_time, replace_patterns, seconds_to_midnight, set_cookie, set_cookies
from module.utils import fixup, fs_encode, parseFileSize as parse_size
-#@TODO: Adapt and move to PyFile in 0.4.10
-statusMap = dict((v, k) for k, v in _statusMap.items())
-
-
class SimpleHoster(Hoster):
__name__ = "SimpleHoster"
__type__ = "hoster"
- __version__ = "1.80"
+ __version__ = "1.93"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
- __config__ = [("use_premium", "bool", "Use premium account if available" , True),
- ("fallback" , "bool", "Fallback to free download if premium fails", True)]
+ __config__ = [("use_premium" , "bool", "Use premium account if available" , True),
+ ("fallback_premium", "bool", "Fallback to free download if premium fails", True),
+ ("chk_filesize" , "bool", "Check file size" , True)]
__description__ = """Simple hoster plugin"""
__license__ = "GPLv3"
@@ -91,25 +85,43 @@ class SimpleHoster(Hoster):
LINK_PREMIUM_PATTERN: (optional) group(1) should be the direct link for premium download
example: LINK_PREMIUM_PATTERN = r'<div class="link"><a href="(.+?)"'
"""
- NAME_REPLACEMENTS = [("&#?\w+;", fixup)]
- SIZE_REPLACEMENTS = []
- URL_REPLACEMENTS = []
-
- FILE_ERRORS = [('Html error' , r'\A(?:\s*<.+>)?((?:[\w\s]*(?:[Ee]rror|ERROR)\s*\:?)?\s*\d{3})(?:\Z|\s+)'),
- ('Request error', r'([Aa]n error occured while processing your request)' ),
- ('Html file' , r'\A\s*<!DOCTYPE html' )]
- CHECK_FILE = True #: Set to False to not check the last downloaded file with declared error patterns
- CHECK_TRAFFIC = False #: Set to True to reload checking traffic left for premium account
- COOKIES = True #: or False or list of tuples [(domain, name, value)]
- DIRECT_LINK = None #: Set to True to looking for direct link (as defined in handle_direct method), set to None to do it if self.account is True else False
- DISPOSITION = True #: Set to True to use any content-disposition value in http header as file name
- LOGIN_ACCOUNT = False #: Set to True to require account login
- LOGIN_PREMIUM = False #: Set to True to require premium account login
- LEECH_HOSTER = False #: Set to True to leech other hoster link (as defined in handle_multi method)
- TEXT_ENCODING = True #: Set to encoding name if encoding value in http header is not correct
-
- LINK_PATTERN = None
+ NAME_REPLACEMENTS = []
+ SIZE_REPLACEMENTS = []
+ URL_REPLACEMENTS = []
+
+ CHECK_FILE = True #: Set to False to not check the last downloaded file with declared error patterns
+ CHECK_TRAFFIC = False #: Set to True to reload checking traffic left for premium account
+ COOKIES = True #: or False or list of tuples [(domain, name, value)]
+ DIRECT_LINK = None #: Set to True to looking for direct link (as defined in handle_direct method), set to None to do it if self.account is True else False
+ DISPOSITION = True #: Set to True to use any content-disposition value in http header as file name
+ LOGIN_ACCOUNT = False #: Set to True to require account login
+ LOGIN_PREMIUM = False #: Set to True to require premium account login
+ LEECH_HOSTER = False #: Set to True to leech other hoster link (as defined in handle_multi method)
+ TEXT_ENCODING = True #: Set to encoding name if encoding value in http header is not correct
+
+ LINK_PATTERN = None
+ LINK_FREE_PATTERN = None
+ LINK_PREMIUM_PATTERN = None
+
+ INFO_PATTERN = None
+ NAME_PATTERN = None
+ SIZE_PATTERN = None
+ HASHSUM_PATTERN = None
+ OFFLINE_PATTERN = None
+ TEMP_OFFLINE_PATTERN = None
+
+ WAIT_PATTERN = None
+ PREMIUM_ONLY_PATTERN = None
+ HAPPY_HOUR_PATTERN = None
+ IP_BLOCKED_PATTERN = None
+ DL_LIMIT_PATTERN = None
+ SIZE_LIMIT_PATTERN = None
+ ERROR_PATTERN = None
+
+ FILE_ERRORS = [('Html error' , r'\A(?:\s*<.+>)?((?:[\w\s]*(?:[Ee]rror|ERROR)\s*\:?)?\s*\d{3})(?:\Z|\s+)'),
+ ('Request error', r'([Aa]n error occured while processing your request)' ),
+ ('Html file' , r'\A\s*<!DOCTYPE html' )]
@classmethod
@@ -150,10 +162,10 @@ class SimpleHoster(Hoster):
pass
if html:
- if hasattr(cls, "OFFLINE_PATTERN") and re.search(cls.OFFLINE_PATTERN, html):
+ if cls.OFFLINE_PATTERN and re.search(cls.OFFLINE_PATTERN, html):
info['status'] = 1
- elif hasattr(cls, "TEMP_OFFLINE_PATTERN") and re.search(cls.TEMP_OFFLINE_PATTERN, html):
+ elif cls.TEMP_OFFLINE_PATTERN and re.search(cls.TEMP_OFFLINE_PATTERN, html):
info['status'] = 6
else:
@@ -165,7 +177,7 @@ class SimpleHoster(Hoster):
if all(True for k in pdict if k not in info['pattern']):
info['pattern'].update(pdict)
- except AttributeError:
+ except Exception:
continue
else:
@@ -175,8 +187,8 @@ class SimpleHoster(Hoster):
info['status'] = 2
if 'N' in info['pattern']:
- info['name'] = replace_patterns(fixurl(info['pattern']['N']),
- cls.NAME_REPLACEMENTS)
+ name = replace_patterns(info['pattern']['N'], cls.NAME_REPLACEMENTS)
+ info['name'] = parse_name(name)
if 'S' in info['pattern']:
size = replace_patterns(info['pattern']['S'] + info['pattern']['U'] if 'U' in info['pattern'] else info['pattern']['S'],
@@ -202,19 +214,12 @@ class SimpleHoster(Hoster):
def prepare(self):
- self.pyfile.error = "" #@TODO: Remove in 0.4.10
- self.html = "" #@TODO: Recheck in 0.4.10
- self.link = "" #@TODO: Recheck in 0.4.10
- self.last_download = ""
- self.direct_dl = False
- self.leech_dl = False
-
- if not self.get_config('use_premium', True):
- self.restart(nopremium=True)
+ self.link = ""
+ self.direct_dl = False
+ self.leech_dl = False
if self.LOGIN_PREMIUM and not self.premium:
self.fail(_("Required premium account not found"))
- self.LOGIN_ACCOUNT = True
if self.LOGIN_ACCOUNT and not self.account:
self.fail(_("Required account not found"))
@@ -222,10 +227,10 @@ class SimpleHoster(Hoster):
self.req.setOption("timeout", 120)
if self.LINK_PATTERN:
- if not hasattr(self, 'LINK_FREE_PATTERN'):
+ if self.LINK_FREE_PATTERN is None:
self.LINK_FREE_PATTERN = self.LINK_PATTERN
- if not hasattr(self, 'LINK_PREMIUM_PATTERN'):
+ if self.LINK_PREMIUM_PATTERN is None:
self.LINK_PREMIUM_PATTERN = self.LINK_PATTERN
if (self.LEECH_HOSTER
@@ -253,95 +258,72 @@ class SimpleHoster(Hoster):
def process(self, pyfile):
- try:
- self.prepare()
- self.check_info() #@TODO: Remove in 0.4.10
-
- if self.leech_dl:
- self.log_info(_("Processing as debrid download..."))
- self.handle_multi(pyfile)
-
- if not self.link and not was_downloaded():
- self.log_info(_("Failed to leech url"))
+ self.prepare()
+ self.check_info() #@TODO: Remove in 0.4.10
- else:
- if not self.link and self.direct_dl and not self.last_download:
- self.log_info(_("Looking for direct download link..."))
- self.handle_direct(pyfile)
+ if self.leech_dl:
+ self.log_info(_("Processing as debrid download..."))
+ self.handle_multi(pyfile)
- if self.link or self.last_download:
- self.log_info(_("Direct download link detected"))
- else:
- self.log_info(_("Direct download link not found"))
+ if not self.link and not was_downloaded():
+ self.log_info(_("Failed to leech url"))
- if not self.link and not self.last_download:
- self.preload()
+ else:
+ if not self.link and self.direct_dl and not self.last_download:
+ self.log_info(_("Looking for direct download link..."))
+ self.handle_direct(pyfile)
- if 'status' not in self.info or self.info['status'] is 3: #@TODO: Recheck in 0.4.10
- self.check_info()
+ if self.link or self.last_download:
+ self.log_info(_("Direct download link detected"))
+ else:
+ self.log_info(_("Direct download link not found"))
- if self.premium and (not self.CHECK_TRAFFIC or self.check_traffic_left()):
- self.log_info(_("Processing as premium download..."))
- self.handle_premium(pyfile)
+ if not self.link and not self.last_download:
+ self.preload()
- elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.check_traffic_left()):
- self.log_info(_("Processing as free download..."))
- self.handle_free(pyfile)
+ if 'status' not in self.info or self.info['status'] is 3: #@TODO: Recheck in 0.4.10
+ self.check_info()
- if not self.last_download:
- self.log_info(_("Downloading file..."))
- self.download(self.link, disposition=self.DISPOSITION)
+ if self.premium and (not self.CHECK_TRAFFIC or self.check_traffic()):
+ self.log_info(_("Processing as premium download..."))
+ self.handle_premium(pyfile)
- self.check_file()
+ elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.check_traffic()):
+ self.log_info(_("Processing as free download..."))
+ self.handle_free(pyfile)
- except Fail, e: #@TODO: Move to PluginThread in 0.4.10
- if self.get_config('fallback', True) and self.premium:
- self.log_warning(_("Premium download failed"), e)
- self.restart(nopremium=True)
+ if not self.last_download:
+ self.log_info(_("Downloading file..."))
+ self.download(self.link, disposition=self.DISPOSITION)
- else:
- raise Fail(encode(e)) #@TODO: Remove `encode` in 0.4.10
+ self.check_download()
- def check_file(self):
- self.log_info(_("Checking file..."))
+ def check_download(self):
+ self.log_info(_("Checking downloaded file..."))
+ self.log_debug("Using default check rules...")
+ for r, p in self.FILE_ERRORS:
+ errmsg = self.check_file({r: re.compile(p)})
+ if errmsg is not None:
+ errmsg = errmsg.strip().capitalize()
- if self.captcha.task and not self.last_download:
- self.captcha.invalid()
- self.retry(10, reason=_("Wrong captcha"))
+ try:
+ errmsg += " | " + self.last_check.group(1).strip()
- # 10485760 is 10MB, tolerance is used when comparing displayed size on the hoster website to real size
- # For example displayed size can be 1.46GB for example, but real size can be 1.4649853GB
- elif self.check_download({'Empty file': re.compile(r'\A((.|)(\2|\s)*)\Z')},
- file_size=self.info['size'] if 'size' in self.info else 0,
- size_tolerance=10485760,
- delete=True):
- self.error(_("Empty file"))
+ except Exception:
+ pass
+ self.log_warning(_("Check result: ") + errmsg, _("Waiting 1 minute and retry"))
+ self.wait(60, reconnect=True)
+ self.restart(errmsg, premium=True)
else:
- self.log_debug("Using default check rules...")
- for r, p in self.FILE_ERRORS:
- errmsg = self.check_download({r: re.compile(p)})
- if errmsg is not None:
- errmsg = errmsg.strip().capitalize()
-
- try:
- errmsg += " | " + self.last_check.group(1).strip()
- except Exception:
- pass
-
- self.log_warning(_("Check result: ") + errmsg, _("Waiting 1 minute and retry"))
- self.wantReconnect = True
- self.retry(wait_time=60, reason=errmsg)
- else:
- if self.CHECK_FILE:
- self.log_debug("Using custom check rules...")
- with open(fs_encode(self.last_download), "rb") as f:
- self.html = f.read(1048576) #@TODO: Recheck in 0.4.10
- self.check_errors()
+ if self.CHECK_FILE:
+ self.log_debug("Using custom check rules...")
+ with open(fs_encode(self.last_download), "rb") as f:
+ self.html = f.read(1048576) #@TODO: Recheck in 0.4.10
+ self.check_errors()
self.log_info(_("No errors found"))
- self.pyfile.error = ""
def check_errors(self):
@@ -349,65 +331,56 @@ class SimpleHoster(Hoster):
self.log_warning(_("No html code to check"))
return
- if hasattr(self, 'IP_BLOCKED_PATTERN') and re.search(self.IP_BLOCKED_PATTERN, self.html):
+ if self.IP_BLOCKED_PATTERN and re.search(self.IP_BLOCKED_PATTERN, self.html):
self.fail(_("Connection from your current IP address is not allowed"))
elif not self.premium:
- if hasattr(self, 'PREMIUM_ONLY_PATTERN') and re.search(self.PREMIUM_ONLY_PATTERN, self.html):
+ if self.PREMIUM_ONLY_PATTERN and re.search(self.PREMIUM_ONLY_PATTERN, self.html):
self.fail(_("File can be downloaded by premium users only"))
- elif hasattr(self, 'SIZE_LIMIT_PATTERN') and re.search(self.SIZE_LIMIT_PATTERN, self.html):
+ elif self.SIZE_LIMIT_PATTERN and re.search(self.SIZE_LIMIT_PATTERN, self.html):
self.fail(_("File too large for free download"))
- elif hasattr(self, 'DL_LIMIT_PATTERN') and re.search(self.DL_LIMIT_PATTERN, self.html):
+ elif self.DL_LIMIT_PATTERN and re.search(self.DL_LIMIT_PATTERN, self.html):
m = re.search(self.DL_LIMIT_PATTERN, self.html)
try:
errmsg = m.group(1).strip()
- except Exception:
+
+ except (AttributeError, IndexError):
errmsg = m.group(0).strip()
self.info['error'] = re.sub(r'<.*?>', " ", errmsg)
self.log_warning(self.info['error'])
- if re.search('da(il)?y|today', errmsg, re.I):
- wait_time = seconds_to_midnight(gmt=2)
- else:
- wait_time = sum(int(v) * {'hr': 3600, 'hour': 3600, 'min': 60, 'sec': 1, "": 1}[u.lower()] for v, u in
- re.findall(r'(\d+)\s*(hr|hour|min|sec|)', errmsg, re.I))
+ wait_time = parse_time(errmsg)
+ self.wait(wait_time, reconnect=wait_time > 300)
+ self.restart(_("Download limit exceeded"), premium=True)
- self.wantReconnect = wait_time > 300
- self.retry(1, wait_time, _("Download limit exceeded"))
-
- if hasattr(self, 'HAPPY_HOUR_PATTERN') and re.search(self.HAPPY_HOUR_PATTERN, self.html):
+ if self.HAPPY_HOUR_PATTERN and re.search(self.HAPPY_HOUR_PATTERN, self.html):
self.multiDL = True
- if hasattr(self, 'ERROR_PATTERN'):
+ if self.ERROR_PATTERN:
m = re.search(self.ERROR_PATTERN, self.html)
- if m:
+ if m is not None:
try:
errmsg = m.group(1).strip()
- except Exception:
+
+ except (AttributeError, IndexError):
errmsg = m.group(0).strip()
self.info['error'] = re.sub(r'<.*?>', " ", errmsg)
self.log_warning(self.info['error'])
if re.search('limit|wait|slot', errmsg, re.I):
- if re.search("da(il)?y|today", errmsg):
- wait_time = seconds_to_midnight(gmt=2)
- else:
- wait_time = sum(int(v) * {'hr': 3600, 'hour': 3600, 'min': 60, 'sec': 1, "": 1}[u.lower()] for v, u in
- re.findall(r'(\d+)\s*(hr|hour|min|sec|)', errmsg, re.I))
-
- self.wantReconnect = wait_time > 300
- self.retry(1, wait_time, _("Download limit exceeded"))
+ wait_time = parse_time(errmsg)
+ self.wait(wait_time, reconnect=wait_time > 300)
+ self.restart(_("Download limit exceeded"), premium=True)
elif re.search('country|ip|region|nation', errmsg, re.I):
self.fail(_("Connection from your current IP address is not allowed"))
elif re.search('captcha|code', errmsg, re.I):
- self.captcha.invalid()
- self.retry(10, reason=_("Wrong captcha"))
+ self.retry_captcha()
elif re.search('countdown|expired', errmsg, re.I):
self.retry(10, 60, _("Link expired"))
@@ -422,28 +395,26 @@ class SimpleHoster(Hoster):
self.offline()
elif re.search('filename', errmsg, re.I):
- url_p = urlparse.urlparse(self.pyfile.url)
- self.pyfile.url = "%s://%s/%s" % (url_p.scheme, url_p.netloc, url_p.path.split('/')[0])
- self.retry(1, reason=_("Wrong url"))
+ self.fail(_("Invalid url"))
elif re.search('premium', errmsg, re.I):
self.fail(_("File can be downloaded by premium users only"))
else:
- self.wantReconnect = True
- self.retry(wait_time=60, reason=errmsg)
+ self.wait(60, reconnect=True)
+ self.restart(errmsg, premium=True)
- elif hasattr(self, 'WAIT_PATTERN'):
+ elif self.WAIT_PATTERN:
m = re.search(self.WAIT_PATTERN, self.html)
- if m:
+ if m is not None:
try:
waitmsg = m.group(1).strip()
- except Exception:
+
+ except (AttributeError, IndexError):
waitmsg = m.group(0).strip()
- wait_time = sum(int(v) * {'hr': 3600, 'hour': 3600, 'min': 60, 'sec': 1, "": 1}[u.lower()] for v, u in
- re.findall(r'(\d+)\s*(hr|hour|min|sec|)', waitmsg, re.I))
- self.wait(wait_time, wait_time > 300)
+ wait_time = parse_time(waitmsg)
+ self.wait(wait_time, econnect=wait_time > 300)
self.info.pop('error', None)
@@ -457,22 +428,19 @@ class SimpleHoster(Hoster):
self.log_debug("Previous file info: %s" % old_info)
try:
- status = self.info['status'] or None
+ status = self.info['status'] or 14
- if status == 1:
+ if status is 1:
self.offline()
- elif status == 6:
+ elif status is 6:
self.temp_offline()
- elif status == 8:
- if 'error' in self.info:
- self.fail(self.info['error'])
- else:
- self.fail(_("File status: " + statusMap[status]))
+ elif status is 8:
+ self.fail()
finally:
- self.log_info(_("File status: ") + (statusMap[status] if status else _("Unknown")))
+ self.log_info(_("File status: ") + self.pyfile.getStatusName())
def check_name_size(self, getinfo=True):
@@ -484,8 +452,8 @@ class SimpleHoster(Hoster):
self.log_debug("Previous file info: %s" % old_info)
try:
- url = self.info['url'].strip()
- name = self.info['name'].strip()
+ url = self.info['url']
+ name = self.info['name']
except KeyError:
pass
@@ -494,7 +462,7 @@ class SimpleHoster(Hoster):
if name and name is not url:
self.pyfile.name = name
- if 'size' in self.info and self.info['size'] > 0:
+ if self.info.get('size') > 0:
self.pyfile.size = int(self.info['size']) #@TODO: Fix int conversion in 0.4.10
# self.pyfile.sync()
@@ -535,7 +503,7 @@ class SimpleHoster(Hoster):
def handle_free(self, pyfile):
- if not hasattr(self, 'LINK_FREE_PATTERN'):
+ if not self.LINK_FREE_PATTERN:
self.log_error(_("Free download not implemented"))
m = re.search(self.LINK_FREE_PATTERN, self.html)
@@ -546,10 +514,9 @@ class SimpleHoster(Hoster):
def handle_premium(self, pyfile):
- if not hasattr(self, 'LINK_PREMIUM_PATTERN'):
+ if not self.LINK_PREMIUM_PATTERN:
self.log_error(_("Premium download not implemented"))
- self.log_info(_("Processing as free download..."))
- self.handle_free(pyfile)
+ self.restart()
m = re.search(self.LINK_PREMIUM_PATTERN, self.html)
if m is None:
diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py
index 0386991d9..908689109 100644
--- a/module/plugins/internal/UnRar.py
+++ b/module/plugins/internal/UnRar.py
@@ -8,11 +8,11 @@ from glob import glob
from string import digits
from module.plugins.internal.Extractor import Extractor, ArchiveError, CRCError, PasswordError
-from module.utils import fs_decode, fs_encode, save_join as fs_join
+from module.utils import fs_decode, save_join as fs_join
def renice(pid, value):
- if value and os.name != "nt":
+ if value and os.name is not "nt":
try:
subprocess.Popen(["renice", str(value), str(pid)], stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=-1)
@@ -22,7 +22,7 @@ def renice(pid, value):
class UnRar(Extractor):
__name__ = "UnRar"
- __version__ = "1.25"
+ __version__ = "1.27"
__status__ = "testing"
__description__ = """Rar extractor plugin"""
@@ -49,7 +49,7 @@ class UnRar(Extractor):
@classmethod
def find(cls):
try:
- if os.name == "nt":
+ if os.name is "nt":
cls.CMD = os.path.join(pypath, "RAR.exe")
else:
cls.CMD = "rar"
@@ -61,7 +61,7 @@ class UnRar(Extractor):
except OSError:
try:
- if os.name == "nt":
+ if os.name is "nt":
cls.CMD = os.path.join(pypath, "UnRAR.exe")
else:
cls.CMD = "unrar"
@@ -84,20 +84,8 @@ class UnRar(Extractor):
return True if cls.re_multipart.search(filename) else False
- def verify(self, password):
- p = self.call_cmd("t", "-v", fs_encode(self.filename), password=password)
- self._progress(p)
- err = p.stderr.read().strip()
-
- if self.re_wrongpwd.search(err):
- raise PasswordError
-
- if self.re_wrongcrc.search(err):
- raise CRCError(err)
-
-
- def check(self, password):
- p = self.call_cmd("l", "-v", fs_encode(self.filename), password=password)
+ def verify(self, password=None):
+ p = self.call_cmd("l", "-v", self.target, password=password)
out, err = p.communicate()
if self.re_wrongpwd.search(err):
@@ -113,13 +101,28 @@ class UnRar(Extractor):
def repair(self):
- p = self.call_cmd("rc", fs_encode(self.filename))
+ p = self.call_cmd("rc", self.target)
#: Communicate and retrieve stderr
self._progress(p)
err = p.stderr.read().strip()
+
if err or p.returncode:
- return False
+ p = self.call_cmd("r", self.target)
+
+ # communicate and retrieve stderr
+ self._progress(p)
+ err = p.stderr.read().strip()
+
+ if err or p.returncode:
+ return False
+
+ else:
+ dir = os.path.dirname(filename)
+ name = re_filefixed.search(out).group(1)
+
+ self.filename = os.path.join(dir, name)
+
return True
@@ -145,7 +148,7 @@ class UnRar(Extractor):
def extract(self, password=None):
command = "x" if self.fullpath else "e"
- p = self.call_cmd(command, fs_encode(self.filename), self.out, password=password)
+ p = self.call_cmd(command, self.target, self.out, password=password)
renice(p.pid, self.renice)
@@ -169,7 +172,7 @@ class UnRar(Extractor):
self.files = self.list(password)
- def get_delete_files(self):
+ def items(self):
dir, name = os.path.split(self.filename)
#: Actually extracted file
@@ -185,7 +188,7 @@ class UnRar(Extractor):
def list(self, password=None):
command = "vb" if self.fullpath else "lb"
- p = self.call_cmd(command, "-v", fs_encode(self.filename), password=password)
+ p = self.call_cmd(command, "-v", self.target, password=password)
out, err = p.communicate()
if "Cannot open" in err:
@@ -226,7 +229,7 @@ class UnRar(Extractor):
args.append("-y")
#: Set a password
- if "password" in kwargs and kwargs['password']:
+ if kwargs.get('password'):
args.append("-p%s" % kwargs['password'])
else:
args.append("-p-")
diff --git a/module/plugins/internal/UnZip.py b/module/plugins/internal/UnZip.py
index 9a01611bf..87cbd568a 100644
--- a/module/plugins/internal/UnZip.py
+++ b/module/plugins/internal/UnZip.py
@@ -7,12 +7,11 @@ import sys
import zipfile
from module.plugins.internal.Extractor import Extractor, ArchiveError, CRCError, PasswordError
-from module.utils import fs_encode
class UnZip(Extractor):
__name__ = "UnZip"
- __version__ = "1.15"
+ __version__ = "1.16"
__status__ = "testing"
__description__ = """Zip extractor plugin"""
@@ -30,17 +29,13 @@ class UnZip(Extractor):
def list(self, password=None):
- with zipfile.ZipFile(fs_encode(self.filename), 'r', allowZip64=True) as z:
+ with zipfile.ZipFile(self.target, 'r', allowZip64=True) as z:
z.setpassword(password)
return z.namelist()
- def check(self, password):
- pass
-
-
- def verify(self):
- with zipfile.ZipFile(fs_encode(self.filename), 'r', allowZip64=True) as z:
+ def verify(self, password=None):
+ with zipfile.ZipFile(self.target, 'r', allowZip64=True) as z:
badfile = z.testzip()
if badfile:
@@ -51,7 +46,7 @@ class UnZip(Extractor):
def extract(self, password=None):
try:
- with zipfile.ZipFile(fs_encode(self.filename), 'r', allowZip64=True) as z:
+ with zipfile.ZipFile(self.target, 'r', allowZip64=True) as z:
z.setpassword(password)
badfile = z.testzip()
diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py
index e0f6b1ee8..7b9410222 100644
--- a/module/plugins/internal/XFSAccount.py
+++ b/module/plugins/internal/XFSAccount.py
@@ -4,14 +4,16 @@ import re
import time
import urlparse
+from module.common.json_layer import json_loads
from module.plugins.internal.Account import Account
+# from module.plugins.internal.MultiAccount import MultiAccount
from module.plugins.internal.Plugin import parse_html_form, set_cookie
class XFSAccount(Account):
__name__ = "XFSAccount"
__type__ = "account"
- __version__ = "0.42"
+ __version__ = "0.49"
__status__ = "testing"
__description__ = """XFileSharing account plugin"""
@@ -20,8 +22,8 @@ class XFSAccount(Account):
("Walter Purcaro", "vuolter@gmail.com" )]
- HOSTER_DOMAIN = None
- HOSTER_URL = None
+ PLUGIN_DOMAIN = None
+ PLUGIN_URL = None
LOGIN_URL = None
COOKIES = True
@@ -37,28 +39,39 @@ class XFSAccount(Account):
LEECH_TRAFFIC_UNIT = "MB" #: Used only if no group <U> was found
LOGIN_FAIL_PATTERN = r'Incorrect Login or Password|account was banned|Error<'
+ LOGIN_SKIP_PATTERN = r'op=logout'
- def parse_info(self, user, password, data, req):
+ def set_xfs_cookie(self):
+ if not self.COOKIES:
+ return
+
+ if isinstance(self.COOKIES, list) and (self.PLUGIN_DOMAIN, "lang", "english") not in self.COOKIES:
+ self.COOKIES.insert((self.PLUGIN_DOMAIN, "lang", "english"))
+ else:
+ set_cookie(self.req.cj, self.PLUGIN_DOMAIN, "lang", "english")
+
+
+ def grab_info(self, user, password, data):
validuntil = None
trafficleft = None
leechtraffic = None
premium = None
- if not self.HOSTER_URL: #@TODO: Remove in 0.4.10
+ if not self.PLUGIN_URL: #@TODO: Remove in 0.4.10
return {'validuntil' : validuntil,
'trafficleft' : trafficleft,
'leechtraffic': leechtraffic,
'premium' : premium}
- html = self.load(self.HOSTER_URL,
+ html = self.load(self.PLUGIN_URL,
get={'op': "my_account"},
cookies=self.COOKIES)
premium = True if re.search(self.PREMIUM_PATTERN, html) else False
m = re.search(self.VALID_UNTIL_PATTERN, html)
- if m:
+ if m is not None:
expiredate = m.group(1).strip()
self.log_debug("Expire date: " + expiredate)
@@ -81,7 +94,7 @@ class XFSAccount(Account):
self.log_debug("VALID_UNTIL_PATTERN not found")
m = re.search(self.TRAFFIC_LEFT_PATTERN, html)
- if m:
+ if m is not None:
try:
traffic = m.groupdict()
size = traffic['S']
@@ -138,29 +151,30 @@ class XFSAccount(Account):
'premium' : premium}
- def login(self, user, password, data, req):
- if self.HOSTER_DOMAIN:
- if not self.HOSTER_URL:
- self.HOSTER_URL = "http://www.%s/" % self.HOSTER_DOMAIN
+ def signin(self, user, password, data):
+ if self.PLUGIN_DOMAIN:
+ if not self.PLUGIN_URL:
+ self.PLUGIN_URL = "http://www.%s/" % self.PLUGIN_DOMAIN
- if self.COOKIES:
- if isinstance(self.COOKIES, list) and not self.COOKIES.count((self.HOSTER_DOMAIN, "lang", "english")):
- self.COOKIES.insert((self.HOSTER_DOMAIN, "lang", "english"))
- else:
- set_cookie(self.req.cj, self.HOSTER_DOMAIN, "lang", "english")
+ self.set_xfs_cookie()
- if not self.HOSTER_URL:
- self.login_fail(_("Missing HOSTER_URL"))
+ if not self.PLUGIN_URL:
+ self.fail_login(_("Missing PLUGIN_URL"))
+ else:
+ self.PLUGIN_URL = self.PLUGIN_URL.rstrip('/') + "/"
if not self.LOGIN_URL:
- self.LOGIN_URL = urlparse.urljoin(self.HOSTER_URL, "login.html")
+ self.LOGIN_URL = urlparse.urljoin(self.PLUGIN_URL, "login.html")
html = self.load(self.LOGIN_URL, cookies=self.COOKIES)
+ if re.search(self.LOGIN_SKIP_PATTERN, html):
+ self.skip_login()
+
action, inputs = parse_html_form('name="FL"', html)
if not inputs:
inputs = {'op' : "login",
- 'redirect': self.HOSTER_URL}
+ 'redirect': self.PLUGIN_URL}
inputs.update({'login' : user,
'password': password})
@@ -168,9 +182,17 @@ class XFSAccount(Account):
if action:
url = urlparse.urljoin("http://", action)
else:
- url = self.HOSTER_URL
+ url = self.PLUGIN_URL
html = self.load(url, post=inputs, cookies=self.COOKIES)
- if re.search(self.LOGIN_FAIL_PATTERN, html):
- self.login_fail()
+ try:
+ json = json_loads(html)
+
+ except ValueError:
+ if re.search(self.LOGIN_FAIL_PATTERN, html):
+ self.fail_login()
+
+ else:
+ if not 'success' in json or not json['success']:
+ self.fail_login()
diff --git a/module/plugins/internal/XFSCrypter.py b/module/plugins/internal/XFSCrypter.py
index 4c059d647..876575874 100644
--- a/module/plugins/internal/XFSCrypter.py
+++ b/module/plugins/internal/XFSCrypter.py
@@ -7,17 +7,20 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo
class XFSCrypter(SimpleCrypter):
__name__ = "XFSCrypter"
__type__ = "crypter"
- __version__ = "0.13"
+ __version__ = "0.16"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
+ __config__ = [("use_premium" , "bool", "Use premium account if available" , True),
+ ("use_subfolder" , "bool", "Save package to subfolder" , True),
+ ("subfolder_per_package", "bool", "Create a subfolder for each package", True)]
__description__ = """XFileSharing decrypter plugin"""
__license__ = "GPLv3"
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- HOSTER_DOMAIN = None
+ PLUGIN_DOMAIN = None
URL_REPLACEMENTS = [(r'&?per_page=\d+', ""), (r'[?/&]+$', ""), (r'(.+/[^?]+)$', r'\1?'), (r'$', r'&per_page=10000')]
@@ -28,23 +31,29 @@ class XFSCrypter(SimpleCrypter):
TEMP_OFFLINE_PATTERN = r'>\s*\w+ server (is in )?(maintenance|maintainance)'
+ def set_xfs_cookie(self):
+ if not self.COOKIES:
+ return
+
+ if isinstance(self.COOKIES, list) and (self.PLUGIN_DOMAIN, "lang", "english") not in self.COOKIES:
+ self.COOKIES.insert((self.PLUGIN_DOMAIN, "lang", "english"))
+ else:
+ set_cookie(self.req.cj, self.PLUGIN_DOMAIN, "lang", "english")
+
+
def prepare(self):
- if not self.HOSTER_DOMAIN:
+ if not self.PLUGIN_DOMAIN:
if self.account:
account = self.account
else:
account_name = (self.__name__ + ".py").replace("Folder.py", "").replace(".py", "")
account = self.pyload.accountManager.getAccountPlugin(account_name)
- if account and hasattr(account, "HOSTER_DOMAIN") and account.HOSTER_DOMAIN:
- self.HOSTER_DOMAIN = account.HOSTER_DOMAIN
+ if account and hasattr(account, "PLUGIN_DOMAIN") and account.PLUGIN_DOMAIN:
+ self.PLUGIN_DOMAIN = account.PLUGIN_DOMAIN
else:
- self.fail(_("Missing HOSTER_DOMAIN"))
+ self.fail(_("Missing PLUGIN_DOMAIN"))
- if self.COOKIES:
- if isinstance(self.COOKIES, list) and not self.COOKIES.count((self.HOSTER_DOMAIN, "lang", "english")):
- self.COOKIES.insert((self.HOSTER_DOMAIN, "lang", "english"))
- else:
- set_cookie(self.req.cj, self.HOSTER_DOMAIN, "lang", "english")
+ self.set_xfs_cookie()
return super(XFSCrypter, self).prepare()
diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py
index 5e0830dc6..b59f34122 100644
--- a/module/plugins/internal/XFSHoster.py
+++ b/module/plugins/internal/XFSHoster.py
@@ -14,10 +14,13 @@ from module.utils import html_unescape
class XFSHoster(SimpleHoster):
__name__ = "XFSHoster"
__type__ = "hoster"
- __version__ = "0.57"
+ __version__ = "0.63"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
+ __config__ = [("use_premium" , "bool", "Use premium account if available" , True),
+ ("fallback_premium", "bool", "Fallback to free download if premium fails", True),
+ ("chk_filesize" , "bool", "Check file size" , True)]
__description__ = """XFileSharing hoster plugin"""
__license__ = "GPLv3"
@@ -26,7 +29,7 @@ class XFSHoster(SimpleHoster):
("Walter Purcaro", "vuolter@gmail.com" )]
- HOSTER_DOMAIN = None
+ PLUGIN_DOMAIN = None
LEECH_HOSTER = True #@NOTE: Should be default to False for safe, but I'm lazy...
@@ -57,30 +60,36 @@ class XFSHoster(SimpleHoster):
self.resume_download = self.multiDL = self.premium
+ def set_xfs_cookie(self):
+ if not self.COOKIES:
+ return
+
+ if isinstance(self.COOKIES, list) and (self.PLUGIN_DOMAIN, "lang", "english") not in self.COOKIES:
+ self.COOKIES.insert((self.PLUGIN_DOMAIN, "lang", "english"))
+ else:
+ set_cookie(self.req.cj, self.PLUGIN_DOMAIN, "lang", "english")
+
+
def prepare(self):
"""
Initialize important variables
"""
- if not self.HOSTER_DOMAIN:
+ if not self.PLUGIN_DOMAIN:
if self.account:
account = self.account
else:
account = self.pyload.accountManager.getAccountPlugin(self.__name__)
- if account and hasattr(account, "HOSTER_DOMAIN") and account.HOSTER_DOMAIN:
- self.HOSTER_DOMAIN = account.HOSTER_DOMAIN
+ if account and hasattr(account, "PLUGIN_DOMAIN") and account.PLUGIN_DOMAIN:
+ self.PLUGIN_DOMAIN = account.PLUGIN_DOMAIN
else:
- self.fail(_("Missing HOSTER_DOMAIN"))
+ self.fail(_("Missing PLUGIN_DOMAIN"))
- if self.COOKIES:
- if isinstance(self.COOKIES, list) and not self.COOKIES.count((self.HOSTER_DOMAIN, "lang", "english")):
- self.COOKIES.insert((self.HOSTER_DOMAIN, "lang", "english"))
- else:
- set_cookie(self.req.cj, self.HOSTER_DOMAIN, "lang", "english")
+ self.set_xfs_cookie()
if not self.LINK_PATTERN:
pattern = r'(?:file: "(.+?)"|(https?://(?:www\.)?([^/]*?%s|\d+\.\d+\.\d+\.\d+)(\:\d+)?(/d/|(/files)?/\d+/\w+/).+?)["\'<])'
- self.LINK_PATTERN = pattern % self.HOSTER_DOMAIN.replace('.', '\.')
+ self.LINK_PATTERN = pattern % self.PLUGIN_DOMAIN.replace('.', '\.')
super(XFSHoster, self).prepare()
@@ -95,7 +104,7 @@ class XFSHoster(SimpleHoster):
self.check_errors()
m = re.search(self.LINK_PATTERN, self.html, re.S)
- if m:
+ if m is not None:
break
data = self.get_post_parameters()
@@ -111,7 +120,7 @@ class XFSHoster(SimpleHoster):
break
m = re.search(self.LINK_PATTERN, self.html, re.S)
- if m:
+ if m is not None:
break
else:
if 'op' in data:
@@ -129,7 +138,7 @@ class XFSHoster(SimpleHoster):
self.fail(_("Only registered or premium users can use url leech feature"))
#: Only tested with easybytez.com
- self.html = self.load("http://www.%s/" % self.HOSTER_DOMAIN)
+ self.html = self.load("http://www.%s/" % self.PLUGIN_DOMAIN)
action, inputs = self.parse_html_form()
@@ -150,7 +159,7 @@ class XFSHoster(SimpleHoster):
action, inputs = self.parse_html_form('F1')
if not inputs:
- self.retry(reason=self.info['error'] if 'error' in self.info else _("TEXTAREA F1 not found"))
+ self.retry(msg=self.info['error'] if 'error' in self.info else _("TEXTAREA F1 not found"))
self.log_debug(inputs)
@@ -163,7 +172,7 @@ class XFSHoster(SimpleHoster):
self.retry(20, 3 * 60, _("Can not leech file"))
elif 'today' in stmsg:
- self.retry(wait_time=seconds_to_midnight(gmt=2), reason=_("You've used all Leech traffic today"))
+ self.retry(wait=seconds_to_midnight(), msg=_("You've used all Leech traffic today"))
else:
self.fail(stmsg)
@@ -188,7 +197,7 @@ class XFSHoster(SimpleHoster):
if not inputs:
action, inputs = self.parse_html_form('F1')
if not inputs:
- self.retry(reason=self.info['error'] if 'error' in self.info else _("TEXTAREA F1 not found"))
+ self.retry(msg=self.info['error'] if 'error' in self.info else _("TEXTAREA F1 not found"))
self.log_debug(inputs)
@@ -202,7 +211,7 @@ class XFSHoster(SimpleHoster):
if not self.premium:
m = re.search(self.WAIT_PATTERN, self.html)
- if m:
+ if m is not None:
wait_time = int(m.group(1))
self.set_wait(wait_time, False)
@@ -223,13 +232,13 @@ class XFSHoster(SimpleHoster):
def handle_captcha(self, inputs):
m = re.search(self.CAPTCHA_PATTERN, self.html)
- if m:
+ if m is not None:
captcha_url = m.group(1)
inputs['code'] = self.captcha.decrypt(captcha_url)
return
m = re.search(self.CAPTCHA_BLOCK_PATTERN, self.html, re.S)
- if m:
+ if m is not None:
captcha_div = m.group(1)
numerals = re.findall(r'<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div))