summaryrefslogtreecommitdiffstats
path: root/pyload/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/plugins')
-rw-r--r--pyload/plugins/Account.py316
-rw-r--r--pyload/plugins/Addon.py171
-rw-r--r--pyload/plugins/Base.py346
-rw-r--r--pyload/plugins/ContentProvider.py34
-rw-r--r--pyload/plugins/Crypter.py286
-rw-r--r--pyload/plugins/Download.py48
-rw-r--r--pyload/plugins/Hoster.py401
-rw-r--r--pyload/plugins/MultiHoster.py75
-rw-r--r--pyload/plugins/Plugin.py8
-rw-r--r--pyload/plugins/Request.py77
-rw-r--r--pyload/plugins/__init__.py0
-rw-r--r--pyload/plugins/accounts/AlldebridCom.py52
-rw-r--r--pyload/plugins/accounts/BayfilesCom.py51
-rw-r--r--pyload/plugins/accounts/BitshareCom.py45
-rw-r--r--pyload/plugins/accounts/BoltsharingCom.py13
-rw-r--r--pyload/plugins/accounts/CramitIn.py13
-rw-r--r--pyload/plugins/accounts/CyberlockerCh.py32
-rw-r--r--pyload/plugins/accounts/CzshareCom.py57
-rw-r--r--pyload/plugins/accounts/DdlstorageCom.py51
-rw-r--r--pyload/plugins/accounts/DebridItaliaCom.py58
-rw-r--r--pyload/plugins/accounts/DepositfilesCom.py47
-rw-r--r--pyload/plugins/accounts/EasybytezCom.py75
-rw-r--r--pyload/plugins/accounts/EgoFilesCom.py42
-rw-r--r--pyload/plugins/accounts/EuroshareEu.py56
-rw-r--r--pyload/plugins/accounts/FastixRu.py32
-rw-r--r--pyload/plugins/accounts/FastshareCz.py56
-rw-r--r--pyload/plugins/accounts/FilecloudIo.py72
-rw-r--r--pyload/plugins/accounts/FilefactoryCom.py56
-rw-r--r--pyload/plugins/accounts/FilejungleCom.py62
-rw-r--r--pyload/plugins/accounts/FilerNet.py62
-rw-r--r--pyload/plugins/accounts/FilerioCom.py13
-rw-r--r--pyload/plugins/accounts/FilesMailRu.py42
-rw-r--r--pyload/plugins/accounts/FileserveCom.py58
-rw-r--r--pyload/plugins/accounts/FourSharedCom.py49
-rw-r--r--pyload/plugins/accounts/FreakshareCom.py53
-rw-r--r--pyload/plugins/accounts/FshareVn.py65
-rw-r--r--pyload/plugins/accounts/Ftp.py14
-rw-r--r--pyload/plugins/accounts/HellshareCz.py89
-rw-r--r--pyload/plugins/accounts/HellspyCz.py73
-rw-r--r--pyload/plugins/accounts/HotfileCom.py89
-rw-r--r--pyload/plugins/accounts/Http.py14
-rw-r--r--pyload/plugins/accounts/LetitbitNet.py46
-rw-r--r--pyload/plugins/accounts/MegasharesCom.py44
-rw-r--r--pyload/plugins/accounts/MultiDebridCom.py54
-rw-r--r--pyload/plugins/accounts/MultishareCz.py59
-rwxr-xr-xpyload/plugins/accounts/NetloadIn.py53
-rw-r--r--pyload/plugins/accounts/Premium4Me.py25
-rw-r--r--pyload/plugins/accounts/PremiumizeMe.py42
-rw-r--r--pyload/plugins/accounts/QuickshareCz.py54
-rw-r--r--pyload/plugins/accounts/RPNetBiz.py45
-rw-r--r--pyload/plugins/accounts/RapidgatorNet.py71
-rw-r--r--pyload/plugins/accounts/RapidshareCom.py69
-rw-r--r--pyload/plugins/accounts/RarefileNet.py13
-rw-r--r--pyload/plugins/accounts/RealdebridCom.py31
-rw-r--r--pyload/plugins/accounts/RehostTo.py33
-rw-r--r--pyload/plugins/accounts/ReloadCc.py73
-rw-r--r--pyload/plugins/accounts/RyushareCom.py20
-rw-r--r--pyload/plugins/accounts/Share76Com.py12
-rw-r--r--pyload/plugins/accounts/ShareFilesCo.py13
-rw-r--r--pyload/plugins/accounts/ShareRapidCom.py48
-rw-r--r--pyload/plugins/accounts/ShareonlineBiz.py57
-rw-r--r--pyload/plugins/accounts/SimplydebridCom.py30
-rw-r--r--pyload/plugins/accounts/StahnuTo.py51
-rw-r--r--pyload/plugins/accounts/TurbobitNet.py58
-rw-r--r--pyload/plugins/accounts/UlozTo.py43
-rw-r--r--pyload/plugins/accounts/UnrestrictLi.py64
-rw-r--r--pyload/plugins/accounts/UploadedTo.py68
-rw-r--r--pyload/plugins/accounts/UploadheroCom.py39
-rw-r--r--pyload/plugins/accounts/UploadingCom.py55
-rw-r--r--pyload/plugins/accounts/UploadstationCom.py14
-rw-r--r--pyload/plugins/accounts/UptoboxCom.py13
-rw-r--r--pyload/plugins/accounts/WarserverCz.py68
-rw-r--r--pyload/plugins/accounts/WuploadCom.py48
-rw-r--r--pyload/plugins/accounts/X7To.py67
-rw-r--r--pyload/plugins/accounts/YibaishiwuCom.py53
-rw-r--r--pyload/plugins/accounts/ZeveraCom.py51
-rw-r--r--pyload/plugins/accounts/__init__.py0
-rw-r--r--pyload/plugins/addons/AlldebridCom.py29
-rw-r--r--pyload/plugins/addons/BypassCaptcha.py139
-rwxr-xr-xpyload/plugins/addons/Captcha9kw.py167
-rw-r--r--pyload/plugins/addons/CaptchaBrotherhood.py167
-rw-r--r--pyload/plugins/addons/CaptchaTrader.py156
-rw-r--r--pyload/plugins/addons/Checksum.py182
-rw-r--r--pyload/plugins/addons/ClickAndLoad.py90
-rw-r--r--pyload/plugins/addons/DeathByCaptcha.py212
-rw-r--r--pyload/plugins/addons/DebridItaliaCom.py42
-rw-r--r--pyload/plugins/addons/DeleteFinished.py84
-rw-r--r--pyload/plugins/addons/DownloadScheduler.py86
-rw-r--r--pyload/plugins/addons/EasybytezCom.py34
-rw-r--r--pyload/plugins/addons/Ev0InFetcher.py89
-rw-r--r--pyload/plugins/addons/ExpertDecoders.py106
-rw-r--r--pyload/plugins/addons/ExternalScripts.py116
-rw-r--r--pyload/plugins/addons/ExtractArchive.py318
-rw-r--r--pyload/plugins/addons/FastixRu.py27
-rw-r--r--pyload/plugins/addons/HotFolder.py83
-rw-r--r--pyload/plugins/addons/IRCInterface.py422
-rw-r--r--pyload/plugins/addons/ImageTyperz.py151
-rw-r--r--pyload/plugins/addons/LinkdecrypterCom.py60
-rw-r--r--pyload/plugins/addons/MergeFiles.py90
-rw-r--r--pyload/plugins/addons/MultiHome.py87
-rw-r--r--pyload/plugins/addons/MultiHoster.py97
-rw-r--r--pyload/plugins/addons/MultishareCz.py24
-rw-r--r--pyload/plugins/addons/Premium4Me.py32
-rw-r--r--pyload/plugins/addons/PremiumizeMe.py52
-rw-r--r--pyload/plugins/addons/RPNetBiz.py47
-rw-r--r--pyload/plugins/addons/RealdebridCom.py26
-rw-r--r--pyload/plugins/addons/RehostTo.py39
-rw-r--r--pyload/plugins/addons/ReloadCc.py65
-rw-r--r--pyload/plugins/addons/RestartFailed.py32
-rw-r--r--pyload/plugins/addons/SimplydebridCom.py20
-rw-r--r--pyload/plugins/addons/SkipRev.py0
-rw-r--r--pyload/plugins/addons/UnSkipOnFail.py97
-rw-r--r--pyload/plugins/addons/UpdateManager.py202
-rw-r--r--pyload/plugins/addons/WindowsPhoneToastNotify.py68
-rw-r--r--pyload/plugins/addons/XFileSharingPro.py74
-rw-r--r--pyload/plugins/addons/XMPPInterface.py251
-rw-r--r--pyload/plugins/addons/ZeveraCom.py20
-rw-r--r--pyload/plugins/addons/__init__.py0
-rw-r--r--pyload/plugins/crypter/BitshareComFolder.py31
-rw-r--r--pyload/plugins/crypter/C1neonCom.py13
-rw-r--r--pyload/plugins/crypter/CCF.py42
-rw-r--r--pyload/plugins/crypter/CrockoComFolder.py15
-rw-r--r--pyload/plugins/crypter/CryptItCom.py13
-rw-r--r--pyload/plugins/crypter/CzshareComFolder.py31
-rw-r--r--pyload/plugins/crypter/DDLMusicOrg.py45
-rw-r--r--pyload/plugins/crypter/DLC_25.pycbin0 -> 8027 bytes
-rw-r--r--pyload/plugins/crypter/DLC_26.pycbin0 -> 7985 bytes
-rw-r--r--pyload/plugins/crypter/DLC_27.pycbin0 -> 7674 bytes
-rw-r--r--pyload/plugins/crypter/DataHuFolder.py55
-rw-r--r--pyload/plugins/crypter/DdlstorageComFolder.py30
-rw-r--r--pyload/plugins/crypter/DepositfilesComFolder.py15
-rw-r--r--pyload/plugins/crypter/Dereferer.py35
-rw-r--r--pyload/plugins/crypter/DontKnowMe.py22
-rw-r--r--pyload/plugins/crypter/DownloadVimeoCom.py31
-rw-r--r--pyload/plugins/crypter/DuckCryptInfo.py57
-rw-r--r--pyload/plugins/crypter/DuploadOrgFolder.py30
-rw-r--r--pyload/plugins/crypter/EasybytezComFolder.py35
-rw-r--r--pyload/plugins/crypter/EmbeduploadCom.py53
-rw-r--r--pyload/plugins/crypter/FilebeerInfoFolder.py14
-rw-r--r--pyload/plugins/crypter/FilefactoryComFolder.py45
-rw-r--r--pyload/plugins/crypter/FileserveComFolder.py33
-rw-r--r--pyload/plugins/crypter/FilestubeCom.py31
-rw-r--r--pyload/plugins/crypter/FiletramCom.py31
-rw-r--r--pyload/plugins/crypter/FourChanOrg.py26
-rw-r--r--pyload/plugins/crypter/FreakhareComFolder.py47
-rw-r--r--pyload/plugins/crypter/FreetexthostCom.py37
-rw-r--r--pyload/plugins/crypter/FshareVnFolder.py15
-rw-r--r--pyload/plugins/crypter/GooGl.py41
-rw-r--r--pyload/plugins/crypter/HoerbuchIn.py56
-rw-r--r--pyload/plugins/crypter/HotfileFolderCom.py28
-rw-r--r--pyload/plugins/crypter/ILoadTo.py13
-rw-r--r--pyload/plugins/crypter/LetitbitNetFolder.py33
-rw-r--r--pyload/plugins/crypter/LinkList.py55
-rw-r--r--pyload/plugins/crypter/LinkSaveIn.py228
-rw-r--r--pyload/plugins/crypter/LinkdecrypterCom.py104
-rw-r--r--pyload/plugins/crypter/LixIn.py59
-rw-r--r--pyload/plugins/crypter/LofCc.py13
-rw-r--r--pyload/plugins/crypter/MBLinkInfo.py13
-rw-r--r--pyload/plugins/crypter/MediafireComFolder.py57
-rw-r--r--pyload/plugins/crypter/Movie2kTo.py13
-rw-r--r--pyload/plugins/crypter/MultiloadCz.py42
-rw-r--r--pyload/plugins/crypter/MultiuploadCom.py64
-rw-r--r--pyload/plugins/crypter/NCryptIn.py304
-rw-r--r--pyload/plugins/crypter/NetfolderIn.py71
-rw-r--r--pyload/plugins/crypter/OneKhDe.py38
-rwxr-xr-xpyload/plugins/crypter/OronComFolder.py13
-rw-r--r--pyload/plugins/crypter/PastebinCom.py31
-rw-r--r--pyload/plugins/crypter/QuickshareCzFolder.py31
-rw-r--r--pyload/plugins/crypter/RSDF.py49
-rw-r--r--pyload/plugins/crypter/RSLayerCom.py13
-rw-r--r--pyload/plugins/crypter/RelinkUs.py264
-rw-r--r--pyload/plugins/crypter/SecuredIn.py13
-rw-r--r--pyload/plugins/crypter/SerienjunkiesOrg.py322
-rw-r--r--pyload/plugins/crypter/ShareLinksBiz.py269
-rw-r--r--pyload/plugins/crypter/ShareRapidComFolder.py15
-rw-r--r--pyload/plugins/crypter/SpeedLoadOrgFolder.py28
-rw-r--r--pyload/plugins/crypter/StealthTo.py49
-rw-r--r--pyload/plugins/crypter/TrailerzoneInfo.py13
-rw-r--r--pyload/plugins/crypter/TurbobitNetFolder.py60
-rw-r--r--pyload/plugins/crypter/UlozToFolder.py42
-rw-r--r--pyload/plugins/crypter/UploadedToFolder.py50
-rw-r--r--pyload/plugins/crypter/WiiReloadedOrg.py13
-rw-r--r--pyload/plugins/crypter/XfilesharingProFolder.py34
-rw-r--r--pyload/plugins/crypter/XupPl.py18
-rw-r--r--pyload/plugins/crypter/YoutubeBatch.py44
-rw-r--r--pyload/plugins/crypter/__init__.py0
-rw-r--r--pyload/plugins/hoster/ARD.py83
-rw-r--r--pyload/plugins/hoster/AlldebridCom.py83
-rw-r--r--pyload/plugins/hoster/BasePlugin.py113
-rw-r--r--pyload/plugins/hoster/BayfilesCom.py98
-rw-r--r--pyload/plugins/hoster/BezvadataCz.py101
-rw-r--r--pyload/plugins/hoster/BillionuploadsCom.py19
-rw-r--r--pyload/plugins/hoster/BitshareCom.py146
-rw-r--r--pyload/plugins/hoster/BoltsharingCom.py17
-rw-r--r--pyload/plugins/hoster/CatShareNet.py39
-rw-r--r--pyload/plugins/hoster/ChipDe.py25
-rw-r--r--pyload/plugins/hoster/CloudzerNet.py73
-rw-r--r--pyload/plugins/hoster/CramitIn.py22
-rw-r--r--pyload/plugins/hoster/CrockoCom.py74
-rw-r--r--pyload/plugins/hoster/CyberlockerCh.py17
-rw-r--r--pyload/plugins/hoster/CzshareCom.py158
-rw-r--r--pyload/plugins/hoster/DailymotionCom.py50
-rw-r--r--pyload/plugins/hoster/DataHu.py53
-rw-r--r--pyload/plugins/hoster/DataportCz.py68
-rw-r--r--pyload/plugins/hoster/DateiTo.py97
-rw-r--r--pyload/plugins/hoster/DdlstorageCom.py84
-rw-r--r--pyload/plugins/hoster/DebridItaliaCom.py66
-rw-r--r--pyload/plugins/hoster/DepositfilesCom.py115
-rw-r--r--pyload/plugins/hoster/DlFreeFr.py201
-rw-r--r--pyload/plugins/hoster/DuploadOrg.py35
-rw-r--r--pyload/plugins/hoster/EasybytezCom.py45
-rw-r--r--pyload/plugins/hoster/EdiskCz.py65
-rw-r--r--pyload/plugins/hoster/EgoFilesCom.py102
-rw-r--r--pyload/plugins/hoster/EuroshareEu.py75
-rw-r--r--pyload/plugins/hoster/ExtabitCom.py88
-rw-r--r--pyload/plugins/hoster/FastixRu.py66
-rw-r--r--pyload/plugins/hoster/FastshareCz.py89
-rw-r--r--pyload/plugins/hoster/FileApeCom.py64
-rw-r--r--pyload/plugins/hoster/FilebeerInfo.py15
-rw-r--r--pyload/plugins/hoster/FilecloudIo.py126
-rw-r--r--pyload/plugins/hoster/FilefactoryCom.py133
-rw-r--r--pyload/plugins/hoster/FilejungleCom.py42
-rw-r--r--pyload/plugins/hoster/FilepostCom.py146
-rw-r--r--pyload/plugins/hoster/FilerNet.py119
-rw-r--r--pyload/plugins/hoster/FilerioCom.py22
-rw-r--r--pyload/plugins/hoster/FilesMailRu.py101
-rw-r--r--pyload/plugins/hoster/FileserveCom.py220
-rw-r--r--pyload/plugins/hoster/FileshareInUa.py78
-rw-r--r--pyload/plugins/hoster/FilezyNet.py35
-rw-r--r--pyload/plugins/hoster/FlyFilesNet.py41
-rw-r--r--pyload/plugins/hoster/FourSharedCom.py57
-rw-r--r--pyload/plugins/hoster/FreakshareCom.py171
-rw-r--r--pyload/plugins/hoster/FreevideoCz.py66
-rw-r--r--pyload/plugins/hoster/FshareVn.py117
-rw-r--r--pyload/plugins/hoster/Ftp.py90
-rw-r--r--pyload/plugins/hoster/GamefrontCom.py83
-rw-r--r--pyload/plugins/hoster/GigapetaCom.py76
-rw-r--r--pyload/plugins/hoster/GooIm.py55
-rw-r--r--pyload/plugins/hoster/HellshareCz.py58
-rw-r--r--pyload/plugins/hoster/HellspyCz.py73
-rw-r--r--pyload/plugins/hoster/HotfileCom.py140
-rw-r--r--pyload/plugins/hoster/HundredEightyUploadCom.py39
-rw-r--r--pyload/plugins/hoster/IFileWs.py20
-rw-r--r--pyload/plugins/hoster/IcyFilesCom.py112
-rw-r--r--pyload/plugins/hoster/IfileIt.py75
-rw-r--r--pyload/plugins/hoster/IfolderRu.py88
-rw-r--r--pyload/plugins/hoster/JumbofilesCom.py31
-rw-r--r--pyload/plugins/hoster/Keep2shareCC.py94
-rw-r--r--pyload/plugins/hoster/LetitbitNet.py171
-rw-r--r--pyload/plugins/hoster/LoadTo.py61
-rw-r--r--pyload/plugins/hoster/LuckyShareNet.py72
-rw-r--r--pyload/plugins/hoster/MediafireCom.py137
-rw-r--r--pyload/plugins/hoster/MegaNz.py132
-rw-r--r--pyload/plugins/hoster/MegacrypterCom.py49
-rw-r--r--pyload/plugins/hoster/MegasharesCom.py114
-rw-r--r--pyload/plugins/hoster/MovReelCom.py23
-rw-r--r--pyload/plugins/hoster/MultiDebridCom.py62
-rw-r--r--pyload/plugins/hoster/MultishareCz.py82
-rw-r--r--pyload/plugins/hoster/MyvideoDe.py41
-rw-r--r--pyload/plugins/hoster/NarodRu.py70
-rw-r--r--pyload/plugins/hoster/NetloadIn.py255
-rw-r--r--pyload/plugins/hoster/NovafileCom.py30
-rw-r--r--pyload/plugins/hoster/NowDownloadEu.py73
-rw-r--r--pyload/plugins/hoster/OneFichierCom.py64
-rw-r--r--pyload/plugins/hoster/PornhostCom.py75
-rw-r--r--pyload/plugins/hoster/PornhubCom.py84
-rw-r--r--pyload/plugins/hoster/Premium4Me.py71
-rw-r--r--pyload/plugins/hoster/PremiumizeMe.py55
-rw-r--r--pyload/plugins/hoster/PutlockerCom.py96
-rw-r--r--pyload/plugins/hoster/QuickshareCz.py103
-rw-r--r--pyload/plugins/hoster/RPNetBiz.py76
-rw-r--r--pyload/plugins/hoster/RapidgatorNet.py196
-rw-r--r--pyload/plugins/hoster/RapidshareCom.py230
-rw-r--r--pyload/plugins/hoster/RarefileNet.py35
-rw-r--r--pyload/plugins/hoster/RealdebridCom.py89
-rw-r--r--pyload/plugins/hoster/RedtubeCom.py56
-rw-r--r--pyload/plugins/hoster/RehostTo.py38
-rw-r--r--pyload/plugins/hoster/ReloadCc.py113
-rw-r--r--pyload/plugins/hoster/RgHostNet.py28
-rw-r--r--pyload/plugins/hoster/RyushareCom.py89
-rw-r--r--pyload/plugins/hoster/SecureUploadEu.py19
-rw-r--r--pyload/plugins/hoster/SendmywayCom.py19
-rw-r--r--pyload/plugins/hoster/SendspaceCom.py70
-rw-r--r--pyload/plugins/hoster/Share4webCom.py18
-rw-r--r--pyload/plugins/hoster/Share76Com.py17
-rw-r--r--pyload/plugins/hoster/ShareFilesCo.py28
-rw-r--r--pyload/plugins/hoster/ShareRapidCom.py71
-rw-r--r--pyload/plugins/hoster/SharebeesCom.py20
-rw-r--r--pyload/plugins/hoster/ShareonlineBiz.py209
-rw-r--r--pyload/plugins/hoster/ShareplaceCom.py80
-rw-r--r--pyload/plugins/hoster/ShragleCom.py104
-rw-r--r--pyload/plugins/hoster/SimplydebridCom.py61
-rw-r--r--pyload/plugins/hoster/SockshareCom.py33
-rw-r--r--pyload/plugins/hoster/SpeedLoadOrg.py15
-rw-r--r--pyload/plugins/hoster/SpeedfileCz.py67
-rw-r--r--pyload/plugins/hoster/StreamCz.py80
-rw-r--r--pyload/plugins/hoster/StreamcloudEu.py118
-rw-r--r--pyload/plugins/hoster/TurbobitNet.py182
-rw-r--r--pyload/plugins/hoster/TurbouploadCom.py46
-rw-r--r--pyload/plugins/hoster/TusfilesNet.py29
-rw-r--r--pyload/plugins/hoster/TwoSharedCom.py36
-rw-r--r--pyload/plugins/hoster/UlozTo.py158
-rw-r--r--pyload/plugins/hoster/UloziskoSk.py80
-rw-r--r--pyload/plugins/hoster/UnibytesCom.py82
-rw-r--r--pyload/plugins/hoster/UnrestrictLi.py101
-rw-r--r--pyload/plugins/hoster/UploadStationCom.py25
-rw-r--r--pyload/plugins/hoster/UploadedTo.py231
-rw-r--r--pyload/plugins/hoster/UploadheroCom.py90
-rw-r--r--pyload/plugins/hoster/UploadingCom.py113
-rw-r--r--pyload/plugins/hoster/UptoboxCom.py19
-rw-r--r--pyload/plugins/hoster/VeehdCom.py80
-rw-r--r--pyload/plugins/hoster/WarserverCz.py75
-rw-r--r--pyload/plugins/hoster/WebshareCz.py46
-rw-r--r--pyload/plugins/hoster/WrzucTo.py62
-rw-r--r--pyload/plugins/hoster/WuploadCom.py239
-rw-r--r--pyload/plugins/hoster/X7To.py88
-rw-r--r--pyload/plugins/hoster/XFileSharingPro.py334
-rw-r--r--pyload/plugins/hoster/XHamsterCom.py118
-rw-r--r--pyload/plugins/hoster/XVideosCom.py19
-rw-r--r--pyload/plugins/hoster/Xdcc.py224
-rw-r--r--pyload/plugins/hoster/YibaishiwuCom.py58
-rw-r--r--pyload/plugins/hoster/YoupornCom.py54
-rw-r--r--pyload/plugins/hoster/YourfilesTo.py77
-rw-r--r--pyload/plugins/hoster/YoutubeCom.py168
-rw-r--r--pyload/plugins/hoster/ZDF.py47
-rw-r--r--pyload/plugins/hoster/ZeveraCom.py106
-rw-r--r--pyload/plugins/hoster/ZippyshareCom.py220
-rw-r--r--pyload/plugins/hoster/__init__.py0
-rw-r--r--pyload/plugins/internal/AbstractExtractor.py97
-rw-r--r--pyload/plugins/internal/CaptchaService.py75
-rw-r--r--pyload/plugins/internal/DeadCrypter.py14
-rw-r--r--pyload/plugins/internal/DeadHoster.py18
-rw-r--r--pyload/plugins/internal/NetloadInOCR.py27
-rw-r--r--pyload/plugins/internal/OCR.py314
-rw-r--r--pyload/plugins/internal/ShareonlineBizOCR.py53
-rw-r--r--pyload/plugins/internal/SimpleCrypter.py98
-rw-r--r--pyload/plugins/internal/SimpleHoster.py278
-rw-r--r--pyload/plugins/internal/UnRar.py215
-rw-r--r--pyload/plugins/internal/UnZip.py49
-rw-r--r--pyload/plugins/internal/XFSPAccount.py79
-rw-r--r--pyload/plugins/internal/__init__.py0
-rw-r--r--pyload/plugins/network/CurlChunk.py303
-rw-r--r--pyload/plugins/network/CurlDownload.py325
-rw-r--r--pyload/plugins/network/CurlRequest.py320
-rw-r--r--pyload/plugins/network/DefaultRequest.py9
-rw-r--r--pyload/plugins/network/XDCCRequest.py162
-rw-r--r--pyload/plugins/network/__init__.py1
347 files changed, 26852 insertions, 0 deletions
diff --git a/pyload/plugins/Account.py b/pyload/plugins/Account.py
new file mode 100644
index 000000000..ed0769fb4
--- /dev/null
+++ b/pyload/plugins/Account.py
@@ -0,0 +1,316 @@
+# -*- coding: utf-8 -*-
+
+from time import time
+from threading import RLock
+
+from pyload.Api import AccountInfo, ConfigItem
+from pyload.network.CookieJar import CookieJar
+from pyload.config.convert import from_string, to_configdata
+from pyload.utils import to_string, compare_time, format_size, parseFileSize, lock
+
+from Base import Base
+
+
+class WrongPassword(Exception):
+ pass
+
+#noinspection PyUnresolvedReferences
+class Account(Base):
+ """
+ Base class for every account plugin.
+ Just overwrite `login` and cookies will be stored and the account becomes accessible in\
+ associated hoster plugin. Plugin should also provide `loadAccountInfo`. \
+ An instance of this class is created for every entered account, it holds all \
+ fields of AccountInfo ttype, and can be set easily at runtime.
+ """
+
+ # constants for special values
+ UNKNOWN = -1
+ UNLIMITED = -2
+
+ # Default values
+ valid = True
+ validuntil = -1
+ trafficleft = -1
+ maxtraffic = -1
+ premium = True
+
+ #: after that time [in minutes] pyload will relogin the account
+ login_timeout = 600
+ #: account data will be reloaded after this time
+ info_threshold = 600
+
+ @classmethod
+ def fromInfoData(cls, m, info, password, options):
+ return cls(m, info.loginname, info.owner,
+ True if info.activated else False, True if info.shared else False, password, options)
+
+ def __init__(self, manager, loginname, owner, activated, shared, password, options):
+ Base.__init__(self, manager.core, owner)
+
+ self.loginname = loginname
+ self.owner = owner
+ self.activated = activated
+ self.shared = shared
+ self.password = password
+ self.options = options
+
+ self.manager = manager
+
+ self.lock = RLock()
+ self.timestamp = 0
+ self.login_ts = 0 # timestamp for login
+ self.cj = CookieJar()
+ self.error = None
+
+ try:
+ self.config_data = dict(to_configdata(x) for x in self.__config__)
+ except Exception, e:
+ self.logError("Invalid config: %s" % e)
+ self.config_data = {}
+
+ self.init()
+
+ def toInfoData(self):
+ info = AccountInfo(self.__name__, self.loginname, self.owner, self.valid, self.validuntil, self.trafficleft,
+ self.maxtraffic, self.premium, self.activated, self.shared, self.options)
+
+ info.config = [ConfigItem(name, item.label, item.description, item.input,
+ to_string(self.getConfig(name))) for name, item in
+ self.config_data.iteritems()]
+ return info
+
+ def init(self):
+ pass
+
+ def getConfig(self, option):
+ """ Gets an option that was configured via the account options dialog and
+ is only valid for this specific instance."""
+ if option not in self.config_data:
+ return Base.getConfig(self, option)
+
+ if option in self.options:
+ return self.options[option]
+
+ return self.config_data[option].input.default_value
+
+ def setConfig(self, option, value):
+ """ Sets a config value for this account instance. Modifying the global values is not allowed. """
+ if option not in self.config_data:
+ return
+
+ value = from_string(value, self.config_data[option].input.type)
+ # given value is the default value and does not need to be saved at all
+ if value == self.config_data[option].input.default_value:
+ if option in self.options:
+ del self.options[option]
+ else:
+ self.options[option] = from_string(value, self.config_data[option].input.type)
+
+ def login(self, req):
+ """login into account, the cookies will be saved so the user can be recognized
+
+ :param req: `Request` instance
+ """
+ raise NotImplementedError
+
+ def relogin(self):
+ """ Force a login. """
+ req = self.getAccountRequest()
+ try:
+ return self._login(req)
+ finally:
+ req.close()
+
+ @lock
+ def _login(self, req):
+ # set timestamp for login
+ self.login_ts = time()
+
+ try:
+ try:
+ self.login(req)
+ except TypeError: #TODO: temporary
+ self.logDebug("Deprecated .login(...) signature omit user, data")
+ self.login(self.loginname, {"password": self.password}, req)
+
+ self.valid = True
+ except WrongPassword:
+ self.logWarning(
+ _("Could not login with account %(user)s | %(msg)s") % {"user": self.loginname
+ , "msg": _("Wrong Password")})
+ self.valid = False
+
+ except Exception, e:
+ self.logWarning(
+ _("Could not login with account %(user)s | %(msg)s") % {"user": self.loginname
+ , "msg": e})
+ self.valid = False
+ self.core.print_exc()
+
+ return self.valid
+
+ def restoreDefaults(self):
+ self.validuntil = Account.validuntil
+ self.trafficleft = Account.trafficleft
+ self.maxtraffic = Account.maxtraffic
+ self.premium = Account.premium
+
+ def setPassword(self, password):
+ """ updates the password and returns true if anything changed """
+
+ if password != self.password:
+ self.login_ts = 0
+ self.valid = True #set valid, so the login will be retried
+
+ self.password = password
+ return True
+
+ return False
+
+ def updateConfig(self, items):
+ """ Updates the accounts options from config items """
+ for item in items:
+ # Check if a valid option
+ if item.name in self.config_data:
+ self.setConfig(item.name, item.value)
+
+ def getAccountRequest(self):
+ return self.core.requestFactory.getRequest(self.cj)
+
+ def getDownloadSettings(self):
+ """ Can be overwritten to change download settings. Default is no chunkLimit, max dl limit, resumeDownload
+
+ :return: (chunkLimit, limitDL, resumeDownload) / (int, int, bool)
+ """
+ return -1, 0, True
+
+ # TODO: this method is ambiguous, it returns nothing, but just retrieves the data if needed
+ @lock
+ def getAccountInfo(self, force=False):
+ """retrieve account info's for an user, do **not** overwrite this method!\\
+ just use it to retrieve info's in hoster plugins. see `loadAccountInfo`
+
+ :param name: username
+ :param force: reloads cached account information
+ """
+ if force or self.timestamp + self.info_threshold * 60 < time():
+
+ # make sure to login
+ req = self.getAccountRequest()
+ self.checkLogin(req)
+ self.logInfo(_("Get Account Info for %s") % self.loginname)
+ try:
+ try:
+ infos = self.loadAccountInfo(req)
+ except TypeError: #TODO: temporary
+ self.logDebug("Deprecated .loadAccountInfo(...) signature, omit user argument.")
+ infos = self.loadAccountInfo(self.loginname, req)
+ except Exception, e:
+ infos = {"error": str(e)}
+ self.logError(_("Error: %s") % e)
+ finally:
+ req.close()
+
+ self.logDebug("Account Info: %s" % str(infos))
+ self.timestamp = time()
+
+ self.restoreDefaults() # reset to initial state
+ if type(infos) == dict: # copy result from dict to class
+ for k, v in infos.iteritems():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ self.logDebug("Unknown attribute %s=%s" % (k, v))
+
+ #TODO: remove user
+ def loadAccountInfo(self, req):
+ """ Overwrite this method and set account attributes within this method.
+
+ :param user: Deprecated
+ :param req: Request instance
+ :return:
+ """
+ pass
+
+ def getAccountCookies(self, user):
+ self.logDebug("Deprecated method .getAccountCookies -> use account.cj")
+ return self.cj
+
+ def getAccountData(self, *args):
+ self.logDebug("Deprecated method .getAccountData -> use fields directly")
+ return {"password": self.password, "premium": self.premium, "trafficleft": self.trafficleft,
+ "maxtraffic" : self.maxtraffic, "validuntil": self.validuntil}
+
+ def isPremium(self, user=None):
+ if user: self.logDebug("Deprecated Argument user for .isPremium()", user)
+ return self.premium
+
+ def isUsable(self):
+ """Check several constraints to determine if account should be used"""
+
+ if not self.valid or not self.activated: return False
+
+ # TODO: not in ui currently
+ if "time" in self.options and self.options["time"]:
+ time_data = ""
+ try:
+ time_data = self.options["time"]
+ start, end = time_data.split("-")
+ if not compare_time(start.split(":"), end.split(":")):
+ return False
+ except:
+ self.logWarning(_("Your Time %s has a wrong format, use: 1:22-3:44") % time_data)
+
+ if 0 <= self.validuntil < time():
+ return False
+ if self.trafficleft is 0: # test explicitly for 0
+ return False
+
+ return True
+
+ def parseTraffic(self, string): #returns kbyte
+ return parseFileSize(string) / 1024
+
+ def formatTrafficleft(self):
+ if self.trafficleft is None:
+ self.getAccountInfo(force=True)
+ return format_size(self.trafficleft * 1024)
+
+ def wrongPassword(self):
+ raise WrongPassword
+
+ def empty(self, user=None):
+ if user: self.logDebug("Deprecated argument user for .empty()", user)
+
+ self.logWarning(_("Account %s has not enough traffic, checking again in 30min") % self.login)
+
+ self.trafficleft = 0
+ self.scheduleRefresh(30 * 60)
+
+ def expired(self, user=None):
+ if user: self.logDebug("Deprecated argument user for .expired()", user)
+
+ self.logWarning(_("Account %s is expired, checking again in 1h") % user)
+
+ self.validuntil = time() - 1
+ self.scheduleRefresh(60 * 60)
+
+ def scheduleRefresh(self, time=0, force=True):
+ """ add a task for refreshing the account info to the scheduler """
+ self.logDebug("Scheduled Account refresh for %s in %s seconds." % (self.loginname, time))
+ self.core.scheduler.addJob(time, self.getAccountInfo, [force])
+
+ @lock
+ def checkLogin(self, req):
+ """ checks if the user is still logged in """
+ if self.login_ts + self.login_timeout * 60 < time():
+ if self.login_ts: # separate from fresh login to have better debug logs
+ self.logDebug("Reached login timeout for %s" % self.loginname)
+ else:
+ self.logInfo(_("Login with %s") % self.loginname)
+
+ self._login(req)
+ return False
+
+ return True
diff --git a/pyload/plugins/Addon.py b/pyload/plugins/Addon.py
new file mode 100644
index 000000000..ee8cbe62c
--- /dev/null
+++ b/pyload/plugins/Addon.py
@@ -0,0 +1,171 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: RaNaN
+"""
+
+from traceback import print_exc
+
+#from functools import wraps
+from pyload.utils import has_method, to_list
+
+from Base import Base
+
+def class_name(p):
+ return p.rpartition(".")[2]
+
+
+def AddEventListener(event):
+ """ Used to register method for events. Arguments needs to match parameter of event
+
+ :param event: Name of event or list of them.
+ """
+ class _klass(object):
+ def __new__(cls, f, *args, **kwargs):
+ for ev in to_list(event):
+ addonManager.addEventListener(class_name(f.__module__), f.func_name, ev)
+ return f
+ return _klass
+
+
+def AddonHandler(desc, media=None):
+ """ Register Handler for files, packages, or arbitrary callable methods.
+ To let the method work on packages/files, media must be set and the argument named pid or fid.
+
+ :param desc: verbose description
+ :param media: if True or bits of media type
+ """
+ pass
+
+def AddonInfo(desc):
+ """ Called to retrieve information about the current state.
+ Decorated method must return anything convertable into string.
+
+ :param desc: verbose description
+ """
+ pass
+
+def threaded(f):
+ """ Decorator to run method in a thread. """
+
+ #@wraps(f)
+ def run(*args,**kwargs):
+ addonManager.startThread(f, *args, **kwargs)
+ return run
+
+class Addon(Base):
+ """
+ Base class for addon plugins. Use @threaded decorator for all longer running tasks.
+
+ Decorate methods with @Expose, @AddEventListener, @ConfigHandler
+
+ """
+
+ #: automatically register event listeners for functions, attribute will be deleted don't use it yourself
+ event_map = None
+
+ #: periodic call interval in seconds
+ interval = 60
+
+ def __init__(self, core, manager, user=None):
+ Base.__init__(self, core, user)
+
+ #: Provide information in dict here, usable by API `getInfo`
+ self.info = None
+
+ #: Callback of periodical job task, used by addonmanager
+ self.cb = None
+
+ #: `AddonManager`
+ self.manager = manager
+
+ #register events
+ if self.event_map:
+ for event, funcs in self.event_map.iteritems():
+ if type(funcs) in (list, tuple):
+ for f in funcs:
+ self.evm.listenTo(event, getattr(self,f))
+ else:
+ self.evm.listenTo(event, getattr(self,funcs))
+
+ #delete for various reasons
+ self.event_map = None
+
+ self.initPeriodical()
+ self.init()
+
+ def initPeriodical(self):
+ if self.interval >=1:
+ self.cb = self.core.scheduler.addJob(0, self._periodical, threaded=False)
+
+ def _periodical(self):
+ try:
+ if self.isActivated(): self.periodical()
+ except Exception, e:
+ self.core.log.error(_("Error executing addons: %s") % str(e))
+ if self.core.debug:
+ print_exc()
+
+ self.cb = self.core.scheduler.addJob(self.interval, self._periodical, threaded=False)
+
+ def __repr__(self):
+ return "<Addon %s>" % self.__name__
+
+ def isActivated(self):
+ """ checks if addon is activated"""
+ return True if self.__internal__ else self.getConfig("activated")
+
+ def getCategory(self):
+ return self.core.pluginManager.getCategory(self.__name__)
+
+ def init(self):
+ pass
+
+ def activate(self):
+ """ Used to activate the addon """
+ if has_method(self.__class__, "coreReady"):
+ self.logDebug("Deprecated method .coreReady() use activate() instead")
+ self.coreReady()
+
+ def deactivate(self):
+ """ Used to deactivate the addon. """
+ pass
+
+ def periodical(self):
+ pass
+
+ def newInteractionTask(self, task):
+ """ new interaction task for the plugin, it MUST set the handler and timeout or will be ignored """
+ pass
+
+ def taskCorrect(self, task):
+ pass
+
+ def taskInvalid(self, task):
+ pass
+
+ # public events starts from here
+ def downloadPreparing(self, pyfile):
+ pass
+
+ def downloadFinished(self, pyfile):
+ pass
+
+ def downloadFailed(self, pyfile):
+ pass
+
+ def packageFinished(self, pypack):
+ pass \ No newline at end of file
diff --git a/pyload/plugins/Base.py b/pyload/plugins/Base.py
new file mode 100644
index 000000000..abb59a7bc
--- /dev/null
+++ b/pyload/plugins/Base.py
@@ -0,0 +1,346 @@
+# -*- coding: utf-8 -*-
+
+###############################################################################
+# Copyright(c) 2008-2013 pyLoad Team
+# http://www.pyload.org
+#
+# This file is part of pyLoad.
+# pyLoad is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# Subjected to the terms and conditions in LICENSE
+#
+# @author: RaNaN
+###############################################################################
+
+import sys
+from time import time, sleep
+from random import randint
+
+from pyload.utils import decode
+from pyload.utils.fs import exists, makedirs, join, remove
+
+# TODO
+# more attributes if needed
+# get rid of catpcha & container plugins ?! (move to crypter & internals)
+# adapt old plugins as needed
+
+class Fail(Exception):
+ """ raised when failed """
+
+class Retry(Exception):
+ """ raised when start again from beginning """
+
+class Abort(Exception):
+ """ raised when aborted """
+
+class Base(object):
+ """
+ The Base plugin class with all shared methods and every possible attribute for plugin definition.
+ """
+ __version__ = "0.1"
+ #: Regexp pattern which will be matched for download/crypter plugins
+ __pattern__ = r""
+ #: Internal addon plugin which is always loaded
+ __internal__ = False
+ #: When True this addon can be enabled by every user
+ __user_context__ = False
+ #: Config definition: list of (name, type, label, default_value) or
+ #: (name, label, desc, Input(...))
+ __config__ = tuple()
+ #: Short description, one liner
+ __description__ = ""
+ #: More detailed text
+ __explanation__ = """"""
+ #: List of needed modules
+ __dependencies__ = tuple()
+ #: Used to assign a category for addon plugins
+ __category__ = ""
+ #: Tags to categorize the plugin, see documentation for further info
+ __tags__ = tuple()
+ #: Base64 encoded .png icon, should be 32x32, please don't use sizes above ~2KB, for bigger icons use url.
+ __icon__ = ""
+ #: Alternative, link to png icon
+ __icon_url__ = ""
+ #: Domain name of the service
+ __domain__ = ""
+ #: Url with general information/support/discussion
+ __url__ = ""
+ #: Url to term of content, user is accepting these when using the plugin
+ __toc_url__ = ""
+ #: Url to service (to buy premium) for accounts
+ __ref_url__ = ""
+
+ __author_name__ = tuple()
+ __author_mail__ = tuple()
+
+
+ def __init__(self, core, user=None):
+ self.__name__ = self.__class__.__name__
+
+ #: Core instance
+ self.core = core
+ #: logging instance
+ self.log = core.log
+ #: core config
+ self.config = core.config
+ #: :class:`EventManager`
+ self.evm = core.eventManager
+ #: :class:`InteractionManager`
+ self.im = core.interactionManager
+ if user is not None:
+ #: :class:`Api`, user api when user is set
+ self.api = self.core.api.withUserContext(user)
+ if not self.api:
+ raise Exception("Plugin running with invalid user")
+
+ #: :class:`User`, user related to this plugin
+ self.user = self.api.user
+ else:
+ self.api = self.core.api
+ self.user = None
+
+ #: last interaction task
+ self.task = None
+
+ def __getitem__(self, item):
+ """ Retrieves meta data attribute """
+ return getattr(self, "__%s__" % item)
+
+ def logInfo(self, *args, **kwargs):
+ """ Print args to log at specific level
+
+ :param args: Arbitrary object which should be logged
+ :param kwargs: sep=(how to separate arguments), default = " | "
+ """
+ self._log("info", *args, **kwargs)
+
+ def logWarning(self, *args, **kwargs):
+ self._log("warning", *args, **kwargs)
+
+ def logError(self, *args, **kwargs):
+ self._log("error", *args, **kwargs)
+
+ def logDebug(self, *args, **kwargs):
+ self._log("debug", *args, **kwargs)
+
+ def _log(self, level, *args, **kwargs):
+ if "sep" in kwargs:
+ sep = "%s" % kwargs["sep"]
+ else:
+ sep = " | "
+
+ strings = []
+ for obj in args:
+ if type(obj) == unicode:
+ strings.append(obj)
+ elif type(obj) == str:
+ strings.append(decode(obj))
+ else:
+ strings.append(str(obj))
+
+ getattr(self.log, level)("%s: %s" % (self.__name__, sep.join(strings)))
+
+ def getName(self):
+ """ Name of the plugin class """
+ return self.__name__
+
+ def setConfig(self, option, value):
+ """ Set config value for current plugin """
+ self.core.config.set(self.__name__, option, value)
+
+ def getConf(self, option):
+ """ see `getConfig` """
+ return self.getConfig(option)
+
+ def getConfig(self, option):
+ """ Returns config value for current plugin """
+ return self.core.config.get(self.__name__, option)
+
+ def setStorage(self, key, value):
+ """ Saves a value persistently to the database """
+ self.core.db.setStorage(self.__name__, key, value)
+
+ def store(self, key, value):
+ """ same as `setStorage` """
+ self.core.db.setStorage(self.__name__, key, value)
+
+ def getStorage(self, key=None, default=None):
+ """ Retrieves saved value or dict of all saved entries if key is None """
+ if key is not None:
+ return self.core.db.getStorage(self.__name__, key) or default
+ return self.core.db.getStorage(self.__name__, key)
+
+ def retrieve(self, *args, **kwargs):
+ """ same as `getStorage` """
+ return self.getStorage(*args, **kwargs)
+
+ def delStorage(self, key):
+ """ Delete entry in db """
+ self.core.db.delStorage(self.__name__, key)
+
+ def shell(self):
+ """ open ipython shell """
+ if self.core.debug:
+ from IPython import embed
+ #noinspection PyUnresolvedReferences
+ sys.stdout = sys._stdout
+ embed()
+
+ def abort(self):
+ """ Check if plugin is in an abort state, is overwritten by subtypes"""
+ return False
+
+ def checkAbort(self):
+ """ Will be overwritten to determine if control flow should be aborted """
+ if self.abort(): raise Abort()
+
+ def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False, decode=False):
+ """Load content at url and returns it
+
+ :param url: url as string
+ :param get: GET as dict
+ :param post: POST as dict, list or string
+ :param ref: Set HTTP_REFERER header
+ :param cookies: use saved cookies
+ :param just_header: if True only the header will be retrieved and returned as dict
+ :param decode: Whether to decode the output according to http header, should be True in most cases
+ :return: Loaded content
+ """
+ if not hasattr(self, "req"): raise Exception("Plugin type does not have Request attribute.")
+ self.checkAbort()
+
+ res = self.req.load(url, get, post, ref, cookies, just_header, decode=decode)
+
+ if self.core.debug:
+ from inspect import currentframe
+
+ frame = currentframe()
+ if not exists(join("tmp", self.__name__)):
+ makedirs(join("tmp", self.__name__))
+
+ f = open(
+ join("tmp", self.__name__, "%s_line%s.dump.html" % (frame.f_back.f_code.co_name, frame.f_back.f_lineno))
+ , "wb")
+ del frame # delete the frame or it wont be cleaned
+
+ try:
+ tmp = res.encode("utf8")
+ except:
+ tmp = res
+
+ f.write(tmp)
+ f.close()
+
+ if just_header:
+ #parse header
+ header = {"code": self.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]) == list:
+ header[key].append(value)
+ else:
+ header[key] = [header[key], value]
+ else:
+ header[key] = value
+ res = header
+
+ return res
+
+ def invalidTask(self):
+ if self.task:
+ self.task.invalid()
+
+ def invalidCaptcha(self):
+ self.logDebug("Deprecated method .invalidCaptcha, use .invalidTask")
+ self.invalidTask()
+
+ def correctTask(self):
+ if self.task:
+ self.task.correct()
+
+ def correctCaptcha(self):
+ self.logDebug("Deprecated method .correctCaptcha, use .correctTask")
+ self.correctTask()
+
+ def decryptCaptcha(self, url, get={}, post={}, cookies=False, forceUser=False, imgtype='jpg',
+ result_type='textual'):
+ """ Loads a captcha and decrypts it with ocr, plugin, user input
+
+ :param url: url of captcha image
+ :param get: get part for request
+ :param post: post part for request
+ :param cookies: True if cookies should be enabled
+ :param forceUser: if True, ocr is not used
+ :param imgtype: Type of the Image
+ :param result_type: 'textual' if text is written on the captcha\
+ or 'positional' for captcha where the user have to click\
+ on a specific region on the captcha
+
+ :return: result of decrypting
+ """
+
+ img = self.load(url, get=get, post=post, cookies=cookies)
+
+ id = ("%.2f" % time())[-6:].replace(".", "")
+ temp_file = open(join("tmp", "tmpCaptcha_%s_%s.%s" % (self.__name__, id, imgtype)), "wb")
+ temp_file.write(img)
+ temp_file.close()
+
+ name = "%sOCR" % self.__name__
+ has_plugin = name in self.core.pluginManager.getPlugins("internal")
+
+ if self.core.captcha:
+ OCR = self.core.pluginManager.loadClass("internal", name)
+ else:
+ OCR = None
+
+ if OCR and not forceUser:
+ sleep(randint(3000, 5000) / 1000.0)
+ self.checkAbort()
+
+ ocr = OCR()
+ result = ocr.get_captcha(temp_file.name)
+ else:
+ task = self.im.createCaptchaTask(img, imgtype, temp_file.name, self.__name__, result_type)
+ self.task = task
+
+ while task.isWaiting():
+ if self.abort():
+ self.im.removeTask(task)
+ raise Abort()
+ sleep(1)
+
+ #TODO task handling
+ self.im.removeTask(task)
+
+ if task.error and has_plugin: #ignore default error message since the user could use OCR
+ self.fail(_("Pil and tesseract not installed and no Client connected for captcha decrypting"))
+ elif task.error:
+ self.fail(task.error)
+ elif not task.result:
+ self.fail(_("No captcha result obtained in appropriate time."))
+
+ result = task.result
+ self.log.debug("Received captcha result: %s" % str(result))
+
+ if not self.core.debug:
+ try:
+ remove(temp_file.name)
+ except:
+ pass
+
+ return result
+
+ def fail(self, reason):
+ """ fail and give reason """
+ raise Fail(reason) \ No newline at end of file
diff --git a/pyload/plugins/ContentProvider.py b/pyload/plugins/ContentProvider.py
new file mode 100644
index 000000000..c30186376
--- /dev/null
+++ b/pyload/plugins/ContentProvider.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+###############################################################################
+# Copyright(c) 2008-2013 pyLoad Team
+# http://www.pyload.org
+#
+# This file is part of pyLoad.
+# pyLoad is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# Subjected to the terms and conditions in LICENSE
+#
+# @author: RaNaN
+###############################################################################
+
+
+from Base import Base
+
+class ContentProvider(Base):
+ """
+ Base class to implement services that enables the user to search for content and add it for downloading.
+ """
+
+ def newest(self):
+ """ TODO """
+
+ def search(self, query):
+ """ TODO """
+
+ def suggest(self, query):
+ """ TODO """
diff --git a/pyload/plugins/Crypter.py b/pyload/plugins/Crypter.py
new file mode 100644
index 000000000..af3d5aba7
--- /dev/null
+++ b/pyload/plugins/Crypter.py
@@ -0,0 +1,286 @@
+# -*- coding: utf-8 -*-
+
+from pyload.Api import LinkStatus, DownloadStatus as DS
+from pyload.utils import to_list, has_method, uniqify
+from pyload.utils.fs import exists, remove, fs_encode
+from Base import Base, Retry
+
+
+class Package:
+ """ Container that indicates that a new package should be created """
+
+ def __init__(self, name=None, links=None):
+ self.name = name
+ self.links = []
+
+ if links:
+ self.addLinks(links)
+
+ # nested packages
+ self.packs = []
+
+ def addLinks(self, links):
+ """ Add one or multiple links to the package
+
+ :param links: One or list of urls or :class:`LinkStatus`
+ """
+ links = to_list(links)
+ for link in links:
+ if not isinstance(link, LinkStatus):
+ link = LinkStatus(link, link, -1, DS.Queued)
+
+ self.links.append(link)
+
+ def addPackage(self, pack):
+ self.packs.append(pack)
+
+ def getURLs(self):
+ return [link.url for link in self.links]
+
+ def getAllURLs(self):
+ urls = self.getURLs()
+ for p in self.packs:
+ urls.extend(p.getAllURLs())
+ return urls
+
+ # same name and urls is enough to be equal for packages
+ def __eq__(self, other):
+ return self.name == other.name and self.links == other.links
+
+ def __repr__(self):
+ return u"<CrypterPackage name=%s, links=[%s], packs=%s" % (self.name, ",".join(str(l) for l in self.links),
+ self.packs)
+
+ def __hash__(self):
+ return hash(self.name) ^ hash(frozenset(self.links)) ^ hash(self.name)
+
+
+class PyFileMockup:
+ """ Legacy class needed by old crypter plugins """
+
+ def __init__(self, url, pack):
+ self.url = url
+ self.name = url
+ self._package = None
+ self.packageid = pack.id if pack else -1
+
+ def package(self):
+ return self._package
+
+
+class Crypter(Base):
+ """
+ Base class for (de)crypter plugins. Overwrite decrypt* methods.
+
+ How to use decrypt* methods:
+
+ You have to overwrite at least one method of decryptURL, decryptURLs, decryptFile.
+
+ After decrypting and generating urls/packages you have to return the result.
+ Valid return Data is:
+
+ :class:`Package` instance Crypter.Package
+ A **new** package will be created with the name and the urls of the object.
+
+ List of urls and `Package` instances
+ All urls in the list will be added to the **current** package. For each `Package`\
+ instance a new package will be created.
+
+ """
+
+ #: Prefix to annotate that the submited string for decrypting is indeed file content
+ CONTENT_PREFIX = "filecontent:"
+
+ #: Optional name of an account plugin that should be used, but does not guarantee that one is available
+ USE_ACCOUNT = None
+
+ #: When True this crypter will not be decrypted directly and queued one by one.
+ # Needed for crypter that can't run in parallel or need to wait between decryption.
+ QUEUE_DECRYPT = False
+
+ @classmethod
+ def decrypt(cls, core, url_or_urls, password=None):
+ """Static method to decrypt urls or content. Can be used by other plugins.
+ To decrypt file content prefix the string with ``CONTENT_PREFIX `` as seen above.
+
+ :param core: pyLoad `Core`, needed in decrypt context
+ :param url_or_urls: List of urls or single url/ file content
+ :param password: optional password used for decrypting
+
+ :raises Exception: No decryption errors are cascaded
+ :return: List of decrypted urls, all package info removed
+ """
+ urls = to_list(url_or_urls)
+ p = cls(core, password)
+ try:
+ result = p._decrypt(urls)
+ finally:
+ p.clean()
+
+ ret = []
+
+ for url_or_pack in result:
+ if isinstance(url_or_pack, Package): #package
+ ret.extend(url_or_pack.getAllURLs())
+ else: # single url
+ ret.append(url_or_pack)
+ # eliminate duplicates
+ return uniqify(ret)
+
+ # TODO: pass user to crypter
+ # TODO: crypter could not only know url, but also the name and size
+ def __init__(self, core, password=None):
+ Base.__init__(self, core)
+
+ self.req = None
+ # load account if set
+ if self.USE_ACCOUNT:
+ self.account = self.core.accountManager.selectAccount(self.USE_ACCOUNT, self.user)
+ if self.account:
+ self.req = self.account.getAccountRequest()
+
+ if self.req is None:
+ self.req = core.requestFactory.getRequest()
+
+ #: Password supplied by user
+ self.password = password
+
+ # For old style decrypter, do not use these!
+ self.packages = []
+ self.urls = []
+ self.pyfile = None
+
+ self.init()
+
+ def init(self):
+ """More init stuff if needed"""
+
+ def setup(self):
+ """Called everytime before decrypting. A Crypter plugin will be most likely used for several jobs."""
+
+ def decryptURL(self, url):
+ """Decrypt a single url
+
+ :param url: url to decrypt
+ :return: See :class:`Crypter` Documentation
+ """
+ if url.startswith("http"): # basic method to redirect
+ return self.decryptFile(self.load(url))
+ else:
+ self.fail(_("Not existing file or unsupported protocol"))
+
+ def decryptURLs(self, urls):
+ """Decrypt a bunch of urls
+
+ :param urls: list of urls
+ :return: See :class:`Crypter` Documentation
+ """
+ raise NotImplementedError
+
+ def decryptFile(self, content):
+ """Decrypt file content
+
+ :param content: content to decrypt as string
+ :return: See :class:`Crypter` Documentation
+ """
+ raise NotImplementedError
+
+ def _decrypt(self, urls):
+ """Internal method to select decrypting method
+
+ :param urls: List of urls/content
+ :return:
+ """
+ cls = self.__class__
+
+ # separate local and remote files
+ content, urls = self.getLocalContent(urls)
+ result = []
+
+ if urls and has_method(cls, "decrypt"):
+ self.logDebug("Deprecated .decrypt() method in Crypter plugin")
+ result = []
+ for url in urls:
+ self.pyfile = PyFileMockup(url)
+ self.setup()
+ self.decrypt(self.pyfile)
+ result.extend(self.convertPackages())
+ elif urls:
+ method = True
+ try:
+ self.setup()
+ result = to_list(self.decryptURLs(urls))
+ except NotImplementedError:
+ method = False
+
+ # this will raise error if not implemented
+ if not method:
+ for url in urls:
+ self.setup()
+ result.extend(to_list(self.decryptURL(url)))
+
+ for f, c in content:
+ self.setup()
+ result.extend(to_list(self.decryptFile(c)))
+ try:
+ if f.startswith("tmp_"): remove(f)
+ except IOError:
+ self.logWarning(_("Could not remove file '%s'") % f)
+ self.core.print_exc()
+
+ return result
+
+ def getLocalContent(self, urls):
+ """Load files from disk and separate to file content and url list
+
+ :param urls:
+ :return: list of (filename, content), remote urls
+ """
+ content = []
+ # do nothing if no decryptFile method
+ if hasattr(self.__class__, "decryptFile"):
+ remote = []
+ for url in urls:
+ path = None
+ if url.startswith("http"): # skip urls directly
+ pass
+ elif url.startswith(self.CONTENT_PREFIX):
+ path = url
+ elif exists(url):
+ path = url
+ elif exists(self.core.path(url)):
+ path = self.core.path(url)
+
+ if path:
+ try:
+ if path.startswith(self.CONTENT_PREFIX):
+ content.append(("", path[len(self.CONTENT_PREFIX)]))
+ else:
+ f = open(fs_encode(path), "rb")
+ content.append((f.name, f.read()))
+ f.close()
+ except IOError, e:
+ self.logError("IOError", e)
+ else:
+ remote.append(url)
+
+ #swap filtered url list
+ urls = remote
+
+ return content, urls
+
+ def retry(self):
+ """ Retry decrypting, will only work once. Somewhat deprecated method, should be avoided. """
+ raise Retry()
+
+ def convertPackages(self):
+ """ Deprecated """
+ self.logDebug("Deprecated method .convertPackages()")
+ res = [Package(name, urls) for name, urls in self.packages]
+ res.extend(self.urls)
+ return res
+
+ def clean(self):
+ if hasattr(self, "req"):
+ self.req.close()
+ del self.req \ No newline at end of file
diff --git a/pyload/plugins/Download.py b/pyload/plugins/Download.py
new file mode 100644
index 000000000..e86089dc3
--- /dev/null
+++ b/pyload/plugins/Download.py
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+
+from Request import Request
+
+class Download(Request):
+ """ Abstract class for download request """
+
+ __version__ = "0.1"
+
+ def __init__(self, bucket, request=None):
+ # Copies the context
+ context = request.getContext() if request else [{}]
+ Request.__init__(self, *context)
+
+ self._running = False
+ self._name = None
+ self._size = 0
+
+ #: bucket used for rate limiting
+ self.bucket = bucket
+
+ def download(self, uri, path, *args, **kwargs):
+ """ Downloads the resource with additional options depending on implementation """
+ raise NotImplementedError
+
+ @property
+ def running(self):
+ return self._running
+
+ @property
+ def size(self):
+ """ Size in bytes """
+ return self._size
+
+ @property
+ def name(self):
+ """ Name of the resource if known """
+ return self._name
+
+ @property
+ def speed(self):
+ """ Download rate in bytes per second """
+ return 0
+
+ @property
+ def arrived(self):
+ """ Number of bytes already loaded """
+ return 0 \ No newline at end of file
diff --git a/pyload/plugins/Hoster.py b/pyload/plugins/Hoster.py
new file mode 100644
index 000000000..976918c0d
--- /dev/null
+++ b/pyload/plugins/Hoster.py
@@ -0,0 +1,401 @@
+# -*- coding: utf-8 -*-
+
+import os
+from time import time
+
+if os.name != "nt":
+ from pyload.utils.fs import chown
+ from pwd import getpwnam
+ from grp import getgrnam
+
+from pyload.utils import chunks as _chunks
+from pyload.utils.fs import save_join, save_filename, fs_encode, fs_decode, \
+ remove, makedirs, chmod, stat, exists, join
+
+from Base import Base, Fail, Retry
+from network.DefaultRequest import DefaultRequest, DefaultDownload
+
+# Import for Hoster Plugins
+chunks = _chunks
+
+
+class Reconnect(Exception):
+ """ raised when reconnected """
+
+
+class SkipDownload(Exception):
+ """ raised when download should be skipped """
+
+
+class Hoster(Base):
+ """
+ Base plugin for hoster plugin. Overwrite getInfo for online status retrieval, process for downloading.
+ """
+
+ #: Class used to make requests with `self.load`
+ REQUEST_CLASS = DefaultRequest
+
+ #: Class used to make download
+ DOWNLOAD_CLASS = DefaultDownload
+
+ @staticmethod
+ def getInfo(urls):
+ """This method is used to retrieve the online status of files for hoster plugins.
+
+ :param urls: List of urls
+ :return: yield list of :class:`LinkStatus` as result
+ """
+ pass
+
+ def __init__(self, pyfile):
+ # TODO: pyfile.owner, but it's not correct yet
+ Base.__init__(self, pyfile.m.core)
+
+ self.wantReconnect = False
+ #: enables simultaneous processing of multiple downloads
+ self.limitDL = 0
+ #: chunk limit
+ self.chunkLimit = 1
+ #: enables resume (will be ignored if server dont accept chunks)
+ self.resumeDownload = False
+
+ #: plugin is waiting
+ self.waiting = False
+
+ self.ocr = None #captcha reader instance
+ #: account handler instance, see :py:class:`Account`
+ self.account = self.core.accountManager.selectAccount(self.__name__, self.user)
+
+ #: premium status
+ self.premium = False
+
+ if self.account:
+ #: Request instance bound to account
+ self.req = self.account.getAccountRequest()
+ # Default: -1, True, True
+ self.chunkLimit, self.limitDL, self.resumeDownload = self.account.getDownloadSettings()
+ self.premium = self.account.isPremium()
+ else:
+ self.req = self.core.requestFactory.getRequest(klass=self.REQUEST_CLASS)
+
+ #: Will hold the download class
+ self.dl = None
+
+ #: 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.lastDownload = ""
+ #: re match of the last call to `checkDownload`
+ self.lastCheck = None
+ #: js engine, see `JsEngine`
+ self.js = self.core.js
+
+ self.retries = 0 # amount of retries already made
+ self.html = None # some plugins store html code here
+
+ self.init()
+
+ def getMultiDL(self):
+ return self.limitDL <= 0
+
+ def setMultiDL(self, val):
+ self.limitDL = 0 if val else 1
+
+ #: virtual attribute using self.limitDL on behind
+ multiDL = property(getMultiDL, setMultiDL)
+
+ def getChunkCount(self):
+ if self.chunkLimit <= 0:
+ return self.config["download"]["chunks"]
+ return min(self.config["download"]["chunks"], self.chunkLimit)
+
+ def getDownloadLimit(self):
+ if self.account:
+ limit = self.account.options.get("limitDL", 0)
+ if limit == "": limit = 0
+ if self.limitDL > 0: # a limit is already set, we use the minimum
+ return min(int(limit), self.limitDL)
+ else:
+ return int(limit)
+ else:
+ return self.limitDL
+
+
+ def __call__(self):
+ return self.__name__
+
+ def init(self):
+ """initialize the plugin (in addition to `__init__`)"""
+ pass
+
+ def setup(self):
+ """ setup for environment and other things, called before downloading (possibly more than one time)"""
+ pass
+
+ def preprocessing(self, thread):
+ """ handles important things to do before starting """
+ self.thread = thread
+
+ if self.account:
+ # will force a re-login or reload of account info if necessary
+ self.account.getAccountInfo()
+ else:
+ self.req.reset()
+
+ self.setup()
+
+ self.pyfile.setStatus("starting")
+
+ return self.process(self.pyfile)
+
+ def process(self, pyfile):
+ """the 'main' method of every plugin, you **have to** overwrite it"""
+ raise NotImplementedError
+
+ def abort(self):
+ return self.pyfile.abort
+
+ def resetAccount(self):
+ """ don't use account and retry download """
+ self.account = None
+ self.req = self.core.requestFactory.getRequest(self.__name__)
+ self.retry()
+
+ def checksum(self, local_file=None):
+ """
+ return codes:
+ 0 - checksum ok
+ 1 - checksum wrong
+ 5 - can't get checksum
+ 10 - not implemented
+ 20 - unknown error
+ """
+ #@TODO checksum check addon
+
+ return True, 10
+
+ def setWait(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
+ """
+ if reconnect is not None:
+ self.wantReconnect = reconnect
+ self.pyfile.waitUntil = time() + int(seconds)
+
+ def wait(self, seconds=None, reconnect=None):
+ """ Waits the time previously set or use these from arguments. See `setWait`
+ """
+ if seconds is not None:
+ self.setWait(seconds, reconnect)
+
+ self._wait()
+
+ def _wait(self):
+ self.waiting = True
+ self.pyfile.setStatus("waiting")
+
+ while self.pyfile.waitUntil > time():
+ self.thread.m.reconnecting.wait(2)
+
+ self.checkAbort()
+ if self.thread.m.reconnecting.isSet():
+ self.waiting = False
+ self.wantReconnect = False
+ raise Reconnect
+
+ self.waiting = False
+ self.pyfile.setStatus("starting")
+
+ def offline(self):
+ """ fail and indicate file is offline """
+ raise Fail("offline")
+
+ def tempOffline(self):
+ """ fail and indicates file ist temporary offline, the core may take consequences """
+ raise Fail("temp. offline")
+
+ def retry(self, max_tries=3, wait_time=1, reason="", backoff=lambda x,y: x):
+ """Retries and begin again from the beginning
+
+ :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
+ :param backoff: Function to backoff the wait time, takes initial time and number of retry as argument.
+ defaults to no backoff / fixed wait time
+ """
+ if 0 < max_tries <= self.retries:
+ if not reason: reason = "Max retries reached"
+ raise Fail(reason)
+
+ self.wantReconnect = False
+ self.retries += 1
+ self.setWait(backoff(wait_time, self.retries))
+ self.wait()
+
+ raise Retry(reason)
+
+ def download(self, url, get={}, post={}, ref=True, cookies=True, disposition=False):
+ """Downloads the content at url to download folder
+
+ :param disposition: if True and server provides content-disposition header\
+ the filename will be changed if needed
+ :return: The location where the file was saved
+ """
+ self.checkForSameFiles()
+ self.checkAbort()
+
+ self.pyfile.setStatus("downloading")
+
+ download_folder = self.config['general']['download_folder']
+
+ location = save_join(download_folder, self.pyfile.package().folder)
+
+ if not exists(location):
+ makedirs(location, int(self.core.config["permission"]["folder"], 8))
+
+ if self.core.config["permission"]["change_dl"] and os.name != "nt":
+ try:
+ uid = getpwnam(self.config["permission"]["user"])[2]
+ gid = getgrnam(self.config["permission"]["group"])[2]
+
+ chown(location, uid, gid)
+ except Exception, e:
+ self.log.warning(_("Setting User and Group failed: %s") % str(e))
+
+ # convert back to unicode
+ location = fs_decode(location)
+ name = save_filename(self.pyfile.name)
+
+ filename = join(location, name)
+
+ self.core.addonManager.dispatchEvent("download:start", self.pyfile, url, filename)
+
+ # Create the class used for downloading
+ self.dl = self.core.requestFactory.getDownloadRequest(self.req, self.DOWNLOAD_CLASS)
+ try:
+ # TODO: hardcoded arguments
+ newname = self.dl.download(url, filename, get=get, post=post, referer=ref, chunks=self.getChunkCount(),
+ resume=self.resumeDownload, cookies=cookies, disposition=disposition)
+ finally:
+ self.dl.close()
+ self.pyfile.size = self.dl.size
+
+ if disposition and newname and newname != name: #triple check, just to be sure
+ self.log.info("%(name)s saved as %(newname)s" % {"name": name, "newname": newname})
+ self.pyfile.name = newname
+ filename = join(location, newname)
+
+ fs_filename = fs_encode(filename)
+
+ if self.core.config["permission"]["change_file"]:
+ chmod(fs_filename, int(self.core.config["permission"]["file"], 8))
+
+ if self.core.config["permission"]["change_dl"] and os.name != "nt":
+ try:
+ uid = getpwnam(self.config["permission"]["user"])[2]
+ gid = getgrnam(self.config["permission"]["group"])[2]
+
+ chown(fs_filename, uid, gid)
+ except Exception, e:
+ self.log.warning(_("Setting User and Group failed: %s") % str(e))
+
+ self.lastDownload = filename
+ return self.lastDownload
+
+ def checkDownload(self, rules, api_size=0, max_size=50000, delete=True, read_size=0):
+ """ checks the content of the last downloaded file, re match is saved to `lastCheck`
+
+ :param rules: dict with names and rules to match (compiled regexp or strings)
+ :param api_size: expected file size
+ :param max_size: if the file is larger then it wont be checked
+ :param delete: delete if matched
+ :param read_size: amount of bytes to read from files larger then max_size
+ :return: dictionary key of the first rule that matched
+ """
+ lastDownload = fs_encode(self.lastDownload)
+ if not exists(lastDownload): return None
+
+ size = stat(lastDownload)
+ size = size.st_size
+
+ if api_size and api_size <= size:
+ return None
+ elif size > max_size and not read_size:
+ return None
+ self.log.debug("Download Check triggered")
+ f = open(lastDownload, "rb")
+ content = f.read(read_size if read_size else -1)
+ f.close()
+ #produces encoding errors, better log to other file in the future?
+ #self.log.debug("Content: %s" % content)
+ for name, rule in rules.iteritems():
+ if type(rule) in (str, unicode):
+ if rule in content:
+ if delete:
+ remove(lastDownload)
+ return name
+ elif hasattr(rule, "search"):
+ m = rule.search(content)
+ if m:
+ if delete:
+ remove(lastDownload)
+ self.lastCheck = m
+ return name
+
+
+ def getPassword(self):
+ """ get the password the user provided in the package"""
+ password = self.pyfile.package().password
+ if not password: return ""
+ return password
+
+
+ def checkForSameFiles(self, starting=False):
+ """ checks if same file was/is downloaded within same package
+
+ :param starting: indicates that the current download is going to start
+ :raises SkipDownload:
+ """
+
+ pack = self.pyfile.package()
+
+ for pyfile in self.core.files.cachedFiles():
+ if pyfile != self.pyfile and pyfile.name == self.pyfile.name and pyfile.package().folder == pack.folder:
+ if pyfile.status in (0, 12): #finished or downloading
+ raise SkipDownload(pyfile.pluginname)
+ elif pyfile.status in (
+ 5, 7) and starting: #a download is waiting/starting and was apparently started before
+ raise SkipDownload(pyfile.pluginname)
+
+ download_folder = self.config['general']['download_folder']
+ location = save_join(download_folder, pack.folder, self.pyfile.name)
+
+ if starting and self.core.config['download']['skip_existing'] and exists(location):
+ size = os.stat(location).st_size
+ if size >= self.pyfile.size:
+ raise SkipDownload("File exists.")
+
+ pyfile = self.core.db.findDuplicates(self.pyfile.id, self.pyfile.package().folder, self.pyfile.name)
+ if pyfile:
+ if exists(location):
+ raise SkipDownload(pyfile[0])
+
+ self.log.debug("File %s not skipped, because it does not exists." % self.pyfile.name)
+
+ def clean(self):
+ """ clean everything and remove references """
+ if hasattr(self, "pyfile"):
+ del self.pyfile
+ if hasattr(self, "req"):
+ self.req.close()
+ del self.req
+ if hasattr(self, "dl"):
+ del self.dl
+ if hasattr(self, "thread"):
+ del self.thread
+ if hasattr(self, "html"):
+ del self.html
diff --git a/pyload/plugins/MultiHoster.py b/pyload/plugins/MultiHoster.py
new file mode 100644
index 000000000..6b48e99fb
--- /dev/null
+++ b/pyload/plugins/MultiHoster.py
@@ -0,0 +1,75 @@
+# -*- coding: utf-8 -*-
+
+from time import time
+
+from pyload.utils import remove_chars
+
+from Account import Account
+
+
+def normalize(domain):
+ """ Normalize domain/plugin name, so they are comparable """
+ return remove_chars(domain.strip().lower(), "-.")
+
+
+#noinspection PyUnresolvedReferences
+class MultiHoster(Account):
+ """
+ Base class for MultiHoster services.
+ This is also an Account instance so you should see :class:`Account` and overwrite necessary methods.
+ Multihoster becomes only active when an Account was entered and the MultiHoster addon was activated.
+ You need to overwrite `loadHosterList` and a corresponding :class:`Hoster` plugin with the same name should
+ be available to make your service working.
+ """
+
+ #: List of hoster names that will be replaced so pyLoad will recognize them: (orig_name, pyload_name)
+ replacements = [("freakshare.net", "freakshare.com"), ("uploaded.net", "uploaded.to")]
+
+ #: Load new hoster list every x seconds
+ hoster_timeout = 300
+
+ def __init__(self, *args, **kwargs):
+
+ # Hoster list
+ self.hoster = []
+ # Timestamp
+ self.ts = 0
+
+ Account.__init__(self, *args, **kwargs)
+
+ def loadHosterList(self, req):
+ """Load list of supported hoster
+
+ :return: List of domain names
+ """
+ raise NotImplementedError
+
+
+ def isHosterUsuable(self, domain):
+ """ Determine before downloading if hoster should be used.
+
+ :param domain: domain name
+ :return: True to let the MultiHoster download, False to fallback to default plugin
+ """
+ return True
+
+ def getHosterList(self, force=False):
+ if self.ts + self.hoster_timeout < time() or force:
+ req = self.getAccountRequest()
+ try:
+ self.hoster = self.loadHosterList(req)
+ except Exception, e:
+ self.logError(e)
+ return []
+ finally:
+ req.close()
+
+ for rep in self.replacements:
+ if rep[0] in self.hoster:
+ self.hoster.remove(rep[0])
+ if rep[1] not in self.hoster:
+ self.hoster.append(rep[1])
+
+ self.ts = time()
+
+ return self.hoster \ No newline at end of file
diff --git a/pyload/plugins/Plugin.py b/pyload/plugins/Plugin.py
new file mode 100644
index 000000000..0abb2644f
--- /dev/null
+++ b/pyload/plugins/Plugin.py
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+
+print "Deprecated usage of plugins.Plugin -> use plugins.Base"
+from .Base import *
+from pyload.utils import chunks
+
+Plugin = Base
+
diff --git a/pyload/plugins/Request.py b/pyload/plugins/Request.py
new file mode 100644
index 000000000..8e8e0cc6b
--- /dev/null
+++ b/pyload/plugins/Request.py
@@ -0,0 +1,77 @@
+# -*- coding: utf-8 -*-
+
+from logging import getLogger
+
+
+class ResponseException(Exception):
+ def __init__(self, code, content=""):
+ Exception.__init__(self, "Server response error: %s %s" % (code, content))
+ self.code = code
+
+class Request(object):
+ """ Abstract class to support different types of request, most methods should be overwritten """
+
+ __version__ = "0.1"
+
+ #: Class that will be instantiated and associated with the request, and if needed copied and reused
+ CONTEXT_CLASS = None
+
+ def __init__(self, config, context=None, options=None):
+ self.log = getLogger("log")
+
+ # Global config, holds some configurable parameter
+ self.config = config
+
+ # Create a new context if not given
+ if context is None and self.CONTEXT_CLASS is not None:
+ self.context = self.CONTEXT_CLASS()
+ else:
+ self.context = context
+
+ # Store options in dict
+ self.options = {} if options is None else options
+
+ # Last response code
+ self.code = 0
+ self.doAbort = False
+ self.initContext()
+
+ # TODO: content encoding? Could be handled globally
+
+ def initContext(self):
+ """ Should be used to initialize everything from given context and options """
+ pass
+
+ def getContext(self):
+ """ Retrieves complete state that is needed to copy the request context """
+ return self.config, self.context, self.options
+
+ def setContext(self, *args):
+ """ Sets request context """
+ self.config, self.context, self.options = args
+
+ def setOption(self, name, value):
+ """ Sets an option """
+ self.options[name] = value
+
+ def unsetOption(self, name):
+ """ Removes a specific option or reset everything on empty string """
+ if name == "":
+ self.options.clear()
+ else:
+ del self.options[name]
+
+ def load(self, uri, *args, **kwargs):
+ """ Loads given resource from given uri. Args and kwargs depends on implementation"""
+ raise NotImplementedError
+
+ def abort(self):
+ self.doAbort = True
+
+ def reset(self):
+ """ Resets the context to initial state """
+ self.unsetOption("")
+
+ def close(self):
+ """ Close and clean everything """
+ pass \ No newline at end of file
diff --git a/pyload/plugins/__init__.py b/pyload/plugins/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/pyload/plugins/__init__.py
diff --git a/pyload/plugins/accounts/AlldebridCom.py b/pyload/plugins/accounts/AlldebridCom.py
new file mode 100644
index 000000000..9fb050535
--- /dev/null
+++ b/pyload/plugins/accounts/AlldebridCom.py
@@ -0,0 +1,52 @@
+import xml.dom.minidom as dom
+from time import time
+import re
+import urllib
+
+from module.plugins.Account import Account
+from BeautifulSoup import BeautifulSoup
+
+
+class AlldebridCom(Account):
+ __name__ = "AlldebridCom"
+ __version__ = "0.21"
+ __type__ = "account"
+ __description__ = """AllDebrid.com account plugin"""
+ __author_name__ = ("Andy, Voigt")
+ __author_mail__ = ("spamsales@online.de")
+
+ def loadAccountInfo(self, user, req):
+ data = self.getAccountData(user)
+ page = req.load("http://www.alldebrid.com/account/")
+ soup = BeautifulSoup(page)
+ #Try to parse expiration date directly from the control panel page (better accuracy)
+ try:
+ time_text = soup.find('div', attrs={'class': 'remaining_time_text'}).strong.string
+ self.log.debug("Account expires in: %s" % time_text)
+ p = re.compile('\d+')
+ exp_data = p.findall(time_text)
+ exp_time = time() + int(exp_data[0]) * 24 * 60 * 60 + int(
+ exp_data[1]) * 60 * 60 + (int(exp_data[2]) - 1) * 60
+ #Get expiration date from API
+ except:
+ data = self.getAccountData(user)
+ page = req.load("http://www.alldebrid.com/api.php?action=info_user&login=%s&pw=%s" % (user,
+ data["password"]))
+ self.log.debug(page)
+ xml = dom.parseString(page)
+ exp_time = time() + int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue) * 86400
+ account_info = {"validuntil": exp_time, "trafficleft": -1}
+ return account_info
+
+ def login(self, user, data, req):
+ urlparams = urllib.urlencode({'action': 'login', 'login_login': user, 'login_password': data["password"]})
+ page = req.load("http://www.alldebrid.com/register/?%s" % urlparams)
+
+ if "This login doesn't exist" in page:
+ self.wrongPassword()
+
+ if "The password is not valid" in page:
+ self.wrongPassword()
+
+ if "Invalid captcha" in page:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/BayfilesCom.py b/pyload/plugins/accounts/BayfilesCom.py
new file mode 100644
index 000000000..bf5cc54af
--- /dev/null
+++ b/pyload/plugins/accounts/BayfilesCom.py
@@ -0,0 +1,51 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+from time import time
+
+from module.plugins.Account import Account
+from module.common.json_layer import json_loads
+
+
+class BayfilesCom(Account):
+ __name__ = "BayfilesCom"
+ __version__ = "0.02"
+ __type__ = "account"
+ __description__ = """bayfiles.com account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ def loadAccountInfo(self, user, req):
+ for i in range(2):
+ response = json_loads(req.load("http://api.bayfiles.com/v1/account/info"))
+ self.logDebug(response)
+ if not response["error"]:
+ break
+ self.logWarning(response["error"])
+ self.relogin()
+
+ return {"premium": bool(response['premium']), "trafficleft": -1,
+ "validuntil": response['expires'] if response['expires'] >= int(time()) else -1}
+
+ def login(self, user, data, req):
+ response = json_loads(req.load("http://api.bayfiles.com/v1/account/login/%s/%s" % (user, data["password"])))
+ self.logDebug(response)
+ if response["error"]:
+ self.logError(response["error"])
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/BitshareCom.py b/pyload/plugins/accounts/BitshareCom.py
new file mode 100644
index 000000000..39cff36eb
--- /dev/null
+++ b/pyload/plugins/accounts/BitshareCom.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: pking
+"""
+
+from module.plugins.Account import Account
+
+
+class BitshareCom(Account):
+ __name__ = "BitshareCom"
+ __version__ = "0.11"
+ __type__ = "account"
+ __description__ = """Bitshare account plugin"""
+ __author_name__ = ("Paul King")
+
+ def loadAccountInfo(self, user, req):
+ page = req.load("http://bitshare.com/mysettings.html")
+
+ if "\"http://bitshare.com/myupgrade.html\">Free" in page:
+ return {"validuntil": -1, "trafficleft": -1, "premium": False}
+
+ if not '<input type="checkbox" name="directdownload" checked="checked" />' in page:
+ self.core.log.warning(_("Activate direct Download in your Bitshare Account"))
+
+ return {"validuntil": -1, "trafficleft": -1, "premium": True}
+
+ def login(self, user, data, req):
+ page = req.load("http://bitshare.com/login.html",
+ post={"user": user, "password": data["password"], "submit": "Login"}, cookies=True)
+ if "login" in req.lastEffectiveURL:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/BoltsharingCom.py b/pyload/plugins/accounts/BoltsharingCom.py
new file mode 100644
index 000000000..76e010532
--- /dev/null
+++ b/pyload/plugins/accounts/BoltsharingCom.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+from module.plugins.internal.XFSPAccount import XFSPAccount
+
+
+class BoltsharingCom(XFSPAccount):
+ __name__ = "BoltsharingCom"
+ __version__ = "0.01"
+ __type__ = "account"
+ __description__ = """Boltsharing.com account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ MAIN_PAGE = "http://boltsharing.com/"
diff --git a/pyload/plugins/accounts/CramitIn.py b/pyload/plugins/accounts/CramitIn.py
new file mode 100644
index 000000000..b0334b191
--- /dev/null
+++ b/pyload/plugins/accounts/CramitIn.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+from module.plugins.internal.XFSPAccount import XFSPAccount
+
+
+class CramitIn(XFSPAccount):
+ __name__ = "CramitIn"
+ __version__ = "0.01"
+ __type__ = "account"
+ __description__ = """cramit.in account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ MAIN_PAGE = "http://cramit.in/"
diff --git a/pyload/plugins/accounts/CyberlockerCh.py b/pyload/plugins/accounts/CyberlockerCh.py
new file mode 100644
index 000000000..0eaa262eb
--- /dev/null
+++ b/pyload/plugins/accounts/CyberlockerCh.py
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+from module.plugins.internal.XFSPAccount import XFSPAccount
+from module.plugins.internal.SimpleHoster import parseHtmlForm
+
+
+class CyberlockerCh(XFSPAccount):
+ __name__ = "CyberlockerCh"
+ __version__ = "0.01"
+ __type__ = "account"
+ __description__ = """CyberlockerCh account plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ MAIN_PAGE = "http://cyberlocker.ch/"
+
+ def login(self, user, data, req):
+ html = req.load(self.MAIN_PAGE + 'login.html', decode=True)
+
+ action, inputs = parseHtmlForm('name="FL"', html)
+ if not inputs:
+ inputs = {"op": "login",
+ "redirect": self.MAIN_PAGE}
+
+ inputs.update({"login": user,
+ "password": data['password']})
+
+ # Without this a 403 Forbidden is returned
+ req.http.lastURL = self.MAIN_PAGE + 'login.html'
+ html = req.load(self.MAIN_PAGE, post=inputs, decode=True)
+
+ if 'Incorrect Login or Password' in html or '>Error<' in html:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/CzshareCom.py b/pyload/plugins/accounts/CzshareCom.py
new file mode 100644
index 000000000..7b1a8edc5
--- /dev/null
+++ b/pyload/plugins/accounts/CzshareCom.py
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+from time import mktime, strptime
+import re
+
+from module.plugins.Account import Account
+
+
+class CzshareCom(Account):
+ __name__ = "CzshareCom"
+ __version__ = "0.13"
+ __type__ = "account"
+ __description__ = """czshare.com account plugin"""
+ __author_name__ = ("zoidberg", "stickell")
+ __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+
+ CREDIT_LEFT_PATTERN = r'<tr class="active">\s*<td>([0-9 ,]+) (KiB|MiB|GiB)</td>\s*<td>([^<]*)</td>\s*</tr>'
+
+ def loadAccountInfo(self, user, req):
+ html = req.load("http://czshare.com/prehled_kreditu/")
+
+ found = re.search(self.CREDIT_LEFT_PATTERN, html)
+ if not found:
+ return {"validuntil": 0, "trafficleft": 0}
+ else:
+ credits = float(found.group(1).replace(' ', '').replace(',', '.'))
+ credits = credits * 1024 ** {'KiB': 0, 'MiB': 1, 'GiB': 2}[found.group(2)]
+ validuntil = mktime(strptime(found.group(3), '%d.%m.%y %H:%M'))
+ return {"validuntil": validuntil, "trafficleft": credits}
+
+ def login(self, user, data, req):
+
+ html = req.load('https://czshare.com/index.php', post={
+ "Prihlasit": "Prihlasit",
+ "login-password": data["password"],
+ "login-name": user
+ })
+
+ if '<div class="login' in html:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/DdlstorageCom.py b/pyload/plugins/accounts/DdlstorageCom.py
new file mode 100644
index 000000000..7404348a4
--- /dev/null
+++ b/pyload/plugins/accounts/DdlstorageCom.py
@@ -0,0 +1,51 @@
+# -*- coding: utf-8 -*-
+from hashlib import md5
+from time import mktime, strptime
+
+from module.plugins.internal.XFSPAccount import XFSPAccount
+from module.common.json_layer import json_loads
+from module.utils import parseFileSize
+
+# DDLStorage API Documentation:
+# http://www.ddlstorage.com/cgi-bin/api_req.cgi?req_type=doc
+
+
+class DdlstorageCom(XFSPAccount):
+ __name__ = "DdlstorageCom"
+ __version__ = "1.00"
+ __type__ = "account"
+ __description__ = """DDLStorage.com account plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ MAIN_PAGE = "http://ddlstorage.com/"
+
+ def loadAccountInfo(self, user, req):
+ password = self.accounts[user]['password']
+ api_data = req.load('http://www.ddlstorage.com/cgi-bin/api_req.cgi',
+ post={'req_type': 'user_info',
+ 'client_id': 53472,
+ 'user_login': user,
+ 'user_password': md5(password).hexdigest(),
+ 'sign': md5('user_info%d%s%s%s' % (53472, user, md5(password).hexdigest(),
+ '25JcpU2dPOKg8E2OEoRqMSRu068r0Cv3')).hexdigest()})
+ api_data = api_data.replace('<pre>', '').replace('</pre>', '')
+ self.logDebug('Account Info API data: ' + api_data)
+ api_data = json_loads(api_data)
+
+ if api_data['status'] != 'OK': # 'status' must be always OK for a working account
+ return {"premium": False, "valid": False}
+
+ if api_data['account_type'] == 'REGISTERED':
+ premium = False
+ validuntil = None
+ else:
+ premium = True
+ validuntil = int(mktime(strptime(api_data['premium_expire'], "%Y-%m-%d %H:%M:%S")))
+
+ if api_data['usr_bandwidth_available'] == 'UNLIMITED':
+ trafficleft = -1
+ else:
+ trafficleft = parseFileSize(api_data['usr_bandwidth_available']) / 1024
+
+ return {"premium": premium, "validuntil": validuntil, "trafficleft": trafficleft}
diff --git a/pyload/plugins/accounts/DebridItaliaCom.py b/pyload/plugins/accounts/DebridItaliaCom.py
new file mode 100644
index 000000000..30bfa65f9
--- /dev/null
+++ b/pyload/plugins/accounts/DebridItaliaCom.py
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+import re
+import time
+
+from pyload.plugins.MultiHoster import MultiHoster
+
+
+class DebridItaliaCom(MultiHoster):
+ __name__ = "DebridItaliaCom"
+ __version__ = "0.1"
+ __type__ = "account"
+ __description__ = """debriditalia.com account plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ WALID_UNTIL_PATTERN = r"Premium valid till: (?P<D>[^|]+) \|"
+
+ def loadAccountInfo(self, user, req):
+ if 'Account premium not activated' in self.html:
+ return {"premium": False, "validuntil": None, "trafficleft": None}
+
+ m = re.search(self.WALID_UNTIL_PATTERN, self.html)
+ if m:
+ validuntil = int(time.mktime(time.strptime(m.group('D'), "%d/%m/%Y %H:%M")))
+ return {"premium": True, "validuntil": validuntil, "trafficleft": -1}
+ else:
+ self.logError('Unable to retrieve account information - Plugin may be out of date')
+
+ def login(self, user, data, req):
+ self.html = req.load("http://debriditalia.com/login.php",
+ get={"u": user, "p": data["password"]})
+ if 'NO' in self.html:
+ self.wrongPassword()
+
+ def loadHosterList(self, req):
+ return ["netload.in", "hotfile.com", "rapidshare.com", "multiupload.com",
+ "uploading.com", "megashares.com", "crocko.com", "filepost.com",
+ "bitshare.com", "share-links.biz", "putlocker.com", "uploaded.to",
+ "speedload.org", "rapidgator.net", "likeupload.net", "cyberlocker.ch",
+ "depositfiles.com", "extabit.com", "filefactory.com", "sharefiles.co",
+ "ryushare.com", "tusfiles.net", "nowvideo.co", "cloudzer.net", "letitbit.net",
+ "easybytez.com", "uptobox.com", "ddlstorage.com"]
diff --git a/pyload/plugins/accounts/DepositfilesCom.py b/pyload/plugins/accounts/DepositfilesCom.py
new file mode 100644
index 000000000..5f2408e72
--- /dev/null
+++ b/pyload/plugins/accounts/DepositfilesCom.py
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: mkaay
+"""
+
+import re
+from time import strptime, mktime
+
+from module.plugins.Account import Account
+
+
+class DepositfilesCom(Account):
+ __name__ = "DepositfilesCom"
+ __version__ = "0.2"
+ __type__ = "account"
+ __description__ = """depositfiles.com account plugin"""
+ __author_name__ = ("mkaay", "stickell")
+ __author_mail__ = ("mkaay@mkaay.de", "l.stickell@yahoo.it")
+
+ def loadAccountInfo(self, user, req):
+ src = req.load("http://depositfiles.com/de/gold/")
+ validuntil = re.search(r"Sie haben Gold Zugang bis: <b>(.*?)</b></div>", src).group(1)
+
+ validuntil = int(mktime(strptime(validuntil, "%Y-%m-%d %H:%M:%S")))
+
+ return {"validuntil": validuntil, "trafficleft": -1}
+
+ def login(self, user, data, req):
+ req.load("http://depositfiles.com/de/gold/payment.php")
+ src = req.load("http://depositfiles.com/de/login.php", get={"return": "/de/gold/payment.php"},
+ post={"login": user, "password": data["password"]})
+ if r'<div class="error_message">Sie haben eine falsche Benutzername-Passwort-Kombination verwendet.</div>' in src:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/EasybytezCom.py b/pyload/plugins/accounts/EasybytezCom.py
new file mode 100644
index 000000000..cd995fbe5
--- /dev/null
+++ b/pyload/plugins/accounts/EasybytezCom.py
@@ -0,0 +1,75 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from time import mktime, strptime
+
+from module.plugins.Account import Account
+from module.plugins.internal.SimpleHoster import parseHtmlForm
+from module.utils import parseFileSize
+
+
+class EasybytezCom(Account):
+ __name__ = "EasybytezCom"
+ __version__ = "0.02"
+ __type__ = "account"
+ __description__ = """EasyBytez.com account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ VALID_UNTIL_PATTERN = r'<TR><TD>Premium account expire:</TD><TD><b>([^<]+)</b>'
+ TRAFFIC_LEFT_PATTERN = r'<TR><TD>Traffic available today:</TD><TD><b>(?P<S>[^<]+)</b>'
+
+ def loadAccountInfo(self, user, req):
+ html = req.load("http://www.easybytez.com/?op=my_account", decode=True)
+
+ validuntil = trafficleft = None
+ premium = False
+
+ found = re.search(self.VALID_UNTIL_PATTERN, html)
+ if found:
+ premium = True
+ trafficleft = -1
+ try:
+ self.logDebug(found.group(1))
+ validuntil = mktime(strptime(found.group(1), "%d %B %Y"))
+ except Exception, e:
+ self.logError(e)
+ else:
+ found = re.search(self.TRAFFIC_LEFT_PATTERN, html)
+ if found:
+ trafficleft = found.group(1)
+ if "Unlimited" in trafficleft:
+ premium = True
+ else:
+ trafficleft = parseFileSize(trafficleft) / 1024
+
+ return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}
+
+ def login(self, user, data, req):
+ html = req.load('http://www.easybytez.com/login.html', decode=True)
+ action, inputs = parseHtmlForm('name="FL"', html)
+ inputs.update({"login": user,
+ "password": data['password'],
+ "redirect": "http://www.easybytez.com/"})
+
+ html = req.load(action, post=inputs, decode=True)
+
+ if 'Incorrect Login or Password' in html or '>Error<' in html:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/EgoFilesCom.py b/pyload/plugins/accounts/EgoFilesCom.py
new file mode 100644
index 000000000..9c2b918c3
--- /dev/null
+++ b/pyload/plugins/accounts/EgoFilesCom.py
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+
+import re
+import time
+
+from module.plugins.Account import Account
+from module.utils import parseFileSize
+
+
+class EgoFilesCom(Account):
+ __name__ = "EgoFilesCom"
+ __version__ = "0.2"
+ __type__ = "account"
+ __description__ = """egofiles.com account plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ PREMIUM_ACCOUNT_PATTERN = '<br/>\s*Premium: (?P<P>[^/]*) / Traffic left: (?P<T>[\d.]*) (?P<U>\w*)\s*\\n\s*<br/>'
+
+ def loadAccountInfo(self, user, req):
+ html = req.load("http://egofiles.com")
+ if 'You are logged as a Free User' in html:
+ return {"premium": False, "validuntil": None, "trafficleft": None}
+
+ m = re.search(self.PREMIUM_ACCOUNT_PATTERN, html)
+ if m:
+ validuntil = int(time.mktime(time.strptime(m.group('P'), "%Y-%m-%d %H:%M:%S")))
+ trafficleft = parseFileSize(m.group('T'), m.group('U')) / 1024
+ return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft}
+ else:
+ self.logError('Unable to retrieve account information - Plugin may be out of date')
+
+ def login(self, user, data, req):
+ # Set English language
+ req.load("https://egofiles.com/ajax/lang.php?lang=en", just_header=True)
+
+ html = req.load("http://egofiles.com/ajax/register.php",
+ post={"log": 1,
+ "loginV": user,
+ "passV": data["password"]})
+ if 'Login successful' not in html:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/EuroshareEu.py b/pyload/plugins/accounts/EuroshareEu.py
new file mode 100644
index 000000000..830c1db3f
--- /dev/null
+++ b/pyload/plugins/accounts/EuroshareEu.py
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+from time import mktime, strptime
+import re
+
+from module.plugins.Account import Account
+
+
+class EuroshareEu(Account):
+ __name__ = "EuroshareEu"
+ __version__ = "0.01"
+ __type__ = "account"
+ __description__ = """euroshare.eu account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ def loadAccountInfo(self, user, req):
+ self.relogin(user)
+ html = req.load("http://euroshare.eu/customer-zone/settings/")
+
+ found = re.search('id="input_expire_date" value="(\d+\.\d+\.\d+ \d+:\d+)"', html)
+ if found is None:
+ premium, validuntil = False, -1
+ else:
+ premium = True
+ validuntil = mktime(strptime(found.group(1), "%d.%m.%Y %H:%M"))
+
+ return {"validuntil": validuntil, "trafficleft": -1, "premium": premium}
+
+ def login(self, user, data, req):
+
+ html = req.load('http://euroshare.eu/customer-zone/login/', post={
+ "trvale": "1",
+ "login": user,
+ "password": data["password"]
+ }, decode=True)
+
+ if u">Nesprávne prihlasovacie meno alebo heslo" in html:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/FastixRu.py b/pyload/plugins/accounts/FastixRu.py
new file mode 100644
index 000000000..3e1896e44
--- /dev/null
+++ b/pyload/plugins/accounts/FastixRu.py
@@ -0,0 +1,32 @@
+from module.plugins.Account import Account
+from module.common.json_layer import json_loads
+
+
+class FastixRu(Account):
+ __name__ = "FastixRu"
+ __version__ = "0.02"
+ __type__ = "account"
+ __description__ = """Fastix account plugin"""
+ __author_name__ = ("Massimo, Rosamilia")
+ __author_mail__ = ("max@spiritix.eu")
+
+ def loadAccountInfo(self, user, req):
+ data = self.getAccountData(user)
+ page = req.load("http://fastix.ru/api_v2/?apikey=%s&sub=getaccountdetails" % (data["api"]))
+ page = json_loads(page)
+ points = page['points']
+ kb = float(points)
+ kb = kb * 1024 ** 2 / 1000
+ if points > 0:
+ account_info = {"validuntil": -1, "trafficleft": kb}
+ else:
+ account_info = {"validuntil": None, "trafficleft": None, "premium": False}
+ return account_info
+
+ def login(self, user, data, req):
+ page = req.load("http://fastix.ru/api_v2/?sub=get_apikey&email=%s&password=%s" % (user, data["password"]))
+ api = json_loads(page)
+ api = api['apikey']
+ data["api"] = api
+ if "error_code" in page:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/FastshareCz.py b/pyload/plugins/accounts/FastshareCz.py
new file mode 100644
index 000000000..c047ff766
--- /dev/null
+++ b/pyload/plugins/accounts/FastshareCz.py
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.Account import Account
+from module.utils import parseFileSize
+
+
+class FastshareCz(Account):
+ __name__ = "FastshareCz"
+ __version__ = "0.03"
+ __type__ = "account"
+ __description__ = """fastshare.cz account plugin"""
+ __author_name__ = ("zoidberg", "stickell")
+ __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+
+ CREDIT_PATTERN = r'(?:Kredit|Credit)\s*</td>\s*<td[^>]*>([\d. \w]+)&nbsp;'
+
+ def loadAccountInfo(self, user, req):
+ html = req.load("http://www.fastshare.cz/user", decode=True)
+
+ found = re.search(self.CREDIT_PATTERN, html)
+ if found:
+ trafficleft = parseFileSize(found.group(1)) / 1024
+ premium = True if trafficleft else False
+ else:
+ trafficleft = None
+ premium = False
+
+ return {"validuntil": -1, "trafficleft": trafficleft, "premium": premium}
+
+ def login(self, user, data, req):
+ req.load('http://www.fastshare.cz/login') # Do not remove or it will not login
+ html = req.load('http://www.fastshare.cz/sql.php', post={
+ "heslo": data['password'],
+ "login": user
+ }, decode=True)
+
+ if u'>Špatné uşivatelské jméno nebo heslo.<' in html:
+ self.wrongPassword() \ No newline at end of file
diff --git a/pyload/plugins/accounts/FilecloudIo.py b/pyload/plugins/accounts/FilecloudIo.py
new file mode 100644
index 000000000..93ae02006
--- /dev/null
+++ b/pyload/plugins/accounts/FilecloudIo.py
@@ -0,0 +1,72 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+from module.plugins.Account import Account
+from module.common.json_layer import json_loads
+
+
+class FilecloudIo(Account):
+ __name__ = "FilecloudIo"
+ __version__ = "0.02"
+ __type__ = "account"
+ __description__ = """FilecloudIo account plugin"""
+ __author_name__ = ("zoidberg", "stickell")
+ __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+
+ def loadAccountInfo(self, user, req):
+ # It looks like the first API request always fails, so we retry 5 times, it should work on the second try
+ for _ in range(5):
+ rep = req.load("https://secure.filecloud.io/api-fetch_apikey.api",
+ post={"username": user, "password": self.accounts[user]['password']})
+ rep = json_loads(rep)
+ if rep['status'] == 'ok':
+ break
+ elif rep['status'] == 'error' and rep['message'] == 'no such user or wrong password':
+ self.logError("Wrong username or password")
+ return {"valid": False, "premium": False}
+ else:
+ return {"premium": False}
+
+ akey = rep['akey']
+ self.accounts[user]['akey'] = akey # Saved for hoster plugin
+ rep = req.load("http://api.filecloud.io/api-fetch_account_details.api",
+ post={"akey": akey})
+ rep = json_loads(rep)
+
+ if rep['is_premium'] == 1:
+ return {"validuntil": int(rep["premium_until"]), "trafficleft": -1}
+ else:
+ return {"premium": False}
+
+ def login(self, user, data, req):
+ req.cj.setCookie("secure.filecloud.io", "lang", "en")
+ html = req.load('https://secure.filecloud.io/user-login.html')
+
+ if not hasattr(self, "form_data"):
+ self.form_data = {}
+
+ self.form_data["username"] = user
+ self.form_data["password"] = data['password']
+
+ html = req.load('https://secure.filecloud.io/user-login_p.html',
+ post=self.form_data,
+ multipart=True)
+
+ self.logged_in = True if "you have successfully logged in - filecloud.io" in html else False
+ self.form_data = {}
diff --git a/pyload/plugins/accounts/FilefactoryCom.py b/pyload/plugins/accounts/FilefactoryCom.py
new file mode 100644
index 000000000..679409058
--- /dev/null
+++ b/pyload/plugins/accounts/FilefactoryCom.py
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from time import mktime, strptime
+
+from module.plugins.Account import Account
+
+
+class FilefactoryCom(Account):
+ __name__ = "FilefactoryCom"
+ __version__ = "0.13"
+ __type__ = "account"
+ __description__ = """filefactory.com account plugin"""
+ __author_name__ = ("zoidberg", "stickell")
+ __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+
+ ACCOUNT_INFO_PATTERN = r'<time datetime="([\d-]+)">'
+
+ def loadAccountInfo(self, user, req):
+ html = req.load("http://www.filefactory.com/member/")
+
+ found = re.search(self.ACCOUNT_INFO_PATTERN, html)
+ if found:
+ premium = True
+ validuntil = mktime(strptime(found.group(1), "%Y-%m-%d"))
+ else:
+ premium = False
+ validuntil = -1
+
+ return {"premium": premium, "trafficleft": -1, "validuntil": validuntil}
+
+ def login(self, user, data, req):
+ html = req.load("http://www.filefactory.com/member/login.php", post={
+ "email": user,
+ "password": data["password"],
+ "redirect": "/"})
+
+ if '/member/login.php?err=1' in req.http.header:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/FilejungleCom.py b/pyload/plugins/accounts/FilejungleCom.py
new file mode 100644
index 000000000..2f2a6012d
--- /dev/null
+++ b/pyload/plugins/accounts/FilejungleCom.py
@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from time import mktime, strptime
+
+from module.plugins.Account import Account
+
+
+class FilejungleCom(Account):
+ __name__ = "FilejungleCom"
+ __version__ = "0.11"
+ __type__ = "account"
+ __description__ = """filejungle.com account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ login_timeout = 60
+
+ URL = "http://filejungle.com/"
+ TRAFFIC_LEFT_PATTERN = r'"/extend_premium\.php">Until (\d+ [A-Za-z]+ \d+)<br'
+ LOGIN_FAILED_PATTERN = r'<span htmlfor="loginUser(Name|Password)" generated="true" class="fail_info">'
+
+ def loadAccountInfo(self, user, req):
+ html = req.load(self.URL + "dashboard.php")
+ found = re.search(self.TRAFFIC_LEFT_PATTERN, html)
+ if found:
+ premium = True
+ validuntil = mktime(strptime(found.group(1), "%d %b %Y"))
+ else:
+ premium = False
+ validuntil = -1
+
+ return {"premium": premium, "trafficleft": -1, "validuntil": validuntil}
+
+ def login(self, user, data, req):
+ html = req.load(self.URL + "login.php", post={
+ "loginUserName": user,
+ "loginUserPassword": data["password"],
+ "loginFormSubmit": "Login",
+ "recaptcha_challenge_field": "",
+ "recaptcha_response_field": "",
+ "recaptcha_shortencode_field": ""})
+
+ if re.search(self.LOGIN_FAILED_PATTERN, html):
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/FilerNet.py b/pyload/plugins/accounts/FilerNet.py
new file mode 100644
index 000000000..45ce5ab37
--- /dev/null
+++ b/pyload/plugins/accounts/FilerNet.py
@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+import re
+import time
+
+from module.plugins.Account import Account
+from module.utils import parseFileSize
+
+
+class FilerNet(Account):
+ __name__ = "FilerNet"
+ __version__ = "0.01"
+ __type__ = "account"
+ __description__ = """Filer.net account plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ TOKEN_PATTERN = r'_csrf_token" value="([^"]+)" />'
+ WALID_UNTIL_PATTERN = r"Der Premium-Zugang ist gÃŒltig bis (.+)\.\s*</td>"
+ TRAFFIC_PATTERN = r'Traffic</th>\s*<td>([^<]+)</td>'
+ FREE_PATTERN = r'Account Status</th>\s*<td>\s*Free'
+
+ def loadAccountInfo(self, user, req):
+ self.html = req.load("https://filer.net/profile")
+
+ # Free user
+ if re.search(self.FREE_PATTERN, self.html):
+ return {"premium": False, "validuntil": None, "trafficleft": None}
+
+ until = re.search(self.WALID_UNTIL_PATTERN, self.html)
+ traffic = re.search(self.TRAFFIC_PATTERN, self.html)
+ if until and traffic:
+ validuntil = int(time.mktime(time.strptime(until.group(1), "%d.%m.%Y %H:%M:%S")))
+ trafficleft = parseFileSize(traffic.group(1)) / 1024
+ return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft}
+ else:
+ self.logError('Unable to retrieve account information - Plugin may be out of date')
+ return {"premium": False, "validuntil": None, "trafficleft": None}
+
+ def login(self, user, data, req):
+ self.html = req.load("https://filer.net/login")
+ token = re.search(self.TOKEN_PATTERN, self.html).group(1)
+ self.html = req.load("https://filer.net/login_check",
+ post={"_username": user, "_password": data["password"],
+ "_remember_me": "on", "_csrf_token": token, "_target_path": "https://filer.net/"})
+ if 'Logout' not in self.html:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/FilerioCom.py b/pyload/plugins/accounts/FilerioCom.py
new file mode 100644
index 000000000..8b0b5f54f
--- /dev/null
+++ b/pyload/plugins/accounts/FilerioCom.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+from module.plugins.internal.XFSPAccount import XFSPAccount
+
+
+class FilerioCom(XFSPAccount):
+ __name__ = "FilerioCom"
+ __version__ = "0.01"
+ __type__ = "account"
+ __description__ = """FileRio.in account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ MAIN_PAGE = "http://filerio.in/"
diff --git a/pyload/plugins/accounts/FilesMailRu.py b/pyload/plugins/accounts/FilesMailRu.py
new file mode 100644
index 000000000..ea976bd44
--- /dev/null
+++ b/pyload/plugins/accounts/FilesMailRu.py
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: RaNaN
+"""
+
+from module.plugins.Account import Account
+
+
+class FilesMailRu(Account):
+ __name__ = "FilesMailRu"
+ __version__ = "0.1"
+ __type__ = "account"
+ __description__ = """filesmail.ru account plugin"""
+ __author_name__ = ("RaNaN")
+ __author_mail__ = ("RaNaN@pyload.org")
+
+ def loadAccountInfo(self, user, req):
+ return {"validuntil": None, "trafficleft": None}
+
+ def login(self, user, data, req):
+ user, domain = user.split("@")
+
+ page = req.load("http://swa.mail.ru/cgi-bin/auth", None,
+ {"Domain": domain, "Login": user, "Password": data['password'],
+ "Page": "http://files.mail.ru/"}, cookies=True)
+
+ if "НеверМПе ОЌя пПльзПвателя ОлО парПль" in page: # @TODO seems not to work
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/FileserveCom.py b/pyload/plugins/accounts/FileserveCom.py
new file mode 100644
index 000000000..d4056891a
--- /dev/null
+++ b/pyload/plugins/accounts/FileserveCom.py
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: mkaay
+"""
+
+from time import mktime, strptime
+
+from module.plugins.Account import Account
+from module.common.json_layer import json_loads
+
+
+class FileserveCom(Account):
+ __name__ = "FileserveCom"
+ __version__ = "0.2"
+ __type__ = "account"
+ __description__ = """fileserve.com account plugin"""
+ __author_name__ = ("mkaay")
+ __author_mail__ = ("mkaay@mkaay.de")
+
+ def loadAccountInfo(self, user, req):
+ data = self.getAccountData(user)
+
+ page = req.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data["password"],
+ "submit": "Submit+Query"})
+ res = json_loads(page)
+
+ if res["type"] == "premium":
+ validuntil = mktime(strptime(res["expireTime"], "%Y-%m-%d %H:%M:%S"))
+ return {"trafficleft": res["traffic"], "validuntil": validuntil}
+ else:
+ return {"premium": False, "trafficleft": None, "validuntil": None}
+
+ def login(self, user, data, req):
+ page = req.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data["password"],
+ "submit": "Submit+Query"})
+ res = json_loads(page)
+
+ if not res["type"]:
+ self.wrongPassword()
+
+ #login at fileserv page
+ req.load("http://www.fileserve.com/login.php",
+ post={"loginUserName": user, "loginUserPassword": data["password"], "autoLogin": "checked",
+ "loginFormSubmit": "Login"})
diff --git a/pyload/plugins/accounts/FourSharedCom.py b/pyload/plugins/accounts/FourSharedCom.py
new file mode 100644
index 000000000..69a465671
--- /dev/null
+++ b/pyload/plugins/accounts/FourSharedCom.py
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+from module.plugins.Account import Account
+from module.common.json_layer import json_loads
+
+
+class FourSharedCom(Account):
+ __name__ = "FourSharedCom"
+ __version__ = "0.01"
+ __type__ = "account"
+ __description__ = """FourSharedCom account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ def loadAccountInfo(self, user, req):
+ #fixme
+ return {"validuntil": -1, "trafficleft": -1, "premium": False}
+
+ def login(self, user, data, req):
+ req.cj.setCookie("www.4shared.com", "4langcookie", "en")
+ response = req.load('http://www.4shared.com/login',
+ post={"login": user,
+ "password": data['password'],
+ "remember": "false",
+ "doNotRedirect": "true"})
+ self.logDebug(response)
+ response = json_loads(response)
+
+ if not "ok" in response or response['ok'] != True:
+ if "rejectReason" in response and response['rejectReason'] != True:
+ self.logError(response['rejectReason'])
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/FreakshareCom.py b/pyload/plugins/accounts/FreakshareCom.py
new file mode 100644
index 000000000..cdf45114a
--- /dev/null
+++ b/pyload/plugins/accounts/FreakshareCom.py
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: RaNaN
+"""
+import re
+from time import strptime, mktime
+
+from module.plugins.Account import Account
+
+
+class FreakshareCom(Account):
+ __name__ = "FreakshareCom"
+ __version__ = "0.1"
+ __type__ = "account"
+ __description__ = """freakshare.com account plugin"""
+ __author_name__ = ("RaNaN")
+ __author_mail__ = ("RaNaN@pyload.org")
+
+ def loadAccountInfo(self, user, req):
+ page = req.load("http://freakshare.com/")
+
+ validuntil = r"ltig bis:</td>\s*<td><b>([0-9 \-:.]+)</b></td>"
+ validuntil = re.search(validuntil, page, re.MULTILINE)
+ validuntil = validuntil.group(1).strip()
+ validuntil = mktime(strptime(validuntil, "%d.%m.%Y - %H:%M"))
+
+ traffic = r"Traffic verbleibend:</td>\s*<td>([^<]+)"
+ traffic = re.search(traffic, page, re.MULTILINE)
+ traffic = traffic.group(1).strip()
+ traffic = self.parseTraffic(traffic)
+
+ return {"validuntil": validuntil, "trafficleft": traffic}
+
+ def login(self, user, data, req):
+ page = req.load("http://freakshare.com/login.html", None,
+ {"submit": "Login", "user": user, "pass": data['password']}, cookies=True)
+
+ if "Falsche Logindaten!" in page or "Wrong Username or Password!" in page:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/FshareVn.py b/pyload/plugins/accounts/FshareVn.py
new file mode 100644
index 000000000..75191e74a
--- /dev/null
+++ b/pyload/plugins/accounts/FshareVn.py
@@ -0,0 +1,65 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+from time import mktime, strptime
+from pycurl import REFERER
+import re
+
+from module.plugins.Account import Account
+
+
+class FshareVn(Account):
+ __name__ = "FshareVn"
+ __version__ = "0.04"
+ __type__ = "account"
+ __description__ = """fshare.vn account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ VALID_UNTIL_PATTERN = ur'<dt>Thời hạn dùng:</dt>\s*<dd>([^<]+)</dd>'
+ TRAFFIC_LEFT_PATTERN = ur'<dt>Tổng Dung Lượng Tài Khoản</dt>\s*<dd[^>]*>([0-9.]+) ([kKMG])B</dd>'
+ DIRECT_DOWNLOAD_PATTERN = ur'<input type="checkbox"\s*([^=>]*)[^>]*/>Kích hoạt download trực tiếp</dt>'
+
+ def loadAccountInfo(self, user, req):
+ html = req.load("http://www.fshare.vn/account_info.php", decode=True)
+ found = re.search(self.VALID_UNTIL_PATTERN, html)
+ if found:
+ premium = True
+ validuntil = mktime(strptime(found.group(1), '%I:%M:%S %p %d-%m-%Y'))
+ found = re.search(self.TRAFFIC_LEFT_PATTERN, html)
+ trafficleft = float(found.group(1)) * 1024 ** {
+ 'k': 0, 'K': 0, 'M': 1, 'G': 2}[found.group(2)] if found else 0
+ else:
+ premium = False
+ validuntil = None
+ trafficleft = None
+
+ return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}
+
+ def login(self, user, data, req):
+ req.http.c.setopt(REFERER, "https://www.fshare.vn/login.php")
+
+ html = req.load('https://www.fshare.vn/login.php', post={
+ "login_password": data['password'],
+ "login_useremail": user,
+ "url_refe": "https://www.fshare.vn/login.php"
+ }, referer=True, decode=True)
+
+ if not '<img alt="VIP"' in html:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/Ftp.py b/pyload/plugins/accounts/Ftp.py
new file mode 100644
index 000000000..681d14cea
--- /dev/null
+++ b/pyload/plugins/accounts/Ftp.py
@@ -0,0 +1,14 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.Account import Account
+
+
+class Ftp(Account):
+ __name__ = "Ftp"
+ __version__ = "0.01"
+ __type__ = "account"
+ __description__ = """Ftp dummy account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ login_timeout = info_threshold = 1000000
diff --git a/pyload/plugins/accounts/HellshareCz.py b/pyload/plugins/accounts/HellshareCz.py
new file mode 100644
index 000000000..4718ade99
--- /dev/null
+++ b/pyload/plugins/accounts/HellshareCz.py
@@ -0,0 +1,89 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+import time
+
+from module.plugins.Account import Account
+
+
+class HellshareCz(Account):
+ __name__ = "HellshareCz"
+ __version__ = "0.14"
+ __type__ = "account"
+ __description__ = """hellshare.cz account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ CREDIT_LEFT_PATTERN = r'<div class="credit-link">\s*<table>\s*<tr>\s*<th>(\d+|\d\d\.\d\d\.)</th>'
+
+ def loadAccountInfo(self, user, req):
+ self.relogin(user)
+ html = req.load("http://www.hellshare.com/")
+
+ found = re.search(self.CREDIT_LEFT_PATTERN, html)
+ if found is None:
+ trafficleft = None
+ validuntil = None
+ premium = False
+ else:
+ credit = found.group(1)
+ premium = True
+ try:
+ if "." in credit:
+ #Time-based account
+ vt = [int(x) for x in credit.split('.')[:2]]
+ lt = time.localtime()
+ year = lt.tm_year + int(vt[1] < lt.tm_mon or (vt[1] == lt.tm_mon and vt[0] < lt.tm_mday))
+ validuntil = time.mktime(time.strptime("%s%d 23:59:59" % (credit, year), "%d.%m.%Y %H:%M:%S"))
+ trafficleft = -1
+ else:
+ #Traffic-based account
+ trafficleft = int(credit) * 1024
+ validuntil = -1
+ except Exception, e:
+ self.logError('Unable to parse credit info', e)
+ validuntil = -1
+ trafficleft = -1
+
+ return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}
+
+ def login(self, user, data, req):
+ html = req.load('http://www.hellshare.com/')
+ if req.lastEffectiveURL != 'http://www.hellshare.com/':
+ #Switch to English
+ self.logDebug('Switch lang - URL: %s' % req.lastEffectiveURL)
+ json = req.load("%s?do=locRouter-show" % req.lastEffectiveURL)
+ hash = re.search(r"(--[0-9a-f]+-)", json).group(1)
+ self.logDebug('Switch lang - HASH: %s' % hash)
+ html = req.load('http://www.hellshare.com/%s/' % hash)
+
+ if re.search(self.CREDIT_LEFT_PATTERN, html):
+ self.logDebug('Already logged in')
+ return
+
+ html = req.load('http://www.hellshare.com/login?do=loginForm-submit', post={
+ "login": "Log in",
+ "password": data["password"],
+ "username": user,
+ "perm_login": "on"
+ })
+
+ if "<p>You input a wrong user name or wrong password</p>" in html:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/HellspyCz.py b/pyload/plugins/accounts/HellspyCz.py
new file mode 100644
index 000000000..1bb574731
--- /dev/null
+++ b/pyload/plugins/accounts/HellspyCz.py
@@ -0,0 +1,73 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+
+from module.plugins.Account import Account
+
+
+class HellspyCz(Account):
+ __name__ = "HellspyCz"
+ __version__ = "0.2"
+ __type__ = "account"
+ __description__ = """hellspy.cz account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ CREDIT_LEFT_PATTERN = r'<strong>Credits: </strong>\s*(\d+)'
+ WRONG_PASSWORD_PATTERN = r'<p class="block-error-3 marg-tb-050">\s*Wrong user or password was entered<br />'
+
+ phpsessid = ''
+
+ def loadAccountInfo(self, user, req):
+ cj = self.getAccountCookies(user)
+ cj.setCookie(".hellspy.com", "PHPSESSID", self.phpsessid)
+
+ html = req.load("http://www.hellspy.com/")
+
+ found = re.search(self.CREDIT_LEFT_PATTERN, html)
+ if found is None:
+ credits = 0
+ else:
+ credits = int(found.group(1)) * 1024
+
+ return {"validuntil": -1, "trafficleft": credits}
+
+ def login(self, user, data, req):
+ header = req.load('http://www.hellspy.com/', just_header=True)
+ self.phpsessid = re.search(r'PHPSESSID=(\w+)', header).group(1)
+ self.logDebug("PHPSESSID:" + self.phpsessid)
+
+ html = req.load("http://www.hellspy.com/--%s-" % self.phpsessid)
+
+ html = req.load(
+ "http://www.hell-share.com/user/login/?do=apiLoginForm-submit&api_hash=hellspy_iq&user_hash=%s" % self.phpsessid,
+ post={
+ "login": "1",
+ "password": data["password"],
+ "username": user,
+ "redir_url": 'http://www.hellspy.com/?do=loginBox-login',
+ "permanent_login": "1"
+ })
+
+ cj = self.getAccountCookies(user)
+ cj.setCookie(".hellspy.com", "PHPSESSID", self.phpsessid)
+
+ if not re.search(self.CREDIT_LEFT_PATTERN, html):
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/HotfileCom.py b/pyload/plugins/accounts/HotfileCom.py
new file mode 100644
index 000000000..4c144a883
--- /dev/null
+++ b/pyload/plugins/accounts/HotfileCom.py
@@ -0,0 +1,89 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: mkaay, JoKoT3
+"""
+
+from time import strptime, mktime
+import hashlib
+
+from module.plugins.Account import Account
+
+
+class HotfileCom(Account):
+ __name__ = "HotfileCom"
+ __version__ = "0.2"
+ __type__ = "account"
+ __description__ = """hotfile.com account plugin"""
+ __author_name__ = ("mkaay", "JoKoT3")
+ __author_mail__ = ("mkaay@mkaay.de", "jokot3@gmail.com")
+
+ def loadAccountInfo(self, user, req):
+ resp = self.apiCall("getuserinfo", user=user)
+ if resp.startswith("."):
+ self.core.debug("HotfileCom API Error: %s" % resp)
+ raise Exception
+ info = {}
+ for p in resp.split("&"):
+ key, value = p.split("=")
+ info[key] = value
+
+ if info['is_premium'] == '1':
+ info["premium_until"] = info["premium_until"].replace("T", " ")
+ zone = info["premium_until"][19:]
+ info["premium_until"] = info["premium_until"][:19]
+ zone = int(zone[:3])
+
+ validuntil = int(mktime(strptime(info["premium_until"], "%Y-%m-%d %H:%M:%S"))) + (zone * 3600)
+ tmp = {"validuntil": validuntil, "trafficleft": -1, "premium": True}
+
+ elif info['is_premium'] == '0':
+ tmp = {"premium": False}
+
+ return tmp
+
+ def apiCall(self, method, post={}, user=None):
+ if user:
+ data = self.getAccountData(user)
+ else:
+ user, data = self.selectAccount()
+
+ req = self.getAccountRequest(user)
+
+ digest = req.load("http://api.hotfile.com/", post={"action": "getdigest"})
+ h = hashlib.md5()
+ h.update(data["password"])
+ hp = h.hexdigest()
+ h = hashlib.md5()
+ h.update(hp)
+ h.update(digest)
+ pwhash = h.hexdigest()
+
+ post.update({"action": method})
+ post.update({"username": user, "passwordmd5dig": pwhash, "digest": digest})
+ resp = req.load("http://api.hotfile.com/", post=post)
+ req.close()
+ return resp
+
+ def login(self, user, data, req):
+ cj = self.getAccountCookies(user)
+ cj.setCookie("hotfile.com", "lang", "en")
+ req.load("http://hotfile.com/", cookies=True)
+ page = req.load("http://hotfile.com/login.php", post={"returnto": "/", "user": user, "pass": data["password"]},
+ cookies=True)
+
+ if "Bad username/password" in page:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/Http.py b/pyload/plugins/accounts/Http.py
new file mode 100644
index 000000000..5701d1f03
--- /dev/null
+++ b/pyload/plugins/accounts/Http.py
@@ -0,0 +1,14 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.Account import Account
+
+
+class Http(Account):
+ __name__ = "Http"
+ __version__ = "0.01"
+ __type__ = "account"
+ __description__ = """Http dummy account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ login_timeout = info_threshold = 1000000
diff --git a/pyload/plugins/accounts/LetitbitNet.py b/pyload/plugins/accounts/LetitbitNet.py
new file mode 100644
index 000000000..bcc004b91
--- /dev/null
+++ b/pyload/plugins/accounts/LetitbitNet.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+from module.plugins.Account import Account
+# from module.common.json_layer import json_loads, json_dumps
+
+
+class LetitbitNet(Account):
+ __name__ = "LetitbitNet"
+ __version__ = "0.01"
+ __type__ = "account"
+ __description__ = """Letitbit.net account plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ def loadAccountInfo(self, user, req):
+ ## DISABLED BECAUSE IT GET 'key exausted' EVEN IF VALID ##
+ # api_key = self.accounts[user]['password']
+ # json_data = [api_key, ["key/info"]]
+ # api_rep = req.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)})
+ # self.logDebug('API Key Info: ' + api_rep)
+ # api_rep = json_loads(api_rep)
+ #
+ # if api_rep['status'] == 'FAIL':
+ # self.logWarning(api_rep['data'])
+ # return {'valid': False, 'premium': False}
+
+ return {"premium": True}
+
+ def login(self, user, data, req):
+ # API_KEY is the username and the PREMIUM_KEY is the password
+ self.logInfo('You must use your API KEY as username and the PREMIUM KEY as password.')
diff --git a/pyload/plugins/accounts/MegasharesCom.py b/pyload/plugins/accounts/MegasharesCom.py
new file mode 100644
index 000000000..e7d5f9ca9
--- /dev/null
+++ b/pyload/plugins/accounts/MegasharesCom.py
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+
+import re
+from time import mktime, strptime
+
+from module.plugins.Account import Account
+
+
+class MegasharesCom(Account):
+ __name__ = "MegasharesCom"
+ __version__ = "0.02"
+ __type__ = "account"
+ __description__ = """megashares.com account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ VALID_UNTIL_PATTERN = r'<p class="premium_info_box">Period Ends: (\w{3} \d{1,2}, \d{4})</p>'
+
+ def loadAccountInfo(self, user, req):
+ #self.relogin(user)
+ html = req.load("http://d01.megashares.com/myms.php", decode=True)
+
+ premium = False if '>Premium Upgrade<' in html else True
+
+ validuntil = trafficleft = -1
+ try:
+ timestr = re.search(self.VALID_UNTIL_PATTERN, html).group(1)
+ self.logDebug(timestr)
+ validuntil = mktime(strptime(timestr, "%b %d, %Y"))
+ except Exception, e:
+ self.logError(e)
+
+ return {"validuntil": validuntil, "trafficleft": -1, "premium": premium}
+
+ def login(self, user, data, req):
+ html = req.load('http://d01.megashares.com/myms_login.php', post={
+ "httpref": "",
+ "myms_login": "Login",
+ "mymslogin_name": user,
+ "mymspassword": data['password']
+ }, decode=True)
+
+ if not '<span class="b ml">%s</span>' % user in html:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/MultiDebridCom.py b/pyload/plugins/accounts/MultiDebridCom.py
new file mode 100644
index 000000000..a98b8abae
--- /dev/null
+++ b/pyload/plugins/accounts/MultiDebridCom.py
@@ -0,0 +1,54 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+from time import time
+
+from pyload.plugins.MultiHoster import MultiHoster
+from pyload.utils import json_loads
+
+
+class MultiDebridCom(MultiHoster):
+ __name__ = "MultiDebridCom"
+ __version__ = "0.01"
+ __type__ = "account"
+ __description__ = """Multi-debrid.com account plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ def loadAccountInfo(self, user, req):
+ if 'days_left' in self.json_data:
+ validuntil = int(time() + self.json_data['days_left'] * 86400)
+ return {"premium": True, "validuntil": validuntil, "trafficleft": -1}
+ else:
+ self.logError('Unable to get account information')
+
+ def login(self, user, data, req):
+ # Password to use is the API-Password written in http://multi-debrid.com/myaccount
+ self.html = req.load("http://multi-debrid.com/api.php",
+ get={"user": user, "pass": data["password"]})
+ self.logDebug('JSON data: ' + self.html)
+ self.json_data = json_loads(self.html)
+ if self.json_data['status'] != 'ok':
+ self.logError('Invalid login. The password to use is the API-Password you find in your "My Account" page')
+ self.wrongPassword()
+
+ def loadHosterList(self, req):
+ json_data = req.load('http://multi-debrid.com/api.php?hosts', decode=True)
+ self.logDebug('JSON data: ' + json_data)
+ json_data = json_loads(json_data)
+
+ return json_data['hosts']
diff --git a/pyload/plugins/accounts/MultishareCz.py b/pyload/plugins/accounts/MultishareCz.py
new file mode 100644
index 000000000..273936615
--- /dev/null
+++ b/pyload/plugins/accounts/MultishareCz.py
@@ -0,0 +1,59 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+from module.plugins.Account import Account
+#from time import mktime, strptime
+#from pycurl import REFERER
+import re
+from module.utils import parseFileSize
+
+
+class MultishareCz(Account):
+ __name__ = "MultishareCz"
+ __version__ = "0.02"
+ __type__ = "account"
+ __description__ = """multishare.cz account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ TRAFFIC_LEFT_PATTERN = r'<span class="profil-zvyrazneni">Kredit:</span>\s*<strong>(?P<S>[0-9,]+)&nbsp;(?P<U>\w+)</strong>'
+ ACCOUNT_INFO_PATTERN = r'<input type="hidden" id="(u_ID|u_hash)" name="[^"]*" value="([^"]+)">'
+
+ def loadAccountInfo(self, user, req):
+ #self.relogin(user)
+ html = req.load("http://www.multishare.cz/profil/", decode=True)
+
+ found = re.search(self.TRAFFIC_LEFT_PATTERN, html)
+ trafficleft = parseFileSize(found.group('S'), found.group('U')) / 1024 if found else 0
+ self.premium = True if trafficleft else False
+
+ html = req.load("http://www.multishare.cz/", decode=True)
+ mms_info = dict(re.findall(self.ACCOUNT_INFO_PATTERN, html))
+
+ return dict(mms_info, **{"validuntil": -1, "trafficleft": trafficleft})
+
+ def login(self, user, data, req):
+ html = req.load('http://www.multishare.cz/html/prihlaseni_process.php', post={
+ "akce": "Přihlásit",
+ "heslo": data['password'],
+ "jmeno": user
+ }, decode=True)
+
+ if '<div class="akce-chyba akce">' in html:
+ self.wrongPassword() \ No newline at end of file
diff --git a/pyload/plugins/accounts/NetloadIn.py b/pyload/plugins/accounts/NetloadIn.py
new file mode 100755
index 000000000..3e3bd93c1
--- /dev/null
+++ b/pyload/plugins/accounts/NetloadIn.py
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: mkaay
+"""
+
+import re
+from time import time
+
+from module.plugins.Account import Account
+
+
+class NetloadIn(Account):
+ __name__ = "NetloadIn"
+ __version__ = "0.22"
+ __type__ = "account"
+ __description__ = """netload.in account plugin"""
+ __author_name__ = ("RaNaN", "CryNickSystems")
+ __author_mail__ = ("RaNaN@pyload.org", "webmaster@pcProfil.de")
+
+ def loadAccountInfo(self, user, req):
+ page = req.load("http://netload.in/index.php?id=2&lang=de")
+ left = r">(\d+) (Tag|Tage), (\d+) Stunden<"
+ left = re.search(left, page)
+ if left:
+ validuntil = time() + int(left.group(1)) * 24 * 60 * 60 + int(left.group(3)) * 60 * 60
+ trafficleft = -1
+ premium = True
+ else:
+ validuntil = None
+ premium = False
+ trafficleft = None
+ return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}
+
+ def login(self, user, data, req):
+ page = req.load("http://netload.in/index.php", None,
+ {"txtuser": user, "txtpass": data['password'], "txtcheck": "login", "txtlogin": "Login"},
+ cookies=True)
+ if "password or it might be invalid!" in page:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/Premium4Me.py b/pyload/plugins/accounts/Premium4Me.py
new file mode 100644
index 000000000..467c5943e
--- /dev/null
+++ b/pyload/plugins/accounts/Premium4Me.py
@@ -0,0 +1,25 @@
+from module.plugins.Account import Account
+
+
+class Premium4Me(Account):
+ __name__ = "Premium4Me"
+ __version__ = "0.03"
+ __type__ = "account"
+ __description__ = """Premium.to account plugin"""
+ __author_name__ = ("RaNaN", "zoidberg", "stickell")
+ __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+
+ def loadAccountInfo(self, user, req):
+ traffic = req.load("http://premium.to/api/traffic.php?authcode=%s" % self.authcode)
+
+ account_info = {"trafficleft": int(traffic) / 1024,
+ "validuntil": -1}
+
+ return account_info
+
+ def login(self, user, data, req):
+ self.authcode = req.load("http://premium.to/api/getauthcode.php?username=%s&password=%s" % (
+ user, data["password"])).strip()
+
+ if "wrong username" in self.authcode:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/PremiumizeMe.py b/pyload/plugins/accounts/PremiumizeMe.py
new file mode 100644
index 000000000..c5c712c52
--- /dev/null
+++ b/pyload/plugins/accounts/PremiumizeMe.py
@@ -0,0 +1,42 @@
+from module.plugins.Account import Account
+
+from module.common.json_layer import json_loads
+
+
+class PremiumizeMe(Account):
+ __name__ = "PremiumizeMe"
+ __version__ = "0.11"
+ __type__ = "account"
+ __description__ = """Premiumize.Me account plugin"""
+ __author_name__ = ("Florian Franzen")
+ __author_mail__ = ("FlorianFranzen@gmail.com")
+
+ def loadAccountInfo(self, user, req):
+ # Get user data from premiumize.me
+ status = self.getAccountStatus(user, req)
+ self.logDebug(status)
+
+ # Parse account info
+ account_info = {"validuntil": float(status['result']['expires']),
+ "trafficleft": max(0, status['result']['trafficleft_bytes'] / 1024)}
+
+ if status['result']['type'] == 'free':
+ account_info['premium'] = False
+
+ return account_info
+
+ def login(self, user, data, req):
+ # Get user data from premiumize.me
+ status = self.getAccountStatus(user, req)
+
+ # Check if user and password are valid
+ if status['status'] != 200:
+ self.wrongPassword()
+
+ def getAccountStatus(self, user, req):
+ # Use premiumize.me API v1 (see https://secure.premiumize.me/?show=api)
+ # to retrieve account info and return the parsed json answer
+ answer = req.load(
+ "https://api.premiumize.me/pm-api/v1.php?method=accountstatus&params[login]=%s&params[pass]=%s" % (
+ user, self.accounts[user]['password']))
+ return json_loads(answer)
diff --git a/pyload/plugins/accounts/QuickshareCz.py b/pyload/plugins/accounts/QuickshareCz.py
new file mode 100644
index 000000000..1af7cbffd
--- /dev/null
+++ b/pyload/plugins/accounts/QuickshareCz.py
@@ -0,0 +1,54 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.Account import Account
+from module.utils import parseFileSize
+
+
+class QuickshareCz(Account):
+ __name__ = "QuickshareCz"
+ __version__ = "0.01"
+ __type__ = "account"
+ __description__ = """quickshare.cz account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ def loadAccountInfo(self, user, req):
+ html = req.load("http://www.quickshare.cz/premium", decode=True)
+
+ found = re.search(r'Stav kreditu: <strong>(.+?)</strong>', html)
+ if found:
+ trafficleft = parseFileSize(found.group(1)) / 1024
+ premium = True if trafficleft else False
+ else:
+ trafficleft = None
+ premium = False
+
+ return {"validuntil": -1, "trafficleft": trafficleft, "premium": premium}
+
+ def login(self, user, data, req):
+ html = req.load('http://www.quickshare.cz/html/prihlaseni_process.php', post={
+ "akce": u'Přihlásit',
+ "heslo": data['password'],
+ "jmeno": user
+ }, decode=True)
+
+ if u'>TakovÜ uşivatel neexistuje.<' in html or u'>Špatné heslo.<' in html:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/RPNetBiz.py b/pyload/plugins/accounts/RPNetBiz.py
new file mode 100644
index 000000000..ceb5e6bbb
--- /dev/null
+++ b/pyload/plugins/accounts/RPNetBiz.py
@@ -0,0 +1,45 @@
+from module.plugins.Account import Account
+from module.common.json_layer import json_loads
+
+
+class RPNetBiz(Account):
+ __name__ = "RPNetBiz"
+ __version__ = "0.1"
+ __type__ = "account"
+ __description__ = """RPNet.biz account plugin"""
+ __author_name__ = ("Dman")
+ __author_mail__ = ("dmanugm@gmail.com")
+
+ def loadAccountInfo(self, user, req):
+ # Get account information from rpnet.biz
+ response = self.getAccountStatus(user, req)
+ try:
+ if response['accountInfo']['isPremium']:
+ # Parse account info. Change the trafficleft later to support per host info.
+ account_info = {"validuntil": int(response['accountInfo']['premiumExpiry']),
+ "trafficleft": -1, "premium": True}
+ else:
+ account_info = {"validuntil": None, "trafficleft": None, "premium": False}
+
+ except KeyError:
+ #handle wrong password exception
+ account_info = {"validuntil": None, "trafficleft": None, "premium": False}
+
+ return account_info
+
+ def login(self, user, data, req):
+ # Get account information from rpnet.biz
+ response = self.getAccountStatus(user, req)
+
+ # If we have an error in the response, we have wrong login information
+ if 'error' in response:
+ self.wrongPassword()
+
+ def getAccountStatus(self, user, req):
+ # Using the rpnet API, check if valid premium account
+ response = req.load("https://premium.rpnet.biz/client_api.php",
+ get={"username": user, "password": self.accounts[user]['password'],
+ "action": "showAccountInformation"})
+ self.logDebug("JSON data: %s" % response)
+
+ return json_loads(response)
diff --git a/pyload/plugins/accounts/RapidgatorNet.py b/pyload/plugins/accounts/RapidgatorNet.py
new file mode 100644
index 000000000..8a02b712c
--- /dev/null
+++ b/pyload/plugins/accounts/RapidgatorNet.py
@@ -0,0 +1,71 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+from module.plugins.Account import Account
+from module.common.json_layer import json_loads
+
+
+class RapidgatorNet(Account):
+ __name__ = "RapidgatorNet"
+ __version__ = "0.04"
+ __type__ = "account"
+ __description__ = """rapidgator.net account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ API_URL = 'http://rapidgator.net/api/user'
+
+ def loadAccountInfo(self, user, req):
+ try:
+ sid = self.getAccountData(user).get('SID')
+ assert sid
+
+ json = req.load("%s/info?sid=%s" % (self.API_URL, sid))
+ self.logDebug("API:USERINFO", json)
+ json = json_loads(json)
+
+ if json['response_status'] == 200:
+ if "reset_in" in json['response']:
+ self.scheduleRefresh(user, json['response']['reset_in'])
+
+ return {"validuntil": json['response']['expire_date'],
+ "trafficleft": int(json['response']['traffic_left']) / 1024,
+ "premium": True}
+ else:
+ self.logError(json['response_details'])
+ except Exception, e:
+ self.logError(e)
+
+ return {"validuntil": None, "trafficleft": None, "premium": False}
+
+ def login(self, user, data, req):
+ try:
+ json = req.load('%s/login' % self.API_URL, post={"username": user, "password": data['password']})
+ self.logDebug("API:LOGIN", json)
+ json = json_loads(json)
+
+ if json['response_status'] == 200:
+ data['SID'] = str(json['response']['session_id'])
+ return
+ else:
+ self.logError(json['response_details'])
+ except Exception, e:
+ self.logError(e)
+
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/RapidshareCom.py b/pyload/plugins/accounts/RapidshareCom.py
new file mode 100644
index 000000000..b2066cd1e
--- /dev/null
+++ b/pyload/plugins/accounts/RapidshareCom.py
@@ -0,0 +1,69 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: mkaay
+"""
+
+from module.plugins.Account import Account
+
+
+class RapidshareCom(Account):
+ __name__ = "RapidshareCom"
+ __version__ = "0.22"
+ __type__ = "account"
+ __description__ = """Rapidshare.com account plugin"""
+ __author_name__ = ("mkaay")
+ __author_mail__ = ("mkaay@mkaay.de")
+
+ def loadAccountInfo(self, user, req):
+ data = self.getAccountData(user)
+ api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi"
+ api_param_prem = {"sub": "getaccountdetails", "type": "prem", "login": user,
+ "password": data["password"], "withcookie": 1}
+ src = req.load(api_url_base, cookies=False, get=api_param_prem)
+ if src.startswith("ERROR"):
+ raise Exception(src)
+ fields = src.split("\n")
+ info = {}
+ for t in fields:
+ if not t.strip():
+ continue
+ k, v = t.split("=")
+ info[k] = v
+
+ validuntil = int(info["billeduntil"])
+ premium = True if validuntil else False
+
+ tmp = {"premium": premium, "validuntil": validuntil, "trafficleft": -1, "maxtraffic": -1}
+
+ return tmp
+
+ def login(self, user, data, req):
+ api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi"
+ api_param_prem = {"sub": "getaccountdetails", "type": "prem", "login": user,
+ "password": data["password"], "withcookie": 1}
+ src = req.load(api_url_base, cookies=False, get=api_param_prem)
+ if src.startswith("ERROR"):
+ raise Exception(src + "### Note you have to use your account number for login, instead of name.")
+ fields = src.split("\n")
+ info = {}
+ for t in fields:
+ if not t.strip():
+ continue
+ k, v = t.split("=")
+ info[k] = v
+ cj = self.getAccountCookies(user)
+ cj.setCookie("rapidshare.com", "enc", info["cookie"])
diff --git a/pyload/plugins/accounts/RarefileNet.py b/pyload/plugins/accounts/RarefileNet.py
new file mode 100644
index 000000000..f4ae4a79a
--- /dev/null
+++ b/pyload/plugins/accounts/RarefileNet.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+from module.plugins.internal.XFSPAccount import XFSPAccount
+
+
+class RarefileNet(XFSPAccount):
+ __name__ = "RarefileNet"
+ __version__ = "0.02"
+ __type__ = "account"
+ __description__ = """RareFile.net account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ MAIN_PAGE = "http://rarefile.net/"
diff --git a/pyload/plugins/accounts/RealdebridCom.py b/pyload/plugins/accounts/RealdebridCom.py
new file mode 100644
index 000000000..a9980b088
--- /dev/null
+++ b/pyload/plugins/accounts/RealdebridCom.py
@@ -0,0 +1,31 @@
+import xml.dom.minidom as dom
+
+from module.plugins.Account import Account
+
+
+class RealdebridCom(Account):
+ __name__ = "RealdebridCom"
+ __version__ = "0.43"
+ __type__ = "account"
+ __description__ = """Real-Debrid.com account plugin"""
+ __author_name__ = ("Devirex, Hazzard")
+ __author_mail__ = ("naibaf_11@yahoo.de")
+
+ def loadAccountInfo(self, user, req):
+ if self.pin_code:
+ return {"premium": False}
+ page = req.load("https://real-debrid.com/api/account.php")
+ xml = dom.parseString(page)
+ account_info = {"validuntil": int(xml.getElementsByTagName("expiration")[0].childNodes[0].nodeValue),
+ "trafficleft": -1}
+
+ return account_info
+
+ def login(self, user, data, req):
+ self.pin_code = False
+ page = req.load("https://real-debrid.com/ajax/login.php", get={"user": user, "pass": data["password"]})
+ if "Your login informations are incorrect" in page:
+ self.wrongPassword()
+ elif "PIN Code required" in page:
+ self.logWarning('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.')
+ self.pin_code = True
diff --git a/pyload/plugins/accounts/RehostTo.py b/pyload/plugins/accounts/RehostTo.py
new file mode 100644
index 000000000..58c91801b
--- /dev/null
+++ b/pyload/plugins/accounts/RehostTo.py
@@ -0,0 +1,33 @@
+from module.plugins.Account import Account
+
+
+class RehostTo(Account):
+ __name__ = "RehostTo"
+ __version__ = "0.1"
+ __type__ = "account"
+ __description__ = """Rehost.to account plugin"""
+ __author_name__ = ("RaNaN")
+ __author_mail__ = ("RaNaN@pyload.org")
+
+ def loadAccountInfo(self, user, req):
+ data = self.getAccountData(user)
+ page = req.load("http://rehost.to/api.php?cmd=login&user=%s&pass=%s" % (user, data["password"]))
+ data = [x.split("=") for x in page.split(",")]
+ ses = data[0][1]
+ long_ses = data[1][1]
+
+ page = req.load("http://rehost.to/api.php?cmd=get_premium_credits&long_ses=%s" % long_ses)
+ traffic, valid = page.split(",")
+
+ account_info = {"trafficleft": int(traffic) * 1024,
+ "validuntil": int(valid),
+ "long_ses": long_ses,
+ "ses": ses}
+
+ return account_info
+
+ def login(self, user, data, req):
+ page = req.load("http://rehost.to/api.php?cmd=login&user=%s&pass=%s" % (user, data["password"]))
+
+ if "Login failed." in page:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/ReloadCc.py b/pyload/plugins/accounts/ReloadCc.py
new file mode 100644
index 000000000..b3c26c6d3
--- /dev/null
+++ b/pyload/plugins/accounts/ReloadCc.py
@@ -0,0 +1,73 @@
+from module.plugins.Account import Account
+
+from module.common.json_layer import json_loads
+
+from module.network.HTTPRequest import BadHeader
+
+
+class ReloadCc(Account):
+ __name__ = "ReloadCc"
+ __version__ = "0.3"
+ __type__ = "account"
+ __description__ = """Reload.Cc account plugin"""
+
+ __author_name__ = ("Reload Team")
+ __author_mail__ = ("hello@reload.cc")
+
+ def loadAccountInfo(self, user, req):
+
+ # Get user data from reload.cc
+ status = self.getAccountStatus(user, req)
+
+ # Parse account info
+ account_info = {"validuntil": float(status['msg']['expires']),
+ "pwdhash": status['msg']['hash'],
+ "trafficleft": -1}
+
+ return account_info
+
+ def login(self, user, data, req):
+
+ # Get user data from reload.cc
+ status = self.getAccountStatus(user, req)
+
+ if not status:
+ raise Exception("There was an error upon logging in to Reload.cc!")
+
+ # Check if user and password are valid
+ if status['status'] != "ok":
+ self.wrongPassword()
+
+ def getAccountStatus(self, user, req):
+ # Use reload.cc API v1 to retrieve account info and return the parsed json answer
+ query_params = dict(
+ via='pyload',
+ v=1,
+ get_traffic='true',
+ user=user
+ )
+
+ try:
+ query_params.update(dict(hash=self.infos[user]['pwdhash']))
+ except Exception:
+ query_params.update(dict(pwd=self.accounts[user]['password']))
+
+ try:
+ answer = req.load("http://api.reload.cc/login", get=query_params)
+ except BadHeader, e:
+ if e.code == 400:
+ raise Exception("There was an unknown error within the Reload.cc plugin.")
+ elif e.code == 401:
+ self.wrongPassword()
+ elif e.code == 402:
+ self.expired(user)
+ elif e.code == 403:
+ raise Exception("Your account is disabled. Please contact the Reload.cc support!")
+ elif e.code == 409:
+ self.empty(user)
+ elif e.code == 503:
+ self.logInfo("Reload.cc is currently in maintenance mode! Please check again later.")
+ self.wrongPassword()
+ return None
+
+ return json_loads(answer)
diff --git a/pyload/plugins/accounts/RyushareCom.py b/pyload/plugins/accounts/RyushareCom.py
new file mode 100644
index 000000000..484de2d7a
--- /dev/null
+++ b/pyload/plugins/accounts/RyushareCom.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from module.plugins.internal.XFSPAccount import XFSPAccount
+
+
+class RyushareCom(XFSPAccount):
+ __name__ = "RyushareCom"
+ __version__ = "0.03"
+ __type__ = "account"
+ __description__ = """ryushare.com account plugin"""
+ __author_name__ = ("zoidberg", "trance4us")
+ __author_mail__ = ("zoidberg@mujmail.cz", "")
+
+ MAIN_PAGE = "http://ryushare.com/"
+
+ def login(self, user, data, req):
+ req.lastURL = "http://ryushare.com/login.python"
+ html = req.load("http://ryushare.com/login.python",
+ post={"login": user, "password": data["password"], "op": "login"})
+ if 'Incorrect Login or Password' in html or '>Error<' in html:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/Share76Com.py b/pyload/plugins/accounts/Share76Com.py
new file mode 100644
index 000000000..1dfcd8510
--- /dev/null
+++ b/pyload/plugins/accounts/Share76Com.py
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+from module.plugins.internal.XFSPAccount import XFSPAccount
+
+
+class Share76Com(XFSPAccount):
+ __name__ = "Share76Com"
+ __version__ = "0.02"
+ __type__ = "account"
+ __description__ = """Share76.com account plugin"""
+ __author_name__ = ("me")
+
+ MAIN_PAGE = "http://Share76.com/"
diff --git a/pyload/plugins/accounts/ShareFilesCo.py b/pyload/plugins/accounts/ShareFilesCo.py
new file mode 100644
index 000000000..cff52d570
--- /dev/null
+++ b/pyload/plugins/accounts/ShareFilesCo.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+from module.plugins.internal.XFSPAccount import XFSPAccount
+
+
+class ShareFilesCo(XFSPAccount):
+ __name__ = "ShareFilesCo"
+ __version__ = "0.01"
+ __type__ = "account"
+ __description__ = """ShareFilesCo account plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ MAIN_PAGE = "http://sharefiles.co/"
diff --git a/pyload/plugins/accounts/ShareRapidCom.py b/pyload/plugins/accounts/ShareRapidCom.py
new file mode 100644
index 000000000..b532768b1
--- /dev/null
+++ b/pyload/plugins/accounts/ShareRapidCom.py
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+
+import re
+from time import mktime, strptime
+from module.plugins.Account import Account
+
+
+class ShareRapidCom(Account):
+ __name__ = "ShareRapidCom"
+ __version__ = "0.32"
+ __type__ = "account"
+ __description__ = """ShareRapid account plugin"""
+ __author_name__ = ("MikyWoW", "zoidberg")
+
+ login_timeout = 60
+
+ def loadAccountInfo(self, user, req):
+ src = req.load("http://share-rapid.com/mujucet/", decode=True)
+
+ found = re.search(ur'<td>Max. počet paralelních stahování: </td><td>(\d+)', src)
+ if found:
+ data = self.getAccountData(user)
+ data["options"]["limitDL"] = [int(found.group(1))]
+
+ found = re.search(ur'<td>Paušální stahování aktivní. Vyprší </td><td><strong>(.*?)</strong>', src)
+ if found:
+ validuntil = mktime(strptime(found.group(1), "%d.%m.%Y - %H:%M"))
+ return {"premium": True, "trafficleft": -1, "validuntil": validuntil}
+
+ found = re.search(r'<tr><td>GB:</td><td>(.*?) GB', src)
+ if found:
+ trafficleft = float(found.group(1)) * (1 << 20)
+ return {"premium": True, "trafficleft": trafficleft, "validuntil": -1}
+
+ return {"premium": False, "trafficleft": None, "validuntil": None}
+
+ def login(self, user, data, req):
+ htm = req.load("http://share-rapid.com/prihlaseni/", cookies=True)
+ if "Heslo:" in htm:
+ start = htm.index('id="inp_hash" name="hash" value="')
+ htm = htm[start + 33:]
+ hashes = htm[0:32]
+ htm = req.load("http://share-rapid.com/prihlaseni/",
+ post={"hash": hashes,
+ "login": user,
+ "pass1": data["password"],
+ "remember": 0,
+ "sbmt": u"Přihlásit"}, cookies=True)
diff --git a/pyload/plugins/accounts/ShareonlineBiz.py b/pyload/plugins/accounts/ShareonlineBiz.py
new file mode 100644
index 000000000..03babb5e6
--- /dev/null
+++ b/pyload/plugins/accounts/ShareonlineBiz.py
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: mkaay
+"""
+
+from module.plugins.Account import Account
+
+
+class ShareonlineBiz(Account):
+ __name__ = "ShareonlineBiz"
+ __version__ = "0.24"
+ __type__ = "account"
+ __description__ = """share-online.biz account plugin"""
+ __author_name__ = ("mkaay", "zoidberg")
+ __author_mail__ = ("mkaay@mkaay.de", "zoidberg@mujmail.cz")
+
+ def getUserAPI(self, user, req):
+ return req.load("http://api.share-online.biz/account.php",
+ {"username": user, "password": self.accounts[user]["password"], "act": "userDetails"})
+
+ def loadAccountInfo(self, user, req):
+ src = self.getUserAPI(user, req)
+
+ info = {}
+ for line in src.splitlines():
+ if "=" in line:
+ key, value = line.split("=")
+ info[key] = value
+ self.logDebug(info)
+
+ if "dl" in info and info["dl"].lower() != "not_available":
+ req.cj.setCookie("share-online.biz", "dl", info["dl"])
+ if "a" in info and info["a"].lower() != "not_available":
+ req.cj.setCookie("share-online.biz", "a", info["a"])
+
+ return {"validuntil": int(info["expire_date"]) if "expire_date" in info else -1,
+ "trafficleft": -1,
+ "premium": True if ("dl" in info or "a" in info) and (info["group"] != "Sammler") else False}
+
+ def login(self, user, data, req):
+ src = self.getUserAPI(user, req)
+ if "EXCEPTION" in src:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/SimplydebridCom.py b/pyload/plugins/accounts/SimplydebridCom.py
new file mode 100644
index 000000000..82b499bbd
--- /dev/null
+++ b/pyload/plugins/accounts/SimplydebridCom.py
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+from time import mktime, strptime
+
+from module.plugins.Account import Account
+
+
+class SimplydebridCom(Account):
+ __name__ = "SimplydebridCom"
+ __version__ = "0.1"
+ __type__ = "account"
+ __description__ = """Simply-Debrid.com account plugin"""
+ __author_name__ = ("Kagenoshin")
+ __author_mail__ = ("kagenoshin@gmx.ch")
+
+ def loadAccountInfo(self, user, req):
+ get_data = {'login': 2, 'u': self.loginname, 'p': self.password}
+ response = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True)
+ data = [x.strip() for x in response.split(";")]
+ if str(data[0]) != "1":
+ return {"premium": False}
+ else:
+ return {"trafficleft": -1, "validuntil": mktime(strptime(str(data[2]), "%d/%m/%Y"))}
+
+ def login(self, user, data, req):
+ self.loginname = user
+ self.password = data["password"]
+ get_data = {'login': 1, 'u': self.loginname, 'p': self.password}
+ response = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True)
+ if response != "02: loggin success":
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/StahnuTo.py b/pyload/plugins/accounts/StahnuTo.py
new file mode 100644
index 000000000..6e2b1c96d
--- /dev/null
+++ b/pyload/plugins/accounts/StahnuTo.py
@@ -0,0 +1,51 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+
+from module.plugins.Account import Account
+from module.utils import parseFileSize
+
+
+class StahnuTo(Account):
+ __name__ = "StahnuTo"
+ __version__ = "0.02"
+ __type__ = "account"
+ __description__ = """StahnuTo account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ #login_timeout = 60
+
+ def loadAccountInfo(self, user, req):
+ html = req.load("http://www.stahnu.to/")
+
+ found = re.search(r'>VIP: (\d+.*)<', html)
+ trafficleft = parseFileSize(found.group(1)) * 1024 if found else 0
+
+ return {"premium": trafficleft > (512 * 1024), "trafficleft": trafficleft, "validuntil": -1}
+
+ def login(self, user, data, req):
+ html = req.load("http://www.stahnu.to/login.php", post={
+ "username": user,
+ "password": data["password"],
+ "submit": "Login"})
+
+ if not '<a href="logout.php">' in html:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/TurbobitNet.py b/pyload/plugins/accounts/TurbobitNet.py
new file mode 100644
index 000000000..5d4471c30
--- /dev/null
+++ b/pyload/plugins/accounts/TurbobitNet.py
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from time import mktime, strptime
+
+from module.plugins.Account import Account
+
+
+class TurbobitNet(Account):
+ __name__ = "TurbobitNet"
+ __version__ = "0.01"
+ __type__ = "account"
+ __description__ = """TurbobitNet account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ #login_timeout = 60
+
+ def loadAccountInfo(self, user, req):
+ html = req.load("http://turbobit.net")
+
+ found = re.search(r'<u>Turbo Access</u> to ([0-9.]+)', html)
+ if found:
+ premium = True
+ validuntil = mktime(strptime(found.group(1), "%d.%m.%Y"))
+ else:
+ premium = False
+ validuntil = -1
+
+ return {"premium": premium, "trafficleft": -1, "validuntil": validuntil}
+
+ def login(self, user, data, req):
+ req.cj.setCookie("turbobit.net", "user_lang", "en")
+
+ html = req.load("http://turbobit.net/user/login", post={
+ "user[login]": user,
+ "user[pass]": data["password"],
+ "user[submit]": "Login"})
+
+ if not '<div class="menu-item user-name">' in html:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/UlozTo.py b/pyload/plugins/accounts/UlozTo.py
new file mode 100644
index 000000000..8a281389e
--- /dev/null
+++ b/pyload/plugins/accounts/UlozTo.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.plugins.Account import Account
+
+
+class UlozTo(Account):
+ __name__ = "UlozTo"
+ __version__ = "0.05"
+ __type__ = "account"
+ __description__ = """uloz.to account plugin"""
+ __author_name__ = ("zoidberg", "pulpe")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ TRAFFIC_LEFT_PATTERN = r'<li class="menu-kredit"><a href="http://www.ulozto.net/kredit" title="[^"]*?GB = ([0-9.]+) MB"'
+
+ def loadAccountInfo(self, user, req):
+ #this cookie gets lost somehow after each request
+ self.phpsessid = req.cj.getCookie("ULOSESSID")
+ html = req.load("http://www.ulozto.net/", decode=True)
+ req.cj.setCookie("www.ulozto.net", "ULOSESSID", self.phpsessid)
+
+ found = re.search(self.TRAFFIC_LEFT_PATTERN, html)
+ trafficleft = int(float(found.group(1).replace(' ', '').replace(',', '.')) * 1000 / 1.024) if found else 0
+ self.premium = True if trafficleft else False
+
+ return {"validuntil": -1, "trafficleft": trafficleft}
+
+ def login(self, user, data, req):
+ login_page = req.load('http://www.ulozto.net/?do=web-login', decode=True)
+ action = re.findall('<form action="(.+?)"', login_page)[1].replace('&amp;', '&')
+ token = re.search('_token_" value="(.+?)"', login_page).group(1)
+
+ html = req.load('http://www.ulozto.net'+action, post={
+ "_token_": token,
+ "login": "Submit",
+ "password": data['password'],
+ "username": user
+ }, decode=True)
+
+ if '<div class="flash error">' in html:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/UnrestrictLi.py b/pyload/plugins/accounts/UnrestrictLi.py
new file mode 100644
index 000000000..bfa81a6ef
--- /dev/null
+++ b/pyload/plugins/accounts/UnrestrictLi.py
@@ -0,0 +1,64 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+from pyload.plugins.MultiHoster import MultiHoster
+from pyload.utils import json_loads
+
+
+class UnrestrictLi(MultiHoster):
+ __name__ = "UnrestrictLi"
+ __version__ = "0.03"
+ __type__ = "account"
+ __description__ = """Unrestrict.li account plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ def loadAccountInfo(self, user, req):
+ json_data = req.load('http://unrestrict.li/api/jdownloader/user.php?format=json')
+ self.logDebug("JSON data: " + json_data)
+ json_data = json_loads(json_data)
+
+ if 'vip' in json_data['result'] and json_data['result']['vip'] == 0:
+ return {"premium": False}
+
+ validuntil = json_data['result']['expires']
+ trafficleft = int(json_data['result']['traffic'] / 1024)
+
+ return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft}
+
+ def login(self, user, data, req):
+ req.cj.setCookie("unrestrict.li", "lang", "EN")
+ html = req.load("https://unrestrict.li/sign_in")
+
+ if 'solvemedia' in html:
+ self.logError("A Captcha is required. Go to http://unrestrict.li/sign_in and login, then retry")
+ return
+
+ post_data = {"username": user, "password": data["password"],
+ "remember_me": "remember", "signin": "Sign in"}
+ self.html = req.load("https://unrestrict.li/sign_in", post=post_data)
+
+ if 'sign_out' not in self.html:
+ self.wrongPassword()
+
+ def loadHosterList(self, req):
+ json_data = req.load('http://unrestrict.li/api/jdownloader/hosts.php?format=json')
+ json_data = json_loads(json_data)
+
+ host_list = [element['host'] for element in json_data['result']]
+
+ return host_list
diff --git a/pyload/plugins/accounts/UploadedTo.py b/pyload/plugins/accounts/UploadedTo.py
new file mode 100644
index 000000000..ac1f3fd35
--- /dev/null
+++ b/pyload/plugins/accounts/UploadedTo.py
@@ -0,0 +1,68 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: mkaay
+"""
+
+import re
+from time import time
+
+from module.plugins.Account import Account
+
+
+class UploadedTo(Account):
+ __name__ = "UploadedTo"
+ __version__ = "0.26"
+ __type__ = "account"
+ __description__ = """ul.net account plugin"""
+ __author_name__ = ("mkaay")
+ __author_mail__ = ("mkaay@mkaay.de")
+
+ def loadAccountInfo(self, user, req):
+
+ req.load("http://uploaded.net/language/en")
+ html = req.load("http://uploaded.net/me")
+
+ premium = '<a href="register"><em>Premium</em>' in html or '<em>Premium</em></th>' in html
+
+ if premium:
+ raw_traffic = re.search(r'<th colspan="2"><b class="cB">([^<]+)', html).group(1).replace('.', '')
+ raw_valid = re.search(r"<td>Duration:</td>\s*<th>([^<]+)", html, re.MULTILINE).group(1).strip()
+
+ traffic = int(self.parseTraffic(raw_traffic))
+
+ if raw_valid == "unlimited":
+ validuntil = -1
+ else:
+ raw_valid = re.findall(r"(\d+) (Week|weeks|days|day|hours|hour)", raw_valid)
+ validuntil = time()
+ for n, u in raw_valid:
+ validuntil += 3600 * int(n) * {"Week": 168, "weeks": 168, "days": 24,
+ "day": 24, "hours": 1, "hour": 1}[u]
+
+ return {"validuntil": validuntil, "trafficleft": traffic, "maxtraffic": 50 * 1024 * 1024}
+ else:
+ return {"premium": False, "validuntil": -1}
+
+ def login(self, user, data, req):
+
+ req.load("http://uploaded.net/language/en")
+ req.cj.setCookie("uploaded.net", "lang", "en")
+
+ page = req.load("http://uploaded.net/io/login", post={"id": user, "pw": data["password"], "_": ""})
+
+ if "User and password do not match!" in page:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/UploadheroCom.py b/pyload/plugins/accounts/UploadheroCom.py
new file mode 100644
index 000000000..12463f285
--- /dev/null
+++ b/pyload/plugins/accounts/UploadheroCom.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+import datetime
+import time
+
+from module.plugins.Account import Account
+
+
+class UploadheroCom(Account):
+ __name__ = "UploadheroCom"
+ __version__ = "0.2"
+ __type__ = "account"
+ __description__ = """Uploadhero.co account plugin"""
+ __author_name__ = ("mcmyst")
+ __author_mail__ = ("mcmyst@hotmail.fr")
+
+ def loadAccountInfo(self, user, req):
+ premium_pattern = re.compile('Il vous reste <span class="bleu">([0-9]+)</span> jours premium.')
+
+ data = self.getAccountData(user)
+ page = req.load("http://uploadhero.co/my-account")
+
+ if premium_pattern.search(page):
+ end_date = datetime.date.today() + datetime.timedelta(days=int(premium_pattern.search(page).group(1)))
+ end_date = time.mktime(future.timetuple())
+ account_info = {"validuntil": end_date, "trafficleft": -1, "premium": True}
+ else:
+ account_info = {"validuntil": -1, "trafficleft": -1, "premium": False}
+
+ return account_info
+
+ def login(self, user, data, req):
+ page = req.load("http://uploadhero.co/lib/connexion.php",
+ post={"pseudo_login": user, "password_login": data["password"]})
+
+ if "mot de passe invalide" in page:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/UploadingCom.py b/pyload/plugins/accounts/UploadingCom.py
new file mode 100644
index 000000000..d13df4f9d
--- /dev/null
+++ b/pyload/plugins/accounts/UploadingCom.py
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: mkaay
+"""
+
+from time import time, strptime, mktime
+import re
+
+from module.plugins.Account import Account
+
+
+class UploadingCom(Account):
+ __name__ = "UploadingCom"
+ __version__ = "0.1"
+ __type__ = "account"
+ __description__ = """uploading.com account plugin"""
+ __author_name__ = ("mkaay")
+ __author_mail__ = ("mkaay@mkaay.de")
+
+ def loadAccountInfo(self, user, req):
+ src = req.load("http://uploading.com/")
+ premium = True
+ if "UPGRADE TO PREMIUM" in src:
+ return {"validuntil": -1, "trafficleft": -1, "premium": False}
+
+ m = re.search("Valid Until:(.*?)<", src)
+ if m:
+ validuntil = int(mktime(strptime(m.group(1).strip(), "%b %d, %Y")))
+ else:
+ validuntil = -1
+
+ return {"validuntil": validuntil, "trafficleft": -1, "premium": True}
+
+ def login(self, user, data, req):
+ req.cj.setCookie("uploading.com", "lang", "1")
+ req.cj.setCookie("uploading.com", "language", "1")
+ req.cj.setCookie("uploading.com", "setlang", "en")
+ req.cj.setCookie("uploading.com", "_lang", "en")
+ req.load("http://uploading.com/")
+ req.load("http://uploading.com/general/login_form/?JsHttpRequest=%s-xml" % long(time() * 1000),
+ post={"email": user, "password": data["password"], "remember": "on"})
diff --git a/pyload/plugins/accounts/UploadstationCom.py b/pyload/plugins/accounts/UploadstationCom.py
new file mode 100644
index 000000000..040f6bbef
--- /dev/null
+++ b/pyload/plugins/accounts/UploadstationCom.py
@@ -0,0 +1,14 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.accounts.FilejungleCom import FilejungleCom
+
+
+class UploadstationCom(FilejungleCom):
+ __name__ = "UploadstationCom"
+ __version__ = "0.1"
+ __type__ = "account"
+ __description__ = """uploadstation.com account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ URL = "http://uploadstation.com/"
diff --git a/pyload/plugins/accounts/UptoboxCom.py b/pyload/plugins/accounts/UptoboxCom.py
new file mode 100644
index 000000000..7fc62694a
--- /dev/null
+++ b/pyload/plugins/accounts/UptoboxCom.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+from module.plugins.internal.XFSPAccount import XFSPAccount
+
+
+class UptoboxCom(XFSPAccount):
+ __name__ = "UptoboxCom"
+ __version__ = "0.01"
+ __type__ = "account"
+ __description__ = """DDLStorage.com account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ MAIN_PAGE = "http://uptobox.com/"
diff --git a/pyload/plugins/accounts/WarserverCz.py b/pyload/plugins/accounts/WarserverCz.py
new file mode 100644
index 000000000..2c871eb6d
--- /dev/null
+++ b/pyload/plugins/accounts/WarserverCz.py
@@ -0,0 +1,68 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+
+from module.plugins.Account import Account
+from module.utils import parseFileSize
+
+
+class WarserverCz(Account):
+ __name__ = "WarserverCz"
+ __version__ = "0.02"
+ __type__ = "account"
+ __description__ = """Warserver.cz account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ VALID_UNTIL_PATTERN = ur'<li>Neomezené stahování do: <strong>(.+?)<'
+ TRAFFIC_LEFT_PATTERN = ur'<li>Kredit: <strong>(.+?)<'
+
+ DOMAIN = "http://www.warserver.cz"
+
+ def loadAccountInfo(self, user, req):
+ html = req.load("%s/uzivatele/prehled" % self.DOMAIN, decode=True)
+
+ validuntil = trafficleft = None
+ premium = False
+
+ found = re.search(self.VALID_UNTIL_PATTERN, html)
+ if found:
+ self.logDebug("VALID_UNTIL", found.group(1))
+ try:
+ #validuntil = mktime(strptime(found.group(1), "%d %B %Y"))
+ premium = True
+ trafficleft = -1
+ except Exception, e:
+ self.logError(e)
+
+ found = re.search(self.TRAFFIC_LEFT_PATTERN, html)
+ if found:
+ self.logDebug("TRAFFIC_LEFT", found.group(1))
+ trafficleft = parseFileSize((found.group(1).replace("&thinsp;", ""))) // 1024
+ premium = True if trafficleft > 1 << 18 else False
+
+ return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}
+
+ def login(self, user, data, req):
+ html = req.load('%s/uzivatele/prihlaseni?do=prihlaseni-submit' % self.DOMAIN,
+ post={"username": user, "password": data['password'], "send": u"Přihlásit"}, decode=True)
+
+ if '<p class="chyba">' in html:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/WuploadCom.py b/pyload/plugins/accounts/WuploadCom.py
new file mode 100644
index 000000000..2a8bfee8e
--- /dev/null
+++ b/pyload/plugins/accounts/WuploadCom.py
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: RaNaN
+"""
+
+from types import MethodType
+
+from module.plugins.Account import Account
+from module.common.json_layer import json_loads
+
+
+class WuploadCom(Account):
+ __name__ = "WuploadCom"
+ __version__ = "0.1"
+ __type__ = "account"
+ __description__ = """wupload.com account plugin"""
+ __author_name__ = ("RaNaN", "Paul King")
+ __author_mail__ = ("RaNaN@pyload.org", "")
+
+ API_URL = "http://api.wupload.com"
+
+ def init(self):
+ fs = self.core.pluginManager.loadClass("accounts", "FilesonicCom")
+
+ methods = ["loadAccountInfo", "login"]
+ #methods to bind from fs
+
+ for m in methods:
+ setattr(self, m, MethodType(fs.__dict__[m], self, WuploadCom))
+
+ def getDomain(self, req):
+ xml = req.load(self.API_URL + "/utility?method=getWuploadDomainForCurrentIp&format=json",
+ decode=True)
+ return json_loads(xml)["FSApi_Utility"]["getWuploadDomainForCurrentIp"]["response"]
diff --git a/pyload/plugins/accounts/X7To.py b/pyload/plugins/accounts/X7To.py
new file mode 100644
index 000000000..34a7b99be
--- /dev/null
+++ b/pyload/plugins/accounts/X7To.py
@@ -0,0 +1,67 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: ernieb
+"""
+
+import re
+from time import strptime, mktime
+
+from module.plugins.Account import Account
+
+
+class X7To(Account):
+ __name__ = "X7To"
+ __version__ = "0.1"
+ __type__ = "account"
+ __description__ = """X7.To account plugin"""
+ __author_name__ = ("ernieb")
+ __author_mail__ = ("ernieb")
+
+ def loadAccountInfo(self, user, req):
+ page = req.load("http://www.x7.to/my")
+
+ validCheck = re.search("Premium-Mitglied bis ([0-9]*-[0-9]*-[0-9]*)", page, re.IGNORECASE)
+ if validCheck:
+ valid = validCheck.group(1)
+ valid = int(mktime(strptime(valid, "%Y-%m-%d")))
+ else:
+ validCheck = re.search("Premium member until ([0-9]*-[0-9]*-[0-9]*)", page, re.IGNORECASE)
+ if validCheck:
+ valid = validCheck.group(1)
+ valid = int(mktime(strptime(valid, "%Y-%m-%d")))
+ else:
+ valid = 0
+
+ trafficleft = re.search(r'<em style="white-space:nowrap">([\d]*[,]?[\d]?[\d]?) (KB|MB|GB)</em>',
+ page, re.IGNORECASE)
+ if trafficleft:
+ units = float(trafficleft.group(1).replace(",", "."))
+ pow = {'KB': 0, 'MB': 1, 'GB': 2}[trafficleft.group(2)]
+ trafficleft = int(units * 1024 ** pow)
+ else:
+ trafficleft = -1
+
+ return {"trafficleft": trafficleft, "validuntil": valid}
+
+ def login(self, user, data, req):
+ #req.cj.setCookie("share.cx", "lang", "english")
+ page = req.load("http://x7.to/lang/en", None, {})
+ page = req.load("http://x7.to/james/login", None,
+ {"redirect": "http://www.x7.to/", "id": user, "pw": data['password'], "submit": "submit"})
+
+ if "Username and password are not matching." in page:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/YibaishiwuCom.py b/pyload/plugins/accounts/YibaishiwuCom.py
new file mode 100644
index 000000000..c4eab74dc
--- /dev/null
+++ b/pyload/plugins/accounts/YibaishiwuCom.py
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+
+from module.plugins.Account import Account
+
+
+class YibaishiwuCom(Account):
+ __name__ = "YibaishiwuCom"
+ __version__ = "0.01"
+ __type__ = "account"
+ __description__ = """115.com account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ ACCOUNT_INFO_PATTERN = r'var USER_PERMISSION = {(.*?)}'
+
+ def loadAccountInfo(self, user, req):
+ #self.relogin(user)
+ html = req.load("http://115.com/", decode=True)
+
+ found = re.search(self.ACCOUNT_INFO_PATTERN, html, re.S)
+ premium = True if (found and 'is_vip: 1' in found.group(1)) else False
+ validuntil = trafficleft = (-1 if found else 0)
+ return dict({"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium})
+
+ def login(self, user, data, req):
+ html = req.load('http://passport.115.com/?ac=login', post={
+ "back": "http://www.115.com/",
+ "goto": "http://115.com/",
+ "login[account]": user,
+ "login[passwd]": data['password']
+ }, decode=True)
+
+ if not 'var USER_PERMISSION = {' in html:
+ self.wrongPassword()
diff --git a/pyload/plugins/accounts/ZeveraCom.py b/pyload/plugins/accounts/ZeveraCom.py
new file mode 100644
index 000000000..13ed95133
--- /dev/null
+++ b/pyload/plugins/accounts/ZeveraCom.py
@@ -0,0 +1,51 @@
+# -*- coding: utf-8 -*-
+from time import mktime, strptime
+
+from module.plugins.Account import Account
+
+
+class ZeveraCom(Account):
+ __name__ = "ZeveraCom"
+ __version__ = "0.21"
+ __type__ = "account"
+ __description__ = """Zevera.com account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ def loadAccountInfo(self, user, req):
+ data = self.getAPIData(req)
+ if data == "No traffic":
+ account_info = {"trafficleft": 0, "validuntil": 0, "premium": False}
+ else:
+ account_info = {
+ "trafficleft": int(data['availabletodaytraffic']) * 1024,
+ "validuntil": mktime(strptime(data['endsubscriptiondate'], "%Y/%m/%d %H:%M:%S")),
+ "premium": True
+ }
+ return account_info
+
+ def login(self, user, data, req):
+ self.loginname = user
+ self.password = data["password"]
+ if self.getAPIData(req) == "No traffic":
+ self.wrongPassword()
+
+ def getAPIData(self, req, just_header=False, **kwargs):
+ get_data = {
+ 'cmd': 'accountinfo',
+ 'login': self.loginname,
+ 'pass': self.password
+ }
+ get_data.update(kwargs)
+
+ response = req.load("http://www.zevera.com/jDownloader.ashx", get=get_data,
+ decode=True, just_header=just_header)
+ self.logDebug(response)
+
+ if ':' in response:
+ if not just_header:
+ response = response.replace(',', '\n')
+ return dict((y.strip().lower(), z.strip()) for (y, z) in
+ [x.split(':', 1) for x in response.splitlines() if ':' in x])
+ else:
+ return response
diff --git a/pyload/plugins/accounts/__init__.py b/pyload/plugins/accounts/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/pyload/plugins/accounts/__init__.py
diff --git a/pyload/plugins/addons/AlldebridCom.py b/pyload/plugins/addons/AlldebridCom.py
new file mode 100644
index 000000000..d0e9b1f77
--- /dev/null
+++ b/pyload/plugins/addons/AlldebridCom.py
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+
+# should be working
+
+from module.network.RequestFactory import getURL
+from module.plugins.internal.MultiHoster import MultiHoster
+
+
+class AlldebridCom(MultiHoster):
+ __name__ = "AlldebridCom"
+ __version__ = "0.13"
+ __type__ = "hook"
+
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("https", "bool", "Enable HTTPS", "False"),
+ ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"),
+ ("hosterList", "str", "Hoster list (comma separated)", ""),
+ ("unloadFailing", "bool", "Revert to stanard download if download fails", "False"),
+ ("interval", "int", "Reload interval in hours (0 to disable)", "24")]
+
+ __description__ = """Real-Debrid.com hook plugin"""
+ __author_name__ = ("Andy, Voigt")
+ __author_mail__ = ("spamsales@online.de")
+
+ def getHoster(self):
+ https = "https" if self.getConfig("https") else "http"
+ page = getURL(https + "://www.alldebrid.com/api.php?action=get_host").replace("\"", "").strip()
+
+ return [x.strip() for x in page.split(",") if x.strip()]
diff --git a/pyload/plugins/addons/BypassCaptcha.py b/pyload/plugins/addons/BypassCaptcha.py
new file mode 100644
index 000000000..bd718ea7e
--- /dev/null
+++ b/pyload/plugins/addons/BypassCaptcha.py
@@ -0,0 +1,139 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: RaNaN, Godofdream, zoidberg
+"""
+
+from thread import start_new_thread
+from pycurl import FORM_FILE, LOW_SPEED_TIME
+
+from module.network.RequestFactory import getURL, getRequest
+from module.network.HTTPRequest import BadHeader
+
+from module.plugins.Hook import Hook
+
+PYLOAD_KEY = "4f771155b640970d5607f919a615bdefc67e7d32"
+
+
+class BypassCaptchaException(Exception):
+ def __init__(self, err):
+ self.err = err
+
+ def getCode(self):
+ return self.err
+
+ def __str__(self):
+ return "<BypassCaptchaException %s>" % self.err
+
+ def __repr__(self):
+ return "<BypassCaptchaException %s>" % self.err
+
+
+class BypassCaptcha(Hook):
+ __name__ = "BypassCaptcha"
+ __version__ = "0.04"
+ __description__ = """send captchas to BypassCaptcha.com"""
+ __config__ = [("activated", "bool", "Activated", False),
+ ("force", "bool", "Force BC even if client is connected", False),
+ ("passkey", "password", "Passkey", "")]
+ __author_name__ = ("RaNaN", "Godofdream", "zoidberg")
+ __author_mail__ = ("RaNaN@pyload.org", "soilfcition@gmail.com", "zoidberg@mujmail.cz")
+
+ SUBMIT_URL = "http://bypasscaptcha.com/upload.php"
+ RESPOND_URL = "http://bypasscaptcha.com/check_value.php"
+ GETCREDITS_URL = "http://bypasscaptcha.com/ex_left.php"
+
+ def setup(self):
+ self.info = {}
+
+ def getCredits(self):
+ response = getURL(self.GETCREDITS_URL, post={"key": self.getConfig("passkey")})
+
+ data = dict([x.split(' ', 1) for x in response.splitlines()])
+ return int(data['Left'])
+
+ def submit(self, captcha, captchaType="file", match=None):
+ req = getRequest()
+
+ #raise timeout threshold
+ req.c.setopt(LOW_SPEED_TIME, 80)
+
+ try:
+ response = req.load(self.SUBMIT_URL,
+ post={"vendor_key": PYLOAD_KEY,
+ "key": self.getConfig("passkey"),
+ "gen_task_id": "1",
+ "file": (FORM_FILE, captcha)},
+ multipart=True)
+ finally:
+ req.close()
+
+ data = dict([x.split(' ', 1) for x in response.splitlines()])
+ if not data or "Value" not in data:
+ raise BypassCaptchaException(response)
+
+ result = data['Value']
+ ticket = data['TaskId']
+ self.logDebug("result %s : %s" % (ticket, result))
+
+ return ticket, result
+
+ def respond(self, ticket, success):
+ try:
+ response = getURL(self.RESPOND_URL, post={"task_id": ticket, "key": self.getConfig("passkey"),
+ "cv": 1 if success else 0})
+ except BadHeader, e:
+ self.logError("Could not send response.", str(e))
+
+ def newCaptchaTask(self, task):
+ if "service" in task.data:
+ return False
+
+ if not task.isTextual():
+ return False
+
+ if not self.getConfig("passkey"):
+ return False
+
+ if self.core.isClientConnected() and not self.getConfig("force"):
+ return False
+
+ if self.getCredits() > 0:
+ task.handler.append(self)
+ task.data['service'] = self.__name__
+ task.setWaiting(100)
+ start_new_thread(self.processCaptcha, (task,))
+
+ else:
+ self.logInfo("Your %s account has not enough credits" % self.__name__)
+
+ def captchaCorrect(self, task):
+ if task.data['service'] == self.__name__ and "ticket" in task.data:
+ self.respond(task.data["ticket"], True)
+
+ def captchaInvalid(self, task):
+ if task.data['service'] == self.__name__ and "ticket" in task.data:
+ self.respond(task.data["ticket"], False)
+
+ def processCaptcha(self, task):
+ c = task.captchaFile
+ try:
+ ticket, result = self.submit(c)
+ except BypassCaptchaException, e:
+ task.error = e.getCode()
+ return
+
+ task.data["ticket"] = ticket
+ task.setResult(result)
diff --git a/pyload/plugins/addons/Captcha9kw.py b/pyload/plugins/addons/Captcha9kw.py
new file mode 100755
index 000000000..6a9de24de
--- /dev/null
+++ b/pyload/plugins/addons/Captcha9kw.py
@@ -0,0 +1,167 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: mkaay, RaNaN, zoidberg
+"""
+from __future__ import with_statement
+
+from thread import start_new_thread
+from base64 import b64encode
+import time
+
+from module.network.RequestFactory import getURL
+from module.network.HTTPRequest import BadHeader
+
+from module.plugins.Hook import Hook
+
+
+class Captcha9kw(Hook):
+ __name__ = "Captcha9kw"
+ __version__ = "0.09"
+ __description__ = """send captchas to 9kw.eu"""
+ __config__ = [("activated", "bool", "Activated", False),
+ ("force", "bool", "Force CT even if client is connected", True),
+ ("https", "bool", "Enable HTTPS", "False"),
+ ("confirm", "bool", "Confirm Captcha (Cost +6)", "False"),
+ ("captchaperhour", "int", "Captcha per hour (max. 9999)", "9999"),
+ ("prio", "int", "Prio 1-10 (Cost +1-10)", "0"),
+ ("selfsolve", "bool",
+ "If enabled and you have a 9kw client active only you will get your captcha to solve it (Selfsolve)",
+ "False"),
+ ("timeout", "int", "Timeout (max. 300)", "300"),
+ ("passkey", "password", "API key", ""), ]
+ __author_name__ = ("RaNaN")
+ __author_mail__ = ("RaNaN@pyload.org")
+
+ API_URL = "://www.9kw.eu/index.cgi"
+
+ def setup(self):
+ self.API_URL = "https" + self.API_URL if self.getConfig("https") else "http" + self.API_URL
+ self.info = {}
+
+ def getCredits(self):
+ response = getURL(self.API_URL, get={"apikey": self.getConfig("passkey"), "pyload": "1", "source": "pyload",
+ "action": "usercaptchaguthaben"})
+
+ if response.isdigit():
+ self.logInfo(_("%s credits left") % response)
+ self.info["credits"] = credits = int(response)
+ return credits
+ else:
+ self.logError(response)
+ return 0
+
+ def processCaptcha(self, task):
+ result = None
+
+ with open(task.captchaFile, 'rb') as f:
+ data = f.read()
+ data = b64encode(data)
+ self.logDebug("%s : %s" % (task.captchaFile, data))
+ if task.isPositional():
+ mouse = 1
+ else:
+ mouse = 0
+
+ response = getURL(self.API_URL, post={
+ "apikey": self.getConfig("passkey"),
+ "prio": self.getConfig("prio"),
+ "confirm": self.getConfig("confirm"),
+ "captchaperhour": self.getConfig("captchaperhour"),
+ "maxtimeout": self.getConfig("timeout"),
+ "selfsolve": self.getConfig("selfsolve"),
+ "pyload": "1",
+ "source": "pyload",
+ "base64": "1",
+ "mouse": mouse,
+ "file-upload-01": data,
+ "action": "usercaptchaupload"})
+
+ if response.isdigit():
+ self.logInfo(_("New CaptchaID from upload: %s : %s") % (response, task.captchaFile))
+
+ for i in range(1, 100, 1):
+ response2 = getURL(self.API_URL, get={"apikey": self.getConfig("passkey"), "id": response,
+ "pyload": "1", "source": "pyload",
+ "action": "usercaptchacorrectdata"})
+
+ if response2 != "":
+ break
+
+ time.sleep(3)
+
+ result = response2
+ task.data["ticket"] = response
+ self.logInfo("result %s : %s" % (response, result))
+ task.setResult(result)
+ else:
+ self.logError("Bad upload: %s" % response)
+ return False
+
+ def newCaptchaTask(self, task):
+ if not task.isTextual() and not task.isPositional():
+ return False
+
+ if not self.getConfig("passkey"):
+ return False
+
+ if self.core.isClientConnected() and not self.getConfig("force"):
+ return False
+
+ if self.getCredits() > 0:
+ task.handler.append(self)
+ task.setWaiting(self.getConfig("timeout"))
+ start_new_thread(self.processCaptcha, (task,))
+
+ else:
+ self.logError(_("Your Captcha 9kw.eu Account has not enough credits"))
+
+ def captchaCorrect(self, task):
+ if "ticket" in task.data:
+
+ try:
+ response = getURL(self.API_URL,
+ post={"action": "usercaptchacorrectback",
+ "apikey": self.getConfig("passkey"),
+ "api_key": self.getConfig("passkey"),
+ "correct": "1",
+ "pyload": "1",
+ "source": "pyload",
+ "id": task.data["ticket"]})
+ self.logInfo("Request correct: %s" % response)
+
+ except BadHeader, e:
+ self.logError("Could not send correct request.", str(e))
+ else:
+ self.logError("No CaptchaID for correct request (task %s) found." % task)
+
+ def captchaInvalid(self, task):
+ if "ticket" in task.data:
+
+ try:
+ response = getURL(self.API_URL,
+ post={"action": "usercaptchacorrectback",
+ "apikey": self.getConfig("passkey"),
+ "api_key": self.getConfig("passkey"),
+ "correct": "2",
+ "pyload": "1",
+ "source": "pyload",
+ "id": task.data["ticket"]})
+ self.logInfo("Request refund: %s" % response)
+
+ except BadHeader, e:
+ self.logError("Could not send refund request.", str(e))
+ else:
+ self.logError("No CaptchaID for not correct request (task %s) found." % task)
diff --git a/pyload/plugins/addons/CaptchaBrotherhood.py b/pyload/plugins/addons/CaptchaBrotherhood.py
new file mode 100644
index 000000000..69af96705
--- /dev/null
+++ b/pyload/plugins/addons/CaptchaBrotherhood.py
@@ -0,0 +1,167 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: mkaay, RaNaN, zoidberg
+"""
+from __future__ import with_statement
+
+from thread import start_new_thread
+
+import pycurl
+import StringIO
+from urllib import urlencode
+from time import sleep
+import Image
+
+from module.network.RequestFactory import getURL, getRequest
+from module.plugins.Hook import Hook
+
+
+class CaptchaBrotherhoodException(Exception):
+ def __init__(self, err):
+ self.err = err
+
+ def getCode(self):
+ return self.err
+
+ def __str__(self):
+ return "<CaptchaBrotherhoodException %s>" % self.err
+
+ def __repr__(self):
+ return "<CaptchaBrotherhoodException %s>" % self.err
+
+
+class CaptchaBrotherhood(Hook):
+ __name__ = "CaptchaBrotherhood"
+ __version__ = "0.04"
+ __description__ = """send captchas to CaptchaBrotherhood.com"""
+ __config__ = [("activated", "bool", "Activated", False),
+ ("username", "str", "Username", ""),
+ ("force", "bool", "Force CT even if client is connected", False),
+ ("passkey", "password", "Password", "")]
+ __author_name__ = ("RaNaN", "zoidberg")
+ __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz")
+
+ API_URL = "http://www.captchabrotherhood.com/"
+
+ def setup(self):
+ self.info = {}
+
+ def getCredits(self):
+ response = getURL(self.API_URL + "askCredits.aspx",
+ get={"username": self.getConfig("username"), "password": self.getConfig("passkey")})
+ if not response.startswith("OK"):
+ raise CaptchaBrotherhoodException(response)
+ else:
+ credits = int(response[3:])
+ self.logInfo(_("%d credits left") % credits)
+ self.info["credits"] = credits
+ return credits
+
+ def submit(self, captcha, captchaType="file", match=None):
+ try:
+ img = Image.open(captcha)
+ output = StringIO.StringIO()
+ self.logDebug("CAPTCHA IMAGE", img, img.format, img.mode)
+ if img.format in ("GIF", "JPEG"):
+ img.save(output, img.format)
+ else:
+ if img.mode != "RGB":
+ img = img.convert("RGB")
+ img.save(output, "JPEG")
+ data = output.getvalue()
+ output.close()
+ except Exception, e:
+ raise CaptchaBrotherhoodException("Reading or converting captcha image failed: %s" % e)
+
+ req = getRequest()
+
+ url = "%ssendNewCaptcha.aspx?%s" % (self.API_URL,
+ urlencode({"username": self.getConfig("username"),
+ "password": self.getConfig("passkey"),
+ "captchaSource": "pyLoad",
+ "timeout": "80"}))
+
+ req.c.setopt(pycurl.URL, url)
+ req.c.setopt(pycurl.POST, 1)
+ req.c.setopt(pycurl.POSTFIELDS, data)
+ req.c.setopt(pycurl.HTTPHEADER, ["Content-Type: text/html"])
+
+ try:
+ req.c.perform()
+ response = req.getResponse()
+ except Exception, e:
+ raise CaptchaBrotherhoodException("Submit captcha image failed")
+
+ req.close()
+
+ if not response.startswith("OK"):
+ raise CaptchaBrotherhoodException(response[1])
+
+ ticket = response[3:]
+
+ for i in range(15):
+ sleep(5)
+ response = self.get_api("askCaptchaResult", ticket)
+ if response.startswith("OK-answered"):
+ return ticket, response[12:]
+
+ raise CaptchaBrotherhoodException("No solution received in time")
+
+ def get_api(self, api, ticket):
+ response = getURL("%s%s.aspx" % (self.API_URL, api),
+ get={"username": self.getConfig("username"),
+ "password": self.getConfig("passkey"),
+ "captchaID": ticket})
+ if not response.startswith("OK"):
+ raise CaptchaBrotherhoodException("Unknown response: %s" % response)
+
+ return response
+
+ def newCaptchaTask(self, task):
+ if "service" in task.data:
+ return False
+
+ if not task.isTextual():
+ return False
+
+ if not self.getConfig("username") or not self.getConfig("passkey"):
+ return False
+
+ if self.core.isClientConnected() and not self.getConfig("force"):
+ return False
+
+ if self.getCredits() > 10:
+ task.handler.append(self)
+ task.data['service'] = self.__name__
+ task.setWaiting(100)
+ start_new_thread(self.processCaptcha, (task,))
+ else:
+ self.logInfo("Your CaptchaBrotherhood Account has not enough credits")
+
+ def captchaInvalid(self, task):
+ if task.data['service'] == self.__name__ and "ticket" in task.data:
+ response = self.get_api("complainCaptcha", task.data['ticket'])
+
+ def processCaptcha(self, task):
+ c = task.captchaFile
+ try:
+ ticket, result = self.submit(c)
+ except CaptchaBrotherhoodException, e:
+ task.error = e.getCode()
+ return
+
+ task.data["ticket"] = ticket
+ task.setResult(result)
diff --git a/pyload/plugins/addons/CaptchaTrader.py b/pyload/plugins/addons/CaptchaTrader.py
new file mode 100644
index 000000000..51bb75a17
--- /dev/null
+++ b/pyload/plugins/addons/CaptchaTrader.py
@@ -0,0 +1,156 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: mkaay, RaNaN
+"""
+
+from thread import start_new_thread
+from pycurl import FORM_FILE, LOW_SPEED_TIME
+
+from module.common.json_layer import json_loads
+from module.network.RequestFactory import getURL, getRequest
+from module.network.HTTPRequest import BadHeader
+from module.plugins.Hook import Hook
+
+PYLOAD_KEY = "9f65e7f381c3af2b076ea680ae96b0b7"
+
+
+class CaptchaTraderException(Exception):
+ def __init__(self, err):
+ self.err = err
+
+ def getCode(self):
+ return self.err
+
+ def __str__(self):
+ return "<CaptchaTraderException %s>" % self.err
+
+ def __repr__(self):
+ return "<CaptchaTraderException %s>" % self.err
+
+
+class CaptchaTrader(Hook):
+ __name__ = "CaptchaTrader"
+ __version__ = "0.16"
+ __description__ = """send captchas to captchatrader.com"""
+ __config__ = [("activated", "bool", "Activated", False),
+ ("username", "str", "Username", ""),
+ ("force", "bool", "Force CT even if client is connected", False),
+ ("passkey", "password", "Password", ""), ]
+ __author_name__ = ("RaNaN")
+ __author_mail__ = ("RaNaN@pyload.org")
+
+ SUBMIT_URL = "http://api.captchatrader.com/submit"
+ RESPOND_URL = "http://api.captchatrader.com/respond"
+ GETCREDITS_URL = "http://api.captchatrader.com/get_credits/username:%(user)s/password:%(password)s/"
+
+ def setup(self):
+ self.info = {}
+
+ def getCredits(self):
+ json = getURL(CaptchaTrader.GETCREDITS_URL % {"user": self.getConfig("username"),
+ "password": self.getConfig("passkey")})
+ response = json_loads(json)
+ if response[0] < 0:
+ raise CaptchaTraderException(response[1])
+ else:
+ self.logInfo(_("%s credits left") % response[1])
+ self.info["credits"] = response[1]
+ return response[1]
+
+ def submit(self, captcha, captchaType="file", match=None):
+ if not PYLOAD_KEY:
+ raise CaptchaTraderException("No API Key Specified!")
+
+ #if type(captcha) == str and captchaType == "file":
+ # raise CaptchaTraderException("Invalid Type")
+ assert captchaType in ("file", "url-jpg", "url-jpeg", "url-png", "url-bmp")
+
+ req = getRequest()
+
+ #raise timeout threshold
+ req.c.setopt(LOW_SPEED_TIME, 80)
+
+ try:
+ json = req.load(CaptchaTrader.SUBMIT_URL, post={"api_key": PYLOAD_KEY,
+ "username": self.getConfig("username"),
+ "password": self.getConfig("passkey"),
+ "value": (FORM_FILE, captcha),
+ "type": captchaType}, multipart=True)
+ finally:
+ req.close()
+
+ response = json_loads(json)
+ if response[0] < 0:
+ raise CaptchaTraderException(response[1])
+
+ ticket = response[0]
+ result = response[1]
+ self.logDebug("result %s : %s" % (ticket, result))
+
+ return ticket, result
+
+ def respond(self, ticket, success):
+ try:
+ json = getURL(CaptchaTrader.RESPOND_URL, post={"is_correct": 1 if success else 0,
+ "username": self.getConfig("username"),
+ "password": self.getConfig("passkey"),
+ "ticket": ticket})
+
+ response = json_loads(json)
+ if response[0] < 0:
+ raise CaptchaTraderException(response[1])
+
+ except BadHeader, e:
+ self.logError(_("Could not send response."), str(e))
+
+ def newCaptchaTask(self, task):
+ if not task.isTextual():
+ return False
+
+ if not self.getConfig("username") or not self.getConfig("passkey"):
+ return False
+
+ if self.core.isClientConnected() and not self.getConfig("force"):
+ return False
+
+ if self.getCredits() > 10:
+ task.handler.append(self)
+ task.setWaiting(100)
+ start_new_thread(self.processCaptcha, (task,))
+
+ else:
+ self.logInfo(_("Your CaptchaTrader Account has not enough credits"))
+
+ def captchaCorrect(self, task):
+ if "ticket" in task.data:
+ ticket = task.data["ticket"]
+ self.respond(ticket, True)
+
+ def captchaInvalid(self, task):
+ if "ticket" in task.data:
+ ticket = task.data["ticket"]
+ self.respond(ticket, False)
+
+ def processCaptcha(self, task):
+ c = task.captchaFile
+ try:
+ ticket, result = self.submit(c)
+ except CaptchaTraderException, e:
+ task.error = e.getCode()
+ return
+
+ task.data["ticket"] = ticket
+ task.setResult(result)
diff --git a/pyload/plugins/addons/Checksum.py b/pyload/plugins/addons/Checksum.py
new file mode 100644
index 000000000..081e8ac3b
--- /dev/null
+++ b/pyload/plugins/addons/Checksum.py
@@ -0,0 +1,182 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+from __future__ import with_statement
+import hashlib
+import zlib
+from os import remove
+from os.path import getsize, isfile, splitext
+import re
+
+from module.utils import save_join, fs_encode
+from module.plugins.Hook import Hook
+
+
+def computeChecksum(local_file, algorithm):
+ if algorithm in getattr(hashlib, "algorithms", ("md5", "sha1", "sha224", "sha256", "sha384", "sha512")):
+ h = getattr(hashlib, algorithm)()
+ chunk_size = 128 * h.block_size
+
+ with open(local_file, 'rb') as f:
+ for chunk in iter(lambda: f.read(chunk_size), ''):
+ h.update(chunk)
+
+ return h.hexdigest()
+
+ elif algorithm in ("adler32", "crc32"):
+ hf = getattr(zlib, algorithm)
+ last = 0
+
+ with open(local_file, 'rb') as f:
+ for chunk in iter(lambda: f.read(8192), ''):
+ last = hf(chunk, last)
+
+ return "%x" % last
+
+ else:
+ return None
+
+
+class Checksum(Hook):
+ __name__ = "Checksum"
+ __version__ = "0.10"
+ __description__ = "Verify downloaded file size and checksum (enable in general preferences)"
+ __config__ = [("activated", "bool", "Activated", True),
+ ("action", "fail;retry;nothing", "What to do if check fails?", "retry"),
+ ("max_tries", "int", "Number of retries", 2)]
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ methods = {'sfv': 'crc32', 'crc': 'crc32', 'hash': 'md5'}
+ regexps = {'sfv': r'^(?P<name>[^;].+)\s+(?P<hash>[0-9A-Fa-f]{8})$',
+ 'md5': r'^(?P<name>[0-9A-Fa-f]{32}) (?P<file>.+)$',
+ 'crc': r'filename=(?P<name>.+)\nsize=(?P<size>\d+)\ncrc32=(?P<hash>[0-9A-Fa-f]{8})$',
+ 'default': r'^(?P<hash>[0-9A-Fa-f]+)\s+\*?(?P<name>.+)$'}
+
+ def setup(self):
+ if not self.config['general']['checksum']:
+ self.logInfo("Checksum validation is disabled in general configuration")
+
+ self.algorithms = sorted(
+ getattr(hashlib, "algorithms", ("md5", "sha1", "sha224", "sha256", "sha384", "sha512")), reverse=True)
+ self.algorithms.extend(["crc32", "adler32"])
+ self.formats = self.algorithms + ['sfv', 'crc', 'hash']
+
+ def downloadFinished(self, pyfile):
+ """
+ Compute checksum for the downloaded file and compare it with the hash provided by the hoster.
+ pyfile.plugin.check_data should be a dictionary which can contain:
+ a) if known, the exact filesize in bytes (e.g. "size": 123456789)
+ b) hexadecimal hash string with algorithm name as key (e.g. "md5": "d76505d0869f9f928a17d42d66326307")
+ """
+ if hasattr(pyfile.plugin, "check_data") and (isinstance(pyfile.plugin.check_data, dict)):
+ data = pyfile.plugin.check_data.copy()
+ elif hasattr(pyfile.plugin, "api_data") and (isinstance(pyfile.plugin.api_data, dict)):
+ data = pyfile.plugin.api_data.copy()
+ else:
+ return
+
+ self.logDebug(data)
+
+ if not pyfile.plugin.lastDownload:
+ self.checkFailed(pyfile, None, "No file downloaded")
+
+ local_file = fs_encode(pyfile.plugin.lastDownload)
+ #download_folder = self.config['general']['download_folder']
+ #local_file = fs_encode(save_join(download_folder, pyfile.package().folder, pyfile.name))
+
+ if not isfile(local_file):
+ self.checkFailed(pyfile, None, "File does not exist")
+
+ # validate file size
+ if "size" in data:
+ api_size = int(data['size'])
+ file_size = getsize(local_file)
+ if api_size != file_size:
+ self.logWarning("File %s has incorrect size: %d B (%d expected)" % (pyfile.name, file_size, api_size))
+ self.checkFailed(pyfile, local_file, "Incorrect file size")
+ del data['size']
+
+ # validate checksum
+ if data and self.config['general']['checksum']:
+ if "checksum" in data:
+ data['md5'] = data['checksum']
+
+ for key in self.algorithms:
+ if key in data:
+ checksum = computeChecksum(local_file, key.replace("-", "").lower())
+ if checksum:
+ if checksum == data[key].lower():
+ self.logInfo('File integrity of "%s" verified by %s checksum (%s).' % (pyfile.name,
+ key.upper(),
+ checksum))
+ return
+ else:
+ self.logWarning("%s checksum for file %s does not match (%s != %s)" % (key.upper(),
+ pyfile.name,
+ checksum,
+ data[key]))
+ self.checkFailed(pyfile, local_file, "Checksums do not match")
+ else:
+ self.logWarning("Unsupported hashing algorithm: %s" % key.upper())
+ else:
+ self.logWarning("Unable to validate checksum for file %s" % pyfile.name)
+
+ def checkFailed(self, pyfile, local_file, msg):
+ action = self.getConfig("action")
+ if action == "fail":
+ pyfile.plugin.fail(reason=msg)
+ elif action == "retry":
+ if local_file:
+ remove(local_file)
+ pyfile.plugin.retry(reason=msg, max_tries=self.getConfig("max_tries"))
+
+ def packageFinished(self, pypack):
+ download_folder = save_join(self.config['general']['download_folder'], pypack.folder, "")
+
+ for link in pypack.getChildren().itervalues():
+ file_type = splitext(link["name"])[1][1:].lower()
+ #self.logDebug(link, file_type)
+
+ if file_type not in self.formats:
+ continue
+
+ hash_file = fs_encode(save_join(download_folder, link["name"]))
+ if not isfile(hash_file):
+ self.logWarning("File not found: %s" % link["name"])
+ continue
+
+ with open(hash_file) as f:
+ text = f.read()
+
+ for m in re.finditer(self.regexps.get(file_type, self.regexps['default']), text):
+ data = m.groupdict()
+ self.logDebug(link["name"], data)
+
+ local_file = fs_encode(save_join(download_folder, data["name"]))
+ algorithm = self.methods.get(file_type, file_type)
+ checksum = computeChecksum(local_file, algorithm)
+ if checksum == data["hash"]:
+ self.logInfo('File integrity of "%s" verified by %s checksum (%s).' % (data["name"],
+ algorithm,
+ checksum))
+ else:
+ self.logWarning("%s checksum for file %s does not match (%s != %s)" % (algorithm,
+ data["name"],
+ checksum,
+ data["hash"]))
diff --git a/pyload/plugins/addons/ClickAndLoad.py b/pyload/plugins/addons/ClickAndLoad.py
new file mode 100644
index 000000000..0fc78abfe
--- /dev/null
+++ b/pyload/plugins/addons/ClickAndLoad.py
@@ -0,0 +1,90 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: RaNaN
+ @interface-version: 0.2
+"""
+
+import socket
+import thread
+
+from module.plugins.Hook import Hook
+
+
+class ClickAndLoad(Hook):
+ __name__ = "ClickAndLoad"
+ __version__ = "0.22"
+ __description__ = """Gives abillity to use jd's click and load. depends on webinterface"""
+ __config__ = [("activated", "bool", "Activated", "True"),
+ ("extern", "bool", "Allow external link adding", "False")]
+ __author_name__ = ("RaNaN", "mkaay")
+ __author_mail__ = ("RaNaN@pyload.de", "mkaay@mkaay.de")
+
+ def coreReady(self):
+ self.port = int(self.config['webinterface']['port'])
+ if self.config['webinterface']['activated']:
+ try:
+ if self.getConfig("extern"):
+ ip = "0.0.0.0"
+ else:
+ ip = "127.0.0.1"
+
+ thread.start_new_thread(proxy, (self, ip, self.port, 9666))
+ except:
+ self.logError("ClickAndLoad port already in use.")
+
+
+def proxy(self, *settings):
+ thread.start_new_thread(server, (self,) + settings)
+ lock = thread.allocate_lock()
+ lock.acquire()
+ lock.acquire()
+
+
+def server(self, *settings):
+ try:
+ dock_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ dock_socket.bind((settings[0], settings[2]))
+ dock_socket.listen(5)
+ while True:
+ client_socket = dock_socket.accept()[0]
+ server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ server_socket.connect(("127.0.0.1", settings[1]))
+ thread.start_new_thread(forward, (client_socket, server_socket))
+ thread.start_new_thread(forward, (server_socket, client_socket))
+ except socket.error, e:
+ if hasattr(e, "errno"):
+ errno = e.errno
+ else:
+ errno = e.args[0]
+
+ if errno == 98:
+ self.logWarning(_("Click'N'Load: Port 9666 already in use"))
+ return
+ thread.start_new_thread(server, (self,) + settings)
+ except:
+ thread.start_new_thread(server, (self,) + settings)
+
+
+def forward(source, destination):
+ string = ' '
+ while string:
+ string = source.recv(1024)
+ if string:
+ destination.sendall(string)
+ else:
+ #source.shutdown(socket.SHUT_RD)
+ destination.shutdown(socket.SHUT_WR)
diff --git a/pyload/plugins/addons/DeathByCaptcha.py b/pyload/plugins/addons/DeathByCaptcha.py
new file mode 100644
index 000000000..7de4f4f2c
--- /dev/null
+++ b/pyload/plugins/addons/DeathByCaptcha.py
@@ -0,0 +1,212 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: mkaay, RaNaN, zoidberg
+"""
+from __future__ import with_statement
+
+from thread import start_new_thread
+from pycurl import FORM_FILE, HTTPHEADER
+from time import sleep
+from base64 import b64encode
+import re
+
+from module.network.RequestFactory import getRequest
+from module.network.HTTPRequest import BadHeader
+from module.plugins.Hook import Hook
+from module.common.json_layer import json_loads
+
+
+class DeathByCaptchaException(Exception):
+ DBC_ERRORS = {'not-logged-in': 'Access denied, check your credentials',
+ 'invalid-credentials': 'Access denied, check your credentials',
+ 'banned': 'Access denied, account is suspended',
+ 'insufficient-funds': 'Insufficient account balance to decrypt CAPTCHA',
+ 'invalid-captcha': 'CAPTCHA is not a valid image',
+ 'service-overload': 'CAPTCHA was rejected due to service overload, try again later',
+ 'invalid-request': 'Invalid request',
+ 'timed-out': 'No CAPTCHA solution received in time'}
+
+ def __init__(self, err):
+ self.err = err
+
+ def getCode(self):
+ return self.err
+
+ def getDesc(self):
+ if self.err in self.DBC_ERRORS.keys():
+ return self.DBC_ERRORS[self.err]
+ else:
+ return self.err
+
+ def __str__(self):
+ return "<DeathByCaptchaException %s>" % self.err
+
+ def __repr__(self):
+ return "<DeathByCaptchaException %s>" % self.err
+
+
+class DeathByCaptcha(Hook):
+ __name__ = "DeathByCaptcha"
+ __version__ = "0.03"
+ __description__ = """send captchas to DeathByCaptcha.com"""
+ __config__ = [("activated", "bool", "Activated", False),
+ ("username", "str", "Username", ""),
+ ("passkey", "password", "Password", ""),
+ ("force", "bool", "Force DBC even if client is connected", False)]
+ __author_name__ = ("RaNaN", "zoidberg")
+ __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz")
+
+ API_URL = "http://api.dbcapi.me/api/"
+
+ def setup(self):
+ self.info = {}
+
+ def call_api(self, api="captcha", post=False, multipart=False):
+ req = getRequest()
+ req.c.setopt(HTTPHEADER, ["Accept: application/json", "User-Agent: pyLoad %s" % self.core.version])
+
+ if post:
+ if not isinstance(post, dict):
+ post = {}
+ post.update({"username": self.getConfig("username"),
+ "password": self.getConfig("passkey")})
+
+ response = None
+ try:
+ json = req.load("%s%s" % (self.API_URL, api),
+ post=post,
+ multipart=multipart)
+ self.logDebug(json)
+ response = json_loads(json)
+
+ if "error" in response:
+ raise DeathByCaptchaException(response['error'])
+ elif "status" not in response:
+ raise DeathByCaptchaException(str(response))
+
+ except BadHeader, e:
+ if 403 == e.code:
+ raise DeathByCaptchaException('not-logged-in')
+ elif 413 == e.code:
+ raise DeathByCaptchaException('invalid-captcha')
+ elif 503 == e.code:
+ raise DeathByCaptchaException('service-overload')
+ elif e.code in (400, 405):
+ raise DeathByCaptchaException('invalid-request')
+ else:
+ raise
+
+ finally:
+ req.close()
+
+ return response
+
+ def getCredits(self):
+ response = self.call_api("user", True)
+
+ if 'is_banned' in response and response['is_banned']:
+ raise DeathByCaptchaException('banned')
+ elif 'balance' in response and 'rate' in response:
+ self.info.update(response)
+ else:
+ raise DeathByCaptchaException(response)
+
+ def getStatus(self):
+ response = self.call_api("status", False)
+
+ if 'is_service_overloaded' in response and response['is_service_overloaded']:
+ raise DeathByCaptchaException('service-overload')
+
+ def submit(self, captcha, captchaType="file", match=None):
+ #workaround multipart-post bug in HTTPRequest.py
+ if re.match("^[A-Za-z0-9]*$", self.getConfig("passkey")):
+ multipart = True
+ data = (FORM_FILE, captcha)
+ else:
+ multipart = False
+ with open(captcha, 'rb') as f:
+ data = f.read()
+ data = "base64:" + b64encode(data)
+
+ response = self.call_api("captcha", {"captchafile": data}, multipart)
+
+ if "captcha" not in response:
+ raise DeathByCaptchaException(response)
+ ticket = response['captcha']
+
+ for i in range(24):
+ sleep(5)
+ response = self.call_api("captcha/%d" % ticket, False)
+ if response['text'] and response['is_correct']:
+ break
+ else:
+ raise DeathByCaptchaException('timed-out')
+
+ result = response['text']
+ self.logDebug("result %s : %s" % (ticket, result))
+
+ return ticket, result
+
+ def newCaptchaTask(self, task):
+ if "service" in task.data:
+ return False
+
+ if not task.isTextual():
+ return False
+
+ if not self.getConfig("username") or not self.getConfig("passkey"):
+ return False
+
+ if self.core.isClientConnected() and not self.getConfig("force"):
+ return False
+
+ try:
+ self.getStatus()
+ self.getCredits()
+ except DeathByCaptchaException, e:
+ self.logError(e.getDesc())
+ return False
+
+ balance, rate = self.info["balance"], self.info["rate"]
+ self.logInfo("Account balance: US$%.3f (%d captchas left at %.2f cents each)" % (balance / 100,
+ balance // rate, rate))
+
+ if balance > rate:
+ task.handler.append(self)
+ task.data['service'] = self.__name__
+ task.setWaiting(180)
+ start_new_thread(self.processCaptcha, (task,))
+
+ def captchaInvalid(self, task):
+ if task.data['service'] == self.__name__ and "ticket" in task.data:
+ try:
+ response = self.call_api("captcha/%d/report" % task.data["ticket"], True)
+ except DeathByCaptchaException, e:
+ self.logError(e.getDesc())
+ except Exception, e:
+ self.logError(e)
+
+ def processCaptcha(self, task):
+ c = task.captchaFile
+ try:
+ ticket, result = self.submit(c)
+ except DeathByCaptchaException, e:
+ task.error = e.getCode()
+ self.logError(e.getDesc())
+ return
+
+ task.data["ticket"] = ticket
+ task.setResult(result)
diff --git a/pyload/plugins/addons/DebridItaliaCom.py b/pyload/plugins/addons/DebridItaliaCom.py
new file mode 100644
index 000000000..71ebac85c
--- /dev/null
+++ b/pyload/plugins/addons/DebridItaliaCom.py
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+from module.plugins.internal.MultiHoster import MultiHoster
+
+
+class DebridItaliaCom(MultiHoster):
+ __name__ = "DebridItaliaCom"
+ __version__ = "0.07"
+ __type__ = "hook"
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"),
+ ("hosterList", "str", "Hoster list (comma separated)", ""),
+ ("unloadFailing", "bool", "Revert to standard download if download fails", "False"),
+ ("interval", "int", "Reload interval in hours (0 to disable)", "24")]
+
+ __description__ = """Debriditalia.com hook plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ def getHoster(self):
+ return ["netload.in", "hotfile.com", "rapidshare.com", "multiupload.com",
+ "uploading.com", "megashares.com", "crocko.com", "filepost.com",
+ "bitshare.com", "share-links.biz", "putlocker.com", "uploaded.to",
+ "speedload.org", "rapidgator.net", "likeupload.net", "cyberlocker.ch",
+ "depositfiles.com", "extabit.com", "filefactory.com", "sharefiles.co",
+ "ryushare.com", "tusfiles.net", "nowvideo.co", "cloudzer.net", "letitbit.net",
+ "easybytez.com", "uptobox.com", "ddlstorage.com"]
diff --git a/pyload/plugins/addons/DeleteFinished.py b/pyload/plugins/addons/DeleteFinished.py
new file mode 100644
index 000000000..3bc98a7b3
--- /dev/null
+++ b/pyload/plugins/addons/DeleteFinished.py
@@ -0,0 +1,84 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: Walter Purcaro
+"""
+
+from module.database import style
+from module.plugins.Hook import Hook
+
+
+class DeleteFinished(Hook):
+ __name__ = 'DeleteFinished'
+ __version__ = '1.09'
+ __description__ = 'Automatically delete all finished packages from queue'
+ __config__ = [
+ ('activated', 'bool', 'Activated', 'False'),
+ ('interval', 'int', 'Delete every (hours)', '72'),
+ ('deloffline', 'bool', 'Delete packages with offline links', 'False')
+ ]
+ __author_name__ = ('Walter Purcaro')
+ __author_mail__ = ('vuolter@gmail.com')
+
+ ## overwritten methods ##
+ def periodical(self):
+ if not self.info['sleep']:
+ deloffline = self.getConfig('deloffline')
+ mode = '0,1,4' if deloffline else '0,4'
+ msg = 'delete all finished packages in queue list (%s packages with offline links)'
+ self.logInfo(msg % ('including' if deloffline else 'excluding'))
+ self.deleteFinished(mode)
+ self.info['sleep'] = True
+ self.addEvent('packageFinished', self.wakeup)
+
+ def pluginConfigChanged(self, plugin, name, value):
+ if name == 'interval' and value != self.interval:
+ self.interval = value * 3600
+ self.initPeriodical()
+
+ def unload(self):
+ self.removeEvent('packageFinished', self.wakeup)
+
+ def coreReady(self):
+ self.info = {'sleep': True}
+ interval = self.getConfig('interval')
+ self.pluginConfigChanged('DeleteFinished', 'interval', interval)
+ self.addEvent('packageFinished', self.wakeup)
+
+ ## own methods ##
+ @style.queue
+ def deleteFinished(self, mode):
+ self.c.execute('DELETE FROM packages WHERE NOT EXISTS(SELECT 1 FROM links WHERE package=packages.id AND status NOT IN (%s))' % mode)
+ self.c.execute('DELETE FROM links WHERE NOT EXISTS(SELECT 1 FROM packages WHERE id=links.package)')
+
+ def wakeup(self, pypack):
+ self.removeEvent('packageFinished', self.wakeup)
+ self.info['sleep'] = False
+
+ ## event managing ##
+ def addEvent(self, event, func):
+ """Adds an event listener for event name"""
+ if event in self.m.events:
+ if func in self.m.events[event]:
+ self.logDebug('Function already registered %s' % func)
+ else:
+ self.m.events[event].append(func)
+ else:
+ self.m.events[event] = [func]
+
+ def setup(self):
+ self.m = self.manager
+ self.removeEvent = self.m.removeEvent
diff --git a/pyload/plugins/addons/DownloadScheduler.py b/pyload/plugins/addons/DownloadScheduler.py
new file mode 100644
index 000000000..4049d71c5
--- /dev/null
+++ b/pyload/plugins/addons/DownloadScheduler.py
@@ -0,0 +1,86 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+ Original idea by new.cze
+"""
+
+import re
+from time import localtime
+
+from module.plugins.Hook import Hook
+
+
+class DownloadScheduler(Hook):
+ __name__ = "DownloadScheduler"
+ __version__ = "0.21"
+ __description__ = """Download Scheduler"""
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("timetable", "str", "List time periods as hh:mm full or number(kB/s)",
+ "0:00 full, 7:00 250, 10:00 0, 17:00 150"),
+ ("abort", "bool", "Abort active downloads when start period with speed 0", "False")]
+ __author_name__ = ("zoidberg", "stickell")
+ __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+
+ def setup(self):
+ self.cb = None # callback to scheduler job; will be by removed hookmanager when hook unloaded
+
+ def coreReady(self):
+ self.updateSchedule()
+
+ def updateSchedule(self, schedule=None):
+ if schedule is None:
+ schedule = self.getConfig("timetable")
+
+ schedule = re.findall("(\d{1,2}):(\d{2})[\s]*(-?\d+)",
+ schedule.lower().replace("full", "-1").replace("none", "0"))
+ if not schedule:
+ self.logError("Invalid schedule")
+ return
+
+ t0 = localtime()
+ now = (t0.tm_hour, t0.tm_min, t0.tm_sec, "X")
+ schedule = sorted([(int(x[0]), int(x[1]), 0, int(x[2])) for x in schedule] + [now])
+
+ self.logDebug("Schedule", schedule)
+
+ for i, v in enumerate(schedule):
+ if v[3] == "X":
+ last, next = schedule[i - 1], schedule[(i + 1) % len(schedule)]
+ self.logDebug("Now/Last/Next", now, last, next)
+
+ self.setDownloadSpeed(last[3])
+
+ next_time = (((24 + next[0] - now[0]) * 60 + next[1] - now[1]) * 60 + next[2] - now[2]) % 86400
+ self.core.scheduler.removeJob(self.cb)
+ self.cb = self.core.scheduler.addJob(next_time, self.updateSchedule, threaded=False)
+
+ def setDownloadSpeed(self, speed):
+ if speed == 0:
+ abort = self.getConfig("abort")
+ self.logInfo("Stopping download server. (Running downloads will %sbe aborted.)" % ('' if abort else 'not '))
+ self.core.api.pauseServer()
+ if abort:
+ self.core.api.stopAllDownloads()
+ else:
+ self.core.api.unpauseServer()
+
+ if speed > 0:
+ self.logInfo("Setting download speed to %d kB/s" % speed)
+ self.core.api.setConfigValue("download", "limit_speed", 1)
+ self.core.api.setConfigValue("download", "max_speed", speed)
+ else:
+ self.logInfo("Setting download speed to FULL")
+ self.core.api.setConfigValue("download", "limit_speed", 0)
+ self.core.api.setConfigValue("download", "max_speed", -1)
diff --git a/pyload/plugins/addons/EasybytezCom.py b/pyload/plugins/addons/EasybytezCom.py
new file mode 100644
index 000000000..cc55da9c0
--- /dev/null
+++ b/pyload/plugins/addons/EasybytezCom.py
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.plugins.internal.MultiHoster import MultiHoster
+
+
+class EasybytezCom(MultiHoster):
+ __name__ = "EasybytezCom"
+ __version__ = "0.03"
+ __type__ = "hook"
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"),
+ ("hosterList", "str", "Hoster list (comma separated)", "")]
+ __description__ = """EasyBytez.com hook plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ def getHoster(self):
+ self.account = self.core.accountManager.getAccountPlugin(self.__name__)
+ user = self.account.selectAccount()[0]
+
+ try:
+ req = self.account.getAccountRequest(user)
+ page = req.load("http://www.easybytez.com")
+
+ found = re.search(r'</textarea>\s*Supported sites:(.*)', page)
+ return found.group(1).split(',')
+ except Exception, e:
+ self.logDebug(e)
+ self.logWarning("Unable to load supported hoster list, using last known")
+ return ['bitshare.com', 'crocko.com', 'ddlstorage.com', 'depositfiles.com', 'extabit.com', 'hotfile.com',
+ 'mediafire.com', 'netload.in', 'rapidgator.net', 'rapidshare.com', 'uploading.com', 'uload.to',
+ 'uploaded.to']
diff --git a/pyload/plugins/addons/Ev0InFetcher.py b/pyload/plugins/addons/Ev0InFetcher.py
new file mode 100644
index 000000000..912cb5964
--- /dev/null
+++ b/pyload/plugins/addons/Ev0InFetcher.py
@@ -0,0 +1,89 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: mkaay
+"""
+from time import mktime, time
+
+from module.lib import feedparser
+from module.plugins.Hook import Hook
+
+
+class Ev0InFetcher(Hook):
+ __name__ = "Ev0InFetcher"
+ __version__ = "0.21"
+ __description__ = """checks rss feeds for ev0.in"""
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("interval", "int", "Check interval in minutes", "10"),
+ ("queue", "bool", "Move new shows directly to Queue", False),
+ ("shows", "str", "Shows to check for (comma seperated)", ""),
+ ("quality", "xvid;x264;rmvb", "Video Format", "xvid"),
+ ("hoster", "str", "Hoster to use (comma seperated)",
+ "NetloadIn,RapidshareCom,MegauploadCom,HotfileCom")]
+ __author_name__ = ("mkaay")
+ __author_mail__ = ("mkaay@mkaay.de")
+
+ def setup(self):
+ self.interval = self.getConfig("interval") * 60
+
+ def filterLinks(self, links):
+ results = self.core.pluginManager.parseUrls(links)
+ sortedLinks = {}
+
+ for url, hoster in results:
+ if hoster not in sortedLinks:
+ sortedLinks[hoster] = []
+ sortedLinks[hoster].append(url)
+
+ for h in self.getConfig("hoster").split(","):
+ try:
+ return sortedLinks[h.strip()]
+ except:
+ continue
+ return []
+
+ def periodical(self):
+ def normalizefiletitle(filename):
+ filename = filename.replace('.', ' ')
+ filename = filename.replace('_', ' ')
+ filename = filename.lower()
+ return filename
+
+ shows = [s.strip() for s in self.getConfig("shows").split(",")]
+
+ feed = feedparser.parse("http://feeds.feedburner.com/ev0in/%s?format=xml" % self.getConfig("quality"))
+
+ showStorage = {}
+ for show in shows:
+ showStorage[show] = int(self.getStorage("show_%s_lastfound" % show, 0))
+
+ found = False
+ for item in feed['items']:
+ for show, lastfound in showStorage.iteritems():
+ if show.lower() in normalizefiletitle(item['title']) and lastfound < int(mktime(item.date_parsed)):
+ links = self.filterLinks(item['description'].split("<br />"))
+ packagename = item['title'].encode("utf-8")
+ self.logInfo("Ev0InFetcher: new episode '%s' (matched '%s')" % (packagename, show))
+ self.core.api.addPackage(packagename, links, 1 if self.getConfig("queue") else 0)
+ self.setStorage("show_%s_lastfound" % show, int(mktime(item.date_parsed)))
+ found = True
+ if not found:
+ #self.logDebug("Ev0InFetcher: no new episodes found")
+ pass
+
+ for show, lastfound in self.getStorage().iteritems():
+ if int(lastfound) > 0 and int(lastfound) + (3600 * 24 * 30) < int(time()):
+ self.delStorage("show_%s_lastfound" % show)
+ self.logDebug("Ev0InFetcher: cleaned '%s' record" % show)
diff --git a/pyload/plugins/addons/ExpertDecoders.py b/pyload/plugins/addons/ExpertDecoders.py
new file mode 100644
index 000000000..f1b7ea352
--- /dev/null
+++ b/pyload/plugins/addons/ExpertDecoders.py
@@ -0,0 +1,106 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: mkaay, RaNaN, zoidberg
+"""
+from __future__ import with_statement
+
+from thread import start_new_thread
+from pycurl import LOW_SPEED_TIME
+from uuid import uuid4
+from base64 import b64encode
+
+from module.network.RequestFactory import getURL, getRequest
+from module.network.HTTPRequest import BadHeader
+
+from module.plugins.Hook import Hook
+
+
+class ExpertDecoders(Hook):
+ __name__ = "ExpertDecoders"
+ __version__ = "0.01"
+ __description__ = """send captchas to expertdecoders.com"""
+ __config__ = [("activated", "bool", "Activated", False),
+ ("force", "bool", "Force CT even if client is connected", False),
+ ("passkey", "password", "Access key", ""), ]
+ __author_name__ = ("RaNaN", "zoidberg")
+ __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz")
+
+ API_URL = "http://www.fasttypers.org/imagepost.ashx"
+
+ def setup(self):
+ self.info = {}
+
+ def getCredits(self):
+ response = getURL(self.API_URL, post={"key": self.getConfig("passkey"), "action": "balance"})
+
+ if response.isdigit():
+ self.logInfo(_("%s credits left") % response)
+ self.info["credits"] = credits = int(response)
+ return credits
+ else:
+ self.logError(response)
+ return 0
+
+ def processCaptcha(self, task):
+ task.data["ticket"] = ticket = uuid4()
+ result = None
+
+ with open(task.captchaFile, 'rb') as f:
+ data = f.read()
+ data = b64encode(data)
+ #self.logDebug("%s: %s : %s" % (ticket, task.captchaFile, data))
+
+ req = getRequest()
+ #raise timeout threshold
+ req.c.setopt(LOW_SPEED_TIME, 80)
+
+ try:
+ result = req.load(self.API_URL, post={"action": "upload", "key": self.getConfig("passkey"),
+ "file": data, "gen_task_id": ticket})
+ finally:
+ req.close()
+
+ self.logDebug("result %s : %s" % (ticket, result))
+ task.setResult(result)
+
+ def newCaptchaTask(self, task):
+ if not task.isTextual():
+ return False
+
+ if not self.getConfig("passkey"):
+ return False
+
+ if self.core.isClientConnected() and not self.getConfig("force"):
+ return False
+
+ if self.getCredits() > 0:
+ task.handler.append(self)
+ task.setWaiting(100)
+ start_new_thread(self.processCaptcha, (task,))
+
+ else:
+ self.logInfo(_("Your ExpertDecoders Account has not enough credits"))
+
+ def captchaInvalid(self, task):
+ if "ticket" in task.data:
+
+ try:
+ response = getURL(self.API_URL, post={"action": "refund", "key": self.getConfig("passkey"),
+ "gen_task_id": task.data["ticket"]})
+ self.logInfo("Request refund: %s" % response)
+
+ except BadHeader, e:
+ self.logError("Could not send refund request.", str(e))
diff --git a/pyload/plugins/addons/ExternalScripts.py b/pyload/plugins/addons/ExternalScripts.py
new file mode 100644
index 000000000..de8afda5f
--- /dev/null
+++ b/pyload/plugins/addons/ExternalScripts.py
@@ -0,0 +1,116 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: mkaay
+ @interface-version: 0.1
+"""
+
+import subprocess
+from os import listdir, access, X_OK, makedirs
+from os.path import join, exists, basename
+
+from module.plugins.Hook import Hook
+from module.utils import save_join
+
+
+class ExternalScripts(Hook):
+ __name__ = "ExternalScripts"
+ __version__ = "0.23"
+ __description__ = """Run external scripts"""
+ __config__ = [("activated", "bool", "Activated", "True")]
+ __author_name__ = ("mkaay", "RaNaN", "spoob")
+ __author_mail__ = ("mkaay@mkaay.de", "ranan@pyload.org", "spoob@pyload.org")
+
+ event_list = ["unrarFinished", "allDownloadsFinished", "allDownloadsProcessed"]
+
+ def setup(self):
+ self.scripts = {}
+
+ folders = ['download_preparing', 'download_finished', 'package_finished',
+ 'before_reconnect', 'after_reconnect', 'unrar_finished',
+ 'all_dls_finished', 'all_dls_processed']
+
+ for folder in folders:
+ self.scripts[folder] = []
+
+ self.initPluginType(folder, join(pypath, 'scripts', folder))
+ self.initPluginType(folder, join('scripts', folder))
+
+ for script_type, names in self.scripts.iteritems():
+ if names:
+ self.logInfo((_("Installed scripts for %s: ") % script_type ) + ", ".join([basename(x) for x in names]))
+
+ def initPluginType(self, folder, path):
+ if not exists(path):
+ try:
+ makedirs(path)
+ except:
+ self.logDebug("Script folder %s not created" % folder)
+ return
+
+ for f in listdir(path):
+ if f.startswith("#") or f.startswith(".") or f.startswith("_") or f.endswith("~") or f.endswith(".swp"):
+ continue
+
+ if not access(join(path, f), X_OK):
+ self.logWarning(_("Script not executable:") + " %s/%s" % (folder, f))
+
+ self.scripts[folder].append(join(path, f))
+
+ def callScript(self, script, *args):
+ try:
+ cmd = [script] + [str(x) if not isinstance(x, basestring) else x for x in args]
+ #output goes to pyload
+ subprocess.Popen(cmd, bufsize=-1)
+ except Exception, e:
+ self.logError(_("Error in %(script)s: %(error)s") % {"script": basename(script), "error": str(e)})
+
+ def downloadPreparing(self, pyfile):
+ for script in self.scripts['download_preparing']:
+ self.callScript(script, pyfile.pluginname, pyfile.url, pyfile.id)
+
+ def downloadFinished(self, pyfile):
+ for script in self.scripts['download_finished']:
+ self.callScript(script, pyfile.pluginname, pyfile.url, pyfile.name,
+ save_join(self.config['general']['download_folder'],
+ pyfile.package().folder, pyfile.name), pyfile.id)
+
+ def packageFinished(self, pypack):
+ for script in self.scripts['package_finished']:
+ folder = self.config['general']['download_folder']
+ folder = save_join(folder, pypack.folder)
+
+ self.callScript(script, pypack.name, folder, pypack.password, pypack.id)
+
+ def beforeReconnecting(self, ip):
+ for script in self.scripts['before_reconnect']:
+ self.callScript(script, ip)
+
+ def afterReconnecting(self, ip):
+ for script in self.scripts['after_reconnect']:
+ self.callScript(script, ip)
+
+ def unrarFinished(self, folder, fname):
+ for script in self.scripts["unrar_finished"]:
+ self.callScript(script, folder, fname)
+
+ def allDownloadsFinished(self):
+ for script in self.scripts["all_dls_finished"]:
+ self.callScript(script)
+
+ def allDownloadsProcessed(self):
+ for script in self.scripts["all_dls_processed"]:
+ self.callScript(script)
diff --git a/pyload/plugins/addons/ExtractArchive.py b/pyload/plugins/addons/ExtractArchive.py
new file mode 100644
index 000000000..be023301c
--- /dev/null
+++ b/pyload/plugins/addons/ExtractArchive.py
@@ -0,0 +1,318 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import sys
+import os
+from os import remove, chmod, makedirs
+from os.path import exists, basename, isfile, isdir, join
+from traceback import print_exc
+from copy import copy
+
+# monkey patch bug in python 2.6 and lower
+# see 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":
+ from subprocess import Popen
+ import errno
+
+ def _eintr_retry_call(func, *args):
+ while True:
+ try:
+ return func(*args)
+ except OSError, e:
+ if e.errno == errno.EINTR:
+ continue
+ raise
+
+ # unsued timeout option for older python version
+ def wait(self, timeout=0):
+ """Wait for child process to terminate. Returns returncode
+ attribute."""
+ if self.returncode is None:
+ try:
+ pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
+ except OSError, e:
+ if e.errno != errno.ECHILD:
+ raise
+ # This happens if SIGCLD is set to be ignored or waiting
+ # for child processes has otherwise been disabled for our
+ # process. This child is dead, we can't get the status.
+ sts = 0
+ self._handle_exitstatus(sts)
+ return self.returncode
+
+ Popen.wait = wait
+
+if os.name != "nt":
+ from os import chown
+ from pwd import getpwnam
+ from grp import getgrnam
+
+from module.utils import save_join, fs_encode
+from module.plugins.Hook import Hook, threaded, Expose
+from module.plugins.internal.AbstractExtractor import ArchiveError, CRCError, WrongPassword
+
+
+class ExtractArchive(Hook):
+ """
+ Provides: unrarFinished (folder, filename)
+ """
+ __name__ = "ExtractArchive"
+ __version__ = "0.16"
+ __description__ = "Extract different kind of archives"
+ __config__ = [("activated", "bool", "Activated", True),
+ ("fullpath", "bool", "Extract full path", True),
+ ("overwrite", "bool", "Overwrite files", True),
+ ("passwordfile", "file", "password file", "unrar_passwords.txt"),
+ ("deletearchive", "bool", "Delete archives when done", False),
+ ("subfolder", "bool", "Create subfolder for each package", False),
+ ("destination", "folder", "Extract files to", ""),
+ ("excludefiles", "str", "Exclude files from unpacking (seperated by ;)", ""),
+ ("recursive", "bool", "Extract archives in archvies", True),
+ ("queue", "bool", "Wait for all downloads to be finished", True),
+ ("renice", "int", "CPU Priority", 0)]
+ __author_name__ = ("pyload Team", "AndroKev")
+ __author_mail__ = ("admin<at>pyload.org", "@pyloadforum")
+
+ event_list = ["allDownloadsProcessed"]
+
+ def setup(self):
+ self.plugins = []
+ self.passwords = []
+ names = []
+
+ for p in ("UnRar", "UnZip"):
+ try:
+ module = self.core.pluginManager.loadModule("internal", p)
+ klass = getattr(module, p)
+ if klass.checkDeps():
+ names.append(p)
+ self.plugins.append(klass)
+
+ except OSError, e:
+ if e.errno == 2:
+ self.logInfo(_("No %s installed") % p)
+ else:
+ self.logWarning(_("Could not activate %s") % p, str(e))
+ if self.core.debug:
+ print_exc()
+
+ except Exception, e:
+ self.logWarning(_("Could not activate %s") % p, str(e))
+ if self.core.debug:
+ print_exc()
+
+ if names:
+ self.logInfo(_("Activated") + " " + " ".join(names))
+ else:
+ self.logInfo(_("No Extract plugins activated"))
+
+ # queue with package ids
+ self.queue = []
+
+ @Expose
+ def extractPackage(self, id):
+ """ Extract package with given id"""
+ self.manager.startThread(self.extract, [id])
+
+ def packageFinished(self, pypack):
+ if self.getConfig("queue"):
+ self.logInfo(_("Package %s queued for later extracting") % pypack.name)
+ self.queue.append(pypack.id)
+ else:
+ self.manager.startThread(self.extract, [pypack.id])
+
+ @threaded
+ def allDownloadsProcessed(self, thread):
+ local = copy(self.queue)
+ del self.queue[:]
+ self.extract(local, thread)
+
+ def extract(self, ids, thread=None):
+ # reload from txt file
+ self.reloadPasswords()
+
+ # dl folder
+ dl = self.config['general']['download_folder']
+
+ extracted = []
+
+ #iterate packages -> plugins -> targets
+ for pid in ids:
+ p = self.core.files.getPackage(pid)
+ self.logInfo(_("Check package %s") % p.name)
+ if not p:
+ continue
+
+ # determine output folder
+ out = save_join(dl, p.folder, "")
+ # force trailing slash
+
+ if self.getConfig("destination") and self.getConfig("destination").lower() != "none":
+
+ out = save_join(dl, p.folder, self.getConfig("destination"), "")
+ #relative to package folder if destination is relative, otherwise absolute path overwrites them
+
+ if self.getConfig("subfolder"):
+ out = join(out, fs_encode(p.folder))
+
+ if not exists(out):
+ makedirs(out)
+
+ files_ids = [(save_join(dl, p.folder, x["name"]), x["id"]) for x in p.getChildren().itervalues()]
+ matched = False
+
+ # check as long there are unseen files
+ while files_ids:
+ new_files_ids = []
+
+ for plugin in self.plugins:
+ targets = plugin.getTargets(files_ids)
+ if targets:
+ self.logDebug("Targets for %s: %s" % (plugin.__name__, targets))
+ matched = True
+ for target, fid in targets:
+ if target in extracted:
+ self.logDebug(basename(target), "skipped")
+ continue
+ extracted.append(target) # prevent extracting same file twice
+
+ klass = plugin(self, target, out, self.getConfig("fullpath"), self.getConfig("overwrite"), self.getConfig("excludefiles"),
+ self.getConfig("renice"))
+ klass.init()
+
+ self.logInfo(basename(target), _("Extract to %s") % out)
+ new_files = self.startExtracting(klass, fid, p.password.strip().splitlines(), thread)
+ self.logDebug("Extracted: %s" % new_files)
+ self.setPermissions(new_files)
+
+ for file in new_files:
+ if not exists(file):
+ self.logDebug("new file %s does not exists" % file)
+ continue
+ if self.getConfig("recursive") and isfile(file):
+ new_files_ids.append((file, fid)) # append as new target
+
+ files_ids = new_files_ids # also check extracted files
+
+ if not matched:
+ self.logInfo(_("No files found to extract"))
+
+ def startExtracting(self, plugin, fid, passwords, thread):
+ pyfile = self.core.files.getFile(fid)
+ if not pyfile:
+ return []
+
+ pyfile.setCustomStatus(_("extracting"))
+ thread.addActive(pyfile) # keep this file until everything is done
+
+ try:
+ progress = lambda x: pyfile.setProgress(x)
+ success = False
+
+ if not plugin.checkArchive():
+ plugin.extract(progress)
+ success = True
+ else:
+ self.logInfo(basename(plugin.file), _("Password protected"))
+ self.logDebug("Passwords: %s" % str(passwords))
+
+ pwlist = copy(self.getPasswords())
+ #remove already supplied pws from list (only local)
+ for pw in passwords:
+ if pw in pwlist:
+ pwlist.remove(pw)
+
+ for pw in passwords + pwlist:
+ try:
+ self.logDebug("Try password: %s" % pw)
+ if plugin.checkPassword(pw):
+ plugin.extract(progress, pw)
+ self.addPassword(pw)
+ success = True
+ break
+ except WrongPassword:
+ self.logDebug("Password was wrong")
+
+ if not success:
+ self.logError(basename(plugin.file), _("Wrong password"))
+ return []
+
+ if self.core.debug:
+ self.logDebug("Would delete: %s" % ", ".join(plugin.getDeleteFiles()))
+
+ if self.getConfig("deletearchive"):
+ files = plugin.getDeleteFiles()
+ self.logInfo(_("Deleting %s files") % len(files))
+ for f in files:
+ if exists(f):
+ remove(f)
+ else:
+ self.logDebug("%s does not exists" % f)
+
+ self.logInfo(basename(plugin.file), _("Extracting finished"))
+ self.manager.dispatchEvent("unrarFinished", plugin.out, plugin.file)
+
+ return plugin.getExtractedFiles()
+
+ except ArchiveError, e:
+ self.logError(basename(plugin.file), _("Archive Error"), str(e))
+ except CRCError:
+ self.logError(basename(plugin.file), _("CRC Mismatch"))
+ except Exception, e:
+ if self.core.debug:
+ print_exc()
+ self.logError(basename(plugin.file), _("Unknown Error"), str(e))
+
+ return []
+
+ @Expose
+ def getPasswords(self):
+ """ List of saved passwords """
+ return self.passwords
+
+ def reloadPasswords(self):
+ pwfile = self.getConfig("passwordfile")
+ if not exists(pwfile):
+ open(pwfile, "wb").close()
+
+ passwords = []
+ f = open(pwfile, "rb")
+ for pw in f.read().splitlines():
+ passwords.append(pw)
+ f.close()
+
+ self.passwords = passwords
+
+ @Expose
+ def addPassword(self, pw):
+ """ Adds a password to saved list"""
+ pwfile = self.getConfig("passwordfile")
+
+ if pw in self.passwords:
+ self.passwords.remove(pw)
+ self.passwords.insert(0, pw)
+
+ f = open(pwfile, "wb")
+ for pw in self.passwords:
+ f.write(pw + "\n")
+ f.close()
+
+ def setPermissions(self, files):
+ for f in files:
+ if not exists(f):
+ continue
+ try:
+ if self.config["permission"]["change_file"]:
+ if isfile(f):
+ chmod(f, int(self.config["permission"]["file"], 8))
+ elif isdir(f):
+ chmod(f, int(self.config["permission"]["folder"], 8))
+
+ if self.config["permission"]["change_dl"] and os.name != "nt":
+ uid = getpwnam(self.config["permission"]["user"])[2]
+ gid = getgrnam(self.config["permission"]["group"])[2]
+ chown(f, uid, gid)
+ except Exception, e:
+ self.logWarning(_("Setting User and Group failed"), e)
diff --git a/pyload/plugins/addons/FastixRu.py b/pyload/plugins/addons/FastixRu.py
new file mode 100644
index 000000000..25c9a1a67
--- /dev/null
+++ b/pyload/plugins/addons/FastixRu.py
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+
+# should be working
+
+from module.network.RequestFactory import getURL
+from module.plugins.internal.MultiHoster import MultiHoster
+from module.common.json_layer import json_loads
+
+
+class FastixRu(MultiHoster):
+ __name__ = "FastixRu"
+ __version__ = "0.02"
+ __type__ = "hook"
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"),
+ ("unloadFailing", "bool", "Revert to standard download if download fails", "False"),
+ ("interval", "int", "Reload interval in hours (0 to disable)", "24")]
+ __description__ = """Fastix hook plugin"""
+ __author_name__ = ("Massimo, Rosamilia")
+ __author_mail__ = ("max@spiritix.eu")
+
+ def getHoster(self):
+ page = getURL(
+ "http://fastix.ru/api_v2/?apikey=5182964c3f8f9a7f0b00000a_kelmFB4n1IrnCDYuIFn2y&sub=allowed_sources")
+ host_list = json_loads(page)
+ host_list = host_list['allow']
+ return host_list
diff --git a/pyload/plugins/addons/HotFolder.py b/pyload/plugins/addons/HotFolder.py
new file mode 100644
index 000000000..e44c1e172
--- /dev/null
+++ b/pyload/plugins/addons/HotFolder.py
@@ -0,0 +1,83 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: RaNaN
+ @interface-version: 0.2
+"""
+
+from os import makedirs
+from os import listdir
+from os.path import exists
+from os.path import join
+from os.path import isfile
+from shutil import move
+import time
+
+from module.plugins.Hook import Hook
+
+
+class HotFolder(Hook):
+ __name__ = "HotFolder"
+ __version__ = "0.11"
+ __description__ = """observe folder and file for changes and add container and links"""
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("folder", "str", "Folder to observe", "container"),
+ ("watch_file", "bool", "Observe link file", "False"),
+ ("keep", "bool", "Keep added containers", "True"),
+ ("file", "str", "Link file", "links.txt")]
+ __threaded__ = []
+ __author_name__ = ("RaNaN")
+ __author_mail__ = ("RaNaN@pyload.de")
+
+ def setup(self):
+ self.interval = 10
+
+ def periodical(self):
+
+ if not exists(join(self.getConfig("folder"), "finished")):
+ makedirs(join(self.getConfig("folder"), "finished"))
+
+ if self.getConfig("watch_file"):
+
+ if not exists(self.getConfig("file")):
+ f = open(self.getConfig("file"), "wb")
+ f.close()
+
+ f = open(self.getConfig("file"), "rb")
+ content = f.read().strip()
+ f.close()
+ f = open(self.getConfig("file"), "wb")
+ f.close()
+ if content:
+ name = "%s_%s.txt" % (self.getConfig("file"), time.strftime("%H-%M-%S_%d%b%Y"))
+
+ f = open(join(self.getConfig("folder"), "finished", name), "wb")
+ f.write(content)
+ f.close()
+
+ self.core.api.addPackage(f.name, [f.name], 1)
+
+ for f in listdir(self.getConfig("folder")):
+ path = join(self.getConfig("folder"), f)
+
+ if not isfile(path) or f.endswith("~") or f.startswith("#") or f.startswith("."):
+ continue
+
+ newpath = join(self.getConfig("folder"), "finished", f if self.getConfig("keep") else "tmp_" + f)
+ move(path, newpath)
+
+ self.logInfo(_("Added %s from HotFolder") % f)
+ self.core.api.addPackage(f, [newpath], 1)
diff --git a/pyload/plugins/addons/IRCInterface.py b/pyload/plugins/addons/IRCInterface.py
new file mode 100644
index 000000000..66fd15dcc
--- /dev/null
+++ b/pyload/plugins/addons/IRCInterface.py
@@ -0,0 +1,422 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: RaNaN
+ @author: jeix
+ @interface-version: 0.2
+"""
+
+from select import select
+import socket
+from threading import Thread
+import time
+from time import sleep
+from traceback import print_exc
+import re
+from pycurl import FORM_FILE
+
+from module.plugins.Addon import Addon
+from module.network.RequestFactory import getURL
+from module.utils import formatSize
+from module.Api import PackageDoesNotExists, FileDoesNotExists
+
+
+class IRCInterface(Thread, Addon):
+ __name__ = "IRCInterface"
+ __version__ = "0.11"
+ __description__ = """connect to irc and let owner perform different tasks"""
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("host", "str", "IRC-Server Address", "Enter your server here!"),
+ ("port", "int", "IRC-Server Port", "6667"),
+ ("ident", "str", "Clients ident", "pyload-irc"),
+ ("realname", "str", "Realname", "pyload-irc"),
+ ("nick", "str", "Nickname the Client will take", "pyLoad-IRC"),
+ ("owner", "str", "Nickname the Client will accept commands from", "Enter your nick here!"),
+ ("info_file", "bool", "Inform about every file finished", "False"),
+ ("info_pack", "bool", "Inform about every package finished", "True"),
+ ("captcha", "bool", "Send captcha requests", "True")]
+ __author_name__ = ("Jeix")
+ __author_mail__ = ("Jeix@hasnomail.com")
+
+ def __init__(self, core, manager):
+ Thread.__init__(self)
+ Addon.__init__(self, core, manager)
+ self.setDaemon(True)
+ # self.sm = core.server_methods
+ self.api = core.api # todo, only use api
+
+ def coreReady(self):
+ self.new_package = {}
+
+ self.abort = False
+
+ self.links_added = 0
+ self.more = []
+
+ self.start()
+
+ def packageFinished(self, pypack):
+ try:
+ if self.getConfig("info_pack"):
+ self.response(_("Package finished: %s") % pypack.name)
+ except:
+ pass
+
+ def downloadFinished(self, pyfile):
+ try:
+ if self.getConfig("info_file"):
+ self.response(
+ _("Download finished: %(name)s @ %(plugin)s ") % {"name": pyfile.name, "plugin": pyfile.pluginname})
+ except:
+ pass
+
+ def newCaptchaTask(self, task):
+ if self.getConfig("captcha") and task.isTextual():
+ task.handler.append(self)
+ task.setWaiting(60)
+
+ page = getURL("http://www.freeimagehosting.net/upload.php",
+ post={"attached": (FORM_FILE, task.captchaFile)}, multipart=True)
+
+ url = re.search(r"\[img\]([^\[]+)\[/img\]\[/url\]", page).group(1)
+ self.response(_("New Captcha Request: %s") % url)
+ self.response(_("Answer with 'c %s text on the captcha'") % task.id)
+
+ def run(self):
+ # connect to IRC etc.
+ self.sock = socket.socket()
+ host = self.getConfig("host")
+ self.sock.connect((host, self.getConfig("port")))
+ nick = self.getConfig("nick")
+ self.sock.send("NICK %s\r\n" % nick)
+ self.sock.send("USER %s %s bla :%s\r\n" % (nick, host, nick))
+ for t in self.getConfig("owner").split():
+ if t.strip().startswith("#"):
+ self.sock.send("JOIN %s\r\n" % t.strip())
+ self.logInfo("pyLoad IRC: Connected to %s!" % host)
+ self.logInfo("pyLoad IRC: Switching to listening mode!")
+ try:
+ self.main_loop()
+
+ except IRCError, ex:
+ self.sock.send("QUIT :byebye\r\n")
+ print_exc()
+ self.sock.close()
+
+ def main_loop(self):
+ readbuffer = ""
+ while True:
+ sleep(1)
+ fdset = select([self.sock], [], [], 0)
+ if self.sock not in fdset[0]:
+ continue
+
+ if self.abort:
+ raise IRCError("quit")
+
+ readbuffer += self.sock.recv(1024)
+ temp = readbuffer.split("\n")
+ readbuffer = temp.pop()
+
+ for line in temp:
+ line = line.rstrip()
+ first = line.split()
+
+ if first[0] == "PING":
+ self.sock.send("PONG %s\r\n" % first[1])
+
+ if first[0] == "ERROR":
+ raise IRCError(line)
+
+ msg = line.split(None, 3)
+ if len(msg) < 4:
+ continue
+
+ msg = {
+ "origin": msg[0][1:],
+ "action": msg[1],
+ "target": msg[2],
+ "text": msg[3][1:]
+ }
+
+ self.handle_events(msg)
+
+ def handle_events(self, msg):
+ if not msg["origin"].split("!", 1)[0] in self.getConfig("owner").split():
+ return
+
+ if msg["target"].split("!", 1)[0] != self.getConfig("nick"):
+ return
+
+ if msg["action"] != "PRIVMSG":
+ return
+
+ # HANDLE CTCP ANTI FLOOD/BOT PROTECTION
+ if msg["text"] == "\x01VERSION\x01":
+ self.logDebug("Sending CTCP VERSION.")
+ self.sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface"))
+ return
+ elif msg["text"] == "\x01TIME\x01":
+ self.logDebug("Sending CTCP TIME.")
+ self.sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time()))
+ return
+ elif msg["text"] == "\x01LAG\x01":
+ self.logDebug("Received CTCP LAG.") # don't know how to answer
+ return
+
+ trigger = "pass"
+ args = None
+
+ try:
+ temp = msg["text"].split()
+ trigger = temp[0]
+ if len(temp) > 1:
+ args = temp[1:]
+ except:
+ pass
+
+ handler = getattr(self, "event_%s" % trigger, self.event_pass)
+ try:
+ res = handler(args)
+ for line in res:
+ self.response(line, msg["origin"])
+ except Exception, e:
+ self.logError("pyLoad IRC: " + repr(e))
+
+ def response(self, msg, origin=""):
+ if origin == "":
+ for t in self.getConfig("owner").split():
+ self.sock.send("PRIVMSG %s :%s\r\n" % (t.strip(), msg))
+ else:
+ self.sock.send("PRIVMSG %s :%s\r\n" % (origin.split("!", 1)[0], msg))
+
+ #### Events
+
+ def event_pass(self, args):
+ return []
+
+ def event_status(self, args):
+ downloads = self.api.statusDownloads()
+ if not downloads:
+ return ["INFO: There are no active downloads currently."]
+
+ temp_progress = ""
+ lines = ["ID - Name - Status - Speed - ETA - Progress"]
+ for data in downloads:
+
+ if data.status == 5:
+ temp_progress = data.format_wait
+ else:
+ temp_progress = "%d%% (%s)" % (data.percent, data.format_size)
+
+ lines.append("#%d - %s - %s - %s - %s - %s" %
+ (
+ data.fid,
+ data.name,
+ data.statusmsg,
+ "%s/s" % formatSize(data.speed),
+ "%s" % data.format_eta,
+ temp_progress
+ ))
+ return lines
+
+ def event_queue(self, args):
+ ps = self.api.getQueueData()
+
+ if not ps:
+ return ["INFO: There are no packages in queue."]
+
+ lines = []
+ for pack in ps:
+ lines.append('PACKAGE #%s: "%s" with %d links.' % (pack.pid, pack.name, len(pack.links)))
+
+ return lines
+
+ def event_collector(self, args):
+ ps = self.api.getCollectorData()
+ if not ps:
+ return ["INFO: No packages in collector!"]
+
+ lines = []
+ for pack in ps:
+ lines.append('PACKAGE #%s: "%s" with %d links.' % (pack.pid, pack.name, len(pack.links)))
+
+ return lines
+
+ def event_info(self, args):
+ if not args:
+ return ['ERROR: Use info like this: info <id>']
+
+ info = None
+ try:
+ info = self.api.getFileData(int(args[0]))
+
+ except FileDoesNotExists:
+ return ["ERROR: Link doesn't exists."]
+
+ return ['LINK #%s: %s (%s) [%s][%s]' % (info.fid, info.name, info.format_size, info.statusmsg, info.plugin)]
+
+ def event_packinfo(self, args):
+ if not args:
+ return ['ERROR: Use packinfo like this: packinfo <id>']
+
+ lines = []
+ pack = None
+ try:
+ pack = self.api.getPackageData(int(args[0]))
+
+ except PackageDoesNotExists:
+ return ["ERROR: Package doesn't exists."]
+
+ id = args[0]
+
+ self.more = []
+
+ lines.append('PACKAGE #%s: "%s" with %d links' % (id, pack.name, len(pack.links)))
+ for pyfile in pack.links:
+ self.more.append('LINK #%s: %s (%s) [%s][%s]' % (pyfile.fid, pyfile.name, pyfile.format_size,
+ pyfile.statusmsg, pyfile.plugin))
+
+ if len(self.more) < 6:
+ lines.extend(self.more)
+ self.more = []
+ else:
+ lines.extend(self.more[:6])
+ self.more = self.more[6:]
+ lines.append("%d more links do display." % len(self.more))
+
+ return lines
+
+ def event_more(self, args):
+ if not self.more:
+ return ["No more information to display."]
+
+ lines = self.more[:6]
+ self.more = self.more[6:]
+ lines.append("%d more links do display." % len(self.more))
+
+ return lines
+
+ def event_start(self, args):
+
+ self.api.unpauseServer()
+ return ["INFO: Starting downloads."]
+
+ def event_stop(self, args):
+
+ self.api.pauseServer()
+ return ["INFO: No new downloads will be started."]
+
+ def event_add(self, args):
+ if len(args) < 2:
+ return ['ERROR: Add links like this: "add <packagename|id> links". ',
+ 'This will add the link <link> to to the package <package> / the package with id <id>!']
+
+ pack = args[0].strip()
+ links = [x.strip() for x in args[1:]]
+
+ count_added = 0
+ count_failed = 0
+ try:
+ id = int(pack)
+ pack = self.api.getPackageData(id)
+ if not pack:
+ return ["ERROR: Package doesn't exists."]
+
+ #TODO add links
+
+ return ["INFO: Added %d links to Package %s [#%d]" % (len(links), pack["name"], id)]
+
+ except:
+ # create new package
+ id = self.api.addPackage(pack, links, 1)
+ return ["INFO: Created new Package %s [#%d] with %d links." % (pack, id, len(links))]
+
+ def event_del(self, args):
+ if len(args) < 2:
+ return ["ERROR: Use del command like this: del -p|-l <id> [...] (-p indicates that the ids are from packages, -l indicates that the ids are from links)"]
+
+ if args[0] == "-p":
+ ret = self.api.deletePackages(map(int, args[1:]))
+ return ["INFO: Deleted %d packages!" % len(args[1:])]
+
+ elif args[0] == "-l":
+ ret = self.api.delLinks(map(int, args[1:]))
+ return ["INFO: Deleted %d links!" % len(args[1:])]
+
+ else:
+ return ["ERROR: Use del command like this: del <-p|-l> <id> [...] (-p indicates that the ids are from packages, -l indicates that the ids are from links)"]
+
+ def event_push(self, args):
+ if not args:
+ return ["ERROR: Push package to queue like this: push <package id>"]
+
+ id = int(args[0])
+ try:
+ info = self.api.getPackageInfo(id)
+ except PackageDoesNotExists:
+ return ["ERROR: Package #%d does not exist." % id]
+
+ self.api.pushToQueue(id)
+ return ["INFO: Pushed package #%d to queue." % id]
+
+ def event_pull(self, args):
+ if not args:
+ return ["ERROR: Pull package from queue like this: pull <package id>."]
+
+ id = int(args[0])
+ if not self.api.getPackageData(id):
+ return ["ERROR: Package #%d does not exist." % id]
+
+ self.api.pullFromQueue(id)
+ return ["INFO: Pulled package #%d from queue to collector." % id]
+
+ def event_c(self, args):
+ """ captcha answer """
+ if not args:
+ return ["ERROR: Captcha ID missing."]
+
+ task = self.core.captchaManager.getTaskByID(args[0])
+ if not task:
+ return ["ERROR: Captcha Task with ID %s does not exists." % args[0]]
+
+ task.setResult(" ".join(args[1:]))
+ return ["INFO: Result %s saved." % " ".join(args[1:])]
+
+ def event_help(self, args):
+ lines = ["The following commands are available:",
+ "add <package|packid> <links> [...] Adds link to package. (creates new package if it does not exist)",
+ "queue Shows all packages in the queue",
+ "collector Shows all packages in collector",
+ "del -p|-l <id> [...] Deletes all packages|links with the ids specified",
+ "info <id> Shows info of the link with id <id>",
+ "packinfo <id> Shows info of the package with id <id>",
+ "more Shows more info when the result was truncated",
+ "start Starts all downloads",
+ "stop Stops the download (but not abort active downloads)",
+ "push <id> Push package to queue",
+ "pull <id> Pull package from queue",
+ "status Show general download status",
+ "help Shows this help message"]
+ return lines
+
+
+class IRCError(Exception):
+ def __init__(self, value):
+ self.value = value
+
+ def __str__(self):
+ return repr(self.value)
diff --git a/pyload/plugins/addons/ImageTyperz.py b/pyload/plugins/addons/ImageTyperz.py
new file mode 100644
index 000000000..c9e43b8ae
--- /dev/null
+++ b/pyload/plugins/addons/ImageTyperz.py
@@ -0,0 +1,151 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: mkaay, RaNaN, zoidberg
+"""
+from __future__ import with_statement
+from thread import start_new_thread
+from pycurl import FORM_FILE, LOW_SPEED_TIME
+import re
+from base64 import b64encode
+
+from module.network.RequestFactory import getURL, getRequest
+from module.plugins.Hook import Hook
+
+
+class ImageTyperzException(Exception):
+ def __init__(self, err):
+ self.err = err
+
+ def getCode(self):
+ return self.err
+
+ def __str__(self):
+ return "<ImageTyperzException %s>" % self.err
+
+ def __repr__(self):
+ return "<ImageTyperzException %s>" % self.err
+
+
+class ImageTyperz(Hook):
+ __name__ = "ImageTyperz"
+ __version__ = "0.04"
+ __description__ = """send captchas to ImageTyperz.com"""
+ __config__ = [("activated", "bool", "Activated", False),
+ ("username", "str", "Username", ""),
+ ("passkey", "password", "Password", ""),
+ ("force", "bool", "Force IT even if client is connected", False)]
+ __author_name__ = ("RaNaN", "zoidberg")
+ __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz")
+
+ SUBMIT_URL = "http://captchatypers.com/Forms/UploadFileAndGetTextNEW.ashx"
+ RESPOND_URL = "http://captchatypers.com/Forms/SetBadImage.ashx"
+ GETCREDITS_URL = "http://captchatypers.com/Forms/RequestBalance.ashx"
+
+ def setup(self):
+ self.info = {}
+
+ def getCredits(self):
+ response = getURL(self.GETCREDITS_URL, post={"action": "REQUESTBALANCE", "username": self.getConfig("username"),
+ "password": self.getConfig("passkey")})
+
+ if response.startswith('ERROR'):
+ raise ImageTyperzException(response)
+
+ try:
+ balance = float(response)
+ except:
+ raise ImageTyperzException("invalid response")
+
+ self.logInfo("Account balance: $%s left" % response)
+ return balance
+
+ def submit(self, captcha, captchaType="file", match=None):
+ req = getRequest()
+ #raise timeout threshold
+ req.c.setopt(LOW_SPEED_TIME, 80)
+
+ try:
+ #workaround multipart-post bug in HTTPRequest.py
+ if re.match("^[A-Za-z0-9]*$", self.getConfig("passkey")):
+ multipart = True
+ data = (FORM_FILE, captcha)
+ else:
+ multipart = False
+ with open(captcha, 'rb') as f:
+ data = f.read()
+ data = b64encode(data)
+
+ response = req.load(self.SUBMIT_URL, post={"action": "UPLOADCAPTCHA",
+ "username": self.getConfig("username"),
+ "password": self.getConfig("passkey"), "file": data},
+ multipart=multipart)
+ finally:
+ req.close()
+
+ if response.startswith("ERROR"):
+ raise ImageTyperzException(response)
+ else:
+ data = response.split('|')
+ if len(data) == 2:
+ ticket, result = data
+ else:
+ raise ImageTyperzException("Unknown response %s" % response)
+
+ return ticket, result
+
+ def newCaptchaTask(self, task):
+ if "service" in task.data:
+ return False
+
+ if not task.isTextual():
+ return False
+
+ if not self.getConfig("username") or not self.getConfig("passkey"):
+ return False
+
+ if self.core.isClientConnected() and not self.getConfig("force"):
+ return False
+
+ if self.getCredits() > 0:
+ task.handler.append(self)
+ task.data['service'] = self.__name__
+ task.setWaiting(100)
+ start_new_thread(self.processCaptcha, (task,))
+
+ else:
+ self.logInfo("Your %s account has not enough credits" % self.__name__)
+
+ def captchaInvalid(self, task):
+ if task.data['service'] == self.__name__ and "ticket" in task.data:
+ response = getURL(self.RESPOND_URL, post={"action": "SETBADIMAGE", "username": self.getConfig("username"),
+ "password": self.getConfig("passkey"),
+ "imageid": task.data["ticket"]})
+
+ if response == "SUCCESS":
+ self.logInfo("Bad captcha solution received, requested refund")
+ else:
+ self.logError("Bad captcha solution received, refund request failed", response)
+
+ def processCaptcha(self, task):
+ c = task.captchaFile
+ try:
+ ticket, result = self.submit(c)
+ except ImageTyperzException, e:
+ task.error = e.getCode()
+ return
+
+ task.data["ticket"] = ticket
+ task.setResult(result)
diff --git a/pyload/plugins/addons/LinkdecrypterCom.py b/pyload/plugins/addons/LinkdecrypterCom.py
new file mode 100644
index 000000000..f2176e799
--- /dev/null
+++ b/pyload/plugins/addons/LinkdecrypterCom.py
@@ -0,0 +1,60 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+
+from module.plugins.Hook import Hook
+from module.network.RequestFactory import getURL
+from module.utils import remove_chars
+
+
+class LinkdecrypterCom(Hook):
+ __name__ = "LinkdecrypterCom"
+ __version__ = "0.18"
+ __description__ = """linkdecrypter.com - regexp loader"""
+ __config__ = [("activated", "bool", "Activated", "False")]
+ __author_name__ = ("zoidberg")
+
+ def coreReady(self):
+ page = getURL("http://linkdecrypter.com/")
+ m = re.search(r'<b>Supported\(\d+\)</b>: <i>([^+<]*)', page)
+ if not m:
+ self.logError(_("Crypter list not found"))
+ return
+
+ builtin = [name.lower() for name in self.core.pluginManager.crypterPlugins.keys()]
+ builtin.extend(["downloadserienjunkiesorg"])
+
+ crypter_pattern = re.compile("(\w[\w.-]+)")
+ online = []
+ for crypter in m.group(1).split(', '):
+ m = re.match(crypter_pattern, crypter)
+ if m and remove_chars(m.group(1), "-.") not in builtin:
+ online.append(m.group(1).replace(".", "\\."))
+
+ if not online:
+ self.logError(_("Crypter list is empty"))
+ return
+
+ regexp = r"https?://([^.]+\.)*?(%s)/.*" % "|".join(online)
+
+ dict = self.core.pluginManager.crypterPlugins[self.__name__]
+ dict["pattern"] = regexp
+ dict["re"] = re.compile(regexp)
+
+ self.logDebug("REGEXP: " + regexp)
diff --git a/pyload/plugins/addons/MergeFiles.py b/pyload/plugins/addons/MergeFiles.py
new file mode 100644
index 000000000..869b5b6f8
--- /dev/null
+++ b/pyload/plugins/addons/MergeFiles.py
@@ -0,0 +1,90 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: and9000
+"""
+
+import os
+import re
+import traceback
+
+from os.path import join
+from module.utils import save_join, fs_encode
+from module.plugins.Hook import Hook
+
+BUFFER_SIZE = 4096
+
+
+class MergeFiles(Hook):
+ __name__ = "MergeFiles"
+ __version__ = "0.12"
+ __description__ = "Merges parts splitted with hjsplit"
+ __config__ = [("activated", "bool", "Activated", "False")]
+ __threaded__ = ["packageFinished"]
+ __author_name__ = ("and9000")
+ __author_mail__ = ("me@has-no-mail.com")
+
+ def setup(self):
+ # nothing to do
+ pass
+
+ def packageFinished(self, pack):
+ files = {}
+ fid_dict = {}
+ for fid, data in pack.getChildren().iteritems():
+ if re.search("\.[0-9]{3}$", data["name"]):
+ if data["name"][:-4] not in files:
+ files[data["name"][:-4]] = []
+ files[data["name"][:-4]].append(data["name"])
+ files[data["name"][:-4]].sort()
+ fid_dict[data["name"]] = fid
+
+ download_folder = self.config['general']['download_folder']
+
+ if self.config['general']['folder_per_package']:
+ download_folder = save_join(download_folder, pack.folder)
+
+ for name, file_list in files.iteritems():
+ self.logInfo("Starting merging of %s" % name)
+ final_file = open(join(download_folder, fs_encode(name)), "wb")
+
+ for splitted_file in file_list:
+ self.logDebug("Merging part %s" % splitted_file)
+ pyfile = self.core.files.getFile(fid_dict[splitted_file])
+ pyfile.setStatus("processing")
+ try:
+ s_file = open(os.path.join(download_folder, splitted_file), "rb")
+ size_written = 0
+ s_file_size = int(os.path.getsize(os.path.join(download_folder, splitted_file)))
+ while True:
+ f_buffer = s_file.read(BUFFER_SIZE)
+ if f_buffer:
+ final_file.write(f_buffer)
+ size_written += BUFFER_SIZE
+ pyfile.setProgress((size_written * 100) / s_file_size)
+ else:
+ break
+ s_file.close()
+ self.logDebug("Finished merging part %s" % splitted_file)
+ except Exception, e:
+ print traceback.print_exc()
+ finally:
+ pyfile.setProgress(100)
+ pyfile.setStatus("finished")
+ pyfile.release()
+
+ final_file.close()
+ self.logInfo("Finished merging of %s" % name)
diff --git a/pyload/plugins/addons/MultiHome.py b/pyload/plugins/addons/MultiHome.py
new file mode 100644
index 000000000..473e6dcb1
--- /dev/null
+++ b/pyload/plugins/addons/MultiHome.py
@@ -0,0 +1,87 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: mkaay
+"""
+
+from time import time
+
+from module.plugins.Hook import Hook
+
+
+class MultiHome(Hook):
+ __name__ = "MultiHome"
+ __version__ = "0.11"
+ __description__ = """ip address changer"""
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("interfaces", "str", "Interfaces", "None")]
+ __author_name__ = ("mkaay")
+ __author_mail__ = ("mkaay@mkaay.de")
+
+ def setup(self):
+ self.register = {}
+ self.interfaces = []
+ self.parseInterfaces(self.getConfig("interfaces").split(";"))
+ if not self.interfaces:
+ self.parseInterfaces([self.config["download"]["interface"]])
+ self.setConfig("interfaces", self.toConfig())
+
+ def toConfig(self):
+ return ";".join([i.adress for i in self.interfaces])
+
+ def parseInterfaces(self, interfaces):
+ for interface in interfaces:
+ if not interface or str(interface).lower() == "none":
+ continue
+ self.interfaces.append(Interface(interface))
+
+ def coreReady(self):
+ requestFactory = self.core.requestFactory
+ oldGetRequest = requestFactory.getRequest
+
+ def getRequest(pluginName, account=None):
+ iface = self.bestInterface(pluginName, account)
+ if iface:
+ iface.useFor(pluginName, account)
+ requestFactory.iface = lambda: iface.adress
+ self.logDebug("Multihome: using address: " + iface.adress)
+ return oldGetRequest(pluginName, account)
+
+ requestFactory.getRequest = getRequest
+
+ def bestInterface(self, pluginName, account):
+ best = None
+ for interface in self.interfaces:
+ if not best or interface.lastPluginAccess(pluginName, account) < best.lastPluginAccess(pluginName, account):
+ best = interface
+ return best
+
+
+class Interface(object):
+ def __init__(self, adress):
+ self.adress = adress
+ self.history = {}
+
+ def lastPluginAccess(self, pluginName, account):
+ if (pluginName, account) in self.history:
+ return self.history[(pluginName, account)]
+ return 0
+
+ def useFor(self, pluginName, account):
+ self.history[(pluginName, account)] = time()
+
+ def __repr__(self):
+ return "<Interface - %s>" % self.adress
diff --git a/pyload/plugins/addons/MultiHoster.py b/pyload/plugins/addons/MultiHoster.py
new file mode 100644
index 000000000..2d4029dd6
--- /dev/null
+++ b/pyload/plugins/addons/MultiHoster.py
@@ -0,0 +1,97 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from types import MethodType
+
+from pyload.plugins.MultiHoster import MultiHoster as MultiHosterAccount, normalize
+from pyload.plugins.Addon import Addon, AddEventListener
+from pyload.PluginManager import PluginMatcher
+
+class MultiHoster(Addon, PluginMatcher):
+ __version__ = "0.1"
+ __internal__ = True
+ __description__ = "Gives ability to use MultiHoster services."
+ __config__ = []
+ __author__ = ("pyLoad Team",)
+ __author_mail__ = ("support@pyload.org",)
+
+ #TODO: multiple accounts - multihoster / config options
+ # TODO: rewrite for new plugin manager
+
+ def init(self):
+
+ # overwritten plugins
+ self.plugins = {}
+
+ def addHoster(self, account):
+
+ self.logInfo(_("Activated %s") % account.__name__)
+
+ pluginMap = {}
+ for name in self.core.pluginManager.getPlugins("hoster").keys():
+ pluginMap[name.lower()] = name
+
+ supported = []
+ new_supported = []
+
+ for hoster in account.getHosterList():
+ name = normalize(hoster)
+
+ if name in pluginMap:
+ supported.append(pluginMap[name])
+ else:
+ new_supported.append(hoster)
+
+ if not supported and not new_supported:
+ account.logError(_("No Hoster loaded"))
+ return
+
+ klass = self.core.pluginManager.getPluginClass(account.__name__)
+
+ # inject plugin plugin
+ account.logDebug("Overwritten Hosters: %s" % ", ".join(sorted(supported)))
+ for hoster in supported:
+ self.plugins[hoster] = klass
+
+ account.logDebug("New Hosters: %s" % ", ".join(sorted(new_supported)))
+
+ # create new regexp
+ patterns = [x.replace(".", "\\.") for x in new_supported]
+
+ if klass.__pattern__:
+ patterns.append(klass.__pattern__)
+
+ regexp = r".*(%s).*" % "|".join(patterns)
+
+ # recreate plugin tuple for new regexp
+ hoster = self.core.pluginManager.getPlugins("hoster")
+ p = hoster[account.__name__]
+ new = PluginTuple(p.version, re.compile(regexp), p.deps, p.category, p.user, p.path)
+ hoster[account.__name__] = new
+
+
+ @AddEventListener("account:deleted")
+ def refreshAccounts(self, plugin=None, loginname=None):
+ self.logDebug("Re-checking accounts")
+
+ self.plugins = {}
+ for plugin, account in self.core.accountManager.iterAccounts():
+ if isinstance(account, MultiHosterAccount) and account.isUsable():
+ self.addHoster(account)
+
+ @AddEventListener("account:updated")
+ def refreshAccount(self, acc):
+
+ account = self.core.accountManager.getAccount(acc.plugin, acc.loginname)
+ if isinstance(account, MultiHosterAccount) and account.isUsable():
+ self.addHoster(account)
+
+ def activate(self):
+ self.refreshAccounts()
+
+ self.core.pluginManager.addMatcher(self)
+ def deactivate(self):
+
+ self.core.pluginManager.removeMatcher(self)
+
diff --git a/pyload/plugins/addons/MultishareCz.py b/pyload/plugins/addons/MultishareCz.py
new file mode 100644
index 000000000..fc35bb785
--- /dev/null
+++ b/pyload/plugins/addons/MultishareCz.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.network.RequestFactory import getURL
+from module.plugins.internal.MultiHoster import MultiHoster
+
+
+class MultishareCz(MultiHoster):
+ __name__ = "MultishareCz"
+ __version__ = "0.04"
+ __type__ = "hook"
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"),
+ ("hosterList", "str", "Hoster list (comma separated)", "uloz.to")]
+ __description__ = """MultiShare.cz hook plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ HOSTER_PATTERN = r'<img class="logo-shareserveru"[^>]*?alt="([^"]+)"></td>\s*<td class="stav">[^>]*?alt="OK"'
+
+ def getHoster(self):
+ page = getURL("http://www.multishare.cz/monitoring/")
+ return re.findall(self.HOSTER_PATTERN, page)
diff --git a/pyload/plugins/addons/Premium4Me.py b/pyload/plugins/addons/Premium4Me.py
new file mode 100644
index 000000000..4bcc79b25
--- /dev/null
+++ b/pyload/plugins/addons/Premium4Me.py
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+
+from module.network.RequestFactory import getURL
+from module.plugins.internal.MultiHoster import MultiHoster
+
+
+class Premium4Me(MultiHoster):
+ __name__ = "Premium4Me"
+ __version__ = "0.03"
+ __type__ = "hook"
+
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("hosterListMode", "all;listed;unlisted", "Use for downloads from supported hosters:", "all"),
+ ("hosterList", "str", "Hoster list (comma separated)", "")]
+ __description__ = """Premium.to hook plugin"""
+ __author_name__ = ("RaNaN", "zoidberg", "stickell")
+ __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+
+ def getHoster(self):
+ page = getURL("http://premium.to/api/hosters.php?authcode=%s" % self.account.authcode)
+ return [x.strip() for x in page.replace("\"", "").split(";")]
+
+ def coreReady(self):
+ self.account = self.core.accountManager.getAccountPlugin("Premium4Me")
+
+ user = self.account.selectAccount()[0]
+
+ if not user:
+ self.logError(_("Please add your premium.to account first and restart pyLoad"))
+ return
+
+ return MultiHoster.coreReady(self)
diff --git a/pyload/plugins/addons/PremiumizeMe.py b/pyload/plugins/addons/PremiumizeMe.py
new file mode 100644
index 000000000..07630420c
--- /dev/null
+++ b/pyload/plugins/addons/PremiumizeMe.py
@@ -0,0 +1,52 @@
+from module.plugins.internal.MultiHoster import MultiHoster
+
+from module.common.json_layer import json_loads
+from module.network.RequestFactory import getURL
+
+
+class PremiumizeMe(MultiHoster):
+ __name__ = "PremiumizeMe"
+ __version__ = "0.12"
+ __type__ = "hook"
+ __description__ = """Premiumize.Me hook plugin"""
+
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"),
+ ("hosterList", "str", "Hoster list (comma separated)", ""),
+ ("unloadFailing", "bool", "Revert to stanard download if download fails", "False"),
+ ("interval", "int", "Reload interval in hours (0 to disable)", "24")]
+
+ __author_name__ = ("Florian Franzen")
+ __author_mail__ = ("FlorianFranzen@gmail.com")
+
+ def getHoster(self):
+ # If no accounts are available there will be no hosters available
+ if not self.account or not self.account.canUse():
+ return []
+
+ # Get account data
+ (user, data) = self.account.selectAccount()
+
+ # Get supported hosters list from premiumize.me using the
+ # json API v1 (see https://secure.premiumize.me/?show=api)
+ answer = getURL("https://api.premiumize.me/pm-api/v1.php?method=hosterlist&params[login]=%s&params[pass]=%s" % (
+ user, data['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 coreReady(self):
+ # Get account plugin and check if there is a valid account available
+ self.account = self.core.accountManager.getAccountPlugin("PremiumizeMe")
+ if not self.account.canUse():
+ self.account = None
+ self.logError(_("Please add a valid premiumize.me account first and restart pyLoad."))
+ return
+
+ # Run the overwriten core ready which actually enables the multihoster hook
+ return MultiHoster.coreReady(self)
diff --git a/pyload/plugins/addons/RPNetBiz.py b/pyload/plugins/addons/RPNetBiz.py
new file mode 100644
index 000000000..69976ffc9
--- /dev/null
+++ b/pyload/plugins/addons/RPNetBiz.py
@@ -0,0 +1,47 @@
+from module.plugins.internal.MultiHoster import MultiHoster
+from module.common.json_layer import json_loads
+from module.network.RequestFactory import getURL
+
+
+class RPNetBiz(MultiHoster):
+ __name__ = "RPNetBiz"
+ __version__ = "0.1"
+ __type__ = "hook"
+ __description__ = """RPNet.Biz hook plugin"""
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"),
+ ("hosterList", "str", "Hoster list (comma separated)", ""),
+ ("unloadFailing", "bool", "Revert to stanard download if download fails", "False"),
+ ("interval", "int", "Reload interval in hours (0 to disable)", "24")]
+ __author_name__ = ("Dman")
+ __author_mail__ = ("dmanugm@gmail.com")
+
+ def getHoster(self):
+ # No hosts supported if no account
+ if not self.account or not self.account.canUse():
+ return []
+
+ # Get account data
+ (user, data) = self.account.selectAccount()
+
+ response = getURL("https://premium.rpnet.biz/client_api.php",
+ get={"username": user, "password": data['password'], "action": "showHosterList"})
+ hoster_list = json_loads(response)
+
+ # 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 coreReady(self):
+ # Get account plugin and check if there is a valid account available
+ self.account = self.core.accountManager.getAccountPlugin("RPNetBiz")
+ if not self.account.canUse():
+ self.account = None
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "rpnet")
+ return
+
+ # Run the overwriten core ready which actually enables the multihoster hook
+ return MultiHoster.coreReady(self)
diff --git a/pyload/plugins/addons/RealdebridCom.py b/pyload/plugins/addons/RealdebridCom.py
new file mode 100644
index 000000000..41e988495
--- /dev/null
+++ b/pyload/plugins/addons/RealdebridCom.py
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+
+from module.network.RequestFactory import getURL
+from module.plugins.internal.MultiHoster import MultiHoster
+
+
+class RealdebridCom(MultiHoster):
+ __name__ = "RealdebridCom"
+ __version__ = "0.43"
+ __type__ = "hook"
+
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("https", "bool", "Enable HTTPS", "False"),
+ ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"),
+ ("hosterList", "str", "Hoster list (comma separated)", ""),
+ ("unloadFailing", "bool", "Revert to stanard download if download fails", "False"),
+ ("interval", "int", "Reload interval in hours (0 to disable)", "24")]
+ __description__ = """Real-Debrid.com hook plugin"""
+ __author_name__ = ("Devirex, Hazzard")
+ __author_mail__ = ("naibaf_11@yahoo.de")
+
+ def getHoster(self):
+ https = "https" if self.getConfig("https") else "http"
+ page = getURL(https + "://real-debrid.com/api/hosters.php").replace("\"", "").strip()
+
+ return [x.strip() for x in page.split(",") if x.strip()]
diff --git a/pyload/plugins/addons/RehostTo.py b/pyload/plugins/addons/RehostTo.py
new file mode 100644
index 000000000..6e24988c8
--- /dev/null
+++ b/pyload/plugins/addons/RehostTo.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+
+from module.network.RequestFactory import getURL
+from module.plugins.internal.MultiHoster import MultiHoster
+
+
+class RehostTo(MultiHoster):
+ __name__ = "RehostTo"
+ __version__ = "0.43"
+ __type__ = "hook"
+
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"),
+ ("hosterList", "str", "Hoster list (comma separated)", ""),
+ ("unloadFailing", "bool", "Revert to stanard download if download fails", "False"),
+ ("interval", "int", "Reload interval in hours (0 to disable)", "24")]
+
+ __description__ = """rehost.to hook plugin"""
+ __author_name__ = ("RaNaN")
+ __author_mail__ = ("RaNaN@pyload.org")
+
+ def getHoster(self):
+ page = getURL("http://rehost.to/api.php?cmd=get_supported_och_dl&long_ses=%s" % self.long_ses)
+ return [x.strip() for x in page.replace("\"", "").split(",")]
+
+ def coreReady(self):
+ self.account = self.core.accountManager.getAccountPlugin("RehostTo")
+
+ user = self.account.selectAccount()[0]
+
+ if not user:
+ self.logError("Rehost.to: " + _("Please add your rehost.to account first and restart pyLoad"))
+ return
+
+ data = self.account.getAccountInfo(user)
+ self.ses = data["ses"]
+ self.long_ses = data["long_ses"]
+
+ return MultiHoster.coreReady(self)
diff --git a/pyload/plugins/addons/ReloadCc.py b/pyload/plugins/addons/ReloadCc.py
new file mode 100644
index 000000000..d07923624
--- /dev/null
+++ b/pyload/plugins/addons/ReloadCc.py
@@ -0,0 +1,65 @@
+from module.plugins.internal.MultiHoster import MultiHoster
+
+from module.common.json_layer import json_loads
+from module.network.RequestFactory import getURL
+
+
+class ReloadCc(MultiHoster):
+ __name__ = "ReloadCc"
+ __version__ = "0.3"
+ __type__ = "hook"
+ __description__ = """Reload.cc hook plugin"""
+
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"),
+ ("hosterList", "str", "Hoster list (comma separated)", "")]
+
+ __author_name__ = ("Reload Team")
+ __author_mail__ = ("hello@reload.cc")
+
+ interval = 0 # Disable periodic calls
+
+ def getHoster(self):
+ # If no accounts are available there will be no hosters available
+ if not self.account or not self.account.canUse():
+ print "ReloadCc: No accounts available"
+ return []
+
+ # Get account data
+ (user, data) = self.account.selectAccount()
+
+ # Get supported hosters list from reload.cc using the json API v1
+ query_params = dict(
+ via='pyload',
+ v=1,
+ get_supported='true',
+ get_traffic='true',
+ user=user
+ )
+
+ try:
+ query_params.update(dict(hash=self.account.infos[user]['pwdhash']))
+ except Exception:
+ query_params.update(dict(pwd=data['password']))
+
+ answer = getURL("http://api.reload.cc/login", get=query_params)
+ data = json_loads(answer)
+
+ # If account is not valid thera are no hosters available
+ if data['status'] != "ok":
+ print "ReloadCc: Status is not ok: %s" % data['status']
+ return []
+
+ # Extract hosters from json file
+ return data['msg']['supportedHosters']
+
+ def coreReady(self):
+ # Get account plugin and check if there is a valid account available
+ self.account = self.core.accountManager.getAccountPlugin("ReloadCc")
+ if not self.account.canUse():
+ self.account = None
+ self.logError("Please add a valid reload.cc account first and restart pyLoad.")
+ return
+
+ # Run the overwriten core ready which actually enables the multihoster hook
+ return MultiHoster.coreReady(self)
diff --git a/pyload/plugins/addons/RestartFailed.py b/pyload/plugins/addons/RestartFailed.py
new file mode 100644
index 000000000..3bf6fe365
--- /dev/null
+++ b/pyload/plugins/addons/RestartFailed.py
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.Hook import Hook
+
+
+class RestartFailed(Hook):
+ __name__ = "RestartFailed"
+ __version__ = "1.52"
+ __description__ = "restartedFailed Packages after defined time"
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("interval", "int", "Interval in Minutes", "15")]
+
+ __author_name__ = ("bambie")
+ __author_mail__ = ("bambie@gulli.com")
+
+ interval = 300
+
+ def setup(self):
+ self.info = {"running": False}
+
+ def coreReady(self):
+ self.info["running"] = True
+ self.logInfo("loaded")
+ self.interval = self.getConfig("interval") * 60
+ self.logDebug("interval is set to %s" % self.interval)
+
+ def periodical(self):
+ self.logDebug("periodical called")
+ if self.getConfig("interval") * 60 != self.interval:
+ self.interval = self.getConfig("interval") * 60
+ self.logDebug("interval is set to %s" % self.interval)
+ self.core.api.restartFailed()
diff --git a/pyload/plugins/addons/SimplydebridCom.py b/pyload/plugins/addons/SimplydebridCom.py
new file mode 100644
index 000000000..3272df567
--- /dev/null
+++ b/pyload/plugins/addons/SimplydebridCom.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+
+from module.network.RequestFactory import getURL
+from module.plugins.internal.MultiHoster import MultiHoster
+
+
+class SimplydebridCom(MultiHoster):
+ __name__ = "SimplydebridCom"
+ __version__ = "0.01"
+ __type__ = "hook"
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"),
+ ("hosterList", "str", "Hoster list (comma separated)", "")]
+ __description__ = """Simply-Debrid.com hook plugin"""
+ __author_name__ = ("Kagenoshin")
+ __author_mail__ = ("kagenoshin@gmx.ch")
+
+ def getHoster(self):
+ page = getURL("http://simply-debrid.com/api.php?list=1")
+ return [x.strip() for x in page.rstrip(';').replace("\"", "").split(";")]
diff --git a/pyload/plugins/addons/SkipRev.py b/pyload/plugins/addons/SkipRev.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/pyload/plugins/addons/SkipRev.py
diff --git a/pyload/plugins/addons/UnSkipOnFail.py b/pyload/plugins/addons/UnSkipOnFail.py
new file mode 100644
index 000000000..455832b09
--- /dev/null
+++ b/pyload/plugins/addons/UnSkipOnFail.py
@@ -0,0 +1,97 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: hgg
+"""
+from os.path import basename
+
+from module.utils import fs_encode
+from module.plugins.Hook import Hook
+from module.PyFile import PyFile
+
+
+class UnSkipOnFail(Hook):
+ __name__ = 'UnSkipOnFail'
+ __version__ = '0.01'
+ __description__ = 'When a download fails, restart "skipped" duplicates.'
+ __config__ = [('activated', 'bool', 'Activated', True), ]
+ __author_name__ = ('hagg',)
+ __author_mail__ = ('')
+
+ def downloadFailed(self, pyfile):
+ pyfile_name = basename(pyfile.name)
+ pid = pyfile.package().id
+ msg = 'look for skipped duplicates for %s (pid:%s)...'
+ self.logInfo(msg % (pyfile_name, pid))
+ dups = self.findDuplicates(pyfile)
+ for link in dups:
+ # check if link is "skipped"(=4)
+ if link.status == 4:
+ lpid = link.packageID
+ self.logInfo('restart "%s" (pid:%s)...' % (pyfile_name, lpid))
+ self.setLinkStatus(link, "queued")
+
+ def findDuplicates(self, pyfile):
+ """ Search all packages for duplicate links to "pyfile".
+ Duplicates are links that would overwrite "pyfile".
+ To test on duplicity the package-folder and link-name
+ of twolinks are compared (basename(link.name)).
+ So this method returns a list of all links with equal
+ package-folders and filenames as "pyfile", but except
+ the data for "pyfile" iotselöf.
+ It does MOT check the link's status.
+ """
+ dups = []
+ pyfile_name = fs_encode(basename(pyfile.name))
+ # get packages (w/o files, as most file data is useless here)
+ queue = self.core.api.getQueue()
+ for package in queue:
+ # check if package-folder equals pyfile's package folder
+ if fs_encode(package.folder) == fs_encode(pyfile.package().folder):
+ # now get packaged data w/ files/links
+ pdata = self.core.api.getPackageData(package.pid)
+ if pdata.links:
+ for link in pdata.links:
+ link_name = fs_encode(basename(link.name))
+ # check if link name collides with pdata's name
+ if link_name == pyfile_name:
+ # at last check if it is not pyfile itself
+ if link.fid != pyfile.id:
+ dups.append(link)
+ return dups
+
+ def setLinkStatus(self, link, new_status):
+ """ Change status of "link" to "new_status".
+ "link" has to be a valid FileData object,
+ "new_status" has to be a valid status name
+ (i.e. "queued" for this Plugin)
+ It creates a temporary PyFile object using
+ "link" data, changes its status, and tells
+ the core.files-manager to save its data.
+ """
+ pyfile = PyFile(self.core.files,
+ link.fid,
+ link.url,
+ link.name,
+ link.size,
+ link.status,
+ link.error,
+ link.plugin,
+ link.packageID,
+ link.order)
+ pyfile.setStatus(new_status)
+ self.core.files.save()
+ pyfile.release()
diff --git a/pyload/plugins/addons/UpdateManager.py b/pyload/plugins/addons/UpdateManager.py
new file mode 100644
index 000000000..62031e6a4
--- /dev/null
+++ b/pyload/plugins/addons/UpdateManager.py
@@ -0,0 +1,202 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: RaNaN
+"""
+
+import sys
+import re
+from os import stat
+from os.path import join, exists
+from time import time
+
+from module.ConfigParser import IGNORE
+from module.network.RequestFactory import getURL
+from module.plugins.Hook import threaded, Expose, Hook
+
+
+class UpdateManager(Hook):
+ __name__ = "UpdateManager"
+ __version__ = "0.15"
+ __description__ = """checks for updates"""
+ __config__ = [("activated", "bool", "Activated", "True"),
+ ("interval", "int", "Check interval in minutes", "480"),
+ ("debug", "bool", "Check for plugin changes when in debug mode", False)]
+ __author_name__ = ("RaNaN")
+ __author_mail__ = ("ranan@pyload.org")
+
+ URL = "http://get.pyload.org/check2/%s/"
+ MIN_TIME = 3 * 60 * 60 # 3h minimum check interval
+
+ @property
+ def debug(self):
+ return self.core.debug and self.getConfig("debug")
+
+ def setup(self):
+ if self.debug:
+ self.logDebug("Monitoring file changes")
+ self.interval = 4
+ self.last_check = 0 # timestamp of updatecheck
+ self.old_periodical = self.periodical
+ self.periodical = self.checkChanges
+ self.mtimes = {} # recordes times
+ else:
+ self.interval = max(self.getConfig("interval") * 60, self.MIN_TIME)
+
+ self.updated = False
+ self.reloaded = True
+ self.version = "None"
+
+ self.info = {"pyload": False, "plugins": False}
+
+ @threaded
+ def periodical(self):
+
+ updates = self.checkForUpdate()
+ if updates:
+ self.checkPlugins(updates)
+
+ if self.updated and not self.reloaded:
+ self.info["plugins"] = True
+ self.logInfo(_("*** Plugins have been updated, please restart pyLoad ***"))
+ elif self.updated and self.reloaded:
+ self.logInfo(_("Plugins updated and reloaded"))
+ self.updated = False
+ elif self.version == "None":
+ self.logInfo(_("No plugin updates available"))
+
+ @Expose
+ def recheckForUpdates(self):
+ """recheck if updates are available"""
+ self.periodical()
+
+ def checkForUpdate(self):
+ """checks if an update is available, return result"""
+
+ try:
+ if self.version == "None": # No updated known
+ version_check = getURL(self.URL % self.core.api.getServerVersion()).splitlines()
+ self.version = version_check[0]
+
+ # Still no updates, plugins will be checked
+ if self.version == "None":
+ self.logInfo(_("No Updates for pyLoad"))
+ return version_check[1:]
+
+ self.info["pyload"] = True
+ self.logInfo(_("*** New pyLoad Version %s available ***") % self.version)
+ self.logInfo(_("*** Get it here: http://pyload.org/download ***"))
+
+ except:
+ self.logWarning(_("Not able to connect server for updates"))
+
+ return None # Nothing will be done
+
+ def checkPlugins(self, updates):
+ """ checks for plugins updates"""
+
+ # plugins were already updated
+ if self.info["plugins"]:
+ return
+
+ reloads = []
+
+ vre = re.compile(r'__version__.*=.*("|\')([0-9.]+)')
+ url = updates[0]
+ schema = updates[1].split("|")
+ updates = updates[2:]
+
+ for plugin in updates:
+ info = dict(zip(schema, plugin.split("|")))
+ filename = info["name"]
+ prefix = info["type"]
+ version = info["version"]
+
+ if filename.endswith(".pyc"):
+ name = filename[:filename.find("_")]
+ else:
+ name = filename.replace(".py", "")
+
+ #TODO: obsolete in 0.5.0
+ if prefix.endswith("s"):
+ type = prefix[:-1]
+ else:
+ type = prefix
+
+ plugins = getattr(self.core.pluginManager, "%sPlugins" % type)
+
+ if name in plugins:
+ if float(plugins[name]["v"]) >= float(version):
+ continue
+
+ if name in IGNORE or (type, name) in IGNORE:
+ continue
+
+ self.logInfo(_("New version of %(type)s|%(name)s : %(version).2f") % {
+ "type": type,
+ "name": name,
+ "version": float(version)
+ })
+
+ try:
+ content = getURL(url % info)
+ except Exception, e:
+ self.logWarning(_("Error when updating %s") % filename, str(e))
+ continue
+
+ m = vre.search(content)
+ if not m or m.group(2) != version:
+ self.logWarning(_("Error when updating %s") % name, _("Version mismatch"))
+ continue
+
+ f = open(join("userplugins", prefix, filename), "wb")
+ f.write(content)
+ f.close()
+ self.updated = True
+
+ reloads.append((prefix, name))
+
+ self.reloaded = self.core.pluginManager.reloadPlugins(reloads)
+
+ def checkChanges(self):
+
+ if self.last_check + max(self.getConfig("interval") * 60, self.MIN_TIME) < time():
+ self.old_periodical()
+ self.last_check = time()
+
+ modules = filter(
+ lambda m: m and (m.__name__.startswith("module.plugins.") or m.__name__.startswith(
+ "userplugins.")) and m.__name__.count(".") >= 2, sys.modules.itervalues())
+
+ reloads = []
+
+ for m in modules:
+ root, type, name = m.__name__.rsplit(".", 2)
+ id = (type, name)
+ if type in self.core.pluginManager.plugins:
+ f = m.__file__.replace(".pyc", ".py")
+ if not exists(f):
+ continue
+
+ mtime = stat(f).st_mtime
+
+ if id not in self.mtimes:
+ self.mtimes[id] = mtime
+ elif self.mtimes[id] < mtime:
+ reloads.append(id)
+ self.mtimes[id] = mtime
+
+ self.core.pluginManager.reloadPlugins(reloads)
diff --git a/pyload/plugins/addons/WindowsPhoneToastNotify.py b/pyload/plugins/addons/WindowsPhoneToastNotify.py
new file mode 100644
index 000000000..d110f7896
--- /dev/null
+++ b/pyload/plugins/addons/WindowsPhoneToastNotify.py
@@ -0,0 +1,68 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: RaNaN, Godofdream, zoidberg
+"""
+import time, httplib
+from module.plugins.Hook import Hook
+
+class WindowsPhoneToastNotify(Hook):
+ __name__ = "WindowsPhoneToastNotify"
+ __version__ = "0.02"
+ __description__ = """Send push notifications to Windows Phone."""
+ __author_name__ = ("Andy Voigt")
+ __author_mail__ = ("phone-support@hotmail.de")
+ __config__ = [("activated", "bool", "Activated", False),
+ ("force", "bool", "Force even if client is connected", False),
+ ("pushId", "str", "pushId", ""),
+ ("pushUrl","str","pushUrl", ""),
+ ("pushTimeout","int","Timeout between notifications in seconds","0")]
+
+ def setup(self):
+ self.info = {}
+
+ def getXmlData(self):
+ myxml = ("<?xml version='1.0' encoding='utf-8'?> <wp:Notification xmlns:wp='WPNotification'> "
+ "<wp:Toast> <wp:Text1>Pyload Mobile</wp:Text1> <wp:Text2>Captcha waiting!</wp:Text2> "
+ "</wp:Toast> </wp:Notification>")
+ return myxml
+
+ def doRequest(self):
+ URL = self.getConfig("pushUrl")
+ request = self.getXmlData()
+ webservice = httplib.HTTP(URL)
+ webservice.putrequest("POST", self.getConfig("pushId"))
+ webservice.putheader("Host", URL)
+ webservice.putheader("Content-type", "text/xml")
+ webservice.putheader("X-NotificationClass", "2")
+ webservice.putheader("X-WindowsPhone-Target", "toast")
+ webservice.putheader("Content-length", "%d" % len(request))
+ webservice.endheaders()
+ webservice.send(request)
+ webservice.close()
+ self.setStorage("LAST_NOTIFY", time.time())
+
+ def newCaptchaTask(self, task):
+ if not self.getConfig("pushId") or not self.getConfig("pushUrl"):
+ return False
+
+ if self.core.isClientConnected() and not self.getConfig("force"):
+ return False
+
+ if (time.time() - float(self.getStorage("LAST_NOTIFY", 0))) < self.getConf("pushTimeout"):
+ return False
+
+ self.doRequest()
+
diff --git a/pyload/plugins/addons/XFileSharingPro.py b/pyload/plugins/addons/XFileSharingPro.py
new file mode 100644
index 000000000..fe2df840d
--- /dev/null
+++ b/pyload/plugins/addons/XFileSharingPro.py
@@ -0,0 +1,74 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.plugins.Hook import Hook
+
+
+class XFileSharingPro(Hook):
+ __name__ = "XFileSharingPro"
+ __version__ = "0.06"
+ __type__ = "hook"
+ __config__ = [("activated", "bool", "Activated", "True"),
+ ("loadDefault", "bool", "Include default (built-in) hoster list", "True"),
+ ("includeList", "str", "Include hosters (comma separated)", ""),
+ ("excludeList", "str", "Exclude hosters (comma separated)", "")]
+ __description__ = """Hoster URL pattern loader for the generic XFileSharingPro plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ def coreReady(self):
+ self.loadPattern()
+
+ def loadPattern(self):
+ hosterList = self.getConfigSet('includeList')
+ excludeList = self.getConfigSet('excludeList')
+
+ if self.getConfig('loadDefault'):
+ hosterList |= set((
+ #WORKING HOSTERS:
+ "aieshare.com", "asixfiles.com", "banashare.com", "cyberlocker.ch", "eyesfile.co", "eyesfile.com",
+ "fileband.com", "filedwon.com", "filedownloads.org", "hipfile.com", "kingsupload.com", "mlfat4arab.com",
+ "netuploaded.com", "odsiebie.pl", "q4share.com", "ravishare.com", "uptobox.com", "verzend.be",
+ "xvidstage.com",
+ #NOT TESTED:
+ "bebasupload.com", "boosterking.com", "divxme.com", "filevelocity.com", "glumbouploads.com",
+ "grupload.com", "heftyfile.com", "host4desi.com", "laoupload.com", "linkzhost.com", "movreel.com",
+ "rockdizfile.com", "limfile.com", "share76.com", "sharebeast.com", "sharehut.com", "sharerun.com",
+ "shareswift.com", "sharingonline.com", "6ybh-upload.com", "skipfile.com", "spaadyshare.com",
+ "space4file.com", "uploadbaz.com", "uploadc.com", "uploaddot.com", "uploadfloor.com", "uploadic.com",
+ "uploadville.com", "vidbull.com", "zalaa.com", "zomgupload.com", "kupload.org", "movbay.org",
+ "multishare.org", "omegave.org", "toucansharing.org", "uflinq.org", "banicrazy.info", "flowhot.info",
+ "upbrasil.info", "shareyourfilez.biz", "bzlink.us", "cloudcache.cc", "fileserver.cc", "farshare.to",
+ "filemaze.ws", "filehost.ws", "filestock.ru", "moidisk.ru", "4up.im", "100shared.com",
+ #WRONG FILE NAME:
+ "sendmyway.com", "upchi.co.il",
+ #NOT WORKING:
+ "amonshare.com", "imageporter.com", "file4safe.com",
+ #DOWN OR BROKEN:
+ "ddlanime.com", "fileforth.com", "loombo.com", "goldfile.eu", "putshare.com"
+ ))
+
+ hosterList -= (excludeList)
+ hosterList -= set(('', u''))
+
+ if not hosterList:
+ self.unload()
+ return
+
+ regexp = r"http://(?:[^/]*\.)?(%s)/\w{12}" % ("|".join(sorted(hosterList)).replace('.', '\.'))
+ #self.logDebug(regexp)
+
+ dict = self.core.pluginManager.hosterPlugins['XFileSharingPro']
+ dict["pattern"] = regexp
+ dict["re"] = re.compile(regexp)
+ self.logDebug("Pattern loaded - handling %d hosters" % len(hosterList))
+
+ def getConfigSet(self, option):
+ s = self.getConfig(option).lower().replace('|', ',').replace(';', ',')
+ return set([x.strip() for x in s.split(',')])
+
+ def unload(self):
+ dict = self.core.pluginManager.hosterPlugins['XFileSharingPro']
+ dict["pattern"] = r"^unmatchable$"
+ dict["re"] = re.compile(r"^unmatchable$")
diff --git a/pyload/plugins/addons/XMPPInterface.py b/pyload/plugins/addons/XMPPInterface.py
new file mode 100644
index 000000000..adffc04e3
--- /dev/null
+++ b/pyload/plugins/addons/XMPPInterface.py
@@ -0,0 +1,251 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: RaNaN
+ @interface-version: 0.2
+"""
+
+from pyxmpp import streamtls
+from pyxmpp.all import JID, Message
+from pyxmpp.jabber.client import JabberClient
+from pyxmpp.interface import implements
+from pyxmpp.interfaces import *
+
+from module.plugins.hooks.IRCInterface import IRCInterface
+
+
+class XMPPInterface(IRCInterface, JabberClient):
+ __name__ = "XMPPInterface"
+ __version__ = "0.11"
+ __description__ = """connect to jabber and let owner perform different tasks"""
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("jid", "str", "Jabber ID", "user@exmaple-jabber-server.org"),
+ ("pw", "str", "Password", ""),
+ ("tls", "bool", "Use TLS", False),
+ ("owners", "str", "List of JIDs accepting commands from", "me@icq-gateway.org;some@msn-gateway.org"),
+ ("info_file", "bool", "Inform about every file finished", "False"),
+ ("info_pack", "bool", "Inform about every package finished", "True"),
+ ("captcha", "bool", "Send captcha requests", "True")]
+ __author_name__ = ("RaNaN")
+ __author_mail__ = ("RaNaN@pyload.org")
+
+ implements(IMessageHandlersProvider)
+
+ def __init__(self, core, manager):
+ IRCInterface.__init__(self, core, manager)
+
+ self.jid = JID(self.getConfig("jid"))
+ password = self.getConfig("pw")
+
+ # if bare JID is provided add a resource -- it is required
+ if not self.jid.resource:
+ self.jid = JID(self.jid.node, self.jid.domain, "pyLoad")
+
+ if self.getConfig("tls"):
+ tls_settings = streamtls.TLSSettings(require=True, verify_peer=False)
+ auth = ("sasl:PLAIN", "sasl:DIGEST-MD5")
+ else:
+ tls_settings = None
+ auth = ("sasl:DIGEST-MD5", "digest")
+
+ # setup client with provided connection information
+ # and identity data
+ JabberClient.__init__(self, self.jid, password,
+ disco_name="pyLoad XMPP Client", disco_type="bot",
+ tls_settings=tls_settings, auth_methods=auth)
+
+ self.interface_providers = [
+ VersionHandler(self),
+ self,
+ ]
+
+ def coreReady(self):
+ self.new_package = {}
+
+ self.start()
+
+ def packageFinished(self, pypack):
+ try:
+ if self.getConfig("info_pack"):
+ self.announce(_("Package finished: %s") % pypack.name)
+ except:
+ pass
+
+ def downloadFinished(self, pyfile):
+ try:
+ if self.getConfig("info_file"):
+ self.announce(
+ _("Download finished: %(name)s @ %(plugin)s") % {"name": pyfile.name, "plugin": pyfile.pluginname})
+ except:
+ pass
+
+ def run(self):
+ # connect to IRC etc.
+ self.connect()
+ try:
+ self.loop()
+ except Exception, ex:
+ self.logError("pyLoad XMPP: %s" % str(ex))
+
+ def stream_state_changed(self, state, arg):
+ """This one is called when the state of stream connecting the component
+ to a server changes. This will usually be used to let the user
+ know what is going on."""
+ self.logDebug("pyLoad XMPP: *** State changed: %s %r ***" % (state, arg))
+
+ def disconnected(self):
+ self.logDebug("pyLoad XMPP: Client was disconnected")
+
+ def stream_closed(self, stream):
+ self.logDebug("pyLoad XMPP: Stream was closed | %s" % stream)
+
+ def stream_error(self, err):
+ self.logDebug("pyLoad XMPP: Stream Error: %s" % err)
+
+ def get_message_handlers(self):
+ """Return list of (message_type, message_handler) tuples.
+
+ The handlers returned will be called when matching message is received
+ in a client session."""
+ return [
+ ("normal", self.message),
+ ]
+
+ def message(self, stanza):
+ """Message handler for the component."""
+ subject = stanza.get_subject()
+ body = stanza.get_body()
+ t = stanza.get_type()
+ self.logDebug(u'pyLoad XMPP: Message from %s received.' % (unicode(stanza.get_from(), )))
+ self.logDebug(u'pyLoad XMPP: Body: %s Subject: %s Type: %s' % (body, subject, t))
+
+ if t == "headline":
+ # 'headline' messages should never be replied to
+ return True
+ if subject:
+ subject = u"Re: " + subject
+
+ to_jid = stanza.get_from()
+ from_jid = stanza.get_to()
+
+ #j = JID()
+ to_name = to_jid.as_utf8()
+ from_name = from_jid.as_utf8()
+
+ names = self.getConfig("owners").split(";")
+
+ if to_name in names or to_jid.node + "@" + to_jid.domain in names:
+ messages = []
+
+ trigger = "pass"
+ args = None
+
+ try:
+ temp = body.split()
+ trigger = temp[0]
+ if len(temp) > 1:
+ args = temp[1:]
+ except:
+ pass
+
+ handler = getattr(self, "event_%s" % trigger, self.event_pass)
+ try:
+ res = handler(args)
+ for line in res:
+ m = Message(
+ to_jid=to_jid,
+ from_jid=from_jid,
+ stanza_type=stanza.get_type(),
+ subject=subject,
+ body=line)
+
+ messages.append(m)
+ except Exception, e:
+ self.logError("pyLoad XMPP: " + repr(e))
+
+ return messages
+
+ else:
+ return True
+
+ def response(self, msg, origin=""):
+ return self.announce(msg)
+
+ def announce(self, message):
+ """ send message to all owners"""
+ for user in self.getConfig("owners").split(";"):
+ self.logDebug("pyLoad XMPP: Send message to %s" % user)
+
+ to_jid = JID(user)
+
+ m = Message(from_jid=self.jid,
+ to_jid=to_jid,
+ stanza_type="chat",
+ body=message)
+
+ stream = self.get_stream()
+ if not stream:
+ self.connect()
+ stream = self.get_stream()
+
+ stream.send(m)
+
+ def beforeReconnecting(self, ip):
+ self.disconnect()
+
+ def afterReconnecting(self, ip):
+ self.connect()
+
+
+class VersionHandler(object):
+ """Provides handler for a version query.
+
+ This class will answer version query and announce 'jabber:iq:version' namespace
+ in the client's disco#info results."""
+
+ implements(IIqHandlersProvider, IFeaturesProvider)
+
+ def __init__(self, client):
+ """Just remember who created this."""
+ self.client = client
+
+ def get_features(self):
+ """Return namespace which should the client include in its reply to a
+ disco#info query."""
+ return ["jabber:iq:version"]
+
+ def get_iq_get_handlers(self):
+ """Return list of tuples (element_name, namespace, handler) describing
+ handlers of <iq type='get'/> stanzas"""
+ return [
+ ("query", "jabber:iq:version", self.get_version),
+ ]
+
+ def get_iq_set_handlers(self):
+ """Return empty list, as this class provides no <iq type='set'/> stanza handler."""
+ return []
+
+ def get_version(self, iq):
+ """Handler for jabber:iq:version queries.
+
+ jabber:iq:version queries are not supported directly by PyXMPP, so the
+ XML node is accessed directly through the libxml2 API. This should be
+ used very carefully!"""
+ iq = iq.make_result_response()
+ q = iq.new_query("jabber:iq:version")
+ q.newTextChild(q.ns(), "name", "Echo component")
+ q.newTextChild(q.ns(), "version", "1.0")
+ return iq
diff --git a/pyload/plugins/addons/ZeveraCom.py b/pyload/plugins/addons/ZeveraCom.py
new file mode 100644
index 000000000..fb84886d1
--- /dev/null
+++ b/pyload/plugins/addons/ZeveraCom.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+
+from module.network.RequestFactory import getURL
+from module.plugins.internal.MultiHoster import MultiHoster
+
+
+class ZeveraCom(MultiHoster):
+ __name__ = "ZeveraCom"
+ __version__ = "0.02"
+ __type__ = "hook"
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"),
+ ("hosterList", "str", "Hoster list (comma separated)", "")]
+ __description__ = """Real-Debrid.com hook plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ def getHoster(self):
+ page = getURL("http://www.zevera.com/jDownloader.ashx?cmd=gethosters")
+ return [x.strip() for x in page.replace("\"", "").split(",")]
diff --git a/pyload/plugins/addons/__init__.py b/pyload/plugins/addons/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/pyload/plugins/addons/__init__.py
diff --git a/pyload/plugins/crypter/BitshareComFolder.py b/pyload/plugins/crypter/BitshareComFolder.py
new file mode 100644
index 000000000..b77ddb9d9
--- /dev/null
+++ b/pyload/plugins/crypter/BitshareComFolder.py
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+from module.plugins.internal.SimpleCrypter import SimpleCrypter
+
+
+class BitshareComFolder(SimpleCrypter):
+ __name__ = "BitshareComFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(?:www\.)?bitshare\.com/\?d=\w+"
+ __version__ = "0.01"
+ __description__ = """Bitshare.com Folder Plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ LINK_PATTERN = r'<a href="(http://bitshare.com/files/.+)">.+</a></td>'
+ TITLE_PATTERN = r'View public folder "(?P<title>.+)"</h1>'
diff --git a/pyload/plugins/crypter/C1neonCom.py b/pyload/plugins/crypter/C1neonCom.py
new file mode 100644
index 000000000..c1e9013b3
--- /dev/null
+++ b/pyload/plugins/crypter/C1neonCom.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.internal.DeadCrypter import DeadCrypter
+
+
+class C1neonCom(DeadCrypter):
+ __name__ = "C1neonCom"
+ __type__ = "container"
+ __pattern__ = r"http://(www\.)?c1neon.com/.*?"
+ __version__ = "0.05"
+ __description__ = """C1neon.Com Container Plugin"""
+ __author_name__ = ("godofdream")
+ __author_mail__ = ("soilfiction@gmail.com")
diff --git a/pyload/plugins/crypter/CCF.py b/pyload/plugins/crypter/CCF.py
new file mode 100644
index 000000000..ab7ff1099
--- /dev/null
+++ b/pyload/plugins/crypter/CCF.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from urllib2 import build_opener
+
+from module.plugins.Crypter import Crypter
+from module.lib.MultipartPostHandler import MultipartPostHandler
+
+from os import makedirs
+from os.path import exists, join
+
+class CCF(Crypter):
+ __name__ = "CCF"
+ __version__ = "0.2"
+ __pattern__ = r"(?!http://).*\.ccf$"
+ __description__ = """CCF Container Convert Plugin"""
+ __author_name__ = ("Willnix")
+ __author_mail__ = ("Willnix@pyload.org")
+
+ def decrypt(self, pyfile):
+
+ infile = pyfile.url.replace("\n", "")
+
+ opener = build_opener(MultipartPostHandler)
+ params = {"src": "ccf",
+ "filename": "test.ccf",
+ "upload": open(infile, "rb")}
+ tempdlc_content = opener.open('http://service.jdownloader.net/dlcrypt/getDLC.php', params).read()
+
+ download_folder = self.config['general']['download_folder']
+ location = download_folder #join(download_folder, self.pyfile.package().folder.decode(sys.getfilesystemencoding()))
+ if not exists(location):
+ makedirs(location)
+
+ tempdlc_name = join(location, "tmp_%s.dlc" % pyfile.name)
+ tempdlc = open(tempdlc_name, "w")
+ tempdlc.write(re.search(r'<dlc>(.*)</dlc>', tempdlc_content, re.DOTALL).group(1))
+ tempdlc.close()
+
+ self.packages.append((tempdlc_name, [tempdlc_name], tempdlc_name))
+
diff --git a/pyload/plugins/crypter/CrockoComFolder.py b/pyload/plugins/crypter/CrockoComFolder.py
new file mode 100644
index 000000000..ffa8039a1
--- /dev/null
+++ b/pyload/plugins/crypter/CrockoComFolder.py
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.internal.SimpleCrypter import SimpleCrypter
+
+
+class CrockoComFolder(SimpleCrypter):
+ __name__ = "CrockoComFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(www\.)?crocko.com/f/.*"
+ __version__ = "0.01"
+ __description__ = """Crocko.com Folder Plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ LINK_PATTERN = r'<td class="last"><a href="([^"]+)">download</a>' \ No newline at end of file
diff --git a/pyload/plugins/crypter/CryptItCom.py b/pyload/plugins/crypter/CryptItCom.py
new file mode 100644
index 000000000..679e891b9
--- /dev/null
+++ b/pyload/plugins/crypter/CryptItCom.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.internal.DeadCrypter import DeadCrypter
+
+
+class CryptItCom(DeadCrypter):
+ __name__ = "CryptItCom"
+ __type__ = "container"
+ __pattern__ = r"http://[\w\.]*?crypt-it\.com/(s|e|d|c)/[\w]+"
+ __version__ = "0.11"
+ __description__ = """Crypt.It.com Container Plugin"""
+ __author_name__ = ("jeix")
+ __author_mail__ = ("jeix@hasnomail.de")
diff --git a/pyload/plugins/crypter/CzshareComFolder.py b/pyload/plugins/crypter/CzshareComFolder.py
new file mode 100644
index 000000000..9ccda3ed2
--- /dev/null
+++ b/pyload/plugins/crypter/CzshareComFolder.py
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Crypter import Crypter
+
+
+class CzshareComFolder(Crypter):
+ __name__ = "CzshareComFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(\w*\.)*czshare\.(com|cz)/folders/.*"
+ __version__ = "0.1"
+ __description__ = """Czshare.com Folder Plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FOLDER_PATTERN = r'<tr class="subdirectory">\s*<td>\s*<table>(.*?)</table>'
+ LINK_PATTERN = r'<td class="col2"><a href="([^"]+)">info</a></td>'
+ #NEXT_PAGE_PATTERN = r'<a class="next " href="/([^"]+)">&nbsp;</a>'
+
+ def decrypt(self, pyfile):
+ html = self.load(self.pyfile.url)
+
+ new_links = []
+ found = re.search(self.FOLDER_PATTERN, html, re.DOTALL)
+ if found is None: self.fail("Parse error (FOLDER)")
+ new_links.extend(re.findall(self.LINK_PATTERN, found.group(1)))
+
+ if new_links:
+ self.core.files.addLinks(new_links, self.pyfile.package().id)
+ else:
+ self.fail('Could not extract any links') \ No newline at end of file
diff --git a/pyload/plugins/crypter/DDLMusicOrg.py b/pyload/plugins/crypter/DDLMusicOrg.py
new file mode 100644
index 000000000..822addca1
--- /dev/null
+++ b/pyload/plugins/crypter/DDLMusicOrg.py
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from time import sleep
+
+from module.plugins.Crypter import Crypter
+
+
+class DDLMusicOrg(Crypter):
+ __name__ = "DDLMusicOrg"
+ __type__ = "container"
+ __pattern__ = r"http://[\w\.]*?ddl-music\.org/captcha/ddlm_cr\d\.php\?\d+\?\d+"
+ __version__ = "0.3"
+ __description__ = """ddl-music.org Container Plugin"""
+ __author_name__ = ("mkaay")
+ __author_mail__ = ("mkaay@mkaay.de")
+
+ def setup(self):
+ self.multiDL = False
+
+ def decrypt(self, pyfile):
+ html = self.req.load(self.pyfile.url, cookies=True)
+
+ if re.search(r"Wer dies nicht rechnen kann", html) is not None:
+ self.offline()
+
+ math = re.search(r"(\d+) ([\+-]) (\d+) =\s+<inp", self.html)
+ id = re.search(r"name=\"id\" value=\"(\d+)\"", self.html).group(1)
+ linknr = re.search(r"name=\"linknr\" value=\"(\d+)\"", self.html).group(1)
+
+ solve = ""
+ if math.group(2) == "+":
+ solve = int(math.group(1)) + int(math.group(3))
+ else:
+ solve = int(math.group(1)) - int(math.group(3))
+ sleep(3)
+ htmlwithlink = self.req.load(self.pyfile.url, cookies=True,
+ post={"calc%s" % linknr: solve, "send%s" % linknr: "Send", "id": id,
+ "linknr": linknr})
+ m = re.search(r"<form id=\"ff\" action=\"(.*?)\" method=\"post\">", htmlwithlink)
+ if m:
+ self.packages.append((self.pyfile.package().name, [m.group(1)], self.pyfile.package().folder))
+ else:
+ self.retry()
diff --git a/pyload/plugins/crypter/DLC_25.pyc b/pyload/plugins/crypter/DLC_25.pyc
new file mode 100644
index 000000000..e3c9150c3
--- /dev/null
+++ b/pyload/plugins/crypter/DLC_25.pyc
Binary files differ
diff --git a/pyload/plugins/crypter/DLC_26.pyc b/pyload/plugins/crypter/DLC_26.pyc
new file mode 100644
index 000000000..e20700eb1
--- /dev/null
+++ b/pyload/plugins/crypter/DLC_26.pyc
Binary files differ
diff --git a/pyload/plugins/crypter/DLC_27.pyc b/pyload/plugins/crypter/DLC_27.pyc
new file mode 100644
index 000000000..6f04d88f4
--- /dev/null
+++ b/pyload/plugins/crypter/DLC_27.pyc
Binary files differ
diff --git a/pyload/plugins/crypter/DataHuFolder.py b/pyload/plugins/crypter/DataHuFolder.py
new file mode 100644
index 000000000..f710f60d7
--- /dev/null
+++ b/pyload/plugins/crypter/DataHuFolder.py
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+import re
+
+from module.plugins.internal.SimpleCrypter import SimpleCrypter
+
+
+class DataHuFolder(SimpleCrypter):
+ __name__ = "DataHuFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(www\.)?data.hu/dir/\w+"
+ __version__ = "0.03"
+ __description__ = """Data.hu Folder Plugin"""
+ __author_name__ = ("crash", "stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ LINK_PATTERN = r"<a href='(http://data\.hu/get/.+)' target='_blank'>\1</a>"
+ TITLE_PATTERN = ur'<title>(?P<title>.+) Let\xf6lt\xe9se</title>'
+
+ def decrypt(self, pyfile):
+ self.html = self.load(pyfile.url, decode=True)
+
+ if u'K\xe9rlek add meg a jelsz\xf3t' in self.html: # Password protected
+ password = self.getPassword()
+ if password is '':
+ self.fail("No password specified, please set right password on Add package form and retry")
+ self.logDebug('The folder is password protected', 'Using password: ' + password)
+ self.html = self.load(pyfile.url, post={'mappa_pass': password}, decode=True)
+ if u'Hib\xe1s jelsz\xf3' in self.html: # Wrong password
+ self.fail("Incorrect password, please set right password on Add package form and retry")
+
+ package_name, folder_name = self.getPackageNameAndFolder()
+
+ package_links = re.findall(self.LINK_PATTERN, self.html)
+ self.logDebug('Package has %d links' % len(package_links))
+
+ if package_links:
+ self.packages = [(package_name, package_links, folder_name)]
+ else:
+ self.fail('Could not extract any links')
diff --git a/pyload/plugins/crypter/DdlstorageComFolder.py b/pyload/plugins/crypter/DdlstorageComFolder.py
new file mode 100644
index 000000000..d76988c92
--- /dev/null
+++ b/pyload/plugins/crypter/DdlstorageComFolder.py
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+from module.plugins.internal.SimpleCrypter import SimpleCrypter
+
+
+class DdlstorageComFolder(SimpleCrypter):
+ __name__ = "DdlstorageComFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(?:\w*\.)*?ddlstorage.com/folder/\w{10}"
+ __version__ = "0.02"
+ __description__ = """DDLStorage.com Folder Plugin"""
+ __author_name__ = ("godofdream", "stickell")
+ __author_mail__ = ("soilfiction@gmail.com", "l.stickell@yahoo.it")
+
+ LINK_PATTERN = '<a class="sub_title" style="text-decoration:none;" href="(http://www.ddlstorage.com/.*)">'
diff --git a/pyload/plugins/crypter/DepositfilesComFolder.py b/pyload/plugins/crypter/DepositfilesComFolder.py
new file mode 100644
index 000000000..15c317acf
--- /dev/null
+++ b/pyload/plugins/crypter/DepositfilesComFolder.py
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.internal.SimpleCrypter import SimpleCrypter
+
+
+class DepositfilesComFolder(SimpleCrypter):
+ __name__ = "DepositfilesComFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(www\.)?depositfiles.com/folders/\w+"
+ __version__ = "0.01"
+ __description__ = """Depositfiles.com Folder Plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ LINK_PATTERN = r'<div class="progressName"[^>]*>\s*<a href="([^"]+)" title="[^"]*" target="_blank">'
diff --git a/pyload/plugins/crypter/Dereferer.py b/pyload/plugins/crypter/Dereferer.py
new file mode 100644
index 000000000..7b7c34fee
--- /dev/null
+++ b/pyload/plugins/crypter/Dereferer.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+"""
+
+import re
+import urllib
+
+from module.plugins.Crypter import Crypter
+
+
+class Dereferer(Crypter):
+ __name__ = "Dereferer"
+ __type__ = "crypter"
+ __pattern__ = r'https?://([^/]+)/.*?(?P<url>(ht|f)tps?(://|%3A%2F%2F).*)'
+ __version__ = "0.1"
+ __description__ = """Crypter for dereferers"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ def decrypt(self, pyfile):
+ link = re.match(self.__pattern__, self.pyfile.url).group('url')
+ self.core.files.addLinks([urllib.unquote(link).rstrip('+')], self.pyfile.package().id)
diff --git a/pyload/plugins/crypter/DontKnowMe.py b/pyload/plugins/crypter/DontKnowMe.py
new file mode 100644
index 000000000..0791e3c22
--- /dev/null
+++ b/pyload/plugins/crypter/DontKnowMe.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+
+import re
+import urllib
+
+from module.plugins.Crypter import Crypter
+
+
+class DontKnowMe(Crypter):
+ __name__ = "DontKnowMe"
+ __type__ = "crypter"
+ __pattern__ = r"http://dontknow.me/at/\?.+$"
+ __version__ = "0.1"
+ __description__ = """DontKnowMe"""
+ __author_name__ = ("selaux")
+ __author_mail__ = ("")
+
+ LINK_PATTERN = r"http://dontknow.me/at/\?(.+)$"
+
+ def decrypt(self, pyfile):
+ link = re.findall(self.LINK_PATTERN, self.pyfile.url)[0]
+ self.core.files.addLinks([urllib.unquote(link)], self.pyfile.package().id)
diff --git a/pyload/plugins/crypter/DownloadVimeoCom.py b/pyload/plugins/crypter/DownloadVimeoCom.py
new file mode 100644
index 000000000..562672599
--- /dev/null
+++ b/pyload/plugins/crypter/DownloadVimeoCom.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+import HTMLParser
+from module.plugins.Crypter import Crypter
+
+
+class DownloadVimeoCom(Crypter):
+ __name__ = 'DownloadVimeoCom'
+ __type__ = 'crypter'
+ __pattern__ = r'(?:http://vimeo\.com/\d*|http://smotri\.com/video/view/\?id=.*)'
+ ## The download from dailymotion failed with a 403
+ __version__ = '0.1'
+ __description__ = """Video Download Plugin based on downloadvimeo.com"""
+ __author_name__ = ('4Christopher')
+ __author_mail__ = ('4Christopher@gmx.de')
+ BASE_URL = 'http://downloadvimeo.com'
+
+ def decrypt(self, pyfile):
+ self.package = pyfile.package()
+ html = self.load('%s/generate?url=%s' % (self.BASE_URL, pyfile.url))
+ h = HTMLParser.HTMLParser()
+ try:
+ f = re.search(r'cmd quality="(?P<quality>[^"]+?)">\s*?(?P<URL>[^<]*?)</cmd>', html)
+ except:
+ self.logDebug('Failed to find the URL')
+ else:
+ url = h.unescape(f.group('URL'))
+ self.logDebug('Quality: %s, URL: %s' % (f.group('quality'), url))
+ self.packages.append((self.package.name, [url], self.package.folder))
diff --git a/pyload/plugins/crypter/DuckCryptInfo.py b/pyload/plugins/crypter/DuckCryptInfo.py
new file mode 100644
index 000000000..64302c800
--- /dev/null
+++ b/pyload/plugins/crypter/DuckCryptInfo.py
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+
+import re
+from module.lib.BeautifulSoup import BeautifulSoup
+from module.plugins.Crypter import Crypter
+
+
+class DuckCryptInfo(Crypter):
+ __name__ = "DuckCryptInfo"
+ __type__ = "container"
+ __pattern__ = r"http://(?:www\.)?duckcrypt.info/(folder|wait|link)/(\w+)/?(\w*)"
+ __version__ = "0.02"
+ __description__ = """DuckCrypt.Info Container Plugin"""
+ __author_name__ = ("godofdream")
+ __author_mail__ = ("soilfiction@gmail.com")
+
+ TIMER_PATTERN = r'<span id="timer">(.*)</span>'
+
+ def decrypt(self, pyfile):
+ url = pyfile.url
+ # seems we don't need to wait
+ #src = self.req.load(str(url))
+ #found = re.search(self.TIMER_PATTERN, src)
+ #if found:
+ # self.logDebug("Sleeping for" % found.group(1))
+ # self.setWait(int(found.group(1)) ,False)
+ found = re.search(self.__pattern__, url)
+ if not found:
+ self.fail('Weird error in link')
+ if str(found.group(1)) == "link":
+ self.handleLink(url)
+ else:
+ self.handleFolder(found)
+
+
+ def handleFolder(self, found):
+ src = self.load("http://duckcrypt.info/ajax/auth.php?hash=" + str(found.group(2)))
+ found = re.search(self.__pattern__, src)
+ self.logDebug("Redirectet to " + str(found.group(0)))
+ src = self.load(str(found.group(0)))
+ soup = BeautifulSoup(src)
+ cryptlinks = soup.findAll("div", attrs={"class": "folderbox"})
+ self.logDebug("Redirectet to " + str(cryptlinks))
+ if not cryptlinks:
+ self.fail('no links found - (Plugin out of date?)')
+ for clink in cryptlinks:
+ if clink.find("a"):
+ self.handleLink(clink.find("a")['href'])
+
+ def handleLink(self, url):
+ src = self.load(url)
+ soup = BeautifulSoup(src)
+ link = soup.find("iframe")["src"]
+ if not link:
+ self.logDebug('no links found - (Plugin out of date?)')
+ else:
+ self.core.files.addLinks([link], self.pyfile.package().id)
diff --git a/pyload/plugins/crypter/DuploadOrgFolder.py b/pyload/plugins/crypter/DuploadOrgFolder.py
new file mode 100644
index 000000000..a1918f055
--- /dev/null
+++ b/pyload/plugins/crypter/DuploadOrgFolder.py
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+from module.plugins.internal.SimpleCrypter import SimpleCrypter
+
+
+class DuploadOrgFolder(SimpleCrypter):
+ __name__ = "DuploadOrgFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(www\.)?dupload\.org/folder/\d+/"
+ __version__ = "0.01"
+ __description__ = """Dupload.org Folder Plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ LINK_PATTERN = r'<td style="[^"]+"><a href="(http://[^"]+)" target="_blank">[^<]+</a></td>'
diff --git a/pyload/plugins/crypter/EasybytezComFolder.py b/pyload/plugins/crypter/EasybytezComFolder.py
new file mode 100644
index 000000000..56be72669
--- /dev/null
+++ b/pyload/plugins/crypter/EasybytezComFolder.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+from module.plugins.internal.SimpleCrypter import SimpleCrypter
+
+
+class EasybytezComFolder(SimpleCrypter):
+ __name__ = "EasybytezComFolder"
+ __type__ = "crypter"
+ __pattern__ = r"https?://(www\.)?easybytez\.com/users/\w+/\w+"
+ __version__ = "0.03"
+ __description__ = """Easybytez Crypter Plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ LINK_PATTERN = r'<div class="link"><a href="(http://www\.easybytez\.com/\w+)" target="_blank">.+</a></div>'
+ TITLE_PATTERN = r'<Title>Files of \d+: (?P<title>.+) folder</Title>'
+ PAGES_PATTERN = r"<a href='[^']+'>(?P<pages>\d+)</a><a href='[^']+'>Next &#187;</a><br><small>\(\d+ total\)</small></div>"
+
+ def loadPage(self, page_n):
+ return self.load(self.pyfile.url, get={'page': page_n}, decode=True)
diff --git a/pyload/plugins/crypter/EmbeduploadCom.py b/pyload/plugins/crypter/EmbeduploadCom.py
new file mode 100644
index 000000000..122c0f671
--- /dev/null
+++ b/pyload/plugins/crypter/EmbeduploadCom.py
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Crypter import Crypter
+from module.network.HTTPRequest import BadHeader
+
+
+class EmbeduploadCom(Crypter):
+ __name__ = "EmbeduploadCom"
+ __type__ = "crypter"
+ __pattern__ = r"http://(www\.)?embedupload.com/\?d=.*"
+ __version__ = "0.02"
+ __description__ = """EmbedUpload.com crypter"""
+ __config__ = [("preferedHoster", "str", "Prefered hoster list (bar-separated) ", "embedupload"),
+ ("ignoredHoster", "str", "Ignored hoster list (bar-separated) ", "")]
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ LINK_PATTERN = r'<div id="([^"]+)"[^>]*>\s*<a href="([^"]+)" target="_blank" (?:class="DownloadNow"|style="color:red")>'
+
+ def decrypt(self, pyfile):
+ self.html = self.load(self.pyfile.url, decode=True)
+ tmp_links = []
+ new_links = []
+
+ found = re.findall(self.LINK_PATTERN, self.html)
+ if found:
+ prefered_set = set(self.getConfig("preferedHoster").split('|'))
+ prefered_set = map(lambda s: s.lower().split('.')[0], prefered_set)
+ print "PF", prefered_set
+ tmp_links.extend([x[1] for x in found if x[0] in prefered_set])
+ self.getLocation(tmp_links, new_links)
+
+ if not new_links:
+ ignored_set = set(self.getConfig("ignoredHoster").split('|'))
+ ignored_set = map(lambda s: s.lower().split('.')[0], ignored_set)
+ print "IG", ignored_set
+ tmp_links.extend([x[1] for x in found if x[0] not in ignored_set])
+ self.getLocation(tmp_links, new_links)
+
+ if new_links:
+ self.core.files.addLinks(new_links, self.pyfile.package().id)
+ else:
+ self.fail('Could not extract any links')
+
+ def getLocation(self, tmp_links, new_links):
+ for link in tmp_links:
+ try:
+ header = self.load(link, just_header=True)
+ if "location" in header:
+ new_links.append(header['location'])
+ except BadHeader:
+ pass
diff --git a/pyload/plugins/crypter/FilebeerInfoFolder.py b/pyload/plugins/crypter/FilebeerInfoFolder.py
new file mode 100644
index 000000000..b6bf4fd07
--- /dev/null
+++ b/pyload/plugins/crypter/FilebeerInfoFolder.py
@@ -0,0 +1,14 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.internal.DeadCrypter import DeadCrypter
+
+
+class FilebeerInfoFolder(DeadCrypter):
+ __name__ = "FilebeerInfoFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(?:www\.)?filebeer\.info/(\d+~f).*"
+ __version__ = "0.02"
+ __description__ = """Filebeer.info Folder Plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
diff --git a/pyload/plugins/crypter/FilefactoryComFolder.py b/pyload/plugins/crypter/FilefactoryComFolder.py
new file mode 100644
index 000000000..64b8ac37e
--- /dev/null
+++ b/pyload/plugins/crypter/FilefactoryComFolder.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Crypter import Crypter
+
+
+class FilefactoryComFolder(Crypter):
+ __name__ = "FilefactoryComFolder"
+ __type__ = "crypter"
+ __pattern__ = r"(http://(www\.)?filefactory\.com/f/\w+).*"
+ __version__ = "0.1"
+ __description__ = """Filefactory.com Folder Plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FOLDER_PATTERN = r'<table class="items" cellspacing="0" cellpadding="0">(.*?)</table>'
+ LINK_PATTERN = r'<td class="name"><a href="([^"]+)">'
+ PAGINATOR_PATTERN = r'<div class="list">\s*<label>Pages</label>\s*<ul>(.*?)</ul>\s*</div>'
+ NEXT_PAGE_PATTERN = r'<li class="current">.*?</li>\s*<li class=""><a href="([^"]+)">'
+
+ def decrypt(self, pyfile):
+ url_base = re.search(self.__pattern__, self.pyfile.url).group(1)
+ html = self.load(url_base)
+
+ new_links = []
+ for i in range(1, 100):
+ self.logInfo("Fetching links from page %i" % i)
+ found = re.search(self.FOLDER_PATTERN, html, re.DOTALL)
+ if found is None: self.fail("Parse error (FOLDER)")
+
+ new_links.extend(re.findall(self.LINK_PATTERN, found.group(1)))
+
+ try:
+ paginator = re.search(self.PAGINATOR_PATTERN, html, re.DOTALL).group(1)
+ next_page = re.search(self.NEXT_PAGE_PATTERN, paginator).group(1)
+ html = self.load("%s/%s" % (url_base, next_page))
+ except Exception, e:
+ break
+ else:
+ self.logInfo("Limit of 99 pages reached, aborting")
+
+ if new_links:
+ self.core.files.addLinks(new_links, self.pyfile.package().id)
+ else:
+ self.fail('Could not extract any links')
diff --git a/pyload/plugins/crypter/FileserveComFolder.py b/pyload/plugins/crypter/FileserveComFolder.py
new file mode 100644
index 000000000..42481c15e
--- /dev/null
+++ b/pyload/plugins/crypter/FileserveComFolder.py
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.plugins.Crypter import Crypter
+
+
+class FileserveComFolder(Crypter):
+ __name__ = "FileserveComFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(?:www\.)?fileserve.com/list/\w+"
+ __version__ = "0.11"
+ __description__ = """FileServeCom.com Folder Plugin"""
+ __author_name__ = ("fionnc")
+ __author_mail__ = ("fionnc@gmail.com")
+
+ FOLDER_PATTERN = r'<table class="file_list">(.*?)</table>'
+ LINK_PATTERN = r'<a href="([^"]+)" class="sheet_icon wbold">'
+
+ def decrypt(self, pyfile):
+ html = self.load(self.pyfile.url)
+
+ new_links = []
+
+ folder = re.search(self.FOLDER_PATTERN, html, re.DOTALL)
+ if folder is None: self.fail("Parse error (FOLDER)")
+
+ new_links.extend(re.findall(self.LINK_PATTERN, folder.group(1)))
+
+ if new_links:
+ self.core.files.addLinks(map(lambda s: "http://fileserve.com%s" % s, new_links), self.pyfile.package().id)
+ else:
+ self.fail('Could not extract any links')
diff --git a/pyload/plugins/crypter/FilestubeCom.py b/pyload/plugins/crypter/FilestubeCom.py
new file mode 100644
index 000000000..1e5712cb5
--- /dev/null
+++ b/pyload/plugins/crypter/FilestubeCom.py
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+from module.plugins.internal.SimpleCrypter import SimpleCrypter
+
+
+class FilestubeCom(SimpleCrypter):
+ __name__ = "FilestubeCom"
+ __type__ = "crypter"
+ __pattern__ = r"http://(?:w{3}.)?filestube\.com/\w+"
+ __version__ = "0.01"
+ __description__ = """Filestube.com Plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ LINK_PATTERN = r"link_download'\]\); renderGo\('(http://[^)]+)'\);"
+ TITLE_PATTERN = r"<title>(?P<title>.+) download"
diff --git a/pyload/plugins/crypter/FiletramCom.py b/pyload/plugins/crypter/FiletramCom.py
new file mode 100644
index 000000000..886b8be30
--- /dev/null
+++ b/pyload/plugins/crypter/FiletramCom.py
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+from module.plugins.internal.SimpleCrypter import SimpleCrypter
+
+
+class FiletramCom(SimpleCrypter):
+ __name__ = "FiletramCom"
+ __type__ = "crypter"
+ __pattern__ = r"http://(?:www\.)?filetram.com/[^/]+/.+"
+ __version__ = "0.01"
+ __description__ = """Filetram.com Plugin"""
+ __author_name__ = ("igel", "stickell")
+ __author_mail__ = ("igelkun@myopera.com", "l.stickell@yahoo.it")
+
+ LINK_PATTERN = r"\s+(http://.+)"
+ TITLE_PATTERN = r"<title>(?P<title>[^<]+) - Free Download[^<]*</title>"
diff --git a/pyload/plugins/crypter/FourChanOrg.py b/pyload/plugins/crypter/FourChanOrg.py
new file mode 100644
index 000000000..700a09b97
--- /dev/null
+++ b/pyload/plugins/crypter/FourChanOrg.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.plugins.Crypter import Crypter
+
+
+class FourChanOrg(Crypter):
+ # Based on 4chandl by Roland Beermann
+ # https://gist.github.com/enkore/3492599
+ __name__ = "FourChanOrg"
+ __type__ = "container"
+ __version__ = "0.3"
+ __pattern__ = r"http://boards\.4chan.org/\w+/res/(\d+)"
+ __description__ = "Downloader for entire 4chan threads"
+
+ def decrypt(self, pyfile):
+ pagehtml = self.load(pyfile.url)
+
+ images = set(re.findall(r'(images\.4chan\.org/[^/]*/src/[^"<]*)', pagehtml))
+ urls = []
+ for image in images:
+ urls.append("http://" + image)
+
+ self.core.files.addLinks(urls, self.pyfile.package().id)
diff --git a/pyload/plugins/crypter/FreakhareComFolder.py b/pyload/plugins/crypter/FreakhareComFolder.py
new file mode 100644
index 000000000..519a468f3
--- /dev/null
+++ b/pyload/plugins/crypter/FreakhareComFolder.py
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+import re
+
+from module.plugins.internal.SimpleCrypter import SimpleCrypter
+
+
+class FreakhareComFolder(SimpleCrypter):
+ __name__ = "FreakhareComFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(?:www\.)?freakshare\.com/folder/.+"
+ __version__ = "0.01"
+ __description__ = """Freakhare.com Folder Plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ LINK_PATTERN = r'<a href="(http://freakshare.com/files/[^"]+)" target="_blank">'
+ TITLE_PATTERN = r'Folder:</b> (?P<title>.+)'
+ PAGES_PATTERN = r'Pages: +(?P<pages>\d+)'
+
+ def loadPage(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:
+ self.f_id = m.group(1)
+ self.f_md5 = m.group(2)
+ return self.load('http://freakshare.com/', get={'x': 'folder',
+ 'f_id': self.f_id,
+ 'f_md5': self.f_md5,
+ 'entrys': '20',
+ 'page': page_n - 1,
+ 'order': ''}, decode=True)
diff --git a/pyload/plugins/crypter/FreetexthostCom.py b/pyload/plugins/crypter/FreetexthostCom.py
new file mode 100644
index 000000000..8d165abe4
--- /dev/null
+++ b/pyload/plugins/crypter/FreetexthostCom.py
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+import re
+
+from module.plugins.internal.SimpleCrypter import SimpleCrypter
+
+
+class FreetexthostCom(SimpleCrypter):
+ __name__ = "FreetexthostCom"
+ __type__ = "crypter"
+ __pattern__ = r"http://(?:w{3}.)?freetexthost\.com/\w+"
+ __version__ = "0.01"
+ __description__ = """Freetexthost.com Plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ def getLinks(self):
+ m = re.search(r'<div id="contentsinner">\s*(.+)<div class="viewcount">', self.html, re.DOTALL)
+ if not m:
+ self.fail('Unable to extract links | Plugin may be out-of-date')
+ links = m.group(1)
+ return links.strip().split("<br />\r\n")
diff --git a/pyload/plugins/crypter/FshareVnFolder.py b/pyload/plugins/crypter/FshareVnFolder.py
new file mode 100644
index 000000000..2d7a3c490
--- /dev/null
+++ b/pyload/plugins/crypter/FshareVnFolder.py
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.internal.SimpleCrypter import SimpleCrypter
+
+
+class FshareVnFolder(SimpleCrypter):
+ __name__ = "FshareVnFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(www\.)?fshare.vn/folder/.*"
+ __version__ = "0.01"
+ __description__ = """Fshare.vn Folder Plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ LINK_PATTERN = r'<li class="w_80pc"><a href="([^"]+)" target="_blank">'
diff --git a/pyload/plugins/crypter/GooGl.py b/pyload/plugins/crypter/GooGl.py
new file mode 100644
index 000000000..bcb1d7494
--- /dev/null
+++ b/pyload/plugins/crypter/GooGl.py
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+from module.plugins.Crypter import Crypter
+from module.common.json_layer import json_loads
+
+
+class GooGl(Crypter):
+ __name__ = "GooGl"
+ __type__ = "crypter"
+ __pattern__ = r"https?://(www\.)?goo\.gl/\w+"
+ __version__ = "0.01"
+ __description__ = """Goo.gl Crypter Plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ API_URL = 'https://www.googleapis.com/urlshortener/v1/url'
+
+ def decrypt(self, pyfile):
+ rep = self.load(self.API_URL, get={'shortUrl': pyfile.url})
+ self.logDebug('JSON data: ' + rep)
+ rep = json_loads(rep)
+
+ if 'longUrl' in rep:
+ self.core.files.addLinks([rep['longUrl']], self.pyfile.package().id)
+ else:
+ self.fail('Unable to expand shortened link')
diff --git a/pyload/plugins/crypter/HoerbuchIn.py b/pyload/plugins/crypter/HoerbuchIn.py
new file mode 100644
index 000000000..9d58873e8
--- /dev/null
+++ b/pyload/plugins/crypter/HoerbuchIn.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.plugins.Crypter import Crypter
+from module.lib.BeautifulSoup import BeautifulSoup, BeautifulStoneSoup
+
+
+class HoerbuchIn(Crypter):
+ __name__ = "HoerbuchIn"
+ __type__ = "container"
+ __pattern__ = r"http://(www\.)?hoerbuch\.in/(wp/horbucher/\d+/.+/|tp/out.php\?.+|protection/folder_\d+\.html)"
+ __version__ = "0.7"
+ __description__ = """Hoerbuch.in Container Plugin"""
+ __author_name__ = ("spoob", "mkaay")
+ __author_mail__ = ("spoob@pyload.org", "mkaay@mkaay.de")
+
+ article = re.compile("http://(www\.)?hoerbuch\.in/wp/horbucher/\d+/.+/")
+ protection = re.compile("http://(www\.)?hoerbuch\.in/protection/folder_\d+.html")
+
+ def decrypt(self, pyfile):
+ self.pyfile = pyfile
+
+ if self.article.match(self.pyfile.url):
+ src = self.load(self.pyfile.url)
+ soup = BeautifulSoup(src, convertEntities=BeautifulStoneSoup.HTML_ENTITIES)
+
+ abookname = soup.find("a", attrs={"rel": "bookmark"}).text
+ for a in soup.findAll("a", attrs={"href": self.protection}):
+ package = "%s (%s)" % (abookname, a.previousSibling.previousSibling.text[:-1])
+ links = self.decryptFolder(a["href"])
+
+ self.packages.append((package, links, self.pyfile.package().folder))
+ else:
+ links = self.decryptFolder(self.pyfile.url)
+
+ self.packages.append((self.pyfile.package().name, links, self.pyfile.package().folder))
+
+ def decryptFolder(self, url):
+ m = self.protection.search(url)
+ if not m:
+ self.fail("Bad URL")
+ url = m.group(0)
+
+ self.pyfile.url = url
+ src = self.req.load(url, post={"viewed": "adpg"})
+
+ links = []
+ pattern = re.compile(r'<div class="container"><a href="(.*?)"')
+ for hoster_url in pattern.findall(src):
+ self.req.lastURL = url
+ self.load(hoster_url)
+ links.append(self.req.lastEffectiveURL)
+
+ return links
diff --git a/pyload/plugins/crypter/HotfileFolderCom.py b/pyload/plugins/crypter/HotfileFolderCom.py
new file mode 100644
index 000000000..79691ad01
--- /dev/null
+++ b/pyload/plugins/crypter/HotfileFolderCom.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.plugins.Crypter import Crypter
+
+
+class HotfileFolderCom(Crypter):
+ __name__ = "HotfileFolderCom"
+ __type__ = "crypter"
+ __pattern__ = r"http://(?:www\.)?hotfile.com/list/\w+/\w+"
+ __version__ = "0.1"
+ __description__ = """HotfileFolder Download Plugin"""
+ __author_name__ = ("RaNaN")
+ __author_mail__ = ("RaNaN@pyload.org")
+
+ def decrypt(self, pyfile):
+ html = self.load(pyfile.url)
+
+ name = re.findall(
+ r'<img src="/i/folder.gif" width="23" height="14" style="margin-bottom: -2px;" />([^<]+)', html,
+ re.MULTILINE)[0].replace("/", "")
+ new_links = re.findall(r'href="(http://(www.)?hotfile\.com/dl/\d+/[0-9a-zA-Z]+[^"]+)', html)
+
+ new_links = [x[0] for x in new_links]
+
+ self.packages.append((name, new_links, name))
diff --git a/pyload/plugins/crypter/ILoadTo.py b/pyload/plugins/crypter/ILoadTo.py
new file mode 100644
index 000000000..d155f4bb6
--- /dev/null
+++ b/pyload/plugins/crypter/ILoadTo.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.internal.DeadCrypter import DeadCrypter
+
+
+class ILoadTo(DeadCrypter):
+ __name__ = "ILoadTo"
+ __type__ = "crypter"
+ __pattern__ = r"http://iload\.to/go/\d+-[\w\.-]+/"
+ __version__ = "0.11"
+ __description__ = """iload.to Crypter Plugin"""
+ __author_name__ = ("hzpz")
+ __author_mail__ = ("")
diff --git a/pyload/plugins/crypter/LetitbitNetFolder.py b/pyload/plugins/crypter/LetitbitNetFolder.py
new file mode 100644
index 000000000..68aad9dd7
--- /dev/null
+++ b/pyload/plugins/crypter/LetitbitNetFolder.py
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Crypter import Crypter
+
+
+class LetitbitNetFolder(Crypter):
+ __name__ = "LetitbitNetFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(?:www\.)?letitbit.net/folder/\w+"
+ __version__ = "0.1"
+ __description__ = """Letitbit.net Folder Plugin"""
+ __author_name__ = ("DHMH", "z00nx")
+ __author_mail__ = ("webmaster@pcProfil.de", "z00nx0@gmail.com")
+
+ FOLDER_PATTERN = r'<table>(.*)</table>'
+ LINK_PATTERN = r'<a href="([^"]+)" target="_blank">'
+
+ def decrypt(self, pyfile):
+ html = self.load(self.pyfile.url)
+
+ new_links = []
+
+ folder = re.search(self.FOLDER_PATTERN, html, re.DOTALL)
+ if folder is None:
+ self.fail("Parse error (FOLDER)")
+
+ new_links.extend(re.findall(self.LINK_PATTERN, folder.group(0)))
+
+ if new_links:
+ self.core.files.addLinks(new_links, self.pyfile.package().id)
+ else:
+ self.fail('Could not extract any links')
diff --git a/pyload/plugins/crypter/LinkList.py b/pyload/plugins/crypter/LinkList.py
new file mode 100644
index 000000000..ebfa373eb
--- /dev/null
+++ b/pyload/plugins/crypter/LinkList.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from module.plugins.Crypter import Crypter, Package
+
+class LinkList(Crypter):
+ __name__ = "LinkList"
+ __version__ = "0.11"
+ __pattern__ = r".+\.txt$"
+ __description__ = """Read Link Lists in txt format"""
+ __author_name__ = ("spoob", "jeix")
+ __author_mail__ = ("spoob@pyload.org", "jeix@hasnomail.com")
+
+ # method declaration is needed here
+ def decryptURL(self, url):
+ return Crypter.decryptURL(self, url)
+
+ def decryptFile(self, content):
+ links = content.splitlines()
+
+ curPack = "default"
+ packages = {curPack:[]}
+
+ for link in links:
+ link = link.strip()
+ if not link: continue
+
+ if link.startswith(";"):
+ continue
+ if link.startswith("[") and link.endswith("]"):
+ # new package
+ curPack = link[1:-1]
+ packages[curPack] = []
+ continue
+ packages[curPack].append(link)
+
+ # empty packages fix
+ delete = []
+
+ for key,value in packages.iteritems():
+ if not value:
+ delete.append(key)
+
+ for key in delete:
+ del packages[key]
+
+ urls = []
+
+ for name, links in packages.iteritems():
+ if name == "default":
+ urls.extend(links)
+ else:
+ urls.append(Package(name, links))
+
+ return urls \ No newline at end of file
diff --git a/pyload/plugins/crypter/LinkSaveIn.py b/pyload/plugins/crypter/LinkSaveIn.py
new file mode 100644
index 000000000..129da6608
--- /dev/null
+++ b/pyload/plugins/crypter/LinkSaveIn.py
@@ -0,0 +1,228 @@
+# -*- coding: utf-8 -*-
+
+#
+# v2.01 - hagg
+# * cnl2 and web links are skipped if JS is not available (instead of failing the package)
+# * only best available link source is used (priority: cnl2>rsdf>ccf>dlc>web
+#
+
+import base64
+import binascii
+import re
+
+from Crypto.Cipher import AES
+from module.plugins.Crypter import Crypter
+from module.unescape import unescape
+
+
+class LinkSaveIn(Crypter):
+ __name__ = "LinkSaveIn"
+ __type__ = "crypter"
+ __pattern__ = r"http://(www\.)?linksave.in/(?P<id>\w+)$"
+ __version__ = "2.01"
+ __description__ = """LinkSave.in Crypter Plugin"""
+ __author_name__ = ("fragonib")
+ __author_mail__ = ("fragonib[AT]yahoo[DOT]es")
+
+ # Constants
+ _JK_KEY_ = "jk"
+ _CRYPTED_KEY_ = "crypted"
+ HOSTER_DOMAIN = "linksave.in"
+
+ def setup(self):
+ self.html = None
+ self.fileid = None
+ self.captcha = False
+ self.package = None
+ self.preferred_sources = ['cnl2', 'rsdf', 'ccf', 'dlc', 'web']
+
+ def decrypt(self, pyfile):
+
+ # Init
+ self.package = pyfile.package()
+ self.fileid = re.match(self.__pattern__, pyfile.url).group('id')
+ self.req.cj.setCookie(self.HOSTER_DOMAIN, "Linksave_Language", "english")
+
+ # Request package
+ self.html = self.load(self.pyfile.url)
+ if not self.isOnline():
+ self.offline()
+
+ # Check for protection
+ if self.isPasswordProtected():
+ self.unlockPasswordProtection()
+ self.handleErrors()
+
+ if self.isCaptchaProtected():
+ self.captcha = True
+ self.unlockCaptchaProtection()
+ self.handleErrors()
+
+ # Get package name and folder
+ (package_name, folder_name) = self.getPackageInfo()
+
+ # Extract package links
+ package_links = []
+ for type_ in self.preferred_sources:
+ package_links.extend(self.handleLinkSource(type_))
+ if package_links: # use only first source which provides links
+ break
+ package_links = set(package_links)
+
+ # Pack
+ if package_links:
+ self.packages = [(package_name, package_links, folder_name)]
+ else:
+ self.fail('Could not extract any links')
+
+ def isOnline(self):
+ if "<big>Error 404 - Folder not found!</big>" in self.html:
+ self.logDebug("File not found")
+ return False
+ return True
+
+ def isPasswordProtected(self):
+ if re.search(r'''<input.*?type="password"''', self.html):
+ self.logDebug("Links are password protected")
+ return True
+
+ def isCaptchaProtected(self):
+ if "<b>Captcha:</b>" in self.html:
+ self.logDebug("Links are captcha protected")
+ return True
+ return False
+
+ def unlockPasswordProtection(self):
+ password = self.getPassword()
+ self.logDebug("Submitting password [%s] for protected links" % password)
+ post = {"id": self.fileid, "besucherpasswort": password, 'login': 'submit'}
+ self.html = self.load(self.pyfile.url, post=post)
+
+ def unlockCaptchaProtection(self):
+ captcha_hash = re.search(r'name="hash" value="([^"]+)', self.html).group(1)
+ captcha_url = re.search(r'src=".(/captcha/cap.php\?hsh=[^"]+)', self.html).group(1)
+ captcha_code = self.decryptCaptcha("http://linksave.in" + captcha_url, forceUser=True)
+ self.html = self.load(self.pyfile.url, post={"id": self.fileid, "hash": captcha_hash, "code": captcha_code})
+
+ def getPackageInfo(self):
+ name = self.pyfile.package().name
+ folder = self.pyfile.package().folder
+ self.logDebug("Defaulting to pyfile name [%s] and folder [%s] for package" % (name, folder))
+ return name, folder
+
+ def handleErrors(self):
+ if "The visitorpassword you have entered is wrong" in self.html:
+ self.logDebug("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")
+
+ if self.captcha:
+ if "Wrong code. Please retry" in self.html:
+ self.logDebug("Invalid captcha, retrying")
+ self.invalidCaptcha()
+ self.retry()
+ else:
+ self.correctCaptcha()
+
+ def handleLinkSource(self, type_):
+ if type_ == 'cnl2':
+ return self.handleCNL2()
+ elif type_ in ('rsdf', 'ccf', 'dlc'):
+ return self.handleContainer(type_)
+ elif type_ == 'web':
+ return self.handleWebLinks()
+ else:
+ self.fail('unknown source type "%s" (this is probably a bug)' % type_)
+
+ def handleWebLinks(self):
+ package_links = []
+ self.logDebug("Search for Web links")
+ if not self.js:
+ self.logDebug("no JS -> skip Web links")
+ else:
+ #@TODO: Gather paginated web links
+ pattern = r'<a href="http://linksave\.in/(\w{43})"'
+ ids = re.findall(pattern, self.html)
+ self.logDebug("Decrypting %d Web links" % len(ids))
+ for i, weblink_id in enumerate(ids):
+ try:
+ webLink = "http://linksave.in/%s" % weblink_id
+ self.logDebug("Decrypting Web link %d, %s" % (i + 1, webLink))
+ fwLink = "http://linksave.in/fw-%s" % weblink_id
+ response = self.load(fwLink)
+ jscode = re.findall(r'<script type="text/javascript">(.*)</script>', response)[-1]
+ jseval = self.js.eval("document = { write: function(e) { return e; } }; %s" % jscode)
+ dlLink = re.search(r'http://linksave\.in/dl-\w+', jseval).group(0)
+ self.logDebug("JsEngine returns value [%s] for redirection link" % dlLink)
+ response = self.load(dlLink)
+ link = unescape(re.search(r'<iframe src="(.+?)"', response).group(1))
+ package_links.append(link)
+ except Exception, detail:
+ self.logDebug("Error decrypting Web link %s, %s" % (webLink, detail))
+ return package_links
+
+ def handleContainer(self, type_):
+ package_links = []
+ type_ = type_.lower()
+ self.logDebug('Seach for %s Container links' % type_.upper())
+ if not type_.isalnum(): # check to prevent broken re-pattern (cnl2,rsdf,ccf,dlc,web are all alpha-numeric)
+ self.fail('unknown container type "%s" (this is probably a bug)' % type_)
+ pattern = r"\('%s_link'\).href=unescape\('(.*?\.%s)'\)" % (type_, type_)
+ containersLinks = re.findall(pattern, self.html)
+ self.logDebug("Found %d %s Container links" % (len(containersLinks), type_.upper()))
+ for containerLink in containersLinks:
+ link = "http://linksave.in/%s" % unescape(containerLink)
+ package_links.append(link)
+ return package_links
+
+ def handleCNL2(self):
+ package_links = []
+ self.logDebug("Search for CNL2 links")
+ if not self.js:
+ self.logDebug("no JS -> skip CNL2 links")
+ elif 'cnl2_load' in self.html:
+ try:
+ (vcrypted, vjk) = self._getCipherParams()
+ for (crypted, jk) in zip(vcrypted, vjk):
+ package_links.extend(self._getLinks(crypted, jk))
+ except:
+ self.fail("Unable to decrypt CNL2 links")
+ return package_links
+
+ def _getCipherParams(self):
+
+ # Get jk
+ jk_re = r'<INPUT.*?NAME="%s".*?VALUE="(.*?)"' % LinkSaveIn._JK_KEY_
+ vjk = re.findall(jk_re, self.html)
+
+ # Get crypted
+ crypted_re = r'<INPUT.*?NAME="%s".*?VALUE="(.*?)"' % LinkSaveIn._CRYPTED_KEY_
+ vcrypted = re.findall(crypted_re, self.html)
+
+ # Log and return
+ self.logDebug("Detected %d crypted blocks" % len(vcrypted))
+ return vcrypted, vjk
+
+ def _getLinks(self, crypted, jk):
+
+ # Get key
+ jreturn = self.js.eval("%s f()" % jk)
+ self.logDebug("JsEngine returns value [%s]" % jreturn)
+ key = binascii.unhexlify(jreturn)
+
+ # Decode crypted
+ crypted = base64.standard_b64decode(crypted)
+
+ # Decrypt
+ Key = key
+ IV = key
+ obj = AES.new(Key, AES.MODE_CBC, IV)
+ text = obj.decrypt(crypted)
+
+ # Extract links
+ text = text.replace("\x00", "").replace("\r", "")
+ links = text.split("\n")
+ links = filter(lambda x: x != "", links)
+
+ # Log and return
+ self.logDebug("Package has %d links" % len(links))
+ return links
diff --git a/pyload/plugins/crypter/LinkdecrypterCom.py b/pyload/plugins/crypter/LinkdecrypterCom.py
new file mode 100644
index 000000000..6a11c98b0
--- /dev/null
+++ b/pyload/plugins/crypter/LinkdecrypterCom.py
@@ -0,0 +1,104 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.Crypter import Crypter
+
+
+class LinkdecrypterCom(Crypter):
+ __name__ = "LinkdecrypterCom"
+ __type__ = "crypter"
+ __version__ = "0.27"
+ __description__ = """linkdecrypter.com"""
+ __author_name__ = ("zoidberg", "flowlee")
+
+ TEXTAREA_PATTERN = r'<textarea name="links" wrap="off" readonly="1" class="caja_des">(.+)</textarea>'
+ PASSWORD_PATTERN = r'<input type="text" name="password"'
+ CAPTCHA_PATTERN = r'<img class="captcha" src="(.+?)"(.*?)>'
+ REDIR_PATTERN = r'<i>(Click <a href="./">here</a> if your browser does not redirect you).</i>'
+
+ def decrypt(self, pyfile):
+
+ self.passwords = self.getPassword().splitlines()
+
+ # API not working anymore
+ new_links = self.decryptHTML()
+ if new_links:
+ self.core.files.addLinks(new_links, self.pyfile.package().id)
+ else:
+ self.fail('Could not extract any links')
+
+ def decryptAPI(self):
+
+ get_dict = {"t": "link", "url": self.pyfile.url, "lcache": "1"}
+ self.html = self.load('http://linkdecrypter.com/api', get=get_dict)
+ if self.html.startswith('http://'):
+ return self.html.splitlines()
+
+ if self.html == 'INTERRUPTION(PASSWORD)':
+ for get_dict['pass'] in self.passwords:
+ self.html = self.load('http://linkdecrypter.com/api', get=get_dict)
+ if self.html.startswith('http://'):
+ return self.html.splitlines()
+
+ self.logError('API', self.html)
+ if self.html == 'INTERRUPTION(PASSWORD)':
+ self.fail("No or incorrect password")
+
+ return None
+
+ def decryptHTML(self):
+
+ retries = 5
+
+ post_dict = {"link_cache": "on", "pro_links": self.pyfile.url, "modo_links": "text"}
+ self.html = self.load('http://linkdecrypter.com/', post=post_dict, cookies=True, decode=True)
+
+ while self.passwords or retries:
+ found = re.search(self.TEXTAREA_PATTERN, self.html, flags=re.DOTALL)
+ if found:
+ return [x for x in found.group(1).splitlines() if '[LINK-ERROR]' not in x]
+
+ found = re.search(self.CAPTCHA_PATTERN, self.html)
+ if found:
+ captcha_url = 'http://linkdecrypter.com/' + found.group(1)
+ result_type = "positional" if "getPos" in found.group(2) else "textual"
+
+ found = re.search(r"<p><i><b>([^<]+)</b></i></p>", self.html)
+ msg = found.group(1) if found else ""
+ self.logInfo("Captcha protected link", result_type, msg)
+
+ captcha = self.decryptCaptcha(captcha_url, result_type=result_type)
+ if result_type == "positional":
+ captcha = "%d|%d" % captcha
+ self.html = self.load('http://linkdecrypter.com/', post={"captcha": captcha}, decode=True)
+ retries -= 1
+
+ elif self.PASSWORD_PATTERN in self.html:
+ if self.passwords:
+ password = self.passwords.pop(0)
+ self.logInfo("Password protected link, trying " + password)
+ self.html = self.load('http://linkdecrypter.com/', post={'password': password}, decode=True)
+ else:
+ self.fail("No or incorrect password")
+
+ else:
+ retries -= 1
+ self.html = self.load('http://linkdecrypter.com/', cookies=True, decode=True)
+
+ return None
diff --git a/pyload/plugins/crypter/LixIn.py b/pyload/plugins/crypter/LixIn.py
new file mode 100644
index 000000000..52abe1b3c
--- /dev/null
+++ b/pyload/plugins/crypter/LixIn.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.plugins.Crypter import Crypter
+
+
+class LixIn(Crypter):
+ __name__ = "LixIn"
+ __type__ = "container"
+ __pattern__ = r"http://(www.)?lix.in/(?P<id>.*)"
+ __version__ = "0.22"
+ __description__ = """Lix.in Container Plugin"""
+ __author_name__ = ("spoob")
+ __author_mail__ = ("spoob@pyload.org")
+
+ CAPTCHA_PATTERN = '<img src="(?P<image>captcha_img.php\?.*?)"'
+ SUBMIT_PATTERN = r"value='continue.*?'"
+ LINK_PATTERN = r'name="ifram" src="(?P<link>.*?)"'
+
+ def decrypt(self, pyfile):
+ url = pyfile.url
+
+ matches = re.search(self.__pattern__, url)
+ if not matches:
+ self.fail("couldn't identify file id")
+
+ id = matches.group("id")
+ self.logDebug("File id is %s" % id)
+
+ self.html = self.req.load(url, decode=True)
+
+ matches = re.search(self.SUBMIT_PATTERN, self.html)
+ if not matches:
+ self.fail("link doesn't seem valid")
+
+ matches = re.search(self.CAPTCHA_PATTERN, self.html)
+ if matches:
+ for i in range(5):
+ matches = re.search(self.CAPTCHA_PATTERN, self.html)
+ if matches:
+ self.logDebug("trying captcha")
+ captcharesult = self.decryptCaptcha("http://lix.in/" + matches.group("image"))
+ self.html = self.req.load(url, decode=True,
+ post={"capt": captcharesult, "submit": "submit", "tiny": id})
+ else:
+ self.logDebug("no captcha/captcha solved")
+ else:
+ self.html = self.req.load(url, decode=True, post={"submit": "submit", "tiny": id})
+
+ matches = re.search(self.LINK_PATTERN, self.html)
+ if not matches:
+ self.fail("can't find destination url")
+
+ new_link = matches.group("link")
+ self.logDebug("Found link %s, adding to package" % new_link)
+
+ self.packages.append((self.pyfile.package().name, [new_link], self.pyfile.package().name))
diff --git a/pyload/plugins/crypter/LofCc.py b/pyload/plugins/crypter/LofCc.py
new file mode 100644
index 000000000..458609881
--- /dev/null
+++ b/pyload/plugins/crypter/LofCc.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.internal.DeadCrypter import DeadCrypter
+
+
+class LofCc(DeadCrypter):
+ __name__ = "LofCc"
+ __type__ = "container"
+ __pattern__ = r"http://lof.cc/(.*)"
+ __version__ = "0.21"
+ __description__ = """lof.cc Plugin"""
+ __author_name__ = ("mkaay")
+ __author_mail__ = ("mkaay@mkaay.de")
diff --git a/pyload/plugins/crypter/MBLinkInfo.py b/pyload/plugins/crypter/MBLinkInfo.py
new file mode 100644
index 000000000..434819d07
--- /dev/null
+++ b/pyload/plugins/crypter/MBLinkInfo.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.internal.DeadCrypter import DeadCrypter
+
+
+class MBLinkInfo(DeadCrypter):
+ __name__ = "MBLinkInfo"
+ __type__ = "container"
+ __pattern__ = r"http://(?:www\.)?mblink\.info/?\?id=(\d+)"
+ __version__ = "0.03"
+ __description__ = """MBLink.Info Container Plugin"""
+ __author_name__ = ("Gummibaer", "stickell")
+ __author_mail__ = ("Gummibaer@wiki-bierkiste.de", "l.stickell@yahoo.it")
diff --git a/pyload/plugins/crypter/MediafireComFolder.py b/pyload/plugins/crypter/MediafireComFolder.py
new file mode 100644
index 000000000..3709d3349
--- /dev/null
+++ b/pyload/plugins/crypter/MediafireComFolder.py
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Crypter import Crypter
+from module.plugins.hoster.MediafireCom import checkHTMLHeader
+from module.common.json_layer import json_loads
+
+
+class MediafireComFolder(Crypter):
+ __name__ = "MediafireComFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(\w*\.)*mediafire\.com/(folder/|\?sharekey=|\?\w{13}($|[/#]))"
+ __version__ = "0.14"
+ __description__ = """Mediafire.com Folder Plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FOLDER_KEY_PATTERN = r"var afI= '(\w+)';"
+ FILE_URL_PATTERN = '<meta property="og:url" content="http://www.mediafire.com/\?(\w+)"/>'
+
+ def decrypt(self, pyfile):
+ new_links = []
+
+ url, result = checkHTMLHeader(pyfile.url)
+ self.logDebug('Location (%d): %s' % (result, url))
+
+ if result == 0:
+ # load and parse html
+ html = self.load(pyfile.url)
+ found = re.search(self.FILE_URL_PATTERN, html)
+ if found:
+ # file page
+ new_links.append("http://www.mediafire.com/file/%s" % found.group(1))
+ else:
+ # folder page
+ found = re.search(self.FOLDER_KEY_PATTERN, html)
+ if found:
+ folder_key = found.group(1)
+ self.logDebug("FOLDER KEY: %s" % folder_key)
+
+ json_resp = json_loads(self.load(
+ "http://www.mediafire.com/api/folder/get_info.php?folder_key=%s&response_format=json&version=1" % folder_key))
+ #self.logInfo(json_resp)
+ if json_resp['response']['result'] == "Success":
+ for link in json_resp['response']['folder_info']['files']:
+ new_links.append("http://www.mediafire.com/file/%s" % link['quickkey'])
+ else:
+ self.fail(json_resp['response']['message'])
+ elif result == 1:
+ self.offline()
+ else:
+ new_links.append(url)
+
+ if new_links:
+ self.core.files.addLinks(new_links, self.pyfile.package().id)
+ else:
+ self.fail('Could not extract any links')
diff --git a/pyload/plugins/crypter/Movie2kTo.py b/pyload/plugins/crypter/Movie2kTo.py
new file mode 100644
index 000000000..c9c3f8f2d
--- /dev/null
+++ b/pyload/plugins/crypter/Movie2kTo.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.internal.DeadCrypter import DeadCrypter
+
+
+class Movie2kTo(DeadCrypter):
+ __name__ = "Movie2kTo"
+ __type__ = "container"
+ __pattern__ = r"http://(?:www\.)?movie2k\.to/(.*)\.html"
+ __version__ = "0.51"
+ __description__ = """Movie2k.to Container Plugin"""
+ __author_name__ = ("4Christopher")
+ __author_mail__ = ("4Christopher@gmx.de")
diff --git a/pyload/plugins/crypter/MultiloadCz.py b/pyload/plugins/crypter/MultiloadCz.py
new file mode 100644
index 000000000..055d72375
--- /dev/null
+++ b/pyload/plugins/crypter/MultiloadCz.py
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Crypter import Crypter
+
+
+class MultiloadCz(Crypter):
+ __name__ = "MultiloadCz"
+ __type__ = "crypter"
+ __pattern__ = r"http://.*multiload.cz/(stahnout|slozka)/.*"
+ __version__ = "0.4"
+ __description__ = """multiload.cz"""
+ __config__ = [("usedHoster", "str", "Prefered hoster list (bar-separated) ", ""),
+ ("ignoredHoster", "str", "Ignored hoster list (bar-separated) ", "")]
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FOLDER_PATTERN = r'<form action="" method="get"><textarea[^>]*>([^>]*)</textarea></form>'
+ LINK_PATTERN = r'<p class="manager-server"><strong>([^<]+)</strong></p><p class="manager-linky"><a href="([^"]+)">'
+
+ def decrypt(self, pyfile):
+ self.html = self.load(self.pyfile.url, decode=True)
+ new_links = []
+
+ if re.search(self.__pattern__, self.pyfile.url).group(1) == "slozka":
+ found = re.search(self.FOLDER_PATTERN, self.html)
+ if found is not None:
+ new_links.extend(found.group(1).split())
+ else:
+ found = re.findall(self.LINK_PATTERN, self.html)
+ if found:
+ prefered_set = set(self.getConfig("usedHoster").split('|'))
+ new_links.extend([x[1] for x in found if x[0] in prefered_set])
+
+ if not new_links:
+ ignored_set = set(self.getConfig("ignoredHoster").split('|'))
+ new_links.extend([x[1] for x in found if x[0] not in ignored_set])
+
+ if new_links:
+ self.core.files.addLinks(new_links, self.pyfile.package().id)
+ else:
+ self.fail('Could not extract any links')
diff --git a/pyload/plugins/crypter/MultiuploadCom.py b/pyload/plugins/crypter/MultiuploadCom.py
new file mode 100644
index 000000000..111ecdf6c
--- /dev/null
+++ b/pyload/plugins/crypter/MultiuploadCom.py
@@ -0,0 +1,64 @@
+# -*- coding: utf-8 -*-
+
+import re
+from time import time
+
+from module.plugins.Crypter import Crypter
+from module.common.json_layer import json_loads
+
+
+class MultiuploadCom(Crypter):
+ __name__ = "MultiuploadCom"
+ __type__ = "crypter"
+ __pattern__ = r"http://(?:www\.)?multiupload.com/(\w+)"
+ __version__ = "0.01"
+ __description__ = """MultiUpload.com crypter"""
+ __config__ = [("preferedHoster", "str", "Prefered hoster list (bar-separated) ", "multiupload"),
+ ("ignoredHoster", "str", "Ignored hoster list (bar-separated) ", "")]
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ ML_LINK_PATTERN = r'<div id="downloadbutton_" style=""><a href="([^"]+)"'
+
+ def decrypt(self, pyfile):
+ self.html = self.load(pyfile.url)
+ found = re.search(self.ML_LINK_PATTERN, self.html)
+ ml_url = found.group(1) if found else None
+
+ json_list = json_loads(self.load("http://multiupload.com/progress/", get={
+ "d": re.search(self.__pattern__, pyfile.url).group(1),
+ "r": str(int(time() * 1000))
+ }))
+ new_links = []
+
+ prefered_set = map(lambda s: s.lower().split('.')[0], set(self.getConfig("preferedHoster").split('|')))
+
+ if ml_url and 'multiupload' in prefered_set:
+ new_links.append(ml_url)
+
+ for link in json_list:
+ if link['service'].lower() in prefered_set and int(link['status']) and not int(link['deleted']):
+ url = self.getLocation(link['url'])
+ if url:
+ new_links.append(url)
+
+ if not new_links:
+ ignored_set = map(lambda s: s.lower().split('.')[0], set(self.getConfig("ignoredHoster").split('|')))
+
+ if 'multiupload' not in ignored_set:
+ new_links.append(ml_url)
+
+ for link in json_list:
+ if link['service'].lower() not in ignored_set and int(link['status']) and not int(link['deleted']):
+ url = self.getLocation(link['url'])
+ if url:
+ new_links.append(url)
+
+ if new_links:
+ self.core.files.addLinks(new_links, self.pyfile.package().id)
+ else:
+ self.fail('Could not extract any links')
+
+ def getLocation(self, url):
+ header = self.load(url, just_header=True)
+ return header['location'] if "location" in header else None
diff --git a/pyload/plugins/crypter/NCryptIn.py b/pyload/plugins/crypter/NCryptIn.py
new file mode 100644
index 000000000..3a474a1c6
--- /dev/null
+++ b/pyload/plugins/crypter/NCryptIn.py
@@ -0,0 +1,304 @@
+# -*- coding: utf-8 -*-
+
+import base64
+import binascii
+import re
+
+from Crypto.Cipher import AES
+from module.plugins.Crypter import Crypter
+from module.plugins.internal.CaptchaService import ReCaptcha
+
+
+class NCryptIn(Crypter):
+ __name__ = "NCryptIn"
+ __type__ = "crypter"
+ __pattern__ = r"http://(?:www\.)?ncrypt.in/(?P<type>folder|link|frame)-([^/\?]+)"
+ __version__ = "1.32"
+ __description__ = """NCrypt.in Crypter Plugin"""
+ __author_name__ = ("fragonib", "stickell")
+ __author_mail__ = ("fragonib[AT]yahoo[DOT]es", "l.stickell@yahoo.it")
+
+ # Constants
+ _JK_KEY_ = "jk"
+ _CRYPTED_KEY_ = "crypted"
+
+ NAME_PATTERN = r'<meta name="description" content="(?P<N>[^"]+)"'
+
+ def setup(self):
+ self.package = None
+ self.html = None
+ self.cleanedHtml = None
+ self.links_source_order = ['cnl2', 'rsdf', 'ccf', 'dlc', 'web']
+ self.protection_type = None
+
+ def decrypt(self, pyfile):
+
+ # Init
+ self.package = pyfile.package()
+ package_links = []
+ package_name = self.package.name
+ folder_name = self.package.folder
+
+ # Deal with single links
+ if self.isSingleLink():
+ package_links.extend(self.handleSingleLink())
+
+ # Deal with folders
+ else:
+
+ # Request folder home
+ self.html = self.requestFolderHome()
+ self.cleanedHtml = self.removeHtmlCrap(self.html)
+ if not self.isOnline():
+ self.offline()
+
+ # Check for folder protection
+ if self.isProtected():
+ self.html = self.unlockProtection()
+ self.cleanedHtml = self.removeHtmlCrap(self.html)
+ self.handleErrors()
+
+ # Prepare package name and folder
+ (package_name, folder_name) = self.getPackageInfo()
+
+ # Extract package links
+ for link_source_type in self.links_source_order:
+ package_links.extend(self.handleLinkSource(link_source_type))
+ if package_links: # use only first source which provides links
+ break
+ package_links = set(package_links)
+
+ # Pack and return links
+ if not package_links:
+ self.fail('Could not extract any links')
+ self.packages = [(package_name, package_links, folder_name)]
+
+ def isSingleLink(self):
+ link_type = re.search(self.__pattern__, self.pyfile.url).group('type')
+ return link_type in ('link', 'frame')
+
+ def requestFolderHome(self):
+ return self.load(self.pyfile.url, decode=True)
+
+ def removeHtmlCrap(self, content):
+ patterns = (r'(type="hidden".*?(name=".*?")?.*?value=".*?")',
+ r'display:none;">(.*?)</(div|span)>',
+ r'<div\s+class="jdownloader"(.*?)</div>',
+ r'<table class="global">(.*?)</table>',
+ r'<iframe\s+style="display:none(.*?)</iframe>')
+ for pattern in patterns:
+ rexpr = re.compile(pattern, re.DOTALL)
+ content = re.sub(rexpr, "", content)
+ return content
+
+ def isOnline(self):
+ if "Your folder does not exist" in self.cleanedHtml:
+ self.logDebug("File not found")
+ return False
+ return True
+
+ def isProtected(self):
+ form_match = re.search(r'<form.*?name.*?protected.*?>(.*?)</form>', self.cleanedHtml, re.DOTALL)
+ if form_match:
+ form_content = form_match.group(1)
+ for keyword in ("password", "captcha"):
+ if keyword in form_content:
+ self.protection_type = keyword
+ self.logDebug("Links are %s protected" % self.protection_type)
+ return True
+ return False
+
+ def getPackageInfo(self):
+ m = re.search(self.NAME_PATTERN, self.html)
+ if m:
+ name = folder = m.group('N').strip()
+ self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder))
+ else:
+ name = self.package.name
+ folder = self.package.folder
+ self.logDebug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder))
+ return name, folder
+
+ def unlockProtection(self):
+
+ postData = {}
+
+ form = re.search(r'<form name="protected"(.*?)</form>', self.cleanedHtml, re.DOTALL).group(1)
+
+ # Submit package password
+ if "password" in form:
+ password = self.getPassword()
+ self.logDebug("Submitting password [%s] for protected links" % password)
+ postData['password'] = password
+
+ # Resolve anicaptcha
+ if "anicaptcha" in form:
+ self.logDebug("Captcha protected")
+ captchaUri = re.search(r'src="(/temp/anicaptcha/[^"]+)', form).group(1)
+ captcha = self.decryptCaptcha("http://ncrypt.in" + captchaUri)
+ self.logDebug("Captcha resolved [%s]" % captcha)
+ postData['captcha'] = captcha
+
+ # Resolve recaptcha
+ if "recaptcha" in form:
+ self.logDebug("ReCaptcha protected")
+ captcha_key = re.search(r'\?k=(.*?)"', form).group(1)
+ self.logDebug("Resolving ReCaptcha with key [%s]" % captcha_key)
+ recaptcha = ReCaptcha(self)
+ challenge, code = recaptcha.challenge(captcha_key)
+ postData['recaptcha_challenge_field'] = challenge
+ postData['recaptcha_response_field'] = code
+
+ # Resolve circlecaptcha
+ if "circlecaptcha" in form:
+ self.logDebug("CircleCaptcha protected")
+ captcha_img_url = "http://ncrypt.in/classes/captcha/circlecaptcha.php"
+ coords = self.decryptCaptcha(captcha_img_url, forceUser=True, imgtype="png", result_type='positional')
+ self.logDebug("Captcha resolved, coords [%s]" % str(coords))
+ postData['circle.x'] = coords[0]
+ postData['circle.y'] = coords[1]
+
+ # Unlock protection
+ postData['submit_protected'] = 'Continue to folder'
+ return self.load(self.pyfile.url, post=postData, decode=True)
+
+ def handleErrors(self):
+
+ if self.protection_type == "password":
+ if "This password is invalid!" in self.cleanedHtml:
+ self.logDebug("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")
+
+ if self.protection_type == "captcha":
+ if "The securitycheck was wrong!" in self.cleanedHtml:
+ self.logDebug("Invalid captcha, retrying")
+ self.invalidCaptcha()
+ self.retry()
+ else:
+ self.correctCaptcha()
+
+ def handleLinkSource(self, link_source_type):
+
+ # Check for JS engine
+ require_js_engine = link_source_type in ('cnl2', 'rsdf', 'ccf', 'dlc')
+ if require_js_engine and not self.js:
+ self.logDebug("No JS engine available, skip %s links" % link_source_type)
+ return []
+
+ # Select suitable handler
+ if link_source_type == 'single':
+ return self.handleSingleLink()
+ if link_source_type == 'cnl2':
+ return self.handleCNL2()
+ elif link_source_type in ('rsdf', 'ccf', 'dlc'):
+ return self.handleContainer(link_source_type)
+ elif link_source_type == 'web':
+ return self.handleWebLinks()
+ else:
+ self.fail('unknown source type "%s" (this is probably a bug)' % link_source_type)
+
+ def handleSingleLink(self):
+
+ self.logDebug("Handling Single link")
+ package_links = []
+
+ # Decrypt single link
+ decrypted_link = self.decryptLink(self.pyfile.url)
+ if decrypted_link:
+ package_links.append(decrypted_link)
+
+ return package_links
+
+ def handleCNL2(self):
+
+ self.logDebug("Handling CNL2 links")
+ package_links = []
+
+ if 'cnl2_output' in self.cleanedHtml:
+ try:
+ (vcrypted, vjk) = self._getCipherParams()
+ for (crypted, jk) in zip(vcrypted, vjk):
+ package_links.extend(self._getLinks(crypted, jk))
+ except:
+ self.fail("Unable to decrypt CNL2 links")
+
+ return package_links
+
+ def handleContainers(self):
+
+ self.logDebug("Handling Container links")
+ package_links = []
+
+ pattern = r"/container/(rsdf|dlc|ccf)/([a-z0-9]+)"
+ containersLinks = re.findall(pattern, self.html)
+ self.logDebug("Decrypting %d Container links" % len(containersLinks))
+ for containerLink in containersLinks:
+ link = "http://ncrypt.in/container/%s/%s.%s" % (containerLink[0], containerLink[1], containerLink[0])
+ package_links.append(link)
+
+ return package_links
+
+ def handleWebLinks(self):
+
+ self.logDebug("Handling Web links")
+ pattern = r"(http://ncrypt\.in/link-.*?=)"
+ links = re.findall(pattern, self.html)
+
+ package_links = []
+ self.logDebug("Decrypting %d Web links" % len(links))
+ for i, link in enumerate(links):
+ self.logDebug("Decrypting Web link %d, %s" % (i + 1, link))
+ decrypted_link = self.decrypt(link)
+ if decrypted_link:
+ package_links.append(decrypted_link)
+
+ return package_links
+
+ def decryptLink(self, link):
+ try:
+ url = link.replace("link-", "frame-")
+ link = self.load(url, just_header=True)['location']
+ return link
+ except Exception, detail:
+ self.logDebug("Error decrypting link %s, %s" % (link, detail))
+
+ def _getCipherParams(self):
+
+ pattern = r'<input.*?name="%s".*?value="(.*?)"'
+
+ # Get jk
+ jk_re = pattern % NCryptIn._JK_KEY_
+ vjk = re.findall(jk_re, self.html)
+
+ # Get crypted
+ crypted_re = pattern % NCryptIn._CRYPTED_KEY_
+ vcrypted = re.findall(crypted_re, self.html)
+
+ # Log and return
+ self.logDebug("Detected %d crypted blocks" % len(vcrypted))
+ return vcrypted, vjk
+
+ def _getLinks(self, crypted, jk):
+
+ # Get key
+ jreturn = self.js.eval("%s f()" % jk)
+ self.logDebug("JsEngine returns value [%s]" % jreturn)
+ key = binascii.unhexlify(jreturn)
+
+ # Decode crypted
+ crypted = base64.standard_b64decode(crypted)
+
+ # Decrypt
+ Key = key
+ IV = key
+ obj = AES.new(Key, AES.MODE_CBC, IV)
+ text = obj.decrypt(crypted)
+
+ # Extract links
+ text = text.replace("\x00", "").replace("\r", "")
+ links = text.split("\n")
+ links = filter(lambda x: x != "", links)
+
+ # Log and return
+ self.logDebug("Block has %d links" % len(links))
+ return links
diff --git a/pyload/plugins/crypter/NetfolderIn.py b/pyload/plugins/crypter/NetfolderIn.py
new file mode 100644
index 000000000..c5c602c27
--- /dev/null
+++ b/pyload/plugins/crypter/NetfolderIn.py
@@ -0,0 +1,71 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.plugins.internal.SimpleCrypter import SimpleCrypter
+
+
+class NetfolderIn(SimpleCrypter):
+ __name__ = "NetfolderIn"
+ __type__ = "crypter"
+ __pattern__ = r"http://(?:www\.)?netfolder.in/((?P<id1>\w+)/\w+|folder.php\?folder_id=(?P<id2>\w+))"
+ __version__ = "0.6"
+ __description__ = """NetFolder Crypter Plugin"""
+ __author_name__ = ("RaNaN", "fragonib")
+ __author_mail__ = ("RaNaN@pyload.org", "fragonib[AT]yahoo[DOT]es")
+
+ TITLE_PATTERN = r'<div class="Text">Inhalt des Ordners <span(.*)>(?P<title>.+)</span></div>'
+
+ def decrypt(self, pyfile):
+ # Request package
+ self.html = self.load(pyfile.url)
+
+ # Check for password protection
+ if self.isPasswordProtected():
+ self.html = self.submitPassword()
+ if self.html is None:
+ self.fail("Incorrect password, please set right password on Add package form and retry")
+
+ # Get package name and folder
+ (package_name, folder_name) = self.getPackageNameAndFolder()
+
+ # Get package links
+ package_links = self.getLinks()
+
+ # Set package
+ self.packages = [(package_name, package_links, folder_name)]
+
+ def isPasswordProtected(self):
+
+ if '<input type="password" name="password"' in self.html:
+ self.logDebug("Links are password protected")
+ return True
+ return False
+
+ def submitPassword(self):
+ # Gather data
+ try:
+ m = re.match(self.__pattern__, self.pyfile.url)
+ id = max(m.group('id1'), m.group('id2'))
+ except AttributeError:
+ self.logDebug("Unable to get package id from url [%s]" % self.pyfile.url)
+ return
+ url = "http://netfolder.in/folder.php?folder_id=" + id
+ password = self.getPassword()
+
+ # Submit package password
+ post = {'password': password, 'save': 'Absenden'}
+ self.logDebug("Submitting password [%s] for protected links with id [%s]" % (password, id))
+ html = self.load(url, {}, post)
+
+ # Check for invalid password
+ if '<div class="InPage_Error">' in html:
+ self.logDebug("Incorrect password, please set right password on Edit package form and retry")
+ return None
+
+ return html
+
+ def getLinks(self):
+ links = re.search(r'name="list" value="(.*?)"', self.html).group(1).split(",")
+ self.logDebug("Package has %d links" % len(links))
+ return links
diff --git a/pyload/plugins/crypter/OneKhDe.py b/pyload/plugins/crypter/OneKhDe.py
new file mode 100644
index 000000000..a2e6d039e
--- /dev/null
+++ b/pyload/plugins/crypter/OneKhDe.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.unescape import unescape
+from module.plugins.Crypter import Crypter
+
+
+class OneKhDe(Crypter):
+ __name__ = "OneKhDe"
+ __type__ = "container"
+ __pattern__ = r"http://(www\.)?1kh.de/f/"
+ __version__ = "0.1"
+ __description__ = """1kh.de Container Plugin"""
+ __author_name__ = ("spoob")
+ __author_mail__ = ("spoob@pyload.org")
+
+ def __init__(self, parent):
+ Crypter.__init__(self, parent)
+ self.parent = parent
+ self.html = None
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ return True
+
+ def proceed(self, url, location):
+ url = self.parent.url
+ self.html = self.req.load(url)
+ temp_links = []
+ link_ids = re.findall(r"<a id=\"DownloadLink_(\d*)\" href=\"http://1kh.de/", self.html)
+ for id in link_ids:
+ new_link = unescape(
+ re.search("width=\"100%\" src=\"(.*)\"></iframe>", self.req.load("http://1kh.de/l/" + id)).group(1))
+ temp_links.append(new_link)
+ self.links = temp_links
diff --git a/pyload/plugins/crypter/OronComFolder.py b/pyload/plugins/crypter/OronComFolder.py
new file mode 100755
index 000000000..98d7e8242
--- /dev/null
+++ b/pyload/plugins/crypter/OronComFolder.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.internal.DeadCrypter import DeadCrypter
+
+
+class OronComFolder(DeadCrypter):
+ __name__ = "OronComFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(?:www\.)?oron.com/folder/\w+"
+ __version__ = "0.11"
+ __description__ = """Oron.com Folder Plugin"""
+ __author_name__ = ("DHMH")
+ __author_mail__ = ("webmaster@pcProfil.de")
diff --git a/pyload/plugins/crypter/PastebinCom.py b/pyload/plugins/crypter/PastebinCom.py
new file mode 100644
index 000000000..942ab613b
--- /dev/null
+++ b/pyload/plugins/crypter/PastebinCom.py
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+from module.plugins.internal.SimpleCrypter import SimpleCrypter
+
+
+class PastebinCom(SimpleCrypter):
+ __name__ = "PastebinCom"
+ __type__ = "crypter"
+ __pattern__ = r"http://(?:w{3}.)?pastebin\.com/\w+"
+ __version__ = "0.01"
+ __description__ = """Pastebin.com Plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ LINK_PATTERN = r'<div class="de\d+">(https?://[^ <]+)(?:[^<]*)</div>'
+ TITLE_PATTERN = r'<div class="paste_box_line1" title="(?P<title>[^"]+)">'
diff --git a/pyload/plugins/crypter/QuickshareCzFolder.py b/pyload/plugins/crypter/QuickshareCzFolder.py
new file mode 100644
index 000000000..18ac68eec
--- /dev/null
+++ b/pyload/plugins/crypter/QuickshareCzFolder.py
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Crypter import Crypter
+
+
+class QuickshareCzFolder(Crypter):
+ __name__ = "QuickshareCzFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(www\.)?quickshare.cz/slozka-\d+.*"
+ __version__ = "0.1"
+ __description__ = """Quickshare.cz Folder Plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FOLDER_PATTERN = r'<textarea[^>]*>(.*?)</textarea>'
+ LINK_PATTERN = r'(http://www.quickshare.cz/\S+)'
+
+ def decrypt(self, pyfile):
+ html = self.load(self.pyfile.url)
+
+ new_links = []
+ found = re.search(self.FOLDER_PATTERN, html, re.DOTALL)
+ if found is None:
+ self.fail("Parse error (FOLDER)")
+ new_links.extend(re.findall(self.LINK_PATTERN, found.group(1)))
+
+ if new_links:
+ self.core.files.addLinks(new_links, self.pyfile.package().id)
+ else:
+ self.fail('Could not extract any links') \ No newline at end of file
diff --git a/pyload/plugins/crypter/RSDF.py b/pyload/plugins/crypter/RSDF.py
new file mode 100644
index 000000000..cbc9864b1
--- /dev/null
+++ b/pyload/plugins/crypter/RSDF.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import base64
+import binascii
+import re
+
+from module.plugins.Crypter import Crypter
+
+class RSDF(Crypter):
+ __name__ = "RSDF"
+ __version__ = "0.21"
+ __pattern__ = r".*\.rsdf"
+ __description__ = """RSDF Container Decode Plugin"""
+ __author_name__ = ("RaNaN", "spoob")
+ __author_mail__ = ("RaNaN@pyload.org", "spoob@pyload.org")
+
+
+ def decrypt(self, pyfile):
+
+ from Crypto.Cipher import AES
+
+ infile = pyfile.url.replace("\n", "")
+ Key = binascii.unhexlify('8C35192D964DC3182C6F84F3252239EB4A320D2500000000')
+
+ IV = binascii.unhexlify('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF')
+ IV_Cipher = AES.new(Key, AES.MODE_ECB)
+ IV = IV_Cipher.encrypt(IV)
+
+ obj = AES.new(Key, AES.MODE_CFB, IV)
+
+ rsdf = open(infile, 'r')
+
+ data = rsdf.read()
+ rsdf.close()
+
+ if re.search(r"<title>404 - Not Found</title>", data) is None:
+ data = binascii.unhexlify(''.join(data.split()))
+ data = data.splitlines()
+
+ links = []
+ for link in data:
+ link = base64.b64decode(link)
+ link = obj.decrypt(link)
+ decryptedUrl = link.replace('CCF: ', '')
+ links.append(decryptedUrl)
+
+ self.log.debug("%s: adding package %s with %d links" % (self.__name__,pyfile.package().name,len(links)))
+ self.packages.append((pyfile.package().name, links))
diff --git a/pyload/plugins/crypter/RSLayerCom.py b/pyload/plugins/crypter/RSLayerCom.py
new file mode 100644
index 000000000..0dc7ddf4e
--- /dev/null
+++ b/pyload/plugins/crypter/RSLayerCom.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.internal.DeadCrypter import DeadCrypter
+
+
+class RSLayerCom(DeadCrypter):
+ __name__ = "RSLayerCom"
+ __type__ = "container"
+ __pattern__ = r"http://(www\.)?rs-layer.com/directory-"
+ __version__ = "0.21"
+ __description__ = """RS-Layer.com Container Plugin"""
+ __author_name__ = ("hzpz")
+ __author_mail__ = ("none")
diff --git a/pyload/plugins/crypter/RelinkUs.py b/pyload/plugins/crypter/RelinkUs.py
new file mode 100644
index 000000000..104968e06
--- /dev/null
+++ b/pyload/plugins/crypter/RelinkUs.py
@@ -0,0 +1,264 @@
+# -*- coding: utf-8 -*-
+
+import base64
+import binascii
+import re
+import os
+
+from Crypto.Cipher import AES
+from module.plugins.Crypter import Crypter
+
+
+class RelinkUs(Crypter):
+ __name__ = "RelinkUs"
+ __type__ = "crypter"
+ __pattern__ = r"http://(www\.)?relink.us/(f/|((view|go).php\?id=))(?P<id>.+)"
+ __version__ = "3.0"
+ __description__ = """Relink.us Crypter Plugin"""
+ __author_name__ = ("fragonib")
+ __author_mail__ = ("fragonib[AT]yahoo[DOT]es")
+
+ # Constants
+ PREFERRED_LINK_SOURCES = ['cnl2', 'dlc', 'web']
+
+ OFFLINE_TOKEN = "<title>Tattooside"
+ PASSWORD_TOKEN = "container_password.php"
+ PASSWORD_ERROR_ROKEN = "You have entered an incorrect password"
+ PASSWORD_SUBMIT_URL = "http://www.relink.us/container_password.php"
+ CAPTCHA_TOKEN = "container_captcha.php"
+ CAPTCHA_ERROR_ROKEN = "You have solved the captcha wrong"
+ CAPTCHA_IMG_URL = "http://www.relink.us/core/captcha/circlecaptcha.php"
+ CAPTCHA_SUBMIT_URL = "http://www.relink.us/container_captcha.php"
+ FILE_TITLE_REGEX = r"<th>Title</th><td><i>(.*)</i></td></tr>"
+ FILE_NOTITLE = 'No title'
+
+ CNL2_FORM_REGEX = r'<form id="cnl_form-(.*?)</form>'
+ CNL2_FORMINPUT_REGEX = r'<input.*?name="%s".*?value="(.*?)"'
+ CNL2_JK_KEY = "jk"
+ CNL2_CRYPTED_KEY = "crypted"
+ DLC_LINK_REGEX = r'<a href=".*?" class="dlc_button" target="_blank">'
+ DLC_DOWNLOAD_URL = "http://www.relink.us/download.php"
+ WEB_FORWARD_REGEX = r"getFile\('(?P<link>.+)'\)"
+ WEB_FORWARD_URL = "http://www.relink.us/frame.php"
+ WEB_LINK_REGEX = r'<iframe name="Container" height="100%" frameborder="no" width="100%" src="(?P<link>.+)"></iframe>'
+
+ def setup(self):
+ self.fileid = None
+ self.package = None
+ self.password = None
+ self.html = None
+ self.captcha = False
+
+ def decrypt(self, pyfile):
+
+ # Init
+ self.initPackage(pyfile)
+
+ # Request package
+ self.requestPackage()
+
+ # Check for online
+ if not self.isOnline():
+ self.offline()
+
+ # Check for protection
+ if self.isPasswordProtected():
+ self.unlockPasswordProtection()
+ self.handleErrors()
+
+ if self.isCaptchaProtected():
+ self.captcha = True
+ self.unlockCaptchaProtection()
+ self.handleErrors()
+
+ # Get package name and folder
+ (package_name, folder_name) = self.getPackageInfo()
+
+ # Extract package links
+ package_links = []
+ for sources in self.PREFERRED_LINK_SOURCES:
+ package_links.extend(self.handleLinkSource(sources))
+ if package_links: # use only first source which provides links
+ break
+ package_links = set(package_links)
+
+ # Pack
+ if package_links:
+ self.packages = [(package_name, package_links, folder_name)]
+ else:
+ self.fail('Could not extract any links')
+
+ def initPackage(self, pyfile):
+ self.fileid = re.match(self.__pattern__, pyfile.url).group('id')
+ self.package = pyfile.package()
+ self.password = self.getPassword()
+ self.url = pyfile.url
+
+ def requestPackage(self):
+ self.html = self.load(self.url, decode=True)
+
+ def isOnline(self):
+ if self.OFFLINE_TOKEN in self.html:
+ self.logDebug("File not found")
+ return False
+ return True
+
+ def isPasswordProtected(self):
+ if self.PASSWORD_TOKEN in self.html:
+ self.logDebug("Links are password protected")
+ return True
+
+ def isCaptchaProtected(self):
+ if self.CAPTCHA_TOKEN in self.html:
+ self.logDebug("Links are captcha protected")
+ return True
+ return False
+
+ def unlockPasswordProtection(self):
+ self.logDebug("Submitting password [%s] for protected links" % self.password)
+ passwd_url = self.PASSWORD_SUBMIT_URL + "?id=%s" % self.fileid
+ passwd_data = {'id': self.fileid, 'password': self.password, 'pw': 'submit'}
+ self.html = self.load(passwd_url, post=passwd_data, decode=True)
+
+ def unlockCaptchaProtection(self):
+ self.logDebug("Request user positional captcha resolving")
+ captcha_img_url = self.CAPTCHA_IMG_URL + "?id=%s" % self.fileid
+ coords = self.decryptCaptcha(captcha_img_url, forceUser=True, imgtype="png", result_type='positional')
+ self.logDebug("Captcha resolved, coords [%s]" % str(coords))
+ captcha_post_url = self.CAPTCHA_SUBMIT_URL + "?id=%s" % self.fileid
+ captcha_post_data = {'button.x': coords[0], 'button.y': coords[1], 'captcha': 'submit'}
+ self.html = self.load(captcha_post_url, post=captcha_post_data, decode=True)
+
+ def getPackageInfo(self):
+ name = folder = None
+
+ # Try to get info from web
+ m = re.search(self.FILE_TITLE_REGEX, self.html)
+ if m is not None:
+ title = m.group(1).strip()
+ if not self.FILE_NOTITLE in title:
+ name = folder = title
+ self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder))
+
+ # Fallback to defaults
+ if not name or not folder:
+ name = self.package.name
+ folder = self.package.folder
+ self.logDebug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder))
+
+ # Return package info
+ return name, folder
+
+ def handleErrors(self):
+ if self.PASSWORD_ERROR_ROKEN in self.html:
+ msg = "Incorrect password, please set right password on 'Edit package' form and retry"
+ self.logDebug(msg)
+ self.fail(msg)
+
+ if self.captcha:
+ if self.CAPTCHA_ERROR_ROKEN in self.html:
+ self.logDebug("Invalid captcha, retrying")
+ self.invalidCaptcha()
+ self.retry()
+ else:
+ self.correctCaptcha()
+
+ def handleLinkSource(self, source):
+ if source == 'cnl2':
+ return self.handleCNL2Links()
+ elif source == 'dlc':
+ return self.handleDLCLinks()
+ elif source == 'web':
+ return self.handleWEBLinks()
+ else:
+ self.fail('Unknown source [%s] (this is probably a bug)' % source)
+
+ def handleCNL2Links(self):
+ self.logDebug("Search for CNL2 links")
+ package_links = []
+ m = re.search(self.CNL2_FORM_REGEX, self.html, re.DOTALL)
+ if m is not None:
+ cnl2_form = m.group(1)
+ try:
+ (vcrypted, vjk) = self._getCipherParams(cnl2_form)
+ for (crypted, jk) in zip(vcrypted, vjk):
+ package_links.extend(self._getLinks(crypted, jk))
+ except:
+ self.logDebug("Unable to decrypt CNL2 links")
+ return package_links
+
+ def handleDLCLinks(self):
+ self.logDebug('Search for DLC links')
+ package_links = []
+ m = re.search(self.DLC_LINK_REGEX, self.html)
+ if m is not None:
+ container_url = self.DLC_DOWNLOAD_URL + "?id=%s&dlc=1" % self.fileid
+ self.logDebug("Downloading DLC container link [%s]" % container_url)
+ try:
+ dlc = self.load(container_url)
+ dlc_filename = self.fileid + ".dlc"
+ dlc_filepath = os.path.join(self.config["general"]["download_folder"], dlc_filename)
+ f = open(dlc_filepath, "wb")
+ f.write(dlc)
+ f.close()
+ package_links.append(dlc_filepath)
+ except:
+ self.logDebug("Unable to download DLC container")
+ return package_links
+
+ def handleWEBLinks(self):
+ self.logDebug("Search for WEB links")
+ package_links = []
+ fw_params = re.findall(self.WEB_FORWARD_REGEX, self.html)
+ self.logDebug("Decrypting %d Web links" % len(fw_params))
+ for index, fw_param in enumerate(fw_params):
+ try:
+ fw_url = self.WEB_FORWARD_URL + "?%s" % fw_param
+ self.logDebug("Decrypting Web link %d, %s" % (index + 1, fw_url))
+ fw_response = self.load(fw_url, decode=True)
+ dl_link = re.search(self.WEB_LINK_REGEX, fw_response).group('link')
+ package_links.append(dl_link)
+ except Exception, detail:
+ self.logDebug("Error decrypting Web link %s, %s" % (index, detail))
+ self.setWait(4)
+ self.wait()
+ return package_links
+
+ def _getCipherParams(self, cnl2_form):
+
+ # Get jk
+ jk_re = self.CNL2_FORMINPUT_REGEX % self.CNL2_JK_KEY
+ vjk = re.findall(jk_re, cnl2_form, re.IGNORECASE)
+
+ # Get crypted
+ crypted_re = self.CNL2_FORMINPUT_REGEX % RelinkUs.CNL2_CRYPTED_KEY
+ vcrypted = re.findall(crypted_re, cnl2_form, re.IGNORECASE)
+
+ # Log and return
+ self.logDebug("Detected %d crypted blocks" % len(vcrypted))
+ return vcrypted, vjk
+
+ def _getLinks(self, crypted, jk):
+
+ # Get key
+ jreturn = self.js.eval("%s f()" % jk)
+ self.logDebug("JsEngine returns value [%s]" % jreturn)
+ key = binascii.unhexlify(jreturn)
+
+ # Decode crypted
+ crypted = base64.standard_b64decode(crypted)
+
+ # Decrypt
+ Key = key
+ IV = key
+ obj = AES.new(Key, AES.MODE_CBC, IV)
+ text = obj.decrypt(crypted)
+
+ # Extract links
+ text = text.replace("\x00", "").replace("\r", "")
+ links = text.split("\n")
+ links = filter(lambda x: x != "", links)
+
+ # Log and return
+ self.logDebug("Package has %d links" % len(links))
+ return links
diff --git a/pyload/plugins/crypter/SecuredIn.py b/pyload/plugins/crypter/SecuredIn.py
new file mode 100644
index 000000000..4c3bbf4a6
--- /dev/null
+++ b/pyload/plugins/crypter/SecuredIn.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.internal.DeadCrypter import DeadCrypter
+
+
+class SecuredIn(DeadCrypter):
+ __name__ = "SecuredIn"
+ __type__ = "container"
+ __pattern__ = r"http://[\w\.]*?secured\.in/download-[\d]+-[\w]{8}\.html"
+ __version__ = "0.21"
+ __description__ = """secured.in Container Plugin"""
+ __author_name__ = ("mkaay")
+ __author_mail__ = ("mkaay@mkaay.de")
diff --git a/pyload/plugins/crypter/SerienjunkiesOrg.py b/pyload/plugins/crypter/SerienjunkiesOrg.py
new file mode 100644
index 000000000..a682a44fa
--- /dev/null
+++ b/pyload/plugins/crypter/SerienjunkiesOrg.py
@@ -0,0 +1,322 @@
+# -*- coding: utf-8 -*-
+
+import re
+from time import sleep
+import random
+
+from BeautifulSoup import BeautifulSoup
+
+from module.plugins.Crypter import Crypter
+from module.unescape import unescape
+
+
+class SerienjunkiesOrg(Crypter):
+ __name__ = "SerienjunkiesOrg"
+ __type__ = "container"
+ __pattern__ = r"http://.*?(serienjunkies.org|dokujunkies.org)/.*?"
+ __version__ = "0.39"
+ __config__ = [
+ ("changeNameSJ", "Packagename;Show;Season;Format;Episode", "Take SJ.org name", "Show"),
+ ("changeNameDJ", "Packagename;Show;Format;Episode", "Take DJ.org name", "Show"),
+ ("randomPreferred", "bool", "Randomize Preferred-List", False),
+ ("hosterListMode", "OnlyOne;OnlyPreferred(One);OnlyPreferred(All);All",
+ "Use for hosters (if supported)", "All"),
+ ("hosterList", "str", "Preferred Hoster list (comma separated)",
+ "RapidshareCom,UploadedTo,NetloadIn,FilefactoryCom,FreakshareNet,FilebaseTo,HotfileCom,DepositfilesCom,EasyshareCom,KickloadCom"),
+ ("ignoreList", "str", "Ignored Hoster list (comma separated)", "MegauploadCom")
+ ]
+ __description__ = """serienjunkies.org Container Plugin"""
+ __author_name__ = ("mkaay", "godofdream")
+ __author_mail__ = ("mkaay@mkaay.de", "soilfiction@gmail.com")
+
+ def setup(self):
+ self.multiDL = False
+
+ def getSJSrc(self, url):
+ src = self.req.load(str(url))
+ if "This website is not available in your country" in src:
+ self.fail("Not available in your country")
+ if not src.find("Enter Serienjunkies") == -1:
+ sleep(1)
+ src = self.req.load(str(url))
+ return src
+
+ def handleShow(self, url):
+ src = self.getSJSrc(url)
+ soup = BeautifulSoup(src)
+ packageName = self.pyfile.package().name
+ if self.getConfig("changeNameSJ") == "Show":
+ found = unescape(soup.find("h2").find("a").string.split(' &#8211;')[0])
+ if found:
+ packageName = found
+
+ nav = soup.find("div", attrs={"id": "scb"})
+
+ package_links = []
+ for a in nav.findAll("a"):
+ if self.getConfig("changeNameSJ") == "Show":
+ package_links.append(a["href"])
+ else:
+ package_links.append(a["href"] + "#hasName")
+ if self.getConfig("changeNameSJ") == "Show":
+ self.packages.append((packageName, package_links, packageName))
+ else:
+ self.core.files.addLinks(package_links, self.pyfile.package().id)
+
+ def handleSeason(self, url):
+ src = self.getSJSrc(url)
+ soup = BeautifulSoup(src)
+ post = soup.find("div", attrs={"class": "post-content"})
+ ps = post.findAll("p")
+
+ seasonName = unescape(soup.find("a", attrs={"rel": "bookmark"}).string).replace("&#8211;", "-")
+ groups = {}
+ gid = -1
+ for p in ps:
+ if re.search("<strong>Sprache|<strong>Format", str(p)):
+ var = p.findAll("strong")
+ opts = {"Sprache": "", "Format": ""}
+ for v in var:
+ n = unescape(v.string).strip()
+ n = re.sub(r"^([:]?)(.*?)([:]?)$", r'\2', n)
+ if n.strip() not in opts:
+ continue
+ val = v.nextSibling
+ if not val:
+ continue
+ val = val.replace("|", "").strip()
+ val = re.sub(r"^([:]?)(.*?)([:]?)$", r'\2', val)
+ opts[n.strip()] = val.strip()
+ gid += 1
+ groups[gid] = {}
+ groups[gid]["ep"] = {}
+ groups[gid]["opts"] = opts
+ elif re.search("<strong>Download:", str(p)):
+ parts = str(p).split("<br />")
+ if re.search("<strong>", parts[0]):
+ ename = re.search('<strong>(.*?)</strong>', parts[0]).group(1).strip().decode("utf-8").replace(
+ "&#8211;", "-")
+ groups[gid]["ep"][ename] = {}
+ parts.remove(parts[0])
+ for part in parts:
+ hostername = re.search(r" \| ([-a-zA-Z0-9]+\.\w+)", part)
+ if hostername:
+ hostername = hostername.group(1)
+ groups[gid]["ep"][ename][hostername] = []
+ links = re.findall('href="(.*?)"', part)
+ for link in links:
+ groups[gid]["ep"][ename][hostername].append(link + "#hasName")
+
+ links = []
+ for g in groups.values():
+ for ename in g["ep"]:
+ links.extend(self.getpreferred(g["ep"][ename]))
+ if self.getConfig("changeNameSJ") == "Episode":
+ self.packages.append((ename, links, ename))
+ links = []
+ package = "%s (%s, %s)" % (seasonName, g["opts"]["Format"], g["opts"]["Sprache"])
+ if self.getConfig("changeNameSJ") == "Format":
+ self.packages.append((package, links, package))
+ links = []
+ if (self.getConfig("changeNameSJ") == "Packagename") or re.search("#hasName", url):
+ self.core.files.addLinks(links, self.pyfile.package().id)
+ elif (self.getConfig("changeNameSJ") == "Season") or not re.search("#hasName", url):
+ self.packages.append((seasonName, links, seasonName))
+
+ def handleEpisode(self, url):
+ src = self.getSJSrc(url)
+ if not src.find(
+ "Du hast das Download-Limit &uuml;berschritten! Bitte versuche es sp&auml;ter nocheinmal.") == -1:
+ self.fail(_("Downloadlimit reached"))
+ else:
+ soup = BeautifulSoup(src)
+ form = soup.find("form")
+ h1 = soup.find("h1")
+
+ if h1.get("class") == "wrap":
+ captchaTag = soup.find(attrs={"src": re.compile("^/secure/")})
+ if not captchaTag:
+ sleep(5)
+ self.retry()
+
+ captchaUrl = "http://download.serienjunkies.org" + captchaTag["src"]
+ result = self.decryptCaptcha(str(captchaUrl), imgtype="png")
+ sinp = form.find(attrs={"name": "s"})
+
+ self.req.lastURL = str(url)
+ sj = self.load(str(url), post={'s': sinp["value"], 'c': result, 'action': "Download"})
+
+ soup = BeautifulSoup(sj)
+ rawLinks = soup.findAll(attrs={"action": re.compile("^http://download.serienjunkies.org/")})
+
+ if not len(rawLinks) > 0:
+ sleep(1)
+ self.retry()
+ return
+
+ self.correctCaptcha()
+
+ links = []
+ for link in rawLinks:
+ frameUrl = link["action"].replace("/go-", "/frame/go-")
+ links.append(self.handleFrame(frameUrl))
+ if re.search("#hasName", url) or ((self.getConfig("changeNameSJ") == "Packagename") and
+ (self.getConfig("changeNameDJ") == "Packagename")):
+ self.core.files.addLinks(links, self.pyfile.package().id)
+ else:
+ if h1.text[2] == "_":
+ eName = h1.text[3:]
+ else:
+ eName = h1.text
+ self.packages.append((eName, links, eName))
+
+ def handleOldStyleLink(self, url):
+ sj = self.req.load(str(url))
+ soup = BeautifulSoup(sj)
+ form = soup.find("form", attrs={"action": re.compile("^http://serienjunkies.org")})
+ captchaTag = form.find(attrs={"src": re.compile("^/safe/secure/")})
+ captchaUrl = "http://serienjunkies.org" + captchaTag["src"]
+ result = self.decryptCaptcha(str(captchaUrl))
+ url = form["action"]
+ sinp = form.find(attrs={"name": "s"})
+
+ self.req.load(str(url), post={'s': sinp["value"], 'c': result, 'dl.start': "Download"}, cookies=False,
+ just_header=True)
+ decrypted = self.req.lastEffectiveURL
+ if decrypted == str(url):
+ self.retry()
+ self.core.files.addLinks([decrypted], self.pyfile.package().id)
+
+ def handleFrame(self, url):
+ self.req.load(str(url))
+ return self.req.lastEffectiveURL
+
+ def handleShowDJ(self, url):
+ src = self.getSJSrc(url)
+ soup = BeautifulSoup(src)
+ post = soup.find("div", attrs={"id": "page_post"})
+ ps = post.findAll("p")
+ found = unescape(soup.find("h2").find("a").string.split(' &#8211;')[0])
+ if found:
+ seasonName = found
+
+ groups = {}
+ gid = -1
+ for p in ps:
+ if re.search("<strong>Sprache|<strong>Format", str(p)):
+ var = p.findAll("strong")
+ opts = {"Sprache": "", "Format": ""}
+ for v in var:
+ n = unescape(v.string).strip()
+ n = re.sub(r"^([:]?)(.*?)([:]?)$", r'\2', n)
+ if n.strip() not in opts:
+ continue
+ val = v.nextSibling
+ if not val:
+ continue
+ val = val.replace("|", "").strip()
+ val = re.sub(r"^([:]?)(.*?)([:]?)$", r'\2', val)
+ opts[n.strip()] = val.strip()
+ gid += 1
+ groups[gid] = {}
+ groups[gid]["ep"] = {}
+ groups[gid]["opts"] = opts
+ elif re.search("<strong>Download:", str(p)):
+ parts = str(p).split("<br />")
+ if re.search("<strong>", parts[0]):
+ ename = re.search('<strong>(.*?)</strong>', parts[0]).group(1).strip().decode("utf-8").replace(
+ "&#8211;", "-")
+ groups[gid]["ep"][ename] = {}
+ parts.remove(parts[0])
+ for part in parts:
+ hostername = re.search(r" \| ([-a-zA-Z0-9]+\.\w+)", part)
+ if hostername:
+ hostername = hostername.group(1)
+ groups[gid]["ep"][ename][hostername] = []
+ links = re.findall('href="(.*?)"', part)
+ for link in links:
+ groups[gid]["ep"][ename][hostername].append(link + "#hasName")
+
+ links = []
+ for g in groups.values():
+ for ename in g["ep"]:
+ links.extend(self.getpreferred(g["ep"][ename]))
+ if self.getConfig("changeNameDJ") == "Episode":
+ self.packages.append((ename, links, ename))
+ links = []
+ package = "%s (%s, %s)" % (seasonName, g["opts"]["Format"], g["opts"]["Sprache"])
+ if self.getConfig("changeNameDJ") == "Format":
+ self.packages.append((package, links, package))
+ links = []
+ if (self.getConfig("changeNameDJ") == "Packagename") or re.search("#hasName", url):
+ self.core.files.addLinks(links, self.pyfile.package().id)
+ elif (self.getConfig("changeNameDJ") == "Show") or not re.search("#hasName", url):
+ self.packages.append((seasonName, links, seasonName))
+
+ def handleCategoryDJ(self, url):
+ package_links = []
+ src = self.getSJSrc(url)
+ soup = BeautifulSoup(src)
+ content = soup.find("div", attrs={"id": "content"})
+ for a in content.findAll("a", attrs={"rel": "bookmark"}):
+ package_links.append(a["href"])
+ self.core.files.addLinks(package_links, self.pyfile.package().id)
+
+ def decrypt(self, pyfile):
+ showPattern = re.compile("^http://serienjunkies.org/serie/(.*)/$")
+ seasonPattern = re.compile("^http://serienjunkies.org/.*?/(.*)/$")
+ episodePattern = re.compile("^http://download.serienjunkies.org/f-.*?.html(#hasName)?$")
+ oldStyleLink = re.compile("^http://serienjunkies.org/safe/(.*)$")
+ categoryPatternDJ = re.compile("^http://dokujunkies.org/.*?(.*)$")
+ showPatternDJ = re.compile(r"^http://dokujunkies.org/.*?/(.*)\.html(#hasName)?$")
+ framePattern = re.compile("^http://download.(serienjunkies.org|dokujunkies.org)/frame/go-.*?/$")
+ url = pyfile.url
+ if framePattern.match(url):
+ self.packages.append((self.pyfile.package().name, [self.handleFrame(url)], self.pyfile.package().name))
+ elif episodePattern.match(url):
+ self.handleEpisode(url)
+ elif oldStyleLink.match(url):
+ self.handleOldStyleLink(url)
+ elif showPattern.match(url):
+ self.handleShow(url)
+ elif showPatternDJ.match(url):
+ self.handleShowDJ(url)
+ elif seasonPattern.match(url):
+ self.handleSeason(url)
+ elif categoryPatternDJ.match(url):
+ self.handleCategoryDJ(url)
+
+ #selects the preferred hoster, after that selects any hoster (ignoring the one to ignore)
+ def getpreferred(self, hosterlist):
+
+ result = []
+ preferredList = self.getConfig("hosterList").strip().lower().replace(
+ '|', ',').replace('.', '').replace(';', ',').split(',')
+ if (self.getConfig("randomPreferred") is True) and (
+ self.getConfig("hosterListMode") in ["OnlyOne", "OnlyPreferred(One)"]):
+ random.shuffle(preferredList)
+ # we don't want hosters be read two times
+ hosterlist2 = hosterlist.copy()
+
+ for preferred in preferredList:
+ for Hoster in hosterlist:
+ if preferred == Hoster.lower().replace('.', ''):
+ for Part in hosterlist[Hoster]:
+ self.logDebug("selected " + Part)
+ result.append(str(Part))
+ del (hosterlist2[Hoster])
+ if self.getConfig("hosterListMode") in ["OnlyOne", "OnlyPreferred(One)"]:
+ return result
+
+ ignorelist = self.getConfig("ignoreList").strip().lower().replace(
+ '|', ',').replace('.', '').replace(';', ',').split(',')
+ if self.getConfig('hosterListMode') in ["OnlyOne", "All"]:
+ for Hoster in hosterlist2:
+ if Hoster.strip().lower().replace('.', '') not in ignorelist:
+ for Part in hosterlist2[Hoster]:
+ self.logDebug("selected2 " + Part)
+ result.append(str(Part))
+
+ if self.getConfig('hosterListMode') == "OnlyOne":
+ return result
+ return result
diff --git a/pyload/plugins/crypter/ShareLinksBiz.py b/pyload/plugins/crypter/ShareLinksBiz.py
new file mode 100644
index 000000000..09ac21873
--- /dev/null
+++ b/pyload/plugins/crypter/ShareLinksBiz.py
@@ -0,0 +1,269 @@
+# -*- coding: utf-8 -*-
+
+import base64
+import binascii
+import re
+
+from Crypto.Cipher import AES
+from module.plugins.Crypter import Crypter
+
+
+class ShareLinksBiz(Crypter):
+ __name__ = "ShareLinksBiz"
+ __type__ = "crypter"
+ __pattern__ = r"(?P<base>http://[\w\.]*?(share-links|s2l)\.biz)/(?P<id>_?[0-9a-z]+)(/.*)?"
+ __version__ = "1.13"
+ __description__ = """Share-Links.biz Crypter"""
+ __author_name__ = ("fragonib")
+ __author_mail__ = ("fragonib[AT]yahoo[DOT]es")
+
+ def setup(self):
+ self.baseUrl = None
+ self.fileId = None
+ self.package = None
+ self.html = None
+ self.captcha = False
+
+ def decrypt(self, pyfile):
+
+ # Init
+ self.initFile(pyfile)
+
+ # Request package
+ url = self.baseUrl + '/' + self.fileId
+ self.html = self.load(url, decode=True)
+
+ # Unblock server (load all images)
+ self.unblockServer()
+
+ # Check for protection
+ if self.isPasswordProtected():
+ self.unlockPasswordProtection()
+ self.handleErrors()
+
+ if self.isCaptchaProtected():
+ self.captcha = True
+ self.unlockCaptchaProtection()
+ self.handleErrors()
+
+ # Extract package links
+ package_links = []
+ package_links.extend(self.handleWebLinks())
+ package_links.extend(self.handleContainers())
+ package_links.extend(self.handleCNL2())
+ package_links = set(package_links)
+
+ # Get package info
+ package_name, package_folder = self.getPackageInfo()
+
+ # Pack
+ self.packages = [(package_name, package_links, package_folder)]
+
+ def initFile(self, pyfile):
+ url = pyfile.url
+ if 's2l.biz' in url:
+ url = self.load(url, just_header=True)['location']
+ self.baseUrl = re.search(self.__pattern__, url).group(1)
+ self.fileId = re.match(self.__pattern__, url).group('id')
+ self.package = pyfile.package()
+
+ def isOnline(self):
+ if "No usable content was found" in self.html:
+ self.logDebug("File not found")
+ return False
+ return True
+
+ def isPasswordProtected(self):
+ if re.search(r'''<form.*?id="passwordForm".*?>''', self.html):
+ self.logDebug("Links are protected")
+ return True
+ return False
+
+ def isCaptchaProtected(self):
+ if '<map id="captchamap"' in self.html:
+ self.logDebug("Links are captcha protected")
+ return True
+ return False
+
+ def unblockServer(self):
+ imgs = re.findall(r"(/template/images/.*?\.gif)", self.html)
+ for img in imgs:
+ self.load(self.baseUrl + img)
+
+ def unlockPasswordProtection(self):
+ password = self.getPassword()
+ self.logDebug("Submitting password [%s] for protected links" % password)
+ post = {"password": password, 'login': 'Submit form'}
+ url = self.baseUrl + '/' + self.fileId
+ self.html = self.load(url, post=post, decode=True)
+
+ def unlockCaptchaProtection(self):
+ # Get captcha map
+ captchaMap = self._getCaptchaMap()
+ self.logDebug("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)
+ captchaUrl = self.baseUrl + '/captcha.gif?d=%s&PHPSESSID=%s' % (m.group(1), m.group(2))
+ self.logDebug("Waiting user for correct position")
+ coords = self.decryptCaptcha(captchaUrl, forceUser=True, imgtype="gif", result_type='positional')
+ self.logDebug("Captcha resolved, coords [%s]" % str(coords))
+
+ # Resolve captcha
+ href = self._resolveCoords(coords, captchaMap)
+ if href is None:
+ self.logDebug("Invalid captcha resolving, retrying")
+ self.invalidCaptcha()
+ self.setWait(5, False)
+ self.wait()
+ self.retry()
+ url = self.baseUrl + href
+ self.html = self.load(url, decode=True)
+
+ def _getCaptchaMap(self):
+ mapp = {}
+ for m in re.finditer(r'<area shape="rect" coords="(.*?)" href="(.*?)"', self.html):
+ rect = eval('(' + m.group(1) + ')')
+ href = m.group(2)
+ mapp[rect] = href
+ return mapp
+
+ def _resolveCoords(self, coords, captchaMap):
+ x, y = coords
+ for rect, href in captchaMap.items():
+ x1, y1, x2, y2 = rect
+ if (x >= x1 and x <= x2) and (y >= y1 and y <= y2):
+ return href
+
+ def handleErrors(self):
+ if "The inserted password was wrong" in self.html:
+ self.logDebug("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")
+
+ if self.captcha:
+ if "Your choice was wrong" in self.html:
+ self.logDebug("Invalid captcha, retrying")
+ self.invalidCaptcha()
+ self.setWait(5)
+ self.wait()
+ self.retry()
+ else:
+ self.correctCaptcha()
+
+ def getPackageInfo(self):
+ name = folder = None
+
+ # Extract from web package header
+ title_re = r'<h2><img.*?/>(.*)</h2>'
+ m = re.search(title_re, self.html, re.DOTALL)
+ if m is not None:
+ title = m.group(1).strip()
+ if 'unnamed' not in title:
+ name = folder = title
+ self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder))
+
+ # Fallback to defaults
+ if not name or not folder:
+ name = self.package.name
+ folder = self.package.folder
+ self.logDebug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder))
+
+ # Return package info
+ return name, folder
+
+ def handleWebLinks(self):
+ package_links = []
+ self.logDebug("Handling Web links")
+
+ #@TODO: Gather paginated web links
+ pattern = r"javascript:_get\('(.*?)', \d+, ''\)"
+ ids = re.findall(pattern, self.html)
+ self.logDebug("Decrypting %d Web links" % len(ids))
+ for i, ID in enumerate(ids):
+ try:
+ self.logDebug("Decrypting Web link %d, [%s]" % (i + 1, ID))
+ dwLink = self.baseUrl + "/get/lnk/" + ID
+ response = self.load(dwLink)
+ code = re.search(r'frm/(\d+)', response).group(1)
+ fwLink = self.baseUrl + "/get/frm/" + code
+ response = self.load(fwLink)
+ jscode = re.search(r'<script language="javascript">\s*eval\((.*)\)\s*</script>', response,
+ re.DOTALL).group(1)
+ jscode = self.js.eval("f = %s" % jscode)
+ jslauncher = "window=''; parent={frames:{Main:{location:{href:''}}},location:''}; %s; parent.frames.Main.location.href"
+ dlLink = self.js.eval(jslauncher % jscode)
+ self.logDebug("JsEngine returns value [%s] for redirection link" % dlLink)
+ package_links.append(dlLink)
+ except Exception, detail:
+ self.logDebug("Error decrypting Web link [%s], %s" % (ID, detail))
+ return package_links
+
+ def handleContainers(self):
+ package_links = []
+ self.logDebug("Handling Container links")
+
+ pattern = r"javascript:_get\('(.*?)', 0, '(rsdf|ccf|dlc)'\)"
+ containersLinks = re.findall(pattern, self.html)
+ self.logDebug("Decrypting %d Container links" % len(containersLinks))
+ for containerLink in containersLinks:
+ link = "%s/get/%s/%s" % (self.baseUrl, containerLink[1], containerLink[0])
+ package_links.append(link)
+ return package_links
+
+ def handleCNL2(self):
+ package_links = []
+ self.logDebug("Handling CNL2 links")
+
+ if '/lib/cnl2/ClicknLoad.swf' in self.html:
+ try:
+ (crypted, jk) = self._getCipherParams()
+ package_links.extend(self._getLinks(crypted, jk))
+ except:
+ self.fail("Unable to decrypt CNL2 links")
+ return package_links
+
+ def _getCipherParams(self):
+
+ # Request CNL2
+ code = re.search(r'ClicknLoad.swf\?code=(.*?)"', self.html).group(1)
+ url = "%s/get/cnl2/%s" % (self.baseUrl, code)
+ response = self.load(url)
+ params = response.split(";;")
+
+ # Get jk
+ strlist = list(base64.standard_b64decode(params[1]))
+ strlist.reverse()
+ jk = ''.join(strlist)
+
+ # Get crypted
+ strlist = list(base64.standard_b64decode(params[2]))
+ strlist.reverse()
+ crypted = ''.join(strlist)
+
+ # Log and return
+ return crypted, jk
+
+ def _getLinks(self, crypted, jk):
+
+ # Get key
+ jreturn = self.js.eval("%s f()" % jk)
+ self.logDebug("JsEngine returns value [%s]" % jreturn)
+ key = binascii.unhexlify(jreturn)
+
+ # Decode crypted
+ crypted = base64.standard_b64decode(crypted)
+
+ # Decrypt
+ Key = key
+ IV = key
+ obj = AES.new(Key, AES.MODE_CBC, IV)
+ text = obj.decrypt(crypted)
+
+ # Extract links
+ text = text.replace("\x00", "").replace("\r", "")
+ links = text.split("\n")
+ links = filter(lambda x: x != "", links)
+
+ # Log and return
+ self.logDebug("Block has %d links" % len(links))
+ return links
diff --git a/pyload/plugins/crypter/ShareRapidComFolder.py b/pyload/plugins/crypter/ShareRapidComFolder.py
new file mode 100644
index 000000000..951c09d45
--- /dev/null
+++ b/pyload/plugins/crypter/ShareRapidComFolder.py
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.internal.SimpleCrypter import SimpleCrypter
+
+
+class ShareRapidComFolder(SimpleCrypter):
+ __name__ = "ShareRapidComFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(?:www\.)?((share(-?rapid\.(biz|com|cz|info|eu|net|org|pl|sk)|-(central|credit|free|net)\.cz|-ms\.net)|(s-?rapid|rapids)\.(cz|sk))|(e-stahuj|mediatack|premium-rapidshare|rapidshare-premium|qiuck)\.cz|kadzet\.com|stahuj-zdarma\.eu|strelci\.net|universal-share\.com)/(slozka/.+)"
+ __version__ = "0.01"
+ __description__ = """Share-Rapid.com Folder Plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ LINK_PATTERN = r'<td class="soubor"[^>]*><a href="([^"]+)">'
diff --git a/pyload/plugins/crypter/SpeedLoadOrgFolder.py b/pyload/plugins/crypter/SpeedLoadOrgFolder.py
new file mode 100644
index 000000000..7472e28fe
--- /dev/null
+++ b/pyload/plugins/crypter/SpeedLoadOrgFolder.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+from module.plugins.internal.DeadCrypter import DeadCrypter
+
+
+class SpeedLoadOrgFolder(DeadCrypter):
+ __name__ = "SpeedLoadOrgFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(www\.)?speedload\.org/(\d+~f$|folder/\d+/)"
+ __version__ = "0.3"
+ __description__ = """Speedload Crypter Plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
diff --git a/pyload/plugins/crypter/StealthTo.py b/pyload/plugins/crypter/StealthTo.py
new file mode 100644
index 000000000..45a14f5a2
--- /dev/null
+++ b/pyload/plugins/crypter/StealthTo.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.plugins.Crypter import Crypter
+
+
+class StealthTo(Crypter):
+ __name__ = "StealthTo"
+ __type__ = "container"
+ __pattern__ = r"http://(www\.)?stealth.to/folder/"
+ __version__ = "0.1"
+ __description__ = """Stealth.to Container Plugin"""
+ __author_name__ = ("spoob")
+ __author_mail__ = ("spoob@pyload.org")
+
+ def __init__(self, parent):
+ Crypter.__init__(self, parent)
+ self.parent = parent
+ self.html = None
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ return True
+
+ def proceed(self, url, location):
+ url = self.parent.url
+ self.html = self.req.load(url, cookies=True)
+ temp_links = []
+ ids = []
+ ats = [] # authenticity_token
+ inputs = re.findall(r"(<(input|form)[^>]+)", self.html)
+ for input in inputs:
+ if re.search(r"name=\"authenticity_token\"", input[0]):
+ ats.append(re.search(r"value=\"([^\"]+)", input[0]).group(1))
+ if re.search(r"name=\"id\"", input[0]):
+ ids.append(re.search(r"value=\"([^\"]+)", input[0]).group(1))
+
+ for i in range(0, len(ids)):
+ self.req.load(url + "/web",
+ post={"authenticity_token": ats[i], "id": str(ids[i]), "link": ("download_" + str(ids[i]))},
+ cookies=True)
+ new_html = self.req.load(url + "/web", post={"authenticity_token": ats[i], "id": str(ids[i]), "link": "1"},
+ cookies=True)
+ temp_links.append(re.search(r"iframe src=\"(.*)\" frameborder", new_html).group(1))
+
+ self.links = temp_links
diff --git a/pyload/plugins/crypter/TrailerzoneInfo.py b/pyload/plugins/crypter/TrailerzoneInfo.py
new file mode 100644
index 000000000..cdd84bbc6
--- /dev/null
+++ b/pyload/plugins/crypter/TrailerzoneInfo.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.internal.DeadCrypter import DeadCrypter
+
+
+class TrailerzoneInfo(DeadCrypter):
+ __name__ = "TrailerzoneInfo"
+ __type__ = "crypter"
+ __pattern__ = r"http://(www\.)?trailerzone.info/.*?"
+ __version__ = "0.03"
+ __description__ = """TrailerZone.info Crypter Plugin"""
+ __author_name__ = ("godofdream")
+ __author_mail__ = ("soilfiction@gmail.com")
diff --git a/pyload/plugins/crypter/TurbobitNetFolder.py b/pyload/plugins/crypter/TurbobitNetFolder.py
new file mode 100644
index 000000000..e172f8037
--- /dev/null
+++ b/pyload/plugins/crypter/TurbobitNetFolder.py
@@ -0,0 +1,60 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+import math
+import re
+
+from module.plugins.internal.SimpleCrypter import SimpleCrypter
+from module.common.json_layer import json_loads
+
+
+def format_links(fid):
+ return 'http://turbobit.net/%s.html' % fid
+
+
+class TurbobitNetFolder(SimpleCrypter):
+ __name__ = "TurbobitNetFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(?:w{3}.)?turbobit\.net/download/folder/(?P<id>\w+)"
+ __version__ = "0.01"
+ __description__ = """Turbobit.net Folder Plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ TITLE_PATTERN = r"<img src='/js/lib/grid/icon/folder.png'>(?P<title>.+)</div>"
+
+ def getLinks(self):
+ folder_id = re.search(self.__pattern__, self.pyfile.url).group('id')
+ grid = self.load('http://turbobit.net/downloadfolder/gridFile',
+ get={'id_folder': folder_id, 'rows': 200}, decode=True)
+ grid = json_loads(grid)
+
+ links_count = grid["records"]
+ pages = int(math.ceil(links_count / 200.0))
+
+ ids = list()
+ for i in grid['rows']:
+ ids.append(i['id'])
+
+ for p in range(2, pages + 1):
+ grid = self.load('http://turbobit.net/downloadfolder/gridFile',
+ get={'id_folder': folder_id, 'rows': 200, 'page': p}, decode=True)
+ grid = json_loads(grid)
+ for i in grid['rows']:
+ ids.append(i['id'])
+
+ return map(format_links, ids)
diff --git a/pyload/plugins/crypter/UlozToFolder.py b/pyload/plugins/crypter/UlozToFolder.py
new file mode 100644
index 000000000..a5ccfc753
--- /dev/null
+++ b/pyload/plugins/crypter/UlozToFolder.py
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Crypter import Crypter
+
+
+class UlozToFolder(Crypter):
+ __name__ = "UlozToFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://.*(uloz\.to|ulozto\.(cz|sk|net)|bagruj.cz|zachowajto.pl)/(m|soubory)/.*"
+ __version__ = "0.2"
+ __description__ = """Uloz.to Folder Plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FOLDER_PATTERN = r'<ul class="profile_files">(.*?)</ul>'
+ LINK_PATTERN = r'<br /><a href="/([^"]+)">[^<]+</a>'
+ NEXT_PAGE_PATTERN = r'<a class="next " href="/([^"]+)">&nbsp;</a>'
+
+ def decrypt(self, pyfile):
+ html = self.load(self.pyfile.url)
+
+ new_links = []
+ for i in range(1, 100):
+ self.logInfo("Fetching links from page %i" % i)
+ found = re.search(self.FOLDER_PATTERN, html, re.DOTALL)
+ if found is None:
+ self.fail("Parse error (FOLDER)")
+
+ new_links.extend(re.findall(self.LINK_PATTERN, found.group(1)))
+ found = re.search(self.NEXT_PAGE_PATTERN, html)
+ if found:
+ html = self.load("http://ulozto.net/" + found.group(1))
+ else:
+ break
+ else:
+ self.logInfo("Limit of 99 pages reached, aborting")
+
+ if new_links:
+ self.core.files.addLinks(map(lambda s: "http://ulozto.net/%s" % s, new_links), self.pyfile.package().id)
+ else:
+ self.fail('Could not extract any links')
diff --git a/pyload/plugins/crypter/UploadedToFolder.py b/pyload/plugins/crypter/UploadedToFolder.py
new file mode 100644
index 000000000..88d4e04e8
--- /dev/null
+++ b/pyload/plugins/crypter/UploadedToFolder.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+import re
+
+from module.plugins.internal.SimpleCrypter import SimpleCrypter
+
+
+class UploadedToFolder(SimpleCrypter):
+ __name__ = "UploadedToFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(?:www\.)?(uploaded|ul)\.(to|net)/(f|folder|list)/(?P<id>\w+)"
+ __version__ = "0.3"
+ __description__ = """UploadedTo Crypter Plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ PLAIN_PATTERN = r'<small class="date"><a href="(?P<plain>[\w/]+)" onclick='
+ TITLE_PATTERN = r'<title>(?P<title>[^<]+)</title>'
+
+ def decrypt(self, pyfile):
+ self.html = self.load(pyfile.url)
+
+ package_name, folder_name = self.getPackageNameAndFolder()
+
+ m = re.search(self.PLAIN_PATTERN, self.html)
+ if m:
+ plain_link = 'http://uploaded.net/' + m.group('plain')
+ else:
+ self.fail('Parse error - Unable to find plain url list')
+
+ self.html = self.load(plain_link)
+ package_links = self.html.split('\n')[:-1]
+ self.logDebug('Package has %d links' % len(package_links))
+
+ self.packages = [(package_name, package_links, folder_name)]
diff --git a/pyload/plugins/crypter/WiiReloadedOrg.py b/pyload/plugins/crypter/WiiReloadedOrg.py
new file mode 100644
index 000000000..df70c5aea
--- /dev/null
+++ b/pyload/plugins/crypter/WiiReloadedOrg.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.internal.DeadCrypter import DeadCrypter
+
+
+class WiiReloadedOrg(DeadCrypter):
+ __name__ = "WiiReloadedOrg"
+ __type__ = "crypter"
+ __pattern__ = r"http://www\.wii-reloaded\.org/protect/get\.php\?i=.+"
+ __version__ = "0.11"
+ __description__ = """Wii-Reloaded.org Crypter Plugin"""
+ __author_name__ = ("hzpz")
+ __author_mail__ = ("none")
diff --git a/pyload/plugins/crypter/XfilesharingProFolder.py b/pyload/plugins/crypter/XfilesharingProFolder.py
new file mode 100644
index 000000000..90e3044a3
--- /dev/null
+++ b/pyload/plugins/crypter/XfilesharingProFolder.py
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.Crypter import Crypter, Package
+import re
+
+class XfilesharingProFolder(Crypter):
+ __name__ = "XfilesharingProFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(?:www\.)?((easybytez|turboupload|uploadville|file4safe|fileband|filebeep|grupload|247upload)\.com|(muchshare|annonhost).net|bzlink.us)/users/.*"
+ __version__ = "0.01"
+ __description__ = """Generic XfilesharingPro Folder Plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ LINK_PATTERN = r'<div class="link"><a href="([^"]+)" target="_blank">[^<]*</a></div>'
+ SUBFOLDER_PATTERN = r'<TD width="1%"><img src="[^"]*/images/folder2.gif"></TD><TD><a href="([^"]+)"><b>(?!\. \.<)([^<]+)</b></a></TD>'
+
+ def decryptURL(self, url):
+ return self.decryptFile(self.load(url, decode = True))
+
+ def decryptFile(self, html):
+ new_links = []
+
+ new_links.extend(re.findall(self.LINK_PATTERN, html))
+
+ subfolders = re.findall(self.SUBFOLDER_PATTERN, html)
+ #self.logDebug(subfolders)
+ for (url, name) in subfolders:
+ if self.package: name = "%s/%s" % (self.package.name, name)
+ new_links.append(Package(name, [url]))
+
+ if not new_links: self.fail('Could not extract any links')
+
+ return new_links \ No newline at end of file
diff --git a/pyload/plugins/crypter/XupPl.py b/pyload/plugins/crypter/XupPl.py
new file mode 100644
index 000000000..09832f037
--- /dev/null
+++ b/pyload/plugins/crypter/XupPl.py
@@ -0,0 +1,18 @@
+from module.plugins.Crypter import Crypter
+
+
+class XupPl(Crypter):
+ __name__ = "XupPl"
+ __type__ = "crypter"
+ __pattern__ = r"https?://.*\.xup\.pl/.*"
+ __version__ = "0.1"
+ __description__ = """Xup.pl Crypter Plugin"""
+ __author_name__ = ("z00nx")
+ __author_mail__ = ("z00nx0@gmail.com")
+
+ def decrypt(self, pyfile):
+ header = self.load(self.pyfile.url, just_header=True)
+ if 'location' in header:
+ self.core.files.addLinks([header['location']], self.pyfile.package().id)
+ else:
+ self.fail('Unable to find link')
diff --git a/pyload/plugins/crypter/YoutubeBatch.py b/pyload/plugins/crypter/YoutubeBatch.py
new file mode 100644
index 000000000..b6178448d
--- /dev/null
+++ b/pyload/plugins/crypter/YoutubeBatch.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+import json
+
+from module.plugins.Crypter import Crypter
+
+API_KEY = "AIzaSyCKnWLNlkX-L4oD1aEzqqhRw1zczeD6_k0"
+
+
+class YoutubeBatch(Crypter):
+ __name__ = "YoutubeBatch"
+ __type__ = "container"
+ __pattern__ = r"https?://(?:[^/]*?)youtube\.com/(?:(?:view_play_list|playlist|.*?feature=PlayList).*?[?&](?:list|p)=)([a-zA-Z0-9-_]+)"
+ __version__ = "0.93"
+ __description__ = """Youtube.com Channel Download Plugin"""
+ __author_name__ = ("RaNaN", "Spoob", "zoidberg", "roland")
+ __author_mail__ = ("RaNaN@pyload.org", "spoob@pyload.org", "zoidberg@mujmail.cz", "roland@enkore.de")
+
+ def get_videos(self, playlist_id, token=None):
+ url = "https://www.googleapis.com/youtube/v3/playlistItems?playlistId=%s&part=snippet&key=%s&maxResults=50" % (
+ playlist_id, API_KEY)
+ if token:
+ url += "&pageToken=" + token
+
+ response = json.loads(self.load(url))
+
+ for item in response["items"]:
+ if item["kind"] == "youtube#playlistItem" and item["snippet"]["resourceId"]["kind"] == "youtube#video":
+ yield "http://youtube.com/watch?v=" + item["snippet"]["resourceId"]["videoId"]
+
+ if "nextPageToken" in response:
+ for item in self.get_videos(playlist_id, response["nextPageToken"]):
+ yield item
+
+ def decrypt(self, pyfile):
+ match_id = re.match(self.__pattern__, self.pyfile.url)
+ new_links = []
+ playlist_id = match_id.group(1)
+
+ new_links.extend(self.get_videos(playlist_id))
+
+ self.packages.append((self.pyfile.package().name, new_links, self.pyfile.package().name))
diff --git a/pyload/plugins/crypter/__init__.py b/pyload/plugins/crypter/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/pyload/plugins/crypter/__init__.py
diff --git a/pyload/plugins/hoster/ARD.py b/pyload/plugins/hoster/ARD.py
new file mode 100644
index 000000000..12cb6c95a
--- /dev/null
+++ b/pyload/plugins/hoster/ARD.py
@@ -0,0 +1,83 @@
+import subprocess
+import re
+import os.path
+import os
+
+from module.utils import save_join, save_path
+from module.plugins.Hoster import Hoster
+
+# Requires rtmpdump
+# by Roland Beermann
+
+
+class RTMP:
+ # TODO: Port to some RTMP-library like rtmpy or similar
+ # TODO?: Integrate properly into the API of pyLoad
+
+ command = "rtmpdump"
+
+ @classmethod
+ def download_rtmp_stream(cls, url, output_file, playpath=None):
+ opts = [
+ "-r", url,
+ "-o", output_file,
+ ]
+ if playpath:
+ opts.append("--playpath")
+ opts.append(playpath)
+
+ cls._invoke_rtmpdump(opts)
+
+ @classmethod
+ def _invoke_rtmpdump(cls, opts):
+ args = [
+ cls.command
+ ]
+ args.extend(opts)
+
+ return subprocess.check_call(args)
+
+
+class ARD(Hoster):
+ __name__ = "ARD Mediathek"
+ __version__ = "0.12"
+ __pattern__ = r"http://www\.ardmediathek\.de/.*"
+ __config__ = []
+
+ def process(self, pyfile):
+ site = self.load(pyfile.url)
+
+ avail_videos = re.findall(
+ r'mediaCollection.addMediaStream\(0, ([0-9]*), "([^\"]*)", "([^\"]*)", "[^\"]*"\);', site)
+ avail_videos.sort(key=lambda videodesc: int(videodesc[0]),
+ reverse=True) # The higher the number, the better the quality
+
+ quality, url, playpath = avail_videos[0]
+
+ pyfile.name = re.search(r"<h1>([^<]*)</h1>", site).group(1)
+
+ if url.startswith("http"):
+ # Best quality is available over HTTP. Very rare.
+ self.download(url)
+ else:
+ pyfile.setStatus("downloading")
+
+ download_folder = self.config['general']['download_folder']
+
+ location = save_join(download_folder, pyfile.package().folder)
+
+ if not os.path.exists(location):
+ os.makedirs(location, int(self.config["permission"]["folder"], 8))
+
+ if self.config["permission"]["change_dl"] and os.name != "nt":
+ try:
+ uid = getpwnam(self.config["permission"]["user"])[2]
+ gid = getgrnam(self.config["permission"]["group"])[2]
+
+ chown(location, uid, gid)
+ except Exception, e:
+ self.logWarning(_("Setting User and Group failed: %s") % str(e))
+
+ output_file = save_join(location, save_path(pyfile.name)) + os.path.splitext(playpath)[1]
+
+ RTMP.download_rtmp_stream(url, playpath=playpath, output_file=output_file)
diff --git a/pyload/plugins/hoster/AlldebridCom.py b/pyload/plugins/hoster/AlldebridCom.py
new file mode 100644
index 000000000..82f4531a6
--- /dev/null
+++ b/pyload/plugins/hoster/AlldebridCom.py
@@ -0,0 +1,83 @@
+# -*- coding: utf-8 -*-
+
+import re
+from urllib import unquote
+from random import randrange
+from module.plugins.Hoster import Hoster
+from module.common.json_layer import json_loads
+from module.utils import parseFileSize
+
+
+class AlldebridCom(Hoster):
+ __name__ = "AlldebridCom"
+ __version__ = "0.34"
+ __type__ = "hoster"
+
+ __pattern__ = r"https?://.*alldebrid\..*"
+ __description__ = """Alldebrid.com hoster plugin"""
+ __author_name__ = ("Andy, Voigt")
+ __author_mail__ = ("spamsales@online.de")
+
+ def getFilename(self, url):
+ try:
+ name = unquote(url.rsplit("/", 1)[1])
+ except IndexError:
+ name = "Unknown_Filename..."
+ if name.endswith("..."): # incomplete filename, append random stuff
+ name += "%s.tmp" % randrange(100, 999)
+ return name
+
+ def setup(self):
+ self.chunkLimit = 16
+ self.resumeDownload = True
+
+ def process(self, pyfile):
+ if re.match(self.__pattern__, pyfile.url):
+ new_url = pyfile.url
+ elif not self.account:
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "AllDebrid")
+ self.fail("No AllDebrid account provided")
+ else:
+ self.logDebug("Old URL: %s" % pyfile.url)
+ password = self.getPassword().splitlines()
+ password = "" if not password else password[0]
+
+ url = "http://www.alldebrid.com/service.php?link=%s&json=true&pw=%s" % (pyfile.url, password)
+ page = self.load(url)
+ data = json_loads(page)
+
+ self.logDebug("Json data: %s" % str(data))
+
+ if data["error"]:
+ if data["error"] == "This link isn't available on the hoster website.":
+ self.offline()
+ else:
+ self.logWarning(data["error"])
+ self.tempOffline()
+ else:
+ if self.pyfile.name and not self.pyfile.name.endswith('.tmp'):
+ self.pyfile.name = data["filename"]
+ self.pyfile.size = parseFileSize(data["filesize"])
+ new_url = data["link"]
+
+ if self.getConfig("https"):
+ new_url = new_url.replace("http://", "https://")
+ else:
+ new_url = new_url.replace("https://", "http://")
+
+ if new_url != pyfile.url:
+ self.logDebug("New URL: %s" % new_url)
+
+ if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"):
+ #only use when name wasnt already set
+ pyfile.name = self.getFilename(new_url)
+
+ self.download(new_url, disposition=True)
+
+ check = self.checkDownload({"error": "<title>An error occured while processing your request</title>",
+ "empty": re.compile(r"^$")})
+
+ if check == "error":
+ self.retry(reason="An error occured while generating link.", wait_time=60)
+ elif check == "empty":
+ self.retry(reason="Downloaded File was empty.", wait_time=60)
diff --git a/pyload/plugins/hoster/BasePlugin.py b/pyload/plugins/hoster/BasePlugin.py
new file mode 100644
index 000000000..2bdfda7c4
--- /dev/null
+++ b/pyload/plugins/hoster/BasePlugin.py
@@ -0,0 +1,113 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+from urlparse import urlparse
+from re import search
+from urllib import unquote
+
+from module.network.HTTPRequest import BadHeader
+from module.plugins.Hoster import Hoster
+from module.utils import html_unescape, remove_chars
+
+
+class BasePlugin(Hoster):
+ __name__ = "BasePlugin"
+ __type__ = "hoster"
+ __pattern__ = r"^unmatchable$"
+ __version__ = "0.19"
+ __description__ = """Base Plugin when any other didnt fit"""
+ __author_name__ = ("RaNaN")
+ __author_mail__ = ("RaNaN@pyload.org")
+
+ def setup(self):
+ self.chunkLimit = -1
+ self.resumeDownload = True
+
+ def process(self, pyfile):
+ """main function"""
+
+ #debug part, for api exerciser
+ if pyfile.url.startswith("DEBUG_API"):
+ self.multiDL = False
+ return
+
+ # self.__name__ = "NetloadIn"
+ # pyfile.name = "test"
+ # self.html = self.load("http://localhost:9000/short")
+ # self.download("http://localhost:9000/short")
+ # self.api = self.load("http://localhost:9000/short")
+ # self.decryptCaptcha("http://localhost:9000/captcha")
+ #
+ # if pyfile.url == "79":
+ # self.core.api.addPackage("test", [str(i) for i in range(80)], 1)
+ #
+ # return
+ if pyfile.url.startswith("http"):
+
+ try:
+ self.downloadFile(pyfile)
+ except BadHeader, e:
+ if e.code in (401, 403):
+ self.logDebug("Auth required")
+
+ account = self.core.accountManager.getAccountPlugin('Http')
+ servers = [x['login'] for x in account.getAllAccounts()]
+ server = urlparse(pyfile.url).netloc
+
+ if server in servers:
+ self.logDebug("Logging on to %s" % server)
+ self.req.addAuth(account.accounts[server]["password"])
+ else:
+ for pwd in pyfile.package().password.splitlines():
+ if ":" in pwd:
+ self.req.addAuth(pwd.strip())
+ break
+ else:
+ self.fail(_("Authorization required (username:password)"))
+
+ self.downloadFile(pyfile)
+ else:
+ raise
+
+ else:
+ self.fail("No Plugin matched and not a downloadable url.")
+
+ def downloadFile(self, pyfile):
+ url = pyfile.url
+
+ for i in range(5):
+ header = self.load(url, just_header=True)
+
+ # self.load does not raise a BadHeader on 404 responses, do it here
+ if 'code' in header and header['code'] == 404:
+ raise BadHeader(404)
+
+ if 'location' in header:
+ self.logDebug("Location: " + header['location'])
+ base = search(r'https?://[^/]+', url).group(0)
+ if header['location'].startswith("http"):
+ url = unquote(header['location'])
+ elif header['location'].startswith("/"):
+ url = base + unquote(header['location'])
+ else:
+ url = '%s/%s' % (base, unquote(header['location']))
+ else:
+ break
+
+ name = html_unescape(unquote(urlparse(url).path.split("/")[-1]))
+
+ if 'content-disposition' in header:
+ self.logDebug("Content-Disposition: " + header['content-disposition'])
+ m = search("filename(?P<type>=|\*=(?P<enc>.+)'')(?P<name>.*)", header['content-disposition'])
+ if m:
+ disp = m.groupdict()
+ self.logDebug(disp)
+ if not disp['enc']:
+ disp['enc'] = 'utf-8'
+ name = remove_chars(disp['name'], "\"';").strip()
+ name = unicode(unquote(name), disp['enc'])
+
+ if not name:
+ name = url
+ pyfile.name = name
+ self.logDebug("Filename: %s" % pyfile.name)
+ self.download(url, disposition=True)
diff --git a/pyload/plugins/hoster/BayfilesCom.py b/pyload/plugins/hoster/BayfilesCom.py
new file mode 100644
index 000000000..a696bac26
--- /dev/null
+++ b/pyload/plugins/hoster/BayfilesCom.py
@@ -0,0 +1,98 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from time import time
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.common.json_layer import json_loads
+
+
+class BayfilesCom(SimpleHoster):
+ __name__ = "BayfilesCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?bayfiles\.(?:com|net)/file/\w+/\w+/.*"
+ __version__ = "0.05"
+ __description__ = """Bayfiles.com plugin - free only"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FILE_INFO_PATTERN = r'<p title="(?P<N>[^"]+)">[^<]*<strong>(?P<S>[0-9., ]+)(?P<U>[kKMG])i?B</strong></p>'
+ FILE_OFFLINE_PATTERN = r'(<p>The requested file could not be found.</p>|<title>404 Not Found</title>)'
+
+ WAIT_PATTERN = r'>Your IP [0-9.]* has recently downloaded a file\. Upgrade to premium or wait (\d+) minutes\.<'
+ VARS_PATTERN = r'var vfid = (\d+);\s*var delay = (\d+);'
+ LINK_PATTERN = r"javascript:window.location.href = '([^']+)';"
+ PREMIUM_LINK_PATTERN = r'(?:<a class="highlighted-btn" href="|(?=http://s\d+\.baycdn\.com/dl/))(.*?)"'
+
+ def handleFree(self):
+ found = re.search(self.WAIT_PATTERN, self.html)
+ if found:
+ self.setWait(int(found.group(1)) * 60)
+ self.wait()
+ self.retry()
+
+ # Get download token
+ found = re.search(self.VARS_PATTERN, self.html)
+ if not found:
+ self.parseError('VARS')
+ vfid, delay = found.groups()
+
+ response = json_loads(self.load('http://bayfiles.com/ajax_download', get={
+ "_": time() * 1000,
+ "action": "startTimer",
+ "vfid": vfid}, decode=True))
+
+ if not "token" in response or not response['token']:
+ self.fail('No token')
+
+ self.setWait(int(delay))
+ self.wait()
+
+ self.html = self.load('http://bayfiles.com/ajax_download', get={
+ "token": response['token'],
+ "action": "getLink",
+ "vfid": vfid})
+
+ # Get final link and download
+ found = re.search(self.LINK_PATTERN, self.html)
+ if not found:
+ self.parseError("Free link")
+ self.startDownload(found.group(1))
+
+ def handlePremium(self):
+ found = re.search(self.PREMIUM_LINK_PATTERN, self.html)
+ if not found:
+ self.parseError("Premium link")
+ self.startDownload(found.group(1))
+
+ def startDownload(self, url):
+ self.logDebug("%s URL: %s" % ("Premium" if self.premium else "Free", url))
+ self.download(url)
+ # check download
+ check = self.checkDownload({
+ "waitforfreeslots": re.compile(r"<title>BayFiles</title>"),
+ "notfound": re.compile(r"<title>404 Not Found</title>")
+ })
+ if check == "waitforfreeslots":
+ self.retry(60, 300, "Wait for free slot")
+ elif check == "notfound":
+ self.retry(60, 300, "404 Not found")
+
+
+getInfo = create_getInfo(BayfilesCom)
diff --git a/pyload/plugins/hoster/BezvadataCz.py b/pyload/plugins/hoster/BezvadataCz.py
new file mode 100644
index 000000000..daed65095
--- /dev/null
+++ b/pyload/plugins/hoster/BezvadataCz.py
@@ -0,0 +1,101 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from pyload.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+
+class BezvadataCz(SimpleHoster):
+ __name__ = "BezvadataCz"
+ __type__ = "hoster"
+ __pattern__ = r"http://(\w*\.)*bezvadata.cz/stahnout/.*"
+ __version__ = "0.24"
+ __description__ = """BezvaData.cz"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FILE_NAME_PATTERN = r'<p><b>Soubor: (?P<N>[^<]+)</b></p>'
+ FILE_SIZE_PATTERN = r'<li><strong>Velikost:</strong> (?P<S>[^<]+)</li>'
+ FILE_OFFLINE_PATTERN = r'<title>BezvaData \| Soubor nenalezen</title>'
+
+ def setup(self):
+ self.multiDL = self.resumeDownload = True
+
+ def handleFree(self):
+ #download button
+ found = re.search(r'<a class="stahnoutSoubor".*?href="(.*?)"', self.html)
+ if not found:
+ self.parseError("page1 URL")
+ url = "http://bezvadata.cz%s" % found.group(1)
+
+ #captcha form
+ self.html = self.load(url)
+ self.checkErrors()
+ for i in range(5):
+ action, inputs = self.parseHtmlForm('frm-stahnoutFreeForm')
+ if not inputs:
+ self.parseError("FreeForm")
+
+ found = re.search(r'<img src="data:image/png;base64,(.*?)"', self.html)
+ if not found:
+ self.parseError("captcha img")
+
+ #captcha image is contained in html page as base64encoded data but decryptCaptcha() expects image url
+ self.load, proper_load = self.loadcaptcha, self.load
+ try:
+ inputs['captcha'] = self.decryptCaptcha(found.group(1), imgtype='png')
+ finally:
+ self.load = proper_load
+
+ if '<img src="data:image/png;base64' in self.html:
+ self.invalidCaptcha()
+ else:
+ self.correctCaptcha()
+ break
+ else:
+ self.fail("No valid captcha code entered")
+
+ #download url
+ self.html = self.load("http://bezvadata.cz%s" % action, post=inputs)
+ self.checkErrors()
+ found = re.search(r'<a class="stahnoutSoubor2" href="(.*?)">', self.html)
+ if not found:
+ self.parseError("page2 URL")
+ url = "http://bezvadata.cz%s" % found.group(1)
+ self.logDebug("DL URL %s" % url)
+
+ #countdown
+ found = re.search(r'id="countdown">(\d\d):(\d\d)<', self.html)
+ wait_time = (int(found.group(1)) * 60 + int(found.group(2)) + 1) if found else 120
+ self.setWait(wait_time, False)
+ self.wait()
+
+ self.download(url)
+
+ def checkErrors(self):
+ if 'images/button-download-disable.png' in self.html:
+ self.longWait(300, 24) # parallel dl limit
+ elif '<div class="infobox' in self.html:
+ self.tempOffline()
+
+ def loadcaptcha(self, data, *args, **kwargs):
+ return data.decode("base64")
+
+
+getInfo = create_getInfo(BezvadataCz)
diff --git a/pyload/plugins/hoster/BillionuploadsCom.py b/pyload/plugins/hoster/BillionuploadsCom.py
new file mode 100644
index 000000000..91e869c59
--- /dev/null
+++ b/pyload/plugins/hoster/BillionuploadsCom.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
+
+class BillionuploadsCom(XFileSharingPro):
+ __name__ = "BillionuploadsCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)*?billionuploads.com/\w{12}"
+ __version__ = "0.01"
+ __description__ = """billionuploads.com hoster plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FILE_NAME_PATTERN = r'<b>Filename:</b>(?P<N>.*?)<br>'
+ FILE_SIZE_PATTERN = r'<b>Size:</b>(?P<S>.*?)<br>'
+ HOSTER_NAME = "billionuploads.com"
+
+
+getInfo = create_getInfo(BillionuploadsCom)
diff --git a/pyload/plugins/hoster/BitshareCom.py b/pyload/plugins/hoster/BitshareCom.py
new file mode 100644
index 000000000..2b3f7777f
--- /dev/null
+++ b/pyload/plugins/hoster/BitshareCom.py
@@ -0,0 +1,146 @@
+# -*- coding: utf-8 -*-
+from __future__ import with_statement
+
+import re
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.plugins.internal.CaptchaService import ReCaptcha
+
+
+class BitshareCom(SimpleHoster):
+ __name__ = "BitshareCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?bitshare\.com/(files/(?P<id1>[a-zA-Z0-9]+)(/(?P<name>.*?)\.html)?|\?f=(?P<id2>[a-zA-Z0-9]+))"
+ __version__ = "0.49"
+ __description__ = """Bitshare.Com File Download Hoster"""
+ __author_name__ = ("paulking", "fragonib")
+ __author_mail__ = (None, "fragonib[AT]yahoo[DOT]es")
+
+ HOSTER_DOMAIN = "bitshare.com"
+ FILE_OFFLINE_PATTERN = r'(>We are sorry, but the requested file was not found in our database|>Error - File not available<|The file was deleted either by the uploader, inactivity or due to copyright claim)'
+ FILE_INFO_PATTERN = r'Downloading (?P<N>.+) - (?P<S>[\d.]+) (?P<U>\w+)</h1>'
+ FILE_AJAXID_PATTERN = r'var ajaxdl = "(.*?)";'
+ CAPTCHA_KEY_PATTERN = r"http://api\.recaptcha\.net/challenge\?k=(.*?) "
+ TRAFFIC_USED_UP = r"Your Traffic is used up for today. Upgrade to premium to continue!"
+
+ def setup(self):
+ self.req.cj.setCookie(self.HOSTER_DOMAIN, "language_selection", "EN")
+ self.multiDL = self.premium
+ self.chunkLimit = 1
+
+ def process(self, pyfile):
+ if self.premium:
+ self.account.relogin(self.user)
+
+ self.pyfile = pyfile
+
+ # File id
+ m = re.match(self.__pattern__, self.pyfile.url)
+ self.file_id = max(m.group('id1'), m.group('id2'))
+ self.logDebug("File id is [%s]" % self.file_id)
+
+ # Load main page
+ self.html = self.load(self.pyfile.url, ref=False, decode=True)
+
+ # Check offline
+ if re.search(self.FILE_OFFLINE_PATTERN, self.html):
+ self.offline()
+
+ # Check Traffic used up
+ if re.search(self.TRAFFIC_USED_UP, self.html):
+ self.logInfo("Your Traffic is used up for today. Wait 1800 seconds or reconnect!")
+ self.logDebug("Waiting %d seconds." % 1800)
+ self.setWait(1800, True)
+ self.wantReconnect = True
+ self.wait()
+ self.retry()
+
+ # File name
+ m = re.search(self.__pattern__, self.pyfile.url)
+ name1 = m.group('name') if m else None
+ m = re.search(self.FILE_INFO_PATTERN, self.html)
+ name2 = m.group('N') if m else None
+ self.pyfile.name = max(name1, name2)
+
+ # Ajax file id
+ self.ajaxid = re.search(self.FILE_AJAXID_PATTERN, self.html).group(1)
+ self.logDebug("File ajax id is [%s]" % self.ajaxid)
+
+ # This may either download our file or forward us to an error page
+ url = self.getDownloadUrl()
+ self.logDebug("Downloading file with url [%s]" % url)
+ self.download(url)
+
+ def getDownloadUrl(self):
+ # Return location if direct download is active
+ if self.premium:
+ header = self.load(self.pyfile.url, cookies=True, just_header=True)
+ if 'location' in header:
+ return header['location']
+
+ # Get download info
+ self.logDebug("Getting download info")
+ response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html",
+ post={"request": "generateID", "ajaxid": self.ajaxid})
+ self.handleErrors(response, ':')
+ parts = response.split(":")
+ filetype = parts[0]
+ wait = int(parts[1])
+ captcha = int(parts[2])
+ self.logDebug("Download info [type: '%s', waiting: %d, captcha: %d]" % (filetype, wait, captcha))
+
+ # Waiting
+ if wait > 0:
+ self.logDebug("Waiting %d seconds." % wait)
+ if wait < 120:
+ self.setWait(wait, False)
+ self.wait()
+ else:
+ self.setWait(wait - 55, True)
+ self.wait()
+ self.retry()
+
+ # Resolve captcha
+ if captcha == 1:
+ self.logDebug("File is captcha protected")
+ id = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group(1)
+ # Try up to 3 times
+ for i in range(3):
+ self.logDebug("Resolving ReCaptcha with key [%s], round %d" % (id, i + 1))
+ recaptcha = ReCaptcha(self)
+ challenge, code = recaptcha.challenge(id)
+ response = 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": code})
+ if self.handleCaptchaErrors(response):
+ break
+
+ # Get download URL
+ self.logDebug("Getting download url")
+ response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html",
+ post={"request": "getDownloadURL", "ajaxid": self.ajaxid})
+ self.handleErrors(response, '#')
+ url = response.split("#")[-1]
+
+ return url
+
+ def handleErrors(self, response, separator):
+ self.logDebug("Checking response [%s]" % response)
+ if "ERROR:Session timed out" in response:
+ self.retry()
+ elif "ERROR" in response:
+ msg = response.split(separator)[-1]
+ self.fail(msg)
+
+ def handleCaptchaErrors(self, response):
+ self.logDebug("Result of captcha resolving [%s]" % response)
+ if "SUCCESS" in response:
+ self.correctCaptcha()
+ return True
+ elif "ERROR:SESSION ERROR" in response:
+ self.retry()
+ self.logDebug("Wrong captcha")
+ self.invalidCaptcha()
+
+
+getInfo = create_getInfo(BitshareCom)
diff --git a/pyload/plugins/hoster/BoltsharingCom.py b/pyload/plugins/hoster/BoltsharingCom.py
new file mode 100644
index 000000000..f9cc91ca5
--- /dev/null
+++ b/pyload/plugins/hoster/BoltsharingCom.py
@@ -0,0 +1,17 @@
+# -*- coding: utf-8 -*-
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
+
+class BoltsharingCom(XFileSharingPro):
+ __name__ = "BoltsharingCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)*?boltsharing.com/\w{12}"
+ __version__ = "0.01"
+ __description__ = """Boltsharing.com hoster plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ HOSTER_NAME = "boltsharing.com"
+
+
+getInfo = create_getInfo(BoltsharingCom)
diff --git a/pyload/plugins/hoster/CatShareNet.py b/pyload/plugins/hoster/CatShareNet.py
new file mode 100644
index 000000000..66d46c2e8
--- /dev/null
+++ b/pyload/plugins/hoster/CatShareNet.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.plugins.internal.CaptchaService import ReCaptcha
+
+
+class CatShareNet(SimpleHoster):
+ __name__ = "CatShareNet"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?catshare.net/\w{16}.*"
+ __version__ = "0.01"
+ __description__ = """CatShare.net Download Hoster"""
+ __author_name__ = ("z00nx")
+ __author_mail__ = ("z00nx0@gmail.com")
+
+ FILE_INFO_PATTERN = r'<h3 class="pull-left"[^>]+>(?P<N>.*)</h3>\s+<h3 class="pull-right"[^>]+>(?P<S>.*)</h3>'
+ FILE_OFFLINE_PATTERN = r'Podany plik zosta'
+ SECONDS_PATTERN = 'var\s+count\s+=\s+(\d+);'
+ RECAPTCHA_KEY = "6Lfln9kSAAAAANZ9JtHSOgxUPB9qfDFeLUI_QMEy"
+
+ def handleFree(self):
+ found = re.search(self.SECONDS_PATTERN, self.html)
+ seconds = int(found.group(1))
+ self.logDebug("Seconds found", seconds)
+ self.setWait(seconds + 1)
+ self.wait()
+ recaptcha = ReCaptcha(self)
+ challenge, code = recaptcha.challenge(self.RECAPTCHA_KEY)
+ post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": code}
+ self.download(self.pyfile.url, post=post_data)
+ check = self.checkDownload({"html": re.compile("\A<!DOCTYPE html PUBLIC")})
+ if check == "html":
+ self.logDebug("Wrong captcha entered")
+ self.invalidCaptcha()
+ self.retry()
+
+
+getInfo = create_getInfo(CatShareNet)
diff --git a/pyload/plugins/hoster/ChipDe.py b/pyload/plugins/hoster/ChipDe.py
new file mode 100644
index 000000000..8e13b914d
--- /dev/null
+++ b/pyload/plugins/hoster/ChipDe.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Crypter import Crypter
+
+
+class ChipDe(Crypter):
+ __name__ = "ChipDe"
+ __type__ = "container"
+ __pattern__ = r"http://(?:www\.)?chip.de/video/.*\.html"
+ __version__ = "0.1"
+ __description__ = """Chip.de Container Plugin"""
+ __author_name__ = ('4Christopher')
+ __author_mail__ = ('4Christopher@gmx.de')
+
+ def decrypt(self, pyfile):
+ self.html = self.load(pyfile.url)
+ try:
+ url = re.search(r'"(http://video.chip.de/\d+?/.*)"', self.html).group(1)
+ self.logDebug('The file URL is %s' % url)
+ except:
+ self.fail('Failed to find the URL')
+
+ self.packages.append((self.pyfile.package().name, [url], self.pyfile.package().folder))
diff --git a/pyload/plugins/hoster/CloudzerNet.py b/pyload/plugins/hoster/CloudzerNet.py
new file mode 100644
index 000000000..e95f90792
--- /dev/null
+++ b/pyload/plugins/hoster/CloudzerNet.py
@@ -0,0 +1,73 @@
+# -*- coding: utf-8 -*-
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster
+from module.common.json_layer import json_loads
+from module.plugins.internal.CaptchaService import ReCaptcha
+from module.network.RequestFactory import getURL
+from module.utils import parseFileSize
+
+
+def getInfo(urls):
+ for url in urls:
+ header = getURL(url, just_header=True)
+ if 'Location: http://cloudzer.net/404' in header:
+ file_info = (url, 0, 1, url)
+ else:
+ if url.endswith('/'):
+ api_data = getURL(url + 'status')
+ else:
+ api_data = getURL(url + '/status')
+ name, size = api_data.splitlines()
+ size = parseFileSize(size)
+ file_info = (name, size, 2, url)
+ yield file_info
+
+
+class CloudzerNet(SimpleHoster):
+ __name__ = "CloudzerNet"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?(cloudzer\.net/file/|clz\.to/(file/)?)(?P<ID>\w+).*"
+ __version__ = "0.03"
+ __description__ = """Cloudzer.net hoster plugin"""
+ __author_name__ = ("gs", "z00nx", "stickell")
+ __author_mail__ = ("I-_-I-_-I@web.de", "z00nx0@gmail.com", "l.stickell@yahoo.it")
+
+ FILE_SIZE_PATTERN = '<span class="size">(?P<S>[^<]+)</span>'
+ WAIT_PATTERN = '<meta name="wait" content="(\d+)">'
+ FILE_OFFLINE_PATTERN = r'Please check the URL for typing errors, respectively'
+ CAPTCHA_KEY = '6Lcqz78SAAAAAPgsTYF3UlGf2QFQCNuPMenuyHF3'
+
+ def handleFree(self):
+ found = re.search(self.WAIT_PATTERN, self.html)
+ seconds = int(found.group(1))
+ self.logDebug("Found wait", seconds)
+ self.setWait(seconds + 1)
+ self.wait()
+ response = self.load('http://cloudzer.net/io/ticket/slot/%s' % self.file_info['ID'], post=' ', cookies=True)
+ self.logDebug("Download slot request response", response)
+ response = json_loads(response)
+ if response["succ"] is not True:
+ self.fail("Unable to get a download slot")
+
+ recaptcha = ReCaptcha(self)
+ challenge, response = recaptcha.challenge(self.CAPTCHA_KEY)
+ post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response}
+ response = json_loads(self.load('http://cloudzer.net/io/ticket/captcha/%s' % self.file_info['ID'],
+ post=post_data, cookies=True))
+ self.logDebug("Captcha check response", response)
+ self.logDebug("First check")
+
+ if "err" in response:
+ if response["err"] == "captcha":
+ self.logDebug("Wrong captcha")
+ self.invalidCaptcha()
+ self.retry()
+ elif "Sie haben die max" in response["err"] or "You have reached the max" in response["err"]:
+ self.logDebug("Download limit reached, waiting an hour")
+ self.setWait(3600, True)
+ self.wait()
+ if "type" in response:
+ if response["type"] == "download":
+ url = response["url"]
+ self.logDebug("Download link", url)
+ self.download(url, disposition=True)
diff --git a/pyload/plugins/hoster/CramitIn.py b/pyload/plugins/hoster/CramitIn.py
new file mode 100644
index 000000000..68df322f5
--- /dev/null
+++ b/pyload/plugins/hoster/CramitIn.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
+
+class CramitIn(XFileSharingPro):
+ __name__ = "CramitIn"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)*cramit.in/\w{12}"
+ __version__ = "0.04"
+ __description__ = """Cramit.in hoster plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FILE_INFO_PATTERN = r'<span class=t2>\s*(?P<N>.*?)</span>.*?<small>\s*\((?P<S>.*?)\)'
+ DIRECT_LINK_PATTERN = r'href="(http://cramit.in/file_download/.*?)"'
+ HOSTER_NAME = "cramit.in"
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = self.premium
+
+
+getInfo = create_getInfo(CramitIn)
diff --git a/pyload/plugins/hoster/CrockoCom.py b/pyload/plugins/hoster/CrockoCom.py
new file mode 100644
index 000000000..7d5336cd9
--- /dev/null
+++ b/pyload/plugins/hoster/CrockoCom.py
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.plugins.internal.CaptchaService import ReCaptcha
+
+
+class CrockoCom(SimpleHoster):
+ __name__ = "CrockoCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?(crocko|easy-share).com/.*"
+ __version__ = "0.14"
+ __description__ = """Crocko Download Hoster"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FILE_NAME_PATTERN = r'<span class="fz24">Download:\s*<strong>(?P<N>.*)'
+ FILE_SIZE_PATTERN = r'<span class="tip1"><span class="inner">(?P<S>[^<]+)</span></span>'
+ FILE_OFFLINE_PATTERN = r"<h1>Sorry,<br />the page you're looking for <br />isn't here.</h1>"
+ DOWNLOAD_URL_PATTERN = r"window.location ='([^']+)';"
+ CAPTCHA_URL_PATTERN = re.compile(r"u='(/file_contents/captcha/\w+)';\s*w='(\d+)';")
+ CAPTCHA_KEY_PATTERN = re.compile(r'Recaptcha.create\("([^"]+)"')
+
+ FORM_PATTERN = r'<form method="post" action="([^"]+)">(.*?)</form>'
+ FORM_INPUT_PATTERN = r'<input[^>]* name="?([^" ]+)"? value="?([^" ]+)"?[^>]*>'
+
+ FILE_NAME_REPLACEMENTS = [(r'<[^>]*>', '')]
+
+ def handleFree(self):
+ if "You need Premium membership to download this file." in self.html:
+ self.fail("You need Premium membership to download this file.")
+
+ for i in range(5):
+ found = re.search(self.CAPTCHA_URL_PATTERN, self.html)
+ if found:
+ url, wait_time = 'http://crocko.com' + found.group(1), found.group(2)
+ self.setWait(wait_time)
+ self.wait()
+ self.html = self.load(url)
+ else:
+ break
+
+ found = re.search(self.CAPTCHA_KEY_PATTERN, self.html)
+ if not found:
+ self.parseError('Captcha KEY')
+ captcha_key = found.group(1)
+
+ found = re.search(self.FORM_PATTERN, self.html, re.DOTALL)
+ if not found:
+ self.parseError('ACTION')
+ action, form = found.groups()
+ inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form))
+
+ recaptcha = ReCaptcha(self)
+
+ for i in range(5):
+ inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key)
+ self.download(action, post=inputs)
+
+ check = self.checkDownload({
+ "captcha_err": self.CAPTCHA_KEY_PATTERN
+ })
+
+ if check == "captcha_err":
+ self.invalidCaptcha()
+ else:
+ break
+ else:
+ self.fail('No valid captcha solution received')
+
+
+getInfo = create_getInfo(CrockoCom)
diff --git a/pyload/plugins/hoster/CyberlockerCh.py b/pyload/plugins/hoster/CyberlockerCh.py
new file mode 100644
index 000000000..19a4473b3
--- /dev/null
+++ b/pyload/plugins/hoster/CyberlockerCh.py
@@ -0,0 +1,17 @@
+# -*- coding: utf-8 -*-
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
+
+class CyberlockerCh(XFileSharingPro):
+ __name__ = "CyberlockerCh"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?cyberlocker\.ch/\w{12}"
+ __version__ = "0.01"
+ __description__ = """Cyberlocker.ch hoster plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ HOSTER_NAME = "cyberlocker.ch"
+
+
+getInfo = create_getInfo(CyberlockerCh)
diff --git a/pyload/plugins/hoster/CzshareCom.py b/pyload/plugins/hoster/CzshareCom.py
new file mode 100644
index 000000000..58573d329
--- /dev/null
+++ b/pyload/plugins/hoster/CzshareCom.py
@@ -0,0 +1,158 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+# Test links (random.bin):
+# http://czshare.com/5278880/random.bin
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError
+from module.utils import parseFileSize
+
+
+class CzshareCom(SimpleHoster):
+ __name__ = "CzshareCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(\w*\.)*czshare\.(com|cz)/(\d+/|download.php\?).*"
+ __version__ = "0.93"
+ __description__ = """CZshare.com"""
+ __author_name__ = ("zoidberg")
+
+ FILE_NAME_PATTERN = r'<div class="tab" id="parameters">\s*<p>\s*Cel. n.zev: <a href=[^>]*>(?P<N>[^<]+)</a>'
+ FILE_SIZE_PATTERN = r'<div class="tab" id="category">(?:\s*<p>[^\n]*</p>)*\s*Velikost:\s*(?P<S>[0-9., ]+)(?P<U>[kKMG])i?B\s*</div>'
+ FILE_OFFLINE_PATTERN = r'<div class="header clearfix">\s*<h2 class="red">'
+
+ FILE_SIZE_REPLACEMENTS = [(' ', '')]
+ FILE_URL_REPLACEMENTS = [(r'http://[^/]*/download.php\?.*?id=(\w+).*', r'http://czshare.com/\1/x/')]
+ SH_CHECK_TRAFFIC = True
+
+ FREE_URL_PATTERN = r'<a href="([^"]+)" class="page-download">[^>]*alt="([^"]+)" /></a>'
+ FREE_FORM_PATTERN = r'<form action="download.php" method="post">\s*<img src="captcha.php" id="captcha" />(.*?)</form>'
+ PREMIUM_FORM_PATTERN = r'<form action="/profi_down.php" method="post">(.*?)</form>'
+ FORM_INPUT_PATTERN = r'<input[^>]* name="([^"]+)" value="([^"]+)"[^>]*/>'
+ MULTIDL_PATTERN = r"<p><font color='red'>Z[^<]*PROFI.</font></p>"
+ USER_CREDIT_PATTERN = r'<div class="credit">\s*kredit: <strong>([0-9., ]+)([kKMG]i?B)</strong>\s*</div><!-- .credit -->'
+
+ def checkTrafficLeft(self):
+ # check if user logged in
+ found = re.search(self.USER_CREDIT_PATTERN, self.html)
+ if not found:
+ self.account.relogin(self.user)
+ self.html = self.load(self.pyfile.url, cookies=True, decode=True)
+ found = re.search(self.USER_CREDIT_PATTERN, self.html)
+ if not found:
+ return False
+
+ # check user credit
+ try:
+ credit = parseFileSize(found.group(1).replace(' ', ''), found.group(2))
+ self.logInfo("Premium download for %i KiB of Credit" % (self.pyfile.size / 1024))
+ self.logInfo("User %s has %i KiB left" % (self.user, credit / 1024))
+ if credit < self.pyfile.size:
+ self.logInfo("Not enough credit to download file %s" % self.pyfile.name)
+ return False
+ except Exception, e:
+ # let's continue and see what happens...
+ self.logError('Parse error (CREDIT): %s' % e)
+
+ return True
+
+ def handlePremium(self):
+ # parse download link
+ try:
+ form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.DOTALL).group(1)
+ inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form))
+ except Exception, e:
+ self.logError("Parse error (FORM): %s" % e)
+ self.resetAccount()
+
+ # download the file, destination is determined by pyLoad
+ self.download("http://czshare.com/profi_down.php", post=inputs, disposition=True)
+ self.checkDownloadedFile()
+
+ def handleFree(self):
+ # get free url
+ found = re.search(self.FREE_URL_PATTERN, self.html)
+ if found is None:
+ raise PluginParseError('Free URL')
+ parsed_url = "http://czshare.com" + found.group(1)
+ self.logDebug("PARSED_URL:" + parsed_url)
+
+ # get download ticket and parse html
+ self.html = self.load(parsed_url, cookies=True, decode=True)
+ if re.search(self.MULTIDL_PATTERN, self.html):
+ self.longWait(300, 12)
+
+ try:
+ form = re.search(self.FREE_FORM_PATTERN, self.html, re.DOTALL).group(1)
+ inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form))
+ self.pyfile.size = int(inputs['size'])
+ except Exception, e:
+ self.logError(e)
+ raise PluginParseError('Form')
+
+ # get and decrypt captcha
+ captcha_url = 'http://czshare.com/captcha.php'
+ for i in range(5):
+ inputs['captchastring2'] = self.decryptCaptcha(captcha_url)
+ self.html = self.load(parsed_url, cookies=True, post=inputs, decode=True)
+ if u"<li>ZadanÃœ ověřovací kód nesouhlasí!</li>" in self.html:
+ self.invalidCaptcha()
+ elif re.search(self.MULTIDL_PATTERN, self.html):
+ self.longWait(300, 12)
+ else:
+ self.correctCaptcha()
+ break
+ else:
+ self.fail("No valid captcha code entered")
+
+ found = re.search("countdown_number = (\d+);", self.html)
+ self.setWait(int(found.group(1)) if found else 50)
+
+ # download the file, destination is determined by pyLoad
+ self.logDebug("WAIT URL", self.req.lastEffectiveURL)
+ found = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL)
+ if not found:
+ raise PluginParseError('Download URL')
+
+ url = "http://%s/download.php?%s" % (found.group(1), found.group(2))
+
+ self.wait()
+ self.download(url)
+ self.checkDownloadedFile()
+
+ def checkDownloadedFile(self):
+ # check download
+ check = self.checkDownload({
+ "tempoffline": re.compile(r"^Soubor je do.*asn.* nedostupn.*$"),
+ "credit": re.compile(r"^Nem.*te dostate.*n.* kredit.$"),
+ "multi_dl": re.compile(self.MULTIDL_PATTERN),
+ "captcha_err": "<li>ZadanÃœ ověřovací kód nesouhlasí!</li>"
+ })
+
+ if check == "tempoffline":
+ self.fail("File not available - try later")
+ if check == "credit":
+ self.resetAccount()
+ elif check == "multi_dl":
+ self.longWait(300, 12)
+ elif check == "captcha_err":
+ self.invalidCaptcha()
+ self.retry()
+
+
+getInfo = create_getInfo(CzshareCom)
diff --git a/pyload/plugins/hoster/DailymotionCom.py b/pyload/plugins/hoster/DailymotionCom.py
new file mode 100644
index 000000000..7d33540f8
--- /dev/null
+++ b/pyload/plugins/hoster/DailymotionCom.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from urllib import unquote
+from module.plugins.Hoster import Hoster
+
+
+class DailymotionCom(Hoster):
+ __name__ = 'DailymotionCom'
+ __type__ = 'hoster'
+ __pattern__ = r'http://www.dailymotion.com/.*'
+ __version__ = '0.1'
+ __description__ = """Dailymotion Video Download Hoster"""
+ __author_name__ = ("Peekayy")
+ __author_mail__ = ("peekayy.dev@gmail.com")
+
+ def process(self, pyfile):
+ html = self.load(pyfile.url, decode=True)
+
+ for pattern in (r'name="title" content="Dailymotion \\-(.*?)\\- ein Film',
+ r'class="title" title="(.*?)"',
+ r'<span class="title foreground" title="(.*?)">',
+ r'"(?:vs_videotitle|videoTitle|dm_title|ss_mediaTitle)": "(.*?)"'):
+ filename = re.search(pattern, html)
+ if filename is not None:
+ break
+ else:
+ self.fail("Unable to find file name")
+
+ pyfile.name = filename.group(1) + '.mp4'
+ self.logDebug('Filename=' + pyfile.name)
+ allLinksInfo = re.search(r'"sequence":"(.*?)"', html)
+ self.logDebug(allLinksInfo.groups())
+ allLinksInfo = unquote(allLinksInfo.group(1))
+
+ for quality in ('hd720URL', 'hqURL', 'sdURL', 'ldURL', ''):
+ dlLink = self.getQuality(quality, allLinksInfo)
+ if dlLink is not None:
+ break
+ else:
+ self.fail(r'Unable to find video URL')
+
+ self.logDebug(dlLink)
+ self.download(dlLink)
+
+ def getQuality(self, quality, data):
+ link = re.search('"' + quality + '":"(http:[^<>"\']+)"', data)
+ if link is not None:
+ return link.group(1).replace('\\', '')
diff --git a/pyload/plugins/hoster/DataHu.py b/pyload/plugins/hoster/DataHu.py
new file mode 100644
index 000000000..7abd93d1f
--- /dev/null
+++ b/pyload/plugins/hoster/DataHu.py
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+# Test links (random.bin):
+# http://data.hu/get/6381232/random.bin
+
+import re
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class DataHu(SimpleHoster):
+ __name__ = "DataHu"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?data.hu/get/\w+"
+ __version__ = "0.01"
+ __description__ = """Data.hu Download Hoster"""
+ __author_name__ = ("crash", "stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ FILE_INFO_PATTERN = ur'<title>(?P<N>.*) \((?P<S>[^)]+)\) let\xf6lt\xe9se</title>'
+ FILE_OFFLINE_PATTERN = ur'Az adott f\xe1jl nem l\xe9tezik'
+ DIRECT_LINK_PATTERN = r'<div class="download_box_button"><a href="([^"]+)">'
+
+ def handleFree(self):
+ self.resumeDownload = True
+ self.html = self.load(self.pyfile.url, decode=True)
+
+ m = re.search(self.DIRECT_LINK_PATTERN, self.html)
+ if m:
+ url = m.group(1)
+ self.logDebug('Direct link: ' + url)
+ else:
+ self.parseError('Unable to get direct link')
+
+ self.download(url, disposition=True)
+
+
+getInfo = create_getInfo(DataHu)
diff --git a/pyload/plugins/hoster/DataportCz.py b/pyload/plugins/hoster/DataportCz.py
new file mode 100644
index 000000000..1e24388d7
--- /dev/null
+++ b/pyload/plugins/hoster/DataportCz.py
@@ -0,0 +1,68 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError
+
+
+class DataportCz(SimpleHoster):
+ __name__ = "DataportCz"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:.*?\.)?dataport.cz/file/(.*)"
+ __version__ = "0.37"
+ __description__ = """Dataport.cz plugin - free only"""
+ __author_name__ = ("zoidberg")
+
+ FILE_NAME_PATTERN = r'<span itemprop="name">(?P<N>[^<]+)</span>'
+ FILE_SIZE_PATTERN = r'<td class="fil">Velikost</td>\s*<td>(?P<S>[^<]+)</td>'
+ FILE_OFFLINE_PATTERN = r'<h2>Soubor nebyl nalezen</h2>'
+ FILE_URL_REPLACEMENTS = [(__pattern__, r'http://www.dataport.cz/file/\1')]
+
+ CAPTCHA_URL_PATTERN = r'<section id="captcha_bg">\s*<img src="(.*?)"'
+ FREE_SLOTS_PATTERN = ur'Počet volnÜch slotů: <span class="darkblue">(\d+)</span><br />'
+
+ def handleFree(self):
+ captchas = {"1": "jkeG", "2": "hMJQ", "3": "vmEK", "4": "ePQM", "5": "blBd"}
+
+ for i in range(60):
+ action, inputs = self.parseHtmlForm('free_download_form')
+ self.logDebug(action, inputs)
+ if not action or not inputs:
+ raise PluginParseError('free_download_form')
+
+ if "captchaId" in inputs and inputs["captchaId"] in captchas:
+ inputs['captchaCode'] = captchas[inputs["captchaId"]]
+ else:
+ raise PluginParseError('captcha')
+
+ self.html = self.download("http://www.dataport.cz%s" % action, post=inputs)
+
+ check = self.checkDownload({"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":
+ raise PluginParseError('invalid captcha')
+ elif check == "slot":
+ self.logDebug("No free slots - wait 60s and retry")
+ self.setWait(60, False)
+ self.wait()
+ self.html = self.load(self.pyfile.url, decode=True)
+ continue
+ else:
+ break
+
+
+create_getInfo(DataportCz) \ No newline at end of file
diff --git a/pyload/plugins/hoster/DateiTo.py b/pyload/plugins/hoster/DateiTo.py
new file mode 100644
index 000000000..d7760d940
--- /dev/null
+++ b/pyload/plugins/hoster/DateiTo.py
@@ -0,0 +1,97 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.plugins.internal.CaptchaService import ReCaptcha
+
+
+class DateiTo(SimpleHoster):
+ __name__ = "DateiTo"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?datei\.to/datei/(?P<ID>\w+)\.html"
+ __version__ = "0.02"
+ __description__ = """Datei.to plugin - free only"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FILE_NAME_PATTERN = r'Dateiname:</td>\s*<td colspan="2"><strong>(?P<N>.*?)</'
+ FILE_SIZE_PATTERN = r'Dateigr&ouml;&szlig;e:</td>\s*<td colspan="2">(?P<S>.*?)</'
+ FILE_OFFLINE_PATTERN = r'>Datei wurde nicht gefunden<|>Bitte wÀhle deine Datei aus... <'
+ PARALELL_PATTERN = r'>Du lÀdst bereits eine Datei herunter<'
+
+ WAIT_PATTERN = r'countdown\({seconds: (\d+)'
+ DATA_PATTERN = r'url: "(.*?)", data: "(.*?)",'
+ RECAPTCHA_KEY_PATTERN = r'Recaptcha.create\("(.*?)"'
+
+ def handleFree(self):
+ url = 'http://datei.to/ajax/download.php'
+ data = {'P': 'I', 'ID': self.file_info['ID']}
+
+ recaptcha = ReCaptcha(self)
+
+ for i in range(10):
+ self.logDebug("URL", url, "POST", data)
+ self.html = self.load(url, post=data)
+ self.checkErrors()
+
+ if url.endswith('download.php') and 'P' in data:
+ if data['P'] == 'I':
+ self.doWait()
+
+ elif data['P'] == 'IV':
+ break
+
+ found = re.search(self.DATA_PATTERN, self.html)
+ if not found:
+ self.parseError('data')
+ url = 'http://datei.to/' + found.group(1)
+ data = dict(x.split('=') for x in found.group(2).split('&'))
+
+ if url.endswith('recaptcha.php'):
+ found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html)
+ recaptcha_key = found.group(1) if found else "6LdBbL8SAAAAAI0vKUo58XRwDd5Tu_Ze1DA7qTao"
+
+ data['recaptcha_challenge_field'], data['recaptcha_response_field'] = recaptcha.challenge(recaptcha_key)
+
+ else:
+ self.fail('Too bad...')
+
+ download_url = self.html
+ self.logDebug('Download URL', download_url)
+ self.download(download_url)
+
+ def checkErrors(self):
+ found = re.search(self.PARALELL_PATTERN, self.html)
+ if found:
+ found = re.search(self.WAIT_PATTERN, self.html)
+ wait_time = int(found.group(1)) if found else 30
+ self.setWait(wait_time + 1, False)
+ self.wait(300)
+ self.retry()
+
+ def doWait(self):
+ found = re.search(self.WAIT_PATTERN, self.html)
+ wait_time = int(found.group(1)) if found else 30
+ self.setWait(wait_time + 1, False)
+
+ self.load('http://datei.to/ajax/download.php', post={'P': 'Ads'})
+ self.wait()
+
+
+getInfo = create_getInfo(DateiTo)
diff --git a/pyload/plugins/hoster/DdlstorageCom.py b/pyload/plugins/hoster/DdlstorageCom.py
new file mode 100644
index 000000000..82072aadb
--- /dev/null
+++ b/pyload/plugins/hoster/DdlstorageCom.py
@@ -0,0 +1,84 @@
+# -*- coding: utf-8 -*-
+import re
+from hashlib import md5
+
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro
+from module.network.RequestFactory import getURL
+from module.plugins.Plugin import chunks
+from module.common.json_layer import json_loads
+
+
+def getInfo(urls):
+ # DDLStorage API Documentation:
+ # http://www.ddlstorage.com/cgi-bin/api_req.cgi?req_type=doc
+ ids = dict()
+ for url in urls:
+ m = re.search(DdlstorageCom.__pattern__, url)
+ ids[m.group('ID')] = url
+
+ for chunk in chunks(ids.keys(), 5):
+ api = getURL('http://www.ddlstorage.com/cgi-bin/api_req.cgi',
+ post={'req_type': 'file_info_free',
+ 'client_id': 53472,
+ 'file_code': ','.join(chunk),
+ 'sign': md5('file_info_free%d%s%s' % (53472, ','.join(chunk),
+ '25JcpU2dPOKg8E2OEoRqMSRu068r0Cv3')).hexdigest()})
+ api = api.replace('<pre>', '').replace('</pre>', '')
+ api = json_loads(api)
+
+ result = list()
+ for el in api:
+ if el['status'] == 'online':
+ result.append((el['file_name'], int(el['file_size']), 2, ids[el['file_code']]))
+ else:
+ result.append((ids[el['file_code']], 0, 1, ids[el['file_code']]))
+ yield result
+
+
+class DdlstorageCom(XFileSharingPro):
+ __name__ = "DdlstorageCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)*?ddlstorage.com/(?P<ID>\w{12})"
+ __version__ = "1.00"
+ __description__ = """DDLStorage.com hoster plugin"""
+ __author_name__ = ("zoidberg", "stickell")
+ __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+
+ FILE_INFO_PATTERN = r'<p class="sub_title"[^>]*>(?P<N>.+) \((?P<S>[^)]+)\)</p>'
+ HOSTER_NAME = "ddlstorage.com"
+
+ def prepare(self):
+ self.getAPIData()
+ super(DdlstorageCom, self).prepare()
+
+ def getAPIData(self):
+ file_id = re.search(self.__pattern__, self.pyfile.url).group('ID')
+ data = {'client_id': 53472,
+ 'file_code': file_id}
+ if self.user:
+ passwd = self.account.getAccountData(self.user)["password"]
+ data['req_type'] = 'file_info_reg'
+ data['user_login'] = self.user
+ data['user_password'] = md5(passwd).hexdigest()
+ data['sign'] = md5('file_info_reg%d%s%s%s%s' % (data['client_id'], data['user_login'],
+ data['user_password'], data['file_code'],
+ '25JcpU2dPOKg8E2OEoRqMSRu068r0Cv3')).hexdigest()
+ else:
+ data['req_type'] = 'file_info_free'
+ data['sign'] = md5('file_info_free%d%s%s' % (data['client_id'], data['file_code'],
+ '25JcpU2dPOKg8E2OEoRqMSRu068r0Cv3')).hexdigest()
+
+ self.api_data = self.load('http://www.ddlstorage.com/cgi-bin/api_req.cgi', post=data)
+ self.api_data = self.api_data.replace('<pre>', '').replace('</pre>', '')
+ self.logDebug('API Data: ' + self.api_data)
+ self.api_data = json_loads(self.api_data)[0]
+
+ if self.api_data['status'] == 'offline':
+ self.offline()
+
+ if 'file_name' in self.api_data:
+ self.pyfile.name = self.api_data['file_name']
+ if 'file_size' in self.api_data:
+ self.pyfile.size = self.api_data['size'] = self.api_data['file_size']
+ if 'file_md5_base64' in self.api_data:
+ self.api_data['md5_ddlstorage'] = self.api_data['file_md5_base64']
diff --git a/pyload/plugins/hoster/DebridItaliaCom.py b/pyload/plugins/hoster/DebridItaliaCom.py
new file mode 100644
index 000000000..ebea0ac13
--- /dev/null
+++ b/pyload/plugins/hoster/DebridItaliaCom.py
@@ -0,0 +1,66 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+import re
+
+from pyload.plugins.Hoster import Hoster
+
+
+class DebridItaliaCom(Hoster):
+ __name__ = "DebridItaliaCom"
+ __version__ = "0.05"
+ __type__ = "hoster"
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"),
+ ("hosterList", "str", "Hoster list (comma separated)", ""),
+ ("unloadFailing", "bool", "Revert to standard download if download fails", "False"),
+ ("interval", "int", "Reload interval in hours (0 to disable)", "24")]
+ __pattern__ = r"https?://.*debriditalia\.com"
+ __description__ = """Debriditalia.com hoster plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ def setup(self):
+ self.chunkLimit = -1
+ self.resumeDownload = True
+
+ def process(self, pyfile):
+ if re.match(self.__pattern__, pyfile.url):
+ new_url = pyfile.url
+ elif not self.account:
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "DebridItalia")
+ self.fail("No DebridItalia account provided")
+ else:
+ self.logDebug("Old URL: %s" % pyfile.url)
+ url = "http://debriditalia.com/linkgen2.php?xjxfun=convertiLink&xjxargs[]=S<![CDATA[%s]]>" % pyfile.url
+ page = self.load(url)
+ self.logDebug("XML data: %s" % page)
+
+ if 'File not available' in page:
+ self.fail('File not available')
+ else:
+ new_url = re.search(r'<a href="(?:[^"]+)">(?P<direct>[^<]+)</a>', page).group('direct')
+
+ if new_url != pyfile.url:
+ self.logDebug("New URL: %s" % new_url)
+
+ self.download(new_url, disposition=True)
+
+ check = self.checkDownload({"empty": re.compile(r"^$")})
+
+ if check == "empty":
+ self.retry(5, 120, 'Empty file downloaded')
diff --git a/pyload/plugins/hoster/DepositfilesCom.py b/pyload/plugins/hoster/DepositfilesCom.py
new file mode 100644
index 000000000..99c0d13a1
--- /dev/null
+++ b/pyload/plugins/hoster/DepositfilesCom.py
@@ -0,0 +1,115 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from urllib import unquote
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.plugins.internal.CaptchaService import ReCaptcha
+
+
+class DepositfilesCom(SimpleHoster):
+ __name__ = "DepositfilesCom"
+ __type__ = "hoster"
+ __pattern__ = r"https?://[\w\.]*?(depositfiles\.com|dfiles\.eu)(/\w{1,3})?/files/[\w]+"
+ __version__ = "0.45"
+ __description__ = """Depositfiles.com Download Hoster"""
+ __author_name__ = ("spoob", "zoidberg")
+ __author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz")
+
+ FILE_SIZE_PATTERN = r': <b>(?P<S>[0-9.]+)&nbsp;(?P<U>[kKMG])i?B</b>'
+ FILE_NAME_PATTERN = r'<script type="text/javascript">eval\( unescape\(\'(?P<N>.*?)\''
+ FILE_OFFLINE_PATTERN = r'<span class="html_download_api-not_exists"></span>'
+ FILE_URL_REPLACEMENTS = [(r"\.com(/.*?)?/files", ".com/en/files"), (r"\.html$", "")]
+ FILE_NAME_REPLACEMENTS = [(r'\%u([0-9A-Fa-f]{4})', lambda m: unichr(int(m.group(1), 16))),
+ (r'.*<b title="(?P<N>[^"]+).*', "\g<N>" )]
+
+ RECAPTCHA_PATTERN = r"Recaptcha.create\('([^']+)'"
+ DOWNLOAD_LINK_PATTERN = r'<form id="downloader_file_form" action="(http://.+?\.(dfiles\.eu|depositfiles\.com)/.+?)" method="post"'
+
+ def handleFree(self):
+ self.html = self.load(self.pyfile.url, post={"gateway_result": "1"}, cookies=True)
+ if re.search(self.FILE_OFFLINE_PATTERN, self.html):
+ self.offline()
+
+ if re.search(r'File is checked, please try again in a minute.', self.html) is not None:
+ self.logInfo("DepositFiles.com: The file is being checked. Waiting 1 minute.")
+ self.setWait(61)
+ self.wait()
+ self.retry()
+
+ wait = re.search(r'html_download_api-limit_interval\">(\d+)</span>', self.html)
+ if wait:
+ wait_time = int(wait.group(1))
+ self.logInfo("%s: Traffic used up. Waiting %d seconds." % (self.__name__, wait_time))
+ self.setWait(wait_time)
+ self.wantReconnect = True
+ self.wait()
+ self.retry()
+
+ wait = re.search(r'>Try in (\d+) minutes or use GOLD account', self.html)
+ if wait:
+ wait_time = int(wait.group(1))
+ self.logInfo("%s: All free slots occupied. Waiting %d minutes." % (self.__name__, wait_time))
+ self.setWait(wait_time * 60, False)
+
+ wait = re.search(r'Please wait (\d+) sec', self.html)
+ if wait:
+ self.setWait(int(wait.group(1)))
+
+ found = re.search(r"var fid = '(\w+)';", self.html)
+ if not found:
+ self.retry(wait_time=5)
+ params = {'fid': found.group(1)}
+ self.logDebug("FID: %s" % params['fid'])
+
+ captcha_key = '6LdRTL8SAAAAAE9UOdWZ4d0Ky-aeA7XfSqyWDM2m'
+ found = re.search(self.RECAPTCHA_PATTERN, self.html)
+ if found:
+ captcha_key = found.group(1)
+ self.logDebug("CAPTCHA_KEY: %s" % captcha_key)
+
+ self.wait()
+ recaptcha = ReCaptcha(self)
+
+ for i in range(5):
+ self.html = self.load("http://depositfiles.com/get_file.php", get=params)
+
+ if '<input type=button value="Continue" onclick="check_recaptcha' in self.html:
+ if not captcha_key:
+ self.parseError('Captcha key')
+ if 'response' in params:
+ self.invalidCaptcha()
+ params['challenge'], params['response'] = recaptcha.challenge(captcha_key)
+ self.logDebug(params)
+ continue
+
+ found = re.search(self.DOWNLOAD_LINK_PATTERN, self.html)
+ if found:
+ if 'response' in params:
+ self.correctCaptcha()
+ link = unquote(found.group(1))
+ self.logDebug("LINK: %s" % link)
+ break
+ else:
+ self.parseError('Download link')
+ else:
+ self.fail('No valid captcha response received')
+
+ try:
+ self.download(link, disposition=True)
+ except:
+ self.retry(wait_time=60)
+
+ def handlePremium(self):
+ if '<span class="html_download_api-gold_traffic_limit">' in self.html:
+ self.logWarning("Download limit reached")
+ self.retry(25, 3600, "Download limit reached")
+ elif 'onClick="show_gold_offer' in self.html:
+ self.account.relogin(self.user)
+ self.retry()
+ link = unquote(
+ re.search('<div id="download_url">\s*<a href="(http://.+?\.depositfiles.com/.+?)"', self.html).group(1))
+ self.download(link, disposition=True)
+
+
+getInfo = create_getInfo(DepositfilesCom)
diff --git a/pyload/plugins/hoster/DlFreeFr.py b/pyload/plugins/hoster/DlFreeFr.py
new file mode 100644
index 000000000..35b9ca6b8
--- /dev/null
+++ b/pyload/plugins/hoster/DlFreeFr.py
@@ -0,0 +1,201 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+import pycurl
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns
+from module.common.json_layer import json_loads
+from module.network.Browser import Browser
+from module.network.CookieJar import CookieJar
+
+
+class CustomBrowser(Browser):
+ def __init__(self, bucket=None, options={}):
+ Browser.__init__(self, bucket, options)
+
+ def load(self, *args, **kwargs):
+ post = kwargs.get("post")
+ if post is None:
+ if len(args) > 2:
+ post = args[2]
+ if post:
+ self.http.c.setopt(pycurl.FOLLOWLOCATION, 0)
+ self.http.c.setopt(pycurl.POST, 1)
+ self.http.c.setopt(pycurl.CUSTOMREQUEST, "POST")
+ else:
+ self.http.c.setopt(pycurl.FOLLOWLOCATION, 1)
+ self.http.c.setopt(pycurl.POST, 0)
+ self.http.c.setopt(pycurl.CUSTOMREQUEST, "GET")
+ return Browser.load(self, *args, **kwargs)
+
+
+class AdYouLike():
+ """
+ Class to support adyoulike captcha service
+ """
+ ADYOULIKE_INPUT_PATTERN = r'Adyoulike.create\((.*?)\);'
+ ADYOULIKE_CALLBACK = r'Adyoulike.g._jsonp_5579316662423138'
+ ADYOULIKE_CHALLENGE_PATTERN = ADYOULIKE_CALLBACK + r'\((.*?)\)'
+
+ def __init__(self, plugin, engine="adyoulike"):
+ self.plugin = plugin
+ self.engine = engine
+
+ def challenge(self, html):
+ adyoulike_data_string = None
+ found = re.search(self.ADYOULIKE_INPUT_PATTERN, html)
+ if found:
+ adyoulike_data_string = found.group(1)
+ else:
+ self.plugin.fail("Can't read AdYouLike input data")
+
+ # {"adyoulike":{"key":"P~zQ~O0zV0WTiAzC-iw0navWQpCLoYEP"},
+ # "all":{"element_id":"ayl_private_cap_92300","lang":"fr","env":"prod"}}
+ ayl_data = json_loads(adyoulike_data_string)
+
+ res = self.plugin.load(
+ r'http://api-ayl.appspot.com/challenge?key=%(ayl_key)s&env=%(ayl_env)s&callback=%(callback)s' % {
+ "ayl_key": ayl_data[self.engine]["key"], "ayl_env": ayl_data["all"]["env"],
+ "callback": self.ADYOULIKE_CALLBACK})
+
+ found = re.search(self.ADYOULIKE_CHALLENGE_PATTERN, res)
+ challenge_string = None
+ if found:
+ challenge_string = found.group(1)
+ else:
+ self.plugin.fail("Invalid AdYouLike challenge")
+ challenge_data = json_loads(challenge_string)
+
+ return ayl_data, challenge_data
+
+ def result(self, ayl, challenge):
+ """
+ Adyoulike.g._jsonp_5579316662423138
+ ({"translations":{"fr":{"instructions_visual":"Recopiez « Soonnight » ci-dessous :"}},
+ "site_under":true,"clickable":true,"pixels":{"VIDEO_050":[],"DISPLAY":[],"VIDEO_000":[],"VIDEO_100":[],
+ "VIDEO_025":[],"VIDEO_075":[]},"medium_type":"image/adyoulike",
+ "iframes":{"big":"<iframe src=\"http://www.soonnight.com/campagn.html\" scrolling=\"no\"
+ height=\"250\" width=\"300\" frameborder=\"0\"></iframe>"},"shares":{},"id":256,
+ "token":"e6QuI4aRSnbIZJg02IsV6cp4JQ9~MjA1","formats":{"small":{"y":300,"x":0,"w":300,"h":60},
+ "big":{"y":0,"x":0,"w":300,"h":250},"hover":{"y":440,"x":0,"w":300,"h":60}},
+ "tid":"SqwuAdxT1EZoi4B5q0T63LN2AkiCJBg5"})
+ """
+ response = None
+ try:
+ instructions_visual = challenge["translations"][ayl["all"]["lang"]]["instructions_visual"]
+ found = re.search(u".*«(.*)».*", instructions_visual)
+ if found:
+ response = found.group(1).strip()
+ else:
+ self.plugin.fail("Can't parse instructions visual")
+ except KeyError:
+ self.plugin.fail("No instructions visual")
+
+ #TODO: Supports captcha
+
+ if not response:
+ self.plugin.fail("AdYouLike result failed")
+
+ return {"_ayl_captcha_engine": self.engine,
+ "_ayl_env": ayl["all"]["env"],
+ "_ayl_tid": challenge["tid"],
+ "_ayl_token_challenge": challenge["token"],
+ "_ayl_response": response}
+
+
+class DlFreeFr(SimpleHoster):
+ __name__ = "DlFreeFr"
+ __type__ = "hoster"
+ __pattern__ = r"http://dl\.free\.fr/([a-zA-Z0-9]+|getfile\.pl\?file=/[a-zA-Z0-9]+)"
+ __version__ = "0.25"
+ __description__ = """dl.free.fr download hoster"""
+ __author_name__ = ("the-razer", "zoidberg", "Toilal")
+ __author_mail__ = ("daniel_ AT gmx DOT net", "zoidberg@mujmail.cz", "toilal.dev@gmail.com")
+
+ FILE_NAME_PATTERN = r"Fichier:</td>\s*<td[^>]*>(?P<N>[^>]*)</td>"
+ FILE_SIZE_PATTERN = r"Taille:</td>\s*<td[^>]*>(?P<S>[\d.]+[KMG])o"
+ FILE_OFFLINE_PATTERN = r"Erreur 404 - Document non trouv|Fichier inexistant|Le fichier demand&eacute; n'a pas &eacute;t&eacute; trouv&eacute;"
+ #FILE_URL_PATTERN = r'href="(?P<url>http://.*?)">T&eacute;l&eacute;charger ce fichier'
+
+ def setup(self):
+ self.multiDL = self.resumeDownload = True
+ self.limitDL = 5
+ self.chunkLimit = 1
+
+ def init(self):
+ factory = self.core.requestFactory
+ self.req = CustomBrowser(factory.bucket, factory.getOptions())
+
+ def process(self, pyfile):
+ self.req.setCookieJar(None)
+
+ pyfile.url = replace_patterns(pyfile.url, self.FILE_URL_REPLACEMENTS)
+ valid_url = pyfile.url
+ headers = self.load(valid_url, just_header=True)
+
+ self.html = None
+ if headers.get('code') == 302:
+ valid_url = headers.get('location')
+ headers = self.load(valid_url, just_header=True)
+
+ if headers.get('code') == 200:
+ content_type = headers.get('content-type')
+ if content_type and content_type.startswith("text/html"):
+ # Undirect acces to requested file, with a web page providing it (captcha)
+ self.html = self.load(valid_url)
+ self.handleFree()
+ else:
+ # Direct access to requested file for users using free.fr as Internet Service Provider.
+ self.download(valid_url, disposition=True)
+ elif headers.get('code') == 404:
+ self.offline()
+ else:
+ self.fail("Invalid return code: " + str(headers.get('code')))
+
+ def handleFree(self):
+ action, inputs = self.parseHtmlForm('action="getfile.pl"')
+
+ adyoulike = AdYouLike(self)
+ ayl, challenge = adyoulike.challenge(self.html)
+ result = adyoulike.result(ayl, challenge)
+ inputs.update(result)
+
+ self.load("http://dl.free.fr/getfile.pl", post=inputs)
+ headers = self.getLastHeaders()
+ if headers.get("code") == 302 and "set-cookie" in headers and "location" in headers:
+ found = re.search("(.*?)=(.*?); path=(.*?); domain=(.*?)", headers.get("set-cookie"))
+ cj = CookieJar(__name__)
+ if found:
+ cj.setCookie(found.group(4), found.group(1), found.group(2), found.group(3))
+ else:
+ self.fail("Cookie error")
+ location = headers.get("location")
+ self.req.setCookieJar(cj)
+ self.download(location, disposition=True)
+ else:
+ self.fail("Invalid response")
+
+ def getLastHeaders(self):
+ #parse header
+ header = {"code": self.req.code}
+ for line in self.req.http.header.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]) == list:
+ header[key].append(value)
+ else:
+ header[key] = [header[key], value]
+ else:
+ header[key] = value
+ return header
+
+
+getInfo = create_getInfo(DlFreeFr)
diff --git a/pyload/plugins/hoster/DuploadOrg.py b/pyload/plugins/hoster/DuploadOrg.py
new file mode 100644
index 000000000..6ee2bcc7b
--- /dev/null
+++ b/pyload/plugins/hoster/DuploadOrg.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
+
+class DuploadOrg(XFileSharingPro):
+ __name__ = "DuploadOrg"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?dupload\.org/\w{12}"
+ __version__ = "0.01"
+ __description__ = """Dupload.grg hoster plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ HOSTER_NAME = "dupload.org"
+
+ FILE_INFO_PATTERN = r'<h3[^>]*>(?P<N>.+) \((?P<S>[\d.]+) (?P<U>\w+)\)</h3>'
+
+
+getInfo = create_getInfo(DuploadOrg)
diff --git a/pyload/plugins/hoster/EasybytezCom.py b/pyload/plugins/hoster/EasybytezCom.py
new file mode 100644
index 000000000..98691a641
--- /dev/null
+++ b/pyload/plugins/hoster/EasybytezCom.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
+
+class EasybytezCom(XFileSharingPro):
+ __name__ = "EasybytezCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)?easybytez.com/(\w+).*"
+ __version__ = "0.17"
+ __description__ = """easybytez.com"""
+ __author_name__ = ("zoidberg", "stickell")
+ __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+
+ FILE_INFO_PATTERN = r'<span class="name">(?P<N>.+)</span><br>\s*<span class="size">(?P<S>[^<]+)</span>'
+ FILE_OFFLINE_PATTERN = r'<h1>File not available</h1>'
+
+ DIRECT_LINK_PATTERN = r'(http://(\w+\.(easyload|easybytez|zingload)\.(com|to)|\d+\.\d+\.\d+\.\d+)/files/\d+/\w+/[^"<]+)'
+ OVR_DOWNLOAD_LINK_PATTERN = r'<h2>Download Link</h2>\s*<textarea[^>]*>([^<]+)'
+ OVR_KILL_LINK_PATTERN = r'<h2>Delete Link</h2>\s*<textarea[^>]*>([^<]+)'
+ ERROR_PATTERN = r'(?:class=["\']err["\'][^>]*>|<Center><b>)(.*?)</'
+
+ HOSTER_NAME = "easybytez.com"
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = self.premium
+
+
+getInfo = create_getInfo(EasybytezCom)
diff --git a/pyload/plugins/hoster/EdiskCz.py b/pyload/plugins/hoster/EdiskCz.py
new file mode 100644
index 000000000..c172e7447
--- /dev/null
+++ b/pyload/plugins/hoster/EdiskCz.py
@@ -0,0 +1,65 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class EdiskCz(SimpleHoster):
+ __name__ = "EdiskCz"
+ __type__ = "hoster"
+ __pattern__ = r"http://(\w*\.)?edisk.(cz|sk|eu)/(stahni|sk/stahni|en/download)/.*"
+ __version__ = "0.21"
+ __description__ = """Edisk.cz"""
+ __author_name__ = ("zoidberg")
+
+ URL_PATTERN = r'<form name = "formular" action = "([^"]+)" method = "post">'
+ FILE_INFO_PATTERN = r'<span class="fl" title="(?P<N>[^"]+)">\s*.*?\((?P<S>[0-9.]*) (?P<U>[kKMG])i?B\)</h1></span>'
+ ACTION_PATTERN = r'/en/download/(\d+/.*\.html)'
+ DLLINK_PATTERN = r'http://.*edisk.cz.*\.html'
+ FILE_OFFLINE_PATTERN = r'<h3>This file does not exist due to one of the following:</h3><ul><li>'
+
+ def setup(self):
+ self.multiDL = False
+
+ def process(self, pyfile):
+ url = re.sub("/(stahni|sk/stahni)/", "/en/download/", pyfile.url)
+
+ self.logDebug('URL:' + url)
+
+ found = re.search(self.ACTION_PATTERN, url)
+ if found is None:
+ self.parseError("ACTION")
+ action = found.group(1)
+
+ self.html = self.load(url, decode=True)
+ self.getFileInfo()
+
+ self.html = self.load(re.sub("/en/download/", "/en/download-slow/", url))
+
+ url = self.load(re.sub("/en/download/", "/x-download/", url), post={
+ "action": action
+ })
+
+ if not re.match(self.DLLINK_PATTERN, url):
+ self.fail("Unexpected server response")
+
+ self.download(url)
+
+
+getInfo = create_getInfo(EdiskCz)
diff --git a/pyload/plugins/hoster/EgoFilesCom.py b/pyload/plugins/hoster/EgoFilesCom.py
new file mode 100644
index 000000000..22ca99931
--- /dev/null
+++ b/pyload/plugins/hoster/EgoFilesCom.py
@@ -0,0 +1,102 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+# Test link (random.bin):
+# http://egofiles.com/mOZfMI1WLZ6HBkGG/random.bin
+
+import re
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.plugins.internal.CaptchaService import ReCaptcha
+
+
+class EgoFilesCom(SimpleHoster):
+ __name__ = "EgoFilesCom"
+ __type__ = "hoster"
+ __pattern__ = r"https?://(www\.)?egofiles.com/(\w+)"
+ __version__ = "0.13"
+ __description__ = """Egofiles.com Download Hoster"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ FILE_INFO_PATTERN = r'<div class="down-file">\s+(?P<N>[^\t]+)\s+<div class="file-properties">\s+(File size|Rozmiar): (?P<S>[\w.]+) (?P<U>\w+) \|'
+ FILE_OFFLINE_PATTERN = r'(File size|Rozmiar): 0 KB'
+ WAIT_TIME_PATTERN = r'For next free download you have to wait <strong>((?P<m>\d*)m)? ?((?P<s>\d+)s)?</strong>'
+ DIRECT_LINK_PATTERN = r'<a href="(?P<link>[^"]+)">Download ></a>'
+ RECAPTCHA_KEY = '6LeXatQSAAAAAHezcjXyWAni-4t302TeYe7_gfvX'
+
+ def setup(self):
+ # Set English language
+ self.load("https://egofiles.com/ajax/lang.php?lang=en", just_header=True)
+
+ def process(self, pyfile):
+ if self.premium and (not self.SH_CHECK_TRAFFIC or self.checkTrafficLeft()):
+ self.handlePremium()
+ else:
+ self.handleFree()
+
+ def handleFree(self):
+ self.html = self.load(self.pyfile.url, decode=True)
+ self.getFileInfo()
+
+ # Wait time between free downloads
+ if 'For next free download you have to wait' in self.html:
+ m = re.search(self.WAIT_TIME_PATTERN, self.html).groupdict('0')
+ waittime = int(m['m']) * 60 + int(m['s'])
+ self.setWait(waittime, True)
+ self.wait()
+
+ downloadURL = ''
+ recaptcha = ReCaptcha(self)
+ for i in xrange(5):
+ challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
+ post_data = {'recaptcha_challenge_field': challenge,
+ 'recaptcha_response_field': response}
+ self.html = self.load(self.pyfile.url, post=post_data, decode=True)
+ m = re.search(self.DIRECT_LINK_PATTERN, self.html)
+ if not m:
+ self.logInfo('Wrong captcha')
+ self.invalidCaptcha()
+ elif hasattr(m, 'group'):
+ downloadURL = m.group('link')
+ self.correctCaptcha()
+ break
+ else:
+ self.fail('Unknown error - Plugin may be out of date')
+
+ if not downloadURL:
+ self.fail("No Download url retrieved/all captcha attempts failed")
+
+ self.download(downloadURL, disposition=True)
+
+ def handlePremium(self):
+ header = self.load(self.pyfile.url, just_header=True)
+ if header.has_key('location'):
+ self.logDebug('DIRECT LINK from header: ' + header['location'])
+ self.download(header['location'])
+ else:
+ self.html = self.load(self.pyfile.url, decode=True)
+ self.getFileInfo()
+ m = re.search(r'<a href="(?P<link>[^"]+)">Download ></a>', self.html)
+ if not m:
+ self.parseError('Unable to detect direct download url')
+ else:
+ self.logDebug('DIRECT URL from html: ' + m.group('link'))
+ self.download(m.group('link'), disposition=True)
+
+
+getInfo = create_getInfo(EgoFilesCom)
diff --git a/pyload/plugins/hoster/EuroshareEu.py b/pyload/plugins/hoster/EuroshareEu.py
new file mode 100644
index 000000000..03bec8bbd
--- /dev/null
+++ b/pyload/plugins/hoster/EuroshareEu.py
@@ -0,0 +1,75 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class EuroshareEu(SimpleHoster):
+ __name__ = "EuroshareEu"
+ __type__ = "hoster"
+ __pattern__ = r"http://(\w*\.)?euroshare.(eu|sk|cz|hu|pl)/file/.*"
+ __version__ = "0.25"
+ __description__ = """Euroshare.eu"""
+ __author_name__ = ("zoidberg")
+
+ FILE_INFO_PATTERN = r'<span style="float: left;"><strong>(?P<N>.+?)</strong> \((?P<S>.+?)\)</span>'
+ FILE_OFFLINE_PATTERN = ur'<h2>S.bor sa nena.iel</h2>|Poşadovaná stránka neexistuje!'
+
+ FREE_URL_PATTERN = r'<a href="(/file/\d+/[^/]*/download/)"><div class="downloadButton"'
+ ERR_PARDL_PATTERN = r'<h2>Prebieha s.ahovanie</h2>|<p>Naraz je z jednej IP adresy mo.n. s.ahova. iba jeden s.bor'
+ ERR_NOT_LOGGED_IN_PATTERN = r'href="/customer-zone/login/"'
+
+ FILE_URL_REPLACEMENTS = [(r"(http://[^/]*\.)(sk|cz|hu|pl)/", r"\1eu/")]
+
+ def setup(self):
+ self.multiDL = self.resumeDownload = self.premium
+ self.req.setOption("timeout", 120)
+
+ def handlePremium(self):
+ if self.ERR_NOT_LOGGED_IN_PATTERN in self.html:
+ self.account.relogin(self.user)
+ self.retry(reason="User not logged in")
+
+ self.download(self.pyfile.url.rstrip('/') + "/download/")
+
+ check = self.checkDownload({"login": re.compile(self.ERR_NOT_LOGGED_IN_PATTERN),
+ "json": re.compile(r'\{"status":"error".*?"message":"(.*?)"')})
+ if check == "login" or (check == "json" and self.lastCheck.group(1) == "Access token expired"):
+ self.account.relogin(self.user)
+ self.retry(reason="Access token expired")
+ elif check == "json":
+ self.fail(self.lastCheck.group(1))
+
+ def handleFree(self):
+ if re.search(self.ERR_PARDL_PATTERN, self.html) is not None:
+ self.longWait(300, 12)
+
+ found = re.search(self.FREE_URL_PATTERN, self.html)
+ if found is None:
+ self.parseError("Parse error (URL)")
+ parsed_url = "http://euroshare.eu%s" % found.group(1)
+ self.logDebug("URL", parsed_url)
+ self.download(parsed_url, disposition=True)
+
+ check = self.checkDownload({"multi_dl": re.compile(self.ERR_PARDL_PATTERN)})
+ if check == "multi_dl":
+ self.longWait(300, 12)
+
+
+getInfo = create_getInfo(EuroshareEu)
diff --git a/pyload/plugins/hoster/ExtabitCom.py b/pyload/plugins/hoster/ExtabitCom.py
new file mode 100644
index 000000000..f68627b56
--- /dev/null
+++ b/pyload/plugins/hoster/ExtabitCom.py
@@ -0,0 +1,88 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.plugins.internal.CaptchaService import ReCaptcha
+from module.common.json_layer import json_loads
+
+
+class ExtabitCom(SimpleHoster):
+ __name__ = "ExtabitCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(\w+\.)*extabit\.com/(file|go|fid)/(?P<ID>\w+)"
+ __version__ = "0.4"
+ __description__ = """Extabit.com"""
+ __author_name__ = ("zoidberg")
+
+ FILE_NAME_PATTERN = r'<th>File:</th>\s*<td class="col-fileinfo">\s*<div title="(?P<N>[^"]+)">'
+ FILE_SIZE_PATTERN = r'<th>Size:</th>\s*<td class="col-fileinfo">(?P<S>[^<]+)</td>'
+ FILE_OFFLINE_PATTERN = r'<h1>File not found</h1>'
+ TEMP_OFFLINE_PATTERN = r">(File is temporary unavailable|No download mirror)<"
+
+ DOWNLOAD_LINK_PATTERN = r'[\'"](http://guest\d+\.extabit\.com/[a-z0-9]+/.*?)[\'"]'
+
+ def handleFree(self):
+ if r">Only premium users can download this file" in self.html:
+ 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:
+ self.setWait(int(m.group(1)) * 60, True)
+ self.wait()
+ elif "The daily downloads limit from your IP is exceeded" in self.html:
+ self.setWait(3600, True)
+ self.wait()
+
+ self.logDebug("URL: " + self.req.http.lastEffectiveURL)
+ m = re.match(self.__pattern__, self.req.http.lastEffectiveURL)
+ fileID = m.group('ID') if m else self.file_info('ID')
+
+ m = re.search(r'recaptcha/api/challenge\?k=(\w+)', self.html)
+ if m:
+ recaptcha = ReCaptcha(self)
+ captcha_key = m.group(1)
+
+ for i in range(5):
+ get_data = {"type": "recaptcha"}
+ get_data["challenge"], get_data["capture"] = recaptcha.challenge(captcha_key)
+ response = json_loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data))
+ if "ok" in response:
+ self.correctCaptcha()
+ break
+ else:
+ self.invalidCaptcha()
+ else:
+ self.fail("Invalid captcha")
+ else:
+ self.parseError('Captcha')
+
+ if not "href" in response:
+ self.parseError('JSON')
+
+ self.html = self.load("http://extabit.com/file/%s%s" % (fileID, response['href']))
+ m = re.search(self.DOWNLOAD_LINK_PATTERN, self.html)
+ if not m:
+ self.parseError('Download URL')
+ url = m.group(1)
+ self.logDebug("Download URL: " + url)
+ self.download(url)
+
+
+getInfo = create_getInfo(ExtabitCom)
diff --git a/pyload/plugins/hoster/FastixRu.py b/pyload/plugins/hoster/FastixRu.py
new file mode 100644
index 000000000..8805081c9
--- /dev/null
+++ b/pyload/plugins/hoster/FastixRu.py
@@ -0,0 +1,66 @@
+# -*- coding: utf-8 -*-
+
+import re
+from urllib import unquote
+from random import randrange
+from module.plugins.Hoster import Hoster
+from module.common.json_layer import json_loads
+
+
+class FastixRu(Hoster):
+ __name__ = "FastixRu"
+ __version__ = "0.04"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?fastix\.(ru|it)/file/(?P<ID>[a-zA-Z0-9]{24})"
+ __description__ = """Fastix hoster plugin"""
+ __author_name__ = ("Massimo Rosamilia")
+ __author_mail__ = ("max@spiritix.eu")
+
+ def getFilename(self, url):
+ try:
+ name = unquote(url.rsplit("/", 1)[1])
+ except IndexError:
+ name = "Unknown_Filename..."
+ if name.endswith("..."): # incomplete filename, append random stuff
+ name += "%s.tmp" % randrange(100, 999)
+ return name
+
+ def setup(self):
+ self.chunkLimit = 3
+ self.resumeDownload = True
+
+ def process(self, pyfile):
+ if re.match(self.__pattern__, pyfile.url):
+ new_url = pyfile.url
+ elif not self.account:
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "Fastix")
+ self.fail("No Fastix account provided")
+ else:
+ self.logDebug("Old URL: %s" % pyfile.url)
+ api_key = self.account.getAccountData(self.user)
+ api_key = api_key["api"]
+ url = "http://fastix.ru/api_v2/?apikey=%s&sub=getdirectlink&link=%s" % (api_key, pyfile.url)
+ page = self.load(url)
+ data = json_loads(page)
+ self.logDebug("Json data: %s" % str(data))
+ if "error\":true" in page:
+ self.offline()
+ else:
+ new_url = data["downloadlink"]
+
+ if new_url != pyfile.url:
+ self.logDebug("New URL: %s" % new_url)
+
+ if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"):
+ #only use when name wasnt already set
+ pyfile.name = self.getFilename(new_url)
+
+ self.download(new_url, disposition=True)
+
+ check = self.checkDownload({"error": "<title>An error occurred while processing your request</title>",
+ "empty": re.compile(r"^$")})
+
+ if check == "error":
+ self.retry(reason="An error occurred while generating link.", wait_time=60)
+ elif check == "empty":
+ self.retry(reason="Downloaded File was empty.", wait_time=60)
diff --git a/pyload/plugins/hoster/FastshareCz.py b/pyload/plugins/hoster/FastshareCz.py
new file mode 100644
index 000000000..3e33d0fd9
--- /dev/null
+++ b/pyload/plugins/hoster/FastshareCz.py
@@ -0,0 +1,89 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+# Test links (random.bin):
+# http://www.fastshare.cz/2141189/random.bin
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class FastshareCz(SimpleHoster):
+ __name__ = "FastshareCz"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)?fastshare.cz/\d+/.+"
+ __version__ = "0.20"
+ __description__ = """FastShare.cz"""
+ __author_name__ = ("zoidberg", "stickell")
+
+ FILE_INFO_PATTERN = r'<h1 class="dwp">(?P<N>[^<]+)</h1>\s*<div class="fileinfo">\s*(?:Velikost|Size)\s*: (?P<S>[^,]+),'
+ FILE_OFFLINE_PATTERN = 'The file ?has been deleted'
+ FILE_URL_REPLACEMENTS = [('#.*', '')]
+ SH_COOKIES = [('fastshare.cz', 'lang', 'en')]
+
+ FREE_URL_PATTERN = r'action=(/free/.*?)>\s*<img src="([^"]*)"><br'
+ PREMIUM_URL_PATTERN = r'(http://data\d+\.fastshare\.cz/download\.php\?id=\d+\&[^\s\"\'<>]+)'
+ NOT_ENOUGH_CREDIC_PATTERN = "Nem.te dostate.n. kredit pro sta.en. tohoto souboru"
+
+ def handleFree(self):
+ if '100% of FREE slots are full' in self.html:
+ self.retry(120, 60, "No free slots")
+
+ found = re.search(self.FREE_URL_PATTERN, self.html)
+ if not found:
+ self.parseError("Free URL")
+ action, captcha_src = found.groups()
+ captcha = self.decryptCaptcha("http://www.fastshare.cz" + captcha_src)
+ self.download("http://www.fastshare.cz" + action, post={"code": captcha, "btn.x": 77, "btn.y": 18})
+
+ check = self.checkDownload({
+ "paralell_dl":
+ "<title>FastShare.cz</title>|<script>alert\('Pres FREE muzete stahovat jen jeden soubor najednou.'\)",
+ "wrong_captcha": "Download for FREE"
+ })
+
+ if check == "paralell_dl":
+ self.retry(6, 600, "Paralell download")
+ elif check == "wrong_captcha":
+ self.retry(5, 1, "Wrong captcha")
+
+ def handlePremium(self):
+ header = self.load(self.pyfile.url, just_header=True)
+ if 'location' in header:
+ url = header['location']
+ else:
+ self.html = self.load(self.pyfile.url)
+ self.getFileInfo()
+ if self.NOT_ENOUGH_CREDIC_PATTERN in self.html:
+ self.logWarning('Not enough traffic left')
+ self.resetAccount()
+
+ found = re.search(self.PREMIUM_URL_PATTERN, self.html)
+ if not found:
+ self.parseError("Premium URL")
+ url = found.group(1)
+
+ self.logDebug("PREMIUM URL: %s" % url)
+ self.download(url, disposition=True)
+
+ check = self.checkDownload({"credit": re.compile(self.NOT_ENOUGH_CREDIC_PATTERN)})
+ if check == "credit":
+ self.resetAccount()
+
+
+getInfo = create_getInfo(FastshareCz)
diff --git a/pyload/plugins/hoster/FileApeCom.py b/pyload/plugins/hoster/FileApeCom.py
new file mode 100644
index 000000000..f07fbfc8a
--- /dev/null
+++ b/pyload/plugins/hoster/FileApeCom.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.plugins.Hoster import Hoster
+
+
+class FileApeCom(Hoster):
+ __name__ = "FileApeCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?fileape\.com/(index\.php\?act=download\&id=|dl/)\w+"
+ __version__ = "0.11"
+ __description__ = """FileApe Download Hoster"""
+ __author_name__ = ("espes")
+
+ def setup(self):
+ self.multiDL = False
+
+ def process(self, pyfile):
+ self.pyfile = pyfile
+
+ self.html = self.load(self.pyfile.url)
+
+ if "This file is either temporarily unavailable or does not exist" in self.html:
+ self.offline()
+
+ self.html = self.load(self.pyfile.url + "&g=1")
+
+ continueMatch = re.search(r"window\.location = '(http://.*?)'", self.html)
+ if not continueMatch:
+ continueMatch = re.search(r"'(http://fileape\.com/\?act=download&t=[A-Za-z0-9_-]+)'", self.html)
+ if continueMatch:
+ continuePage = continueMatch.group(1)
+ else:
+ self.fail("Plugin Defect")
+
+ wait = 60
+ waitMatch = re.search(
+ "id=\"waitnumber\" style=\"font-size:2em; text-align:center; width:33px; height:33px;\">(\\d+)</span>",
+ self.html)
+ if waitMatch:
+ wait = int(waitMatch.group(1))
+ self.setWait(wait + 3)
+ self.wait()
+
+ self.html = self.load(continuePage)
+ linkMatch = re.search(r"<div style=\"text-align:center; font-size: 30px;\"><a href=\"(http://.*?)\"", self.html)
+
+ if not linkMatch:
+ linkMatch = re.search(r"\"(http://tx\d+\.fileape\.com/[a-z]+/.*?)\"", self.html)
+ if linkMatch:
+ link = linkMatch.group(1)
+ else:
+ self.fail("Plugin Defect")
+
+ pyfile.name = link.rpartition('/')[2]
+
+ self.download(link)
+
+ check = self.checkDownload({"exp": "Download ticket expired"})
+ if check == "exp":
+ self.logInfo("Ticket expired, retrying...")
+ self.retry()
diff --git a/pyload/plugins/hoster/FilebeerInfo.py b/pyload/plugins/hoster/FilebeerInfo.py
new file mode 100644
index 000000000..216ecfbca
--- /dev/null
+++ b/pyload/plugins/hoster/FilebeerInfo.py
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo
+
+
+class FilebeerInfo(DeadHoster):
+ __name__ = "FilebeerInfo"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?filebeer\.info/(?!\d*~f)(?P<ID>\w+).*"
+ __version__ = "0.03"
+ __description__ = """Filebeer.info plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+
+getInfo = create_getInfo(FilebeerInfo) \ No newline at end of file
diff --git a/pyload/plugins/hoster/FilecloudIo.py b/pyload/plugins/hoster/FilecloudIo.py
new file mode 100644
index 000000000..c7684a05d
--- /dev/null
+++ b/pyload/plugins/hoster/FilecloudIo.py
@@ -0,0 +1,126 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError
+from module.common.json_layer import json_loads
+from module.plugins.internal.CaptchaService import ReCaptcha
+
+
+class FilecloudIo(SimpleHoster):
+ __name__ = "FilecloudIo"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)*(?:filecloud\.io|ifile\.it|mihd\.net)/(?P<ID>\w+).*"
+ __version__ = "0.02"
+ __description__ = """Filecloud.io (formerly Ifile.it) plugin - free account only"""
+ __author_name__ = ("zoidberg", "stickell")
+
+ FILE_SIZE_PATTERN = r'{var __ab1 = (?P<S>\d+);}'
+ FILE_NAME_PATTERN = r'id="aliasSpan">(?P<N>.*?)&nbsp;&nbsp;<'
+ FILE_OFFLINE_PATTERN = r'l10n.(FILES__DOESNT_EXIST|REMOVED)'
+ TEMP_OFFLINE_PATTERN = r'l10n.FILES__WARNING'
+
+ UKEY_PATTERN = r"'ukey'\s*:'(\w+)',"
+ AB1_PATTERN = r"if\( __ab1 == '(\w+)' \)"
+ ERROR_MSG_PATTERN = r"var __error_msg\s*=\s*l10n\.(.*?);"
+ DOWNLOAD_LINK_PATTERN = r'"(http://s\d+.filecloud.io/%s/\d+/.*?)"'
+ RECAPTCHA_KEY_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';"
+ RECAPTCHA_KEY = '6Lf5OdISAAAAAEZObLcx5Wlv4daMaASRov1ysDB1'
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = True
+ self.chunkLimit = 1
+
+ def handleFree(self):
+ data = {"ukey": self.file_info['ID']}
+
+ found = re.search(self.AB1_PATTERN, self.html)
+ if not found:
+ raise PluginParseError("__AB1")
+ data["__ab1"] = found.group(1)
+
+ if not self.account:
+ self.fail("User not logged in")
+ elif not self.account.logged_in:
+ recaptcha = ReCaptcha(self)
+ captcha_challenge, captcha_response = recaptcha.challenge(self.RECAPTCHA_KEY)
+ self.account.form_data = {"recaptcha_challenge_field": captcha_challenge,
+ "recaptcha_response_field": captcha_response}
+ self.account.relogin(self.user)
+ self.retry(max_tries=2)
+
+ json_url = "http://filecloud.io/download-request.json"
+ response = self.load(json_url, post=data)
+ self.logDebug(response)
+ response = json_loads(response)
+
+ if "error" in response and response["error"]:
+ self.fail(response)
+
+ self.logDebug(response)
+ if response["captcha"]:
+ recaptcha = ReCaptcha(self)
+ found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html)
+ captcha_key = found.group(1) if found else self.RECAPTCHA_KEY
+ data["ctype"] = "recaptcha"
+
+ for i in range(5):
+ data["recaptcha_challenge"], data["recaptcha_response"] = recaptcha.challenge(captcha_key)
+
+ json_url = "http://filecloud.io/download-request.json"
+ response = self.load(json_url, post=data)
+ self.logDebug(response)
+ response = json_loads(response)
+
+ if "retry" in response and response["retry"]:
+ self.invalidCaptcha()
+ else:
+ self.correctCaptcha()
+ break
+ else:
+ self.fail("Incorrect captcha")
+
+ if response["dl"]:
+ self.html = self.load('http://filecloud.io/download.html')
+ found = re.search(self.DOWNLOAD_LINK_PATTERN % self.file_info['ID'], self.html)
+ if not found:
+ raise PluginParseError("Download URL")
+ download_url = found.group(1)
+ self.logDebug("Download URL: %s" % download_url)
+
+ if "size" in self.file_info and self.file_info['size']:
+ self.check_data = {"size": int(self.file_info['size'])}
+ self.download(download_url)
+ else:
+ self.fail("Unexpected server response")
+
+ def handlePremium(self):
+ akey = self.account.getAccountData(self.user)['akey']
+ ukey = self.file_info['ID']
+ self.logDebug("Akey: %s | Ukey: %s" % (akey, ukey))
+ rep = self.load("http://api.filecloud.io/api-fetch_download_url.api",
+ post={"akey": akey, "ukey": ukey})
+ self.logDebug("FetchDownloadUrl: " + rep)
+ rep = json_loads(rep)
+ if rep['status'] == 'ok':
+ self.download(rep['download_url'], disposition=True)
+ else:
+ self.fail(rep['message'])
+
+
+getInfo = create_getInfo(FilecloudIo)
diff --git a/pyload/plugins/hoster/FilefactoryCom.py b/pyload/plugins/hoster/FilefactoryCom.py
new file mode 100644
index 000000000..fdde1f9d7
--- /dev/null
+++ b/pyload/plugins/hoster/FilefactoryCom.py
@@ -0,0 +1,133 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+# Test links (random.bin):
+# http://www.filefactory.com/file/ymxkmdud2o3/n/random.bin
+
+import re
+
+from module.plugins.internal.SimpleHoster import SimpleHoster
+from module.network.RequestFactory import getURL
+from module.utils import parseFileSize
+
+
+def getInfo(urls):
+ file_info = list()
+ list_ids = dict()
+
+ # Create a dict id:url. Will be used to retrieve original url
+ for url in urls:
+ m = re.search(FilefactoryCom.__pattern__, url)
+ list_ids[m.group('id')] = url
+
+ # WARN: There could be a limit of urls for request
+ post_data = {'func': 'links', 'links': '\n'.join(urls)}
+ rep = getURL('http://www.filefactory.com/tool/links.php', post=post_data, decode=True)
+
+ # Online links
+ for m in re.finditer(
+ r'innerText">\s*<h1 class="name">(?P<N>.+) \((?P<S>[\w.]+) (?P<U>\w+)\)</h1>\s*<p>http://www.filefactory.com/file/(?P<ID>\w+).*</p>\s*<p class="hidden size">',
+ rep):
+ file_info.append((m.group('N'), parseFileSize(m.group('S'), m.group('U')), 2, list_ids[m.group('ID')]))
+
+ # Offline links
+ for m in re.finditer(
+ r'innerText">\s*<h1>(http://www.filefactory.com/file/(?P<ID>\w+)/)</h1>\s*<p>\1</p>\s*<p class="errorResponse">Error: file not found</p>',
+ rep):
+ file_info.append((list_ids[m.group('ID')], 0, 1, list_ids[m.group('ID')]))
+
+ return file_info
+
+
+class FilefactoryCom(SimpleHoster):
+ __name__ = "FilefactoryCom"
+ __type__ = "hoster"
+ __pattern__ = r"https?://(?:www\.)?filefactory\.com/file/(?P<id>[a-zA-Z0-9]+)"
+ __version__ = "0.41"
+ __description__ = """Filefactory.Com File Download Hoster"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ DIRECT_LINK_PATTERN = r'<section id="downloadLink">\s*<p class="textAlignCenter">\s*<a href="([^"]+)">[^<]+</a>\s*</p>\s*</section>'
+
+ def process(self, pyfile):
+ if not re.match(self.__pattern__ + r'/n/.+', pyfile.url): # Not in standard format
+ header = self.load(pyfile.url, just_header=True)
+ if 'location' in header:
+ self.pyfile.url = 'http://www.filefactory.com' + header['location']
+
+ if self.premium and (not self.SH_CHECK_TRAFFIC or self.checkTrafficLeft()):
+ self.handlePremium()
+ else:
+ self.handleFree()
+
+ def handleFree(self):
+ self.html = self.load(self.pyfile.url, decode=True)
+ if "Currently only Premium Members can download files larger than" in self.html:
+ self.fail("File too large for free download")
+ elif "All free download slots on this server are currently in use" in self.html:
+ self.retry(50, 900, "All free slots are busy")
+
+ # Load the page that contains the direct link
+ url = re.search(r"document\.location\.host \+\s*'(.+)';", self.html)
+ if not url:
+ self.parseError('Unable to detect free link')
+ url = 'http://www.filefactory.com' + url.group(1)
+ self.html = self.load(url, decode=True)
+
+ # Free downloads wait time
+ waittime = re.search(r'id="startWait" value="(\d+)"', self.html)
+ if not waittime:
+ self.parseError('Unable to detect wait time')
+ self.setWait(int(waittime.group(1)))
+ self.wait()
+
+ # Parse the direct link and download it
+ direct = re.search(r'data-href-direct="(.*)" class="button', self.html)
+ if not direct:
+ self.parseError('Unable to detect free direct link')
+ direct = direct.group(1)
+ self.logDebug('DIRECT LINK: ' + direct)
+ self.download(direct, disposition=True)
+
+ check = self.checkDownload({"multiple": "You are currently downloading too many files at once.",
+ "error": '<div id="errorMessage">'})
+
+ if check == "multiple":
+ self.logDebug("Parallel downloads detected; waiting 15 minutes")
+ self.retry(wait_time=15 * 60, reason='Parallel downloads')
+ elif check == "error":
+ self.fail("Unknown error")
+
+ def handlePremium(self):
+ header = self.load(self.pyfile.url, just_header=True)
+ if 'location' in header:
+ url = header['location'].strip()
+ if not url.startswith("http://"):
+ url = "http://www.filefactory.com" + url
+ elif 'content-disposition' in header:
+ url = self.pyfile.url
+ else:
+ html = self.load(self.pyfile.url)
+ found = re.search(self.DIRECT_LINK_PATTERN, html)
+ if found:
+ url = found.group(1)
+ else:
+ self.parseError('Unable to detect premium direct link')
+
+ self.logDebug('DIRECT PREMIUM LINK: ' + url)
+ self.download(url, disposition=True)
diff --git a/pyload/plugins/hoster/FilejungleCom.py b/pyload/plugins/hoster/FilejungleCom.py
new file mode 100644
index 000000000..0fb0b6150
--- /dev/null
+++ b/pyload/plugins/hoster/FilejungleCom.py
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+from module.plugins.hoster.FileserveCom import FileserveCom, checkFile
+from module.plugins.Plugin import chunks
+
+
+class FilejungleCom(FileserveCom):
+ __name__ = "FilejungleCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?filejungle\.com/f/(?P<id>[^/]+).*"
+ __version__ = "0.51"
+ __description__ = """Filejungle.com plugin - free only"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ URLS = ['http://www.filejungle.com/f/', 'http://www.filejungle.com/check_links.php',
+ 'http://www.filejungle.com/checkReCaptcha.php']
+ LINKCHECK_TR = r'<li>\s*(<div class="col1">.*?)</li>'
+ LINKCHECK_TD = r'<div class="(?:col )?col\d">(?:<[^>]*>|&nbsp;)*([^<]*)'
+
+ LONG_WAIT_PATTERN = r'<h1>Please wait for (\d+) (\w+)\s*to download the next file\.</h1>'
+
+
+def getInfo(urls):
+ for chunk in chunks(urls, 100):
+ yield checkFile(FilejungleCom, chunk)
diff --git a/pyload/plugins/hoster/FilepostCom.py b/pyload/plugins/hoster/FilepostCom.py
new file mode 100644
index 000000000..0c3cb925b
--- /dev/null
+++ b/pyload/plugins/hoster/FilepostCom.py
@@ -0,0 +1,146 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+
+ changelog:
+ 0.27 - 2012-08-12 - hgg
+ fix "global name 'js_answer' is not defined" bug
+ fix captcha bug #1 (failed on non-english "captcha wrong" errors)
+"""
+
+import re
+from time import time
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.plugins.internal.CaptchaService import ReCaptcha
+from module.common.json_layer import json_loads
+
+
+class FilepostCom(SimpleHoster):
+ __name__ = "FilepostCom"
+ __type__ = "hoster"
+ __pattern__ = r"https?://(?:www\.)?(?:filepost\.com/files|fp.io)/([^/]+).*"
+ __version__ = "0.27"
+ __description__ = """Filepost.com plugin - free only"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FILE_INFO_PATTERN = r'<input type="text" id="url" value=\'<a href[^>]*>(?P<N>[^>]+?) - (?P<S>[0-9\.]+ [kKMG]i?B)</a>\' class="inp_text"/>'
+ #FILE_INFO_PATTERN = r'<h1>(?P<N>[^<]+)</h1>\s*<div class="ul">\s*<ul>\s*<li><span>Size:</span> (?P<S>[0-9.]+) (?P<U>[kKMG])i?B</li>'
+ FILE_OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. </div>|<div class="file_info file_info_deleted">'
+ RECAPTCHA_KEY_PATTERN = r"Captcha.init\({\s*key:\s*'([^']+)'"
+ FLP_TOKEN_PATTERN = r"set_store_options\({token: '([^']+)'"
+
+ def handleFree(self):
+ # Find token and captcha key
+ file_id = re.search(self.__pattern__, self.pyfile.url).group(1)
+
+ found = re.search(self.FLP_TOKEN_PATTERN, self.html)
+ if not found:
+ self.parseError("Token")
+ flp_token = found.group(1)
+
+ found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html)
+ if not found:
+ self.parseError("Captcha key")
+ captcha_key = found.group(1)
+
+ # Get wait time
+ get_dict = {'SID': self.req.cj.getCookie('SID'), 'JsHttpRequest': str(int(time() * 10000)) + '-xml'}
+ post_dict = {'action': 'set_download', 'token': flp_token, 'code': file_id}
+ wait_time = int(self.getJsonResponse(get_dict, post_dict, 'wait_time'))
+
+ if wait_time > 0:
+ self.setWait(wait_time)
+ self.wait()
+
+ post_dict = {"token": flp_token, "code": file_id, "file_pass": ''}
+
+ if 'var is_pass_exists = true;' in self.html:
+ # Solve password
+ for file_pass in self.getPassword().splitlines():
+ get_dict['JsHttpRequest'] = str(int(time() * 10000)) + '-xml'
+ post_dict['file_pass'] = file_pass
+ self.logInfo("Password protected link, trying " + file_pass)
+
+ download_url = self.getJsonResponse(get_dict, post_dict, 'link')
+ if download_url:
+ break
+
+ else:
+ self.fail("No or incorrect password")
+
+ else:
+ # Solve recaptcha
+ recaptcha = ReCaptcha(self)
+
+ for pokus in range(5):
+ get_dict['JsHttpRequest'] = str(int(time() * 10000)) + '-xml'
+ if pokus:
+ post_dict["recaptcha_challenge_field"], post_dict["recaptcha_response_field"] = recaptcha.challenge(
+ captcha_key)
+ self.logDebug(u"RECAPTCHA: %s : %s : %s" % (
+ captcha_key, post_dict["recaptcha_challenge_field"], post_dict["recaptcha_response_field"]))
+
+ download_url = self.getJsonResponse(get_dict, post_dict, 'link')
+ if download_url:
+ if pokus:
+ self.correctCaptcha()
+ break
+ elif pokus:
+ self.invalidCaptcha()
+
+ else:
+ self.fail("Invalid captcha")
+
+ # Download
+ self.download(download_url)
+
+ def getJsonResponse(self, get_dict, post_dict, field):
+ json_response = json_loads(self.load('https://filepost.com/files/get/', get=get_dict, post=post_dict))
+ self.logDebug(json_response)
+
+ if not 'js' in json_response:
+ self.parseError('JSON %s 1' % field)
+
+ # i changed js_answer to json_response['js'] since js_answer is nowhere set.
+ # i don't know the JSON-HTTP specs in detail, but the previous author
+ # accessed json_response['js']['error'] as well as js_answer['error'].
+ # see the two lines commented out with "# ~?".
+ if 'error' in json_response['js']:
+ if json_response['js']['error'] == 'download_delay':
+ self.retry(json_response['js']['params']['next_download'])
+ # ~? self.retry(js_answer['params']['next_download'])
+ elif 'Wrong file password' in json_response['js']['error']:
+ return None
+ elif 'You entered a wrong CAPTCHA code' in json_response['js']['error']:
+ return None
+ elif 'CAPTCHA Code nicht korrekt' in json_response['js']['error']:
+ return None
+ elif 'CAPTCHA' in json_response['js']['error']:
+ self.logDebug('error response is unknown, but mentions CAPTCHA -> return None')
+ return None
+ else:
+ self.fail(json_response['js']['error'])
+ # ~? self.fail(js_answer['error'])
+
+ if not 'answer' in json_response['js'] or not field in json_response['js']['answer']:
+ self.parseError('JSON %s 2' % field)
+
+ return json_response['js']['answer'][field]
+
+
+getInfo = create_getInfo(FilepostCom)
diff --git a/pyload/plugins/hoster/FilerNet.py b/pyload/plugins/hoster/FilerNet.py
new file mode 100644
index 000000000..8e8cee526
--- /dev/null
+++ b/pyload/plugins/hoster/FilerNet.py
@@ -0,0 +1,119 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+# Test links (random.bin):
+# http://filer.net/get/ivgf5ztw53et3ogd
+# http://filer.net/get/hgo14gzcng3scbvv
+
+import pycurl
+import re
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.plugins.internal.CaptchaService import ReCaptcha
+
+
+class FilerNet(SimpleHoster):
+ __name__ = "FilerNet"
+ __type__ = "hoster"
+ __pattern__ = r"https?://(www\.)?filer\.net/get/(\w+)"
+ __version__ = "0.02"
+ __description__ = """Filer.net Download Hoster"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ FILE_INFO_PATTERN = r'<h1 class="page-header">Free Download (?P<N>\S+) <small>(?P<S>[\w.]+) (?P<U>\w+)</small></h1>'
+ FILE_OFFLINE_PATTERN = r'Nicht gefunden'
+ RECAPTCHA_KEY = '6LcFctISAAAAAAgaeHgyqhNecGJJRnxV1m_vAz3V'
+ DIRECT_LINK_PATTERN = r'href="([^"]+)">Get download</a>'
+
+ def process(self, pyfile):
+ if self.premium and (not self.SH_CHECK_TRAFFIC or self.checkTrafficLeft()):
+ self.handlePremium()
+ else:
+ self.handleFree()
+
+ def handleFree(self):
+ self.req.setOption("timeout", 120)
+ self.html = self.load(self.pyfile.url, decode=not self.SH_BROKEN_ENCODING, cookies=self.SH_COOKIES)
+
+ # Wait between downloads
+ m = re.search(r'musst du <span id="time">(\d+)</span> Sekunden warten', self.html)
+ if m:
+ waittime = int(m.group(1))
+ self.retry(3, waittime, 'Wait between free downloads')
+
+ self.getFileInfo()
+
+ self.html = self.load(self.pyfile.url, decode=True)
+
+ inputs = self.parseHtmlForm(input_names='token')[1]
+ if 'token' not in inputs:
+ self.parseError('Unable to detect token')
+ token = inputs['token']
+ self.logDebug('Token: ' + token)
+
+ self.html = self.load(self.pyfile.url, post={'token': token}, decode=True)
+
+ inputs = self.parseHtmlForm(input_names='hash')[1]
+ if 'hash' not in inputs:
+ self.parseError('Unable to detect hash')
+ hash_data = inputs['hash']
+ self.logDebug('Hash: ' + hash_data)
+
+ downloadURL = ''
+ recaptcha = ReCaptcha(self)
+ for i in xrange(5):
+ challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
+ post_data = {'recaptcha_challenge_field': challenge,
+ 'recaptcha_response_field': response,
+ 'hash': hash_data}
+
+ # Workaround for 0.4.9 just_header issue. In 0.5 clean the code using just_header
+ self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0)
+ self.load(self.pyfile.url, post=post_data)
+ self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1)
+
+ if 'location' in self.req.http.header:
+ location = re.search(r'location: (\S+)', self.req.http.header).group(1)
+ downloadURL = 'http://filer.net' + location
+ self.correctCaptcha()
+ break
+ else:
+ self.logInfo('Wrong captcha')
+ self.invalidCaptcha()
+
+ if not downloadURL:
+ self.fail("No Download url retrieved/all captcha attempts failed")
+
+ self.download(downloadURL, disposition=True)
+
+ def handlePremium(self):
+ header = self.load(self.pyfile.url, just_header=True)
+ if 'location' in header: # Direct Download ON
+ dl = self.pyfile.url
+ else: # Direct Download OFF
+ html = self.load(self.pyfile.url)
+ m = re.search(self.DIRECT_LINK_PATTERN, html)
+ if not m:
+ self.parseError("Unable to detect direct link, try to enable 'Direct download' in your user settings")
+ dl = 'http://filer.net' + m.group(1)
+
+ self.logDebug('Direct link: ' + dl)
+ self.download(dl, disposition=True)
+
+
+getInfo = create_getInfo(FilerNet)
diff --git a/pyload/plugins/hoster/FilerioCom.py b/pyload/plugins/hoster/FilerioCom.py
new file mode 100644
index 000000000..7adffc4ed
--- /dev/null
+++ b/pyload/plugins/hoster/FilerioCom.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
+
+class FilerioCom(XFileSharingPro):
+ __name__ = "FilerioCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)*(filerio\.(in|com)|filekeen\.com)/\w{12}"
+ __version__ = "0.02"
+ __description__ = """FileRio.in hoster plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FILE_OFFLINE_PATTERN = '<b>&quot;File Not Found&quot;</b>|File has been removed due to Copyright Claim'
+ HOSTER_NAME = "filerio.in"
+ FILE_URL_REPLACEMENTS = [(r'http://.*?/', 'http://filerio.in/')]
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = self.premium
+
+
+getInfo = create_getInfo(FilerioCom)
diff --git a/pyload/plugins/hoster/FilesMailRu.py b/pyload/plugins/hoster/FilesMailRu.py
new file mode 100644
index 000000000..2b87c309e
--- /dev/null
+++ b/pyload/plugins/hoster/FilesMailRu.py
@@ -0,0 +1,101 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Hoster import Hoster, chunks
+from module.network.RequestFactory import getURL
+
+
+
+def getInfo(urls):
+ result = []
+ for chunk in chunks(urls, 10):
+ for url in chunk:
+ src = getURL(url)
+ if r'<div class="errorMessage mb10">' in src:
+ result.append((url, 0, 1, url))
+ elif r'Page cannot be displayed' in src:
+ result.append((url, 0, 1, url))
+ else:
+ try:
+ url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>'
+ file_name = re.search(url_pattern, src).group(0).split(', event)">')[1].split('</a>')[0]
+ result.append((file_name, 0, 2, url))
+ except:
+ pass
+
+ # status 1=OFFLINE, 2=OK, 3=UNKNOWN
+ # result.append((#name,#size,#status,#url))
+ yield result
+
+
+class FilesMailRu(Hoster):
+ __name__ = "FilesMailRu"
+ __type__ = "hoster"
+ __pattern__ = r"http://files\.mail\.ru/.*"
+ __version__ = "0.31"
+ __description__ = """Files.Mail.Ru One-Klick Hoster"""
+ __author_name__ = ("oZiRiz")
+ __author_mail__ = ("ich@oziriz.de")
+
+ def setup(self):
+ if not self.account:
+ self.multiDL = False
+
+ def process(self, pyfile):
+ self.html = self.load(pyfile.url)
+ self.url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>'
+
+ #marks the file as "offline" when the pattern was found on the html-page'''
+ if r'<div class="errorMessage mb10">' in self.html:
+ self.offline()
+
+ elif r'Page cannot be displayed' in self.html:
+ self.offline()
+
+ #the filename that will be showed in the list (e.g. test.part1.rar)'''
+ pyfile.name = self.getFileName()
+
+ #prepare and download'''
+ if not self.account:
+ self.prepare()
+ self.download(self.getFileUrl())
+ self.myPostProcess()
+ else:
+ self.download(self.getFileUrl())
+ self.myPostProcess()
+
+ def prepare(self):
+ """You have to wait some seconds. Otherwise you will get a 40Byte HTML Page instead of the file you expected"""
+ self.setWait(10)
+ self.wait()
+ return True
+
+ def getFileUrl(self):
+ """gives you the URL to the file. Extracted from the Files.mail.ru HTML-page stored in self.html"""
+ file_url = re.search(self.url_pattern, self.html).group(0).split('<a href="')[1].split('" onclick="return Act')[
+ 0]
+ return file_url
+
+ def getFileName(self):
+ """gives you the Name for each file. Also extracted from the HTML-Page"""
+ file_name = re.search(self.url_pattern, self.html).group(0).split(', event)">')[1].split('</a>')[0]
+ return file_name
+
+ def myPostProcess(self):
+ # searches the file for HTMl-Code. Sometimes the Redirect
+ # doesn't work (maybe a curl Problem) and you get only a small
+ # HTML file and the Download is marked as "finished"
+ # then the download will be restarted. It's only bad for these
+ # who want download a HTML-File (it's one in a million ;-) )
+ #
+ # The maximum UploadSize allowed on files.mail.ru at the moment is 100MB
+ # 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.checkDownload({"html": "<meta name="}, read_size=50000)
+ if check == "html":
+ self.logInfo(_(
+ "There was HTML Code in the Downloaded File (%s)...redirect error? The Download will be restarted." %
+ self.pyfile.name))
+ self.retry()
diff --git a/pyload/plugins/hoster/FileserveCom.py b/pyload/plugins/hoster/FileserveCom.py
new file mode 100644
index 000000000..a9ff24d19
--- /dev/null
+++ b/pyload/plugins/hoster/FileserveCom.py
@@ -0,0 +1,220 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+"""
+
+import re
+from module.plugins.Hoster import Hoster
+from module.network.RequestFactory import getURL
+from module.plugins.internal.CaptchaService import ReCaptcha
+from module.common.json_layer import json_loads
+from module.utils import parseFileSize
+from module.plugins.Plugin import chunks
+
+
+def checkFile(plugin, urls):
+ html = getURL(plugin.URLS[1], post={"urls": "\n".join(urls)}, decode=True)
+
+ file_info = []
+ for li in re.finditer(plugin.LINKCHECK_TR, html, re.DOTALL):
+ try:
+ cols = re.findall(plugin.LINKCHECK_TD, li.group(1))
+ if cols:
+ file_info.append((
+ cols[1] if cols[1] != '--' else cols[0],
+ parseFileSize(cols[2]) if cols[2] != '--' else 0,
+ 2 if cols[3].startswith('Available') else 1,
+ cols[0]))
+ except Exception, e:
+ continue
+
+ return file_info
+
+
+class FileserveCom(Hoster):
+ __name__ = "FileserveCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?fileserve\.com/file/(?P<id>[^/]+).*"
+ __version__ = "0.51"
+ __description__ = """Fileserve.Com File Download Hoster"""
+ __author_name__ = ("jeix", "mkaay", "paul king", "zoidberg")
+ __author_mail__ = ("jeix@hasnomail.de", "mkaay@mkaay.de", "", "zoidberg@mujmail.cz")
+
+ URLS = ['http://www.fileserve.com/file/', 'http://www.fileserve.com/link-checker.php',
+ 'http://www.fileserve.com/checkReCaptcha.php']
+ LINKCHECK_TR = r'<tr>\s*(<td>http://www.fileserve\.com/file/.*?)</tr>'
+ LINKCHECK_TD = r'<td>(?:<[^>]*>|&nbsp;)*([^<]*)'
+
+ CAPTCHA_KEY_PATTERN = r"var reCAPTCHA_publickey='(?P<key>[^']+)'"
+ LONG_WAIT_PATTERN = r'<li class="title">You need to wait (\d+) (\w+) to start another download\.</li>'
+ LINK_EXPIRED_PATTERN = "Your download link has expired"
+ DAILY_LIMIT_PATTERN = "Your daily download limit has been reached"
+ NOT_LOGGED_IN_PATTERN = '<form (name="loginDialogBoxForm"|id="login_form")|<li><a href="/login.php">Login</a></li>'
+
+ # shares code with FilejungleCom and UploadstationCom
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = self.premium
+
+ self.file_id = re.search(self.__pattern__, self.pyfile.url).group('id')
+ self.url = "%s%s" % (self.URLS[0], self.file_id)
+ self.logDebug("File ID: %s URL: %s" % (self.file_id, self.url))
+
+ def process(self, pyfile):
+ pyfile.name, pyfile.size, status, self.url = checkFile(self, [self.url])[0]
+ if status != 2:
+ self.offline()
+ self.logDebug("File Name: %s Size: %d" % (pyfile.name, pyfile.size))
+
+ if self.premium:
+ self.handlePremium()
+ else:
+ self.handleFree()
+
+ def handleFree(self):
+ self.html = self.load(self.url)
+ action = self.load(self.url, post={"checkDownload": "check"}, decode=True)
+ action = json_loads(action)
+ self.logDebug(action)
+
+ if "fail" in action:
+ if action["fail"] == "timeLimit":
+ self.html = self.load(self.url,post={"checkDownload": "showError", "errorType": "timeLimit"},
+ decode=True)
+
+ self.doLongWait(re.search(self.LONG_WAIT_PATTERN, self.html))
+
+ elif action["fail"] == "parallelDownload":
+ self.logWarning(_("Parallel download error, now waiting 60s."))
+ self.retry(wait_time=60, reason="parallelDownload")
+
+ else:
+ self.fail("Download check returned %s" % action["fail"])
+
+ elif "success" in action:
+ if action["success"] == "showCaptcha":
+ self.doCaptcha()
+ self.doTimmer()
+ elif action["success"] == "showTimmer":
+ self.doTimmer()
+
+ else:
+ self.fail("Unknown server response")
+
+ # show download link
+ response = self.load(self.url, post={"downloadLink": "show"}, decode=True)
+ self.logDebug("show downloadLink response : %s" % response)
+ if "fail" in response:
+ self.fail("Couldn't retrieve download url")
+
+ # this may either download our file or forward us to an error page
+ self.download(self.url, post={"download": "normal"})
+ self.logDebug(self.req.http.lastEffectiveURL)
+
+ check = self.checkDownload({"expired": self.LINK_EXPIRED_PATTERN,
+ "wait": re.compile(self.LONG_WAIT_PATTERN),
+ "limit": self.DAILY_LIMIT_PATTERN})
+
+ if check == "expired":
+ self.logDebug("Download link was expired")
+ self.retry()
+ elif check == "wait":
+ self.doLongWait(self.lastCheck)
+ elif check == "limit":
+ #download limited reached for today (not a exact time known)
+ self.setWait(180 * 60, True) # wait 3 hours
+ self.wait()
+ self.retry(max_tries=0)
+
+ self.thread.m.reconnecting.wait(3) # Ease issue with later downloads appearing to be in parallel
+
+ def doTimmer(self):
+ response = self.load(self.url, post={"downloadLink": "wait"}, decode=True)
+ self.logDebug("wait response : %s" % response[:80])
+
+ if "fail" in response:
+ self.fail("Failed getting wait time")
+
+ if self.__name__ == "FilejungleCom":
+ found = re.search(r'"waitTime":(\d+)', response)
+ if not found:
+ self.fail("Cannot get wait time")
+ wait_time = int(found.group(1))
+ else:
+ wait_time = int(response) + 3
+
+ self.setWait(wait_time)
+ self.wait()
+
+ def doCaptcha(self):
+ captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group("key")
+ recaptcha = ReCaptcha(self)
+
+ for i in range(5):
+ challenge, code = recaptcha.challenge(captcha_key)
+
+ response = json_loads(self.load(self.URLS[2],
+ post={'recaptcha_challenge_field': challenge,
+ 'recaptcha_response_field': code,
+ 'recaptcha_shortencode_field': self.file_id}))
+ self.logDebug("reCaptcha response : %s" % response)
+ if not response["success"]:
+ self.invalidCaptcha()
+ else:
+ self.correctCaptcha()
+ break
+ else:
+ self.fail("Invalid captcha")
+
+ def doLongWait(self, m):
+ wait_time = (int(m.group(1)) * {'seconds': 1, 'minutes': 60, 'hours': 3600}[m.group(2)]) if m else 720
+ self.setWait(wait_time, True)
+ self.wait()
+ self.retry()
+
+ def handlePremium(self):
+ premium_url = None
+ if self.__name__ == "FileserveCom":
+ #try api download
+ response = self.load("http://app.fileserve.com/api/download/premium/",
+ post={"username": self.user,
+ "password": self.account.getAccountData(self.user)["password"],
+ "shorten": self.file_id},
+ decode=True)
+ if response:
+ response = json_loads(response)
+ if response['error_code'] == "302":
+ premium_url = response['next']
+ elif response['error_code'] in ["305", "500"]:
+ self.tempOffline()
+ elif response['error_code'] in ["403", "605"]:
+ self.resetAccount()
+ elif response['error_code'] in ["606", "607", "608"]:
+ self.offline()
+ else:
+ self.logError(response['error_code'], response['error_message'])
+
+ self.download(premium_url or self.pyfile.url)
+
+ if not premium_url:
+ check = self.checkDownload({"login": re.compile(self.NOT_LOGGED_IN_PATTERN)})
+
+ if check == "login":
+ self.account.relogin(self.user)
+ self.retry(reason=_("Not logged in."))
+
+
+def getInfo(urls):
+ for chunk in chunks(urls, 100):
+ yield checkFile(FileserveCom, chunk)
diff --git a/pyload/plugins/hoster/FileshareInUa.py b/pyload/plugins/hoster/FileshareInUa.py
new file mode 100644
index 000000000..11adc4e9c
--- /dev/null
+++ b/pyload/plugins/hoster/FileshareInUa.py
@@ -0,0 +1,78 @@
+import re
+from module.plugins.Hoster import Hoster
+from module.network.RequestFactory import getURL
+from module.utils import parseFileSize
+
+
+class FileshareInUa(Hoster):
+ __name__ = "FileshareInUa"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)*?fileshare.in.ua/[A-Za-z0-9]+"
+ __version__ = "0.01"
+ __description__ = """fileshare.in.ua hoster plugin"""
+ __author_name__ = ("fwannmacher")
+ __author_mail__ = ("felipe@warhammerproject.com")
+
+ HOSTER_NAME = "fileshare.in.ua"
+ PATTERN_FILENAME = r'<h3 class="b-filename">(.*?)</h3>'
+ PATTERN_FILESIZE = r'<b class="b-filesize">(.*?)</b>'
+ PATTERN_OFFLINE = "This file doesn't exist, or has been removed."
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = True
+
+ def process(self, pyfile):
+ self.pyfile = pyfile
+ self.html = self.load(pyfile.url, decode=True)
+
+ if not self._checkOnline():
+ self.offline()
+
+ self.pyfile.name = self._getName()
+
+ self.link = self._getLink()
+
+ if not self.link.startswith('http://'):
+ self.link = "http://fileshare.in.ua" + self.link
+
+ self.download(self.link)
+
+ def _checkOnline(self):
+ if re.search(self.PATTERN_OFFLINE, self.html):
+ return False
+ else:
+ return True
+
+ def _getName(self):
+ name = re.search(self.PATTERN_FILENAME, self.html)
+ if name is None:
+ self.fail("%s: Plugin broken." % self.__name__)
+
+ return name.group(1)
+
+ def _getLink(self):
+ return re.search("<a href=\"(/get/.+)\" class=\"b-button m-blue m-big\" >", self.html).group(1)
+
+
+def getInfo(urls):
+ result = []
+
+ for url in urls:
+ html = getURL(url)
+
+ if re.search(FileshareInUa.PATTERN_OFFLINE, html):
+ result.append((url, 0, 1, url))
+ else:
+ name = re.search(FileshareInUa.PATTERN_FILENAME, html)
+
+ if name is None:
+ result.append((url, 0, 1, url))
+ continue
+
+ name = name.group(1)
+ size = re.search(FileshareInUa.PATTERN_FILESIZE, html)
+ size = parseFileSize(size.group(1))
+
+ result.append((name, size, 3, url))
+
+ yield result
diff --git a/pyload/plugins/hoster/FilezyNet.py b/pyload/plugins/hoster/FilezyNet.py
new file mode 100644
index 000000000..c31707089
--- /dev/null
+++ b/pyload/plugins/hoster/FilezyNet.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+import re
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
+
+class FilezyNet(XFileSharingPro):
+ __name__ = "FilezyNet"
+ __type__ = "hoster"
+ __version__ = "0.1"
+ __pattern__ = r"http://filezy.net/.*/.*.html"
+ __description__ = """filezy.net hoster plugin"""
+
+ HOSTER_NAME = "filezy.net"
+
+ FILE_SIZE_PATTERN = r'<span class="plansize">(?P<S>[0-9.]+) (?P<U>[kKMG])i?B</span>'
+ WAIT_PATTERN = r'<div id="countdown_str" class="seconds">\n<!--Wait--> <span id=".*?">(\d+)</span>'
+ DOWNLOAD_JS_PATTERN = r"<script type='text/javascript'>eval(.*)"
+
+ def setup(self):
+ self.resumeDownload = True
+ self.multiDL = self.premium
+
+ def getDownloadLink(self):
+ self.logDebug("Getting download link")
+
+ data = self.getPostParameters()
+ self.html = self.load(self.pyfile.url, post=data, ref=True, decode=True)
+
+ obfuscated_js = re.search(self.DOWNLOAD_JS_PATTERN, self.html)
+ dl_file_now = self.js.eval(obfuscated_js.group(1))
+ link = re.search(self.DIRECT_LINK_PATTERN, dl_file_now)
+ return link.group(1)
+
+
+getInfo = create_getInfo(FilezyNet)
diff --git a/pyload/plugins/hoster/FlyFilesNet.py b/pyload/plugins/hoster/FlyFilesNet.py
new file mode 100644
index 000000000..8d0ff0a08
--- /dev/null
+++ b/pyload/plugins/hoster/FlyFilesNet.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+import urllib
+
+from module.plugins.internal.SimpleHoster import SimpleHoster
+from module.network.RequestFactory import getURL
+
+
+class FlyFilesNet(SimpleHoster):
+ __name__ = "FlyFilesNet"
+ __version__ = "0.1"
+ __type__ = "hoster"
+ __pattern__ = r'http://flyfiles\.net/.*'
+
+ SESSION_PATTERN = r'flyfiles\.net/(.*)/.*'
+ FILE_NAME_PATTERN = r'flyfiles\.net/.*/(.*)'
+
+ def process(self, pyfile):
+ pyfile.name = re.search(self.FILE_NAME_PATTERN, pyfile.url).group(1)
+ pyfile.name = urllib.unquote_plus(pyfile.name)
+
+ session = re.search(self.SESSION_PATTERN, pyfile.url).group(1)
+
+ url = "http://flyfiles.net"
+
+ # get download URL
+ parsed_url = getURL(url, post={"getDownLink": session}, cookies=True)
+ self.logDebug("Parsed URL: %s" % parsed_url)
+
+ if parsed_url == '#downlink|' or parsed_url == "#downlink|#":
+ self.logWarning("Could not get the download URL. Please wait 10 minutes.")
+ self.setWait(600, True) # wait 10 minutes
+ self.wait()
+ self.retry()
+
+ download_url = parsed_url.replace('#downlink|', '')
+
+ self.logDebug("Download URL: %s" % download_url)
+ self.download(download_url)
diff --git a/pyload/plugins/hoster/FourSharedCom.py b/pyload/plugins/hoster/FourSharedCom.py
new file mode 100644
index 000000000..6b3e33284
--- /dev/null
+++ b/pyload/plugins/hoster/FourSharedCom.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class FourSharedCom(SimpleHoster):
+ __name__ = "FourSharedCom"
+ __type__ = "hoster"
+ __pattern__ = r"https?://(www\.)?4shared(\-china)?\.com/(account/)?(download|get|file|document|photo|video|audio|mp3|office|rar|zip|archive|music)/.+?/.*"
+ __version__ = "0.29"
+ __description__ = """4Shared Download Hoster"""
+ __author_name__ = ("jeix", "zoidberg")
+ __author_mail__ = ("jeix@hasnomail.de", "zoidberg@mujmail.cz")
+
+ FILE_NAME_PATTERN = r'<meta name="title" content="(?P<N>.+?)"'
+ FILE_SIZE_PATTERN = '<span title="Size: (?P<S>[0-9,.]+) (?P<U>[kKMG])i?B">'
+ FILE_OFFLINE_PATTERN = 'The file link that you requested is not valid\.|This file was deleted.'
+ FILE_NAME_REPLACEMENTS = [(r"&#(\d+).", lambda m: unichr(int(m.group(1))))]
+ FILE_SIZE_REPLACEMENTS = [(",", "")]
+
+ DOWNLOAD_BUTTON_PATTERN = 'id="btnLink" href="(.*?)"'
+ FID_PATTERN = 'name="d3fid" value="(.*?)"'
+ DOWNLOAD_URL_PATTERN = r'name="d3link" value="(.*?)"'
+
+ def handleFree(self):
+ if not self.account:
+ self.fail("User not logged in")
+
+ found = re.search(self.DOWNLOAD_BUTTON_PATTERN, self.html)
+ if found:
+ link = found.group(1)
+ else:
+ link = re.sub(r'/(download|get|file|document|photo|video|audio)/', r'/get/', self.pyfile.url)
+
+ self.html = self.load(link)
+
+ found = re.search(self.DOWNLOAD_URL_PATTERN, self.html)
+ if not found:
+ self.parseError('Download link')
+ link = found.group(1)
+
+ try:
+ found = re.search(self.FID_PATTERN, self.html)
+ response = self.load('http://www.4shared.com/web/d2/getFreeDownloadLimitInfo?fileId=%s' % found.group(1))
+ self.logDebug(response)
+ except:
+ pass
+
+ self.setWait(20)
+ self.wait()
+ self.download(link)
+
+
+getInfo = create_getInfo(FourSharedCom)
diff --git a/pyload/plugins/hoster/FreakshareCom.py b/pyload/plugins/hoster/FreakshareCom.py
new file mode 100644
index 000000000..cb84a468a
--- /dev/null
+++ b/pyload/plugins/hoster/FreakshareCom.py
@@ -0,0 +1,171 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Hoster import Hoster
+from module.plugins.internal.CaptchaService import ReCaptcha
+
+
+class FreakshareCom(Hoster):
+ __name__ = "FreakshareCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?freakshare\.(net|com)/files/\S*?/"
+ __version__ = "0.38"
+ __description__ = """Freakshare.com Download Hoster"""
+ __author_name__ = ("sitacuisses", "spoob", "mkaay", "Toilal")
+ __author_mail__ = ("sitacuisses@yahoo.de", "spoob@pyload.org", "mkaay@mkaay.de", "toilal.dev@gmail.com")
+
+ def setup(self):
+ self.html = None
+ self.wantReconnect = False
+ self.multiDL = False
+ self.req_opts = []
+
+ def process(self, pyfile):
+ self.pyfile = pyfile
+
+ pyfile.url = pyfile.url.replace("freakshare.net/", "freakshare.com/")
+
+ if self.account:
+ self.html = self.load(pyfile.url, cookies=False)
+ pyfile.name = self.get_file_name()
+ self.download(pyfile.url)
+
+ else:
+ self.prepare()
+ self.get_file_url()
+
+ self.download(self.pyfile.url, post=self.req_opts)
+
+ check = self.checkDownload({"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!",
+ "downloadserver": "No Downloadserver. Please try again later!"})
+
+ if check == "bad":
+ self.fail("Bad Try.")
+ elif check == "paralell":
+ self.setWait(300, True)
+ self.wait()
+ self.retry()
+ elif check == "empty":
+ self.fail("File not downloadable")
+ elif check == "wrong_captcha":
+ self.invalidCaptcha()
+ self.retry()
+ elif check == "downloadserver":
+ self.retry(5, 900, 'No Download server')
+
+ def prepare(self):
+ pyfile = self.pyfile
+
+ self.wantReconnect = False
+
+ self.download_html()
+
+ if not self.file_exists():
+ self.offline()
+
+ self.setWait(self.get_waiting_time())
+
+ pyfile.name = self.get_file_name()
+ pyfile.size = self.get_file_size()
+
+ self.wait()
+
+ return True
+
+ def download_html(self):
+ self.load("http://freakshare.com/index.php", {"language": "EN"}) # Set english language in server session
+ self.html = self.load(self.pyfile.url)
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if self.html is None:
+ self.download_html()
+ if not self.wantReconnect:
+ self.req_opts = self.get_download_options() # get the Post options for the Request
+ #file_url = self.pyfile.url
+ #return file_url
+ else:
+ self.offline()
+
+ def get_file_name(self):
+ if self.html is None:
+ self.download_html()
+ if not self.wantReconnect:
+ file_name = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">([^ ]+)", self.html)
+ if file_name is not None:
+ file_name = file_name.group(1)
+ else:
+ file_name = self.pyfile.url
+ return file_name
+ else:
+ return self.pyfile.url
+
+ def get_file_size(self):
+ size = 0
+ if self.html is None:
+ self.download_html()
+ if not self.wantReconnect:
+ file_size_check = re.search(
+ r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">[^ ]+ - ([^ ]+) (\w\w)yte", self.html)
+ if file_size_check is not None:
+ units = float(file_size_check.group(1).replace(",", ""))
+ pow = {'KB': 1, 'MB': 2, 'GB': 3}[file_size_check.group(2)]
+ size = int(units * 1024 ** pow)
+
+ return size
+
+ def get_waiting_time(self):
+ if self.html is None:
+ self.download_html()
+
+ if "Your Traffic is used up for today" in self.html:
+ self.wantReconnect = True
+ return 24 * 3600
+
+ timestring = re.search('\s*var\s(?:downloadWait|time)\s=\s(\d*)[.\d]*;', self.html)
+ if timestring:
+ return int(timestring.group(1)) + 1 # add 1 sec as tenths of seconds are cut off
+ else:
+ return 60
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html is None:
+ self.download_html()
+ if re.search(r"This file does not exist!", self.html) is not None:
+ return False
+ else:
+ return True
+
+ def get_download_options(self):
+ re_envelope = re.search(r".*?value=\"Free\sDownload\".*?\n*?(.*?<.*?>\n*)*?\n*\s*?</form>",
+ self.html).group(0) # get the whole request
+ to_sort = re.findall(r"<input\stype=\"hidden\"\svalue=\"(.*?)\"\sname=\"(.*?)\"\s\/>", re_envelope)
+ request_options = dict((n, v) for (v, n) in to_sort)
+
+ herewego = self.load(self.pyfile.url, None, request_options) # the actual download-Page
+
+ # comment this in, when it doesnt work
+ # with open("DUMP__FS_.HTML", "w") as fp:
+ # fp.write(herewego)
+
+ to_sort = re.findall(r"<input\stype=\".*?\"\svalue=\"(\S*?)\".*?name=\"(\S*?)\"\s.*?\/>", herewego)
+ request_options = dict((n, v) for (v, n) in to_sort)
+
+ # comment this in, when it doesnt work as well
+ #print "\n\n%s\n\n" % ";".join(["%s=%s" % x for x in to_sort])
+
+ challenge = re.search(r"http://api\.recaptcha\.net/challenge\?k=([0-9A-Za-z]+)", herewego)
+
+ if challenge:
+ re_captcha = ReCaptcha(self)
+ (request_options["recaptcha_challenge_field"],
+ request_options["recaptcha_response_field"]) = re_captcha.challenge(challenge.group(1))
+
+ return request_options
diff --git a/pyload/plugins/hoster/FreevideoCz.py b/pyload/plugins/hoster/FreevideoCz.py
new file mode 100644
index 000000000..3d8921c38
--- /dev/null
+++ b/pyload/plugins/hoster/FreevideoCz.py
@@ -0,0 +1,66 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.Hoster import Hoster
+from module.network.RequestFactory import getURL
+
+
+def getInfo(urls):
+ result = []
+
+ for url in urls:
+
+ html = getURL(url)
+ if re.search(FreevideoCz.FILE_OFFLINE_PATTERN, html):
+ # File offline
+ result.append((url, 0, 1, url))
+ else:
+ result.append((url, 0, 2, url))
+ yield result
+
+
+class FreevideoCz(Hoster):
+ __name__ = "FreevideoCz"
+ __type__ = "hoster"
+ __pattern__ = r"http://www.freevideo.cz/vase-videa/(.*)\.html"
+ __version__ = "0.2"
+ __description__ = """freevideo.cz"""
+ __author_name__ = ("zoidberg")
+
+ URL_PATTERN = r'clip: {\s*url: "([^"]+)"'
+ FILE_OFFLINE_PATTERN = r'<h2 class="red-corner-full">Str.nka nebyla nalezena</h2>'
+
+ def setup(self):
+ self.multiDL = self.resumeDownload = True
+
+ def process(self, pyfile):
+
+ self.html = self.load(pyfile.url, decode=True)
+
+ if re.search(self.FILE_OFFLINE_PATTERN, self.html):
+ self.offline()
+
+ found = re.search(self.URL_PATTERN, self.html)
+ if found is None:
+ self.fail("Parse error (URL)")
+ download_url = found.group(1)
+
+ pyfile.name = re.search(self.__pattern__, pyfile.url).group(1) + ".mp4"
+
+ self.download(download_url)
diff --git a/pyload/plugins/hoster/FshareVn.py b/pyload/plugins/hoster/FshareVn.py
new file mode 100644
index 000000000..fa0bcb253
--- /dev/null
+++ b/pyload/plugins/hoster/FshareVn.py
@@ -0,0 +1,117 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from time import strptime, mktime, gmtime
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
+from module.network.RequestFactory import getURL
+
+
+def getInfo(urls):
+ for url in urls:
+ html = getURL('http://www.fshare.vn/check_link.php', post={
+ "action": "check_link",
+ "arrlinks": url
+ }, decode=True)
+
+ file_info = parseFileInfo(FshareVn, url, html)
+
+ yield file_info
+
+
+def doubleDecode(m):
+ return m.group(1).decode('raw_unicode_escape')
+
+
+class FshareVn(SimpleHoster):
+ __name__ = "FshareVn"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?fshare.vn/file/.*"
+ __version__ = "0.16"
+ __description__ = """FshareVn Download Hoster"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FILE_INFO_PATTERN = r'<p>(?P<N>[^<]+)<\\/p>[\\trn\s]*<p>(?P<S>[0-9,.]+)\s*(?P<U>[kKMG])i?B<\\/p>'
+ FILE_OFFLINE_PATTERN = r'<div class=\\"f_left file_w\\"|<\\/p>\\t\\t\\t\\t\\r\\n\\t\\t<p><\\/p>\\t\\t\\r\\n\\t\\t<p>0 KB<\\/p>'
+ FILE_NAME_REPLACEMENTS = [("(.*)", doubleDecode)]
+ DOWNLOAD_URL_PATTERN = r'action="(http://download.*?)[#"]'
+ VIP_URL_PATTERN = r'<form action="([^>]+)" method="get" name="frm_download">'
+ WAIT_PATTERN = ur'Lượt tải xuống kế tiếp là:\s*(.*?)\s*<'
+
+ def process(self, pyfile):
+ self.html = self.load('http://www.fshare.vn/check_link.php', post={
+ "action": "check_link",
+ "arrlinks": pyfile.url
+ }, decode=True)
+ self.getFileInfo()
+
+ if self.premium:
+ self.handlePremium()
+ else:
+ self.handleFree()
+ self.checkDownloadedFile()
+
+ def handleFree(self):
+ self.html = self.load(self.pyfile.url, decode=True)
+
+ self.checkErrors()
+
+ action, inputs = self.parseHtmlForm('frm_download')
+ self.url = self.pyfile.url + action
+
+ if not inputs:
+ self.parseError('FORM')
+ elif 'link_file_pwd_dl' in inputs:
+ for password in self.getPassword().splitlines():
+ self.logInfo('Password protected link, trying "%s"' % password)
+ inputs['link_file_pwd_dl'] = password
+ self.html = self.load(self.url, post=inputs, decode=True)
+ if not 'name="link_file_pwd_dl"' in self.html:
+ break
+ else:
+ self.fail("No or incorrect password")
+ else:
+ self.html = self.load(self.url, post=inputs, decode=True)
+
+ self.checkErrors()
+
+ found = re.search(r'var count = (\d+)', self.html)
+ self.setWait(int(found.group(1)) if found else 30)
+
+ found = re.search(self.DOWNLOAD_URL_PATTERN, self.html)
+ if not found:
+ self.parseError('FREE DL URL')
+ self.url = found.group(1)
+ self.logDebug("FREE DL URL: %s" % self.url)
+
+ self.wait()
+ self.download(self.url)
+
+ def handlePremium(self):
+ self.download(self.pyfile.url)
+
+ def checkErrors(self):
+ if '/error.php?' in self.req.lastEffectiveURL or u"Liên kết bạn chọn khÃŽng tồn" in self.html:
+ self.offline()
+
+ found = re.search(self.WAIT_PATTERN, self.html)
+ if found:
+ self.logInfo("Wait until %s ICT" % found.group(1))
+ wait_until = mktime(strptime(found.group(1), "%d/%m/%Y %H:%M"))
+ self.setWait(wait_until - mktime(gmtime()) - 7 * 3600, True)
+ self.wait()
+ self.retry()
+ elif '<ul class="message-error">' in self.html:
+ self.logError("Unknown error occured or wait time not parsed")
+ self.retry(30, 120, "Unknown error")
+
+ def checkDownloadedFile(self):
+ # check download
+ check = self.checkDownload({
+ "not_found": "<head><title>404 Not Found</title></head>"
+ })
+
+ if check == "not_found":
+ self.fail("File not found on server")
diff --git a/pyload/plugins/hoster/Ftp.py b/pyload/plugins/hoster/Ftp.py
new file mode 100644
index 000000000..77992372a
--- /dev/null
+++ b/pyload/plugins/hoster/Ftp.py
@@ -0,0 +1,90 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: jeix
+ @author: mkaay
+"""
+from urlparse import urlparse
+from urllib import quote, unquote
+import pycurl
+import re
+
+from module.plugins.Hoster import Hoster
+
+
+class Ftp(Hoster):
+ __name__ = "Ftp"
+ __version__ = "0.41"
+ __pattern__ = r'(ftps?|sftp)://(.*?:.*?@)?.*?/.*' # ftp://user:password@ftp.server.org/path/to/file
+ __type__ = "hoster"
+ __description__ = """A Plugin that allows you to download from an from an ftp directory"""
+ __author_name__ = ("jeix", "mkaay", "zoidberg")
+ __author_mail__ = ("jeix@hasnomail.com", "mkaay@mkaay.de", "zoidberg@mujmail.cz")
+
+ def setup(self):
+ self.chunkLimit = -1
+ self.resumeDownload = True
+
+ def process(self, pyfile):
+ parsed_url = urlparse(pyfile.url)
+ netloc = parsed_url.netloc
+
+ pyfile.name = parsed_url.path.rpartition('/')[2]
+ try:
+ pyfile.name = unquote(str(pyfile.name)).decode('utf8')
+ except:
+ pass
+
+ if not "@" in netloc:
+ servers = [x['login'] for x in self.account.getAllAccounts()] if self.account else []
+
+ if netloc in servers:
+ self.logDebug("Logging on to %s" % netloc)
+ self.req.addAuth(self.account.accounts[netloc]["password"])
+ else:
+ for pwd in pyfile.package().password.splitlines():
+ if ":" in pwd:
+ self.req.addAuth(pwd.strip())
+ break
+
+ self.req.http.c.setopt(pycurl.NOBODY, 1)
+
+ try:
+ response = self.load(pyfile.url)
+ except pycurl.error, e:
+ self.fail("Error %d: %s" % e.args)
+
+ self.req.http.c.setopt(pycurl.NOBODY, 0)
+ self.logDebug(self.req.http.header)
+
+ found = re.search(r"Content-Length:\s*(\d+)", response)
+ if found:
+ pyfile.size = int(found.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(pyfile.url).path.rpartition('/')[2]))
+ pyfile.url += '/'
+ self.req.http.c.setopt(48, 1) # CURLOPT_DIRLISTONLY
+ response = self.load(pyfile.url, decode=False)
+ links = [pyfile.url + quote(x) for x in response.splitlines()]
+ self.logDebug("LINKS", links)
+ self.core.api.addPackage(pkgname, links, 1)
+ #self.core.files.addLinks(links, pyfile.package().id)
+ else:
+ self.fail("Unexpected server response")
diff --git a/pyload/plugins/hoster/GamefrontCom.py b/pyload/plugins/hoster/GamefrontCom.py
new file mode 100644
index 000000000..c82cfdf50
--- /dev/null
+++ b/pyload/plugins/hoster/GamefrontCom.py
@@ -0,0 +1,83 @@
+import re
+from module.plugins.Hoster import Hoster
+from module.network.RequestFactory import getURL
+from module.utils import parseFileSize
+
+
+class GamefrontCom(Hoster):
+ __name__ = "GamefrontCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)*?gamefront.com/files/[A-Za-z0-9]+"
+ __version__ = "0.04"
+ __description__ = """gamefront.com hoster plugin"""
+ __author_name__ = ("fwannmacher")
+ __author_mail__ = ("felipe@warhammerproject.com")
+
+ HOSTER_NAME = "gamefront.com"
+ PATTERN_FILENAME = r'<title>(.*?) | Game Front'
+ PATTERN_FILESIZE = r'<dt>File Size:</dt>[\n\s]*<dd>(.*?)</dd>'
+ PATTERN_OFFLINE = "This file doesn't exist, or has been removed."
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = True
+ self.chunkLimit = -1
+
+ def process(self, pyfile):
+ self.pyfile = pyfile
+ self.html = self.load(pyfile.url, decode=True)
+
+ if not self._checkOnline():
+ self.offline()
+
+ self.pyfile.name = self._getName()
+
+ self.link = self._getLink()
+
+ if not self.link.startswith('http://'):
+ self.link = "http://www.gamefront.com/" + self.link
+
+ self.download(self.link)
+
+ def _checkOnline(self):
+ if re.search(self.PATTERN_OFFLINE, self.html):
+ return False
+ else:
+ return True
+
+ def _getName(self):
+ name = re.search(self.PATTERN_FILENAME, self.html)
+ if name is None:
+ self.fail("%s: Plugin broken." % self.__name__)
+
+ return name.group(1)
+
+ def _getLink(self):
+ self.html2 = self.load("http://www.gamefront.com/" + re.search("(files/service/thankyou\\?id=[A-Za-z0-9]+)",
+ self.html).group(1))
+ self.link = re.search("<a href=\"(http://media[0-9]+\.gamefront.com/.*)\">click here</a>", self.html2)
+
+ return self.link.group(1).replace("&amp;", "&")
+
+
+def getInfo(urls):
+ result = []
+
+ for url in urls:
+ html = getURL(url)
+
+ if re.search(GamefrontCom.PATTERN_OFFLINE, html):
+ result.append((url, 0, 1, url))
+ else:
+ name = re.search(GamefrontCom.PATTERN_FILENAME, html)
+
+ if name is None:
+ result.append((url, 0, 1, url))
+ continue
+
+ name = name.group(1)
+ size = re.search(GamefrontCom.PATTERN_FILESIZE, html)
+ size = parseFileSize(size.group(1))
+
+ result.append((name, size, 3, url))
+
+ yield result
diff --git a/pyload/plugins/hoster/GigapetaCom.py b/pyload/plugins/hoster/GigapetaCom.py
new file mode 100644
index 000000000..de5d94513
--- /dev/null
+++ b/pyload/plugins/hoster/GigapetaCom.py
@@ -0,0 +1,76 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from random import randint
+from pycurl import FOLLOWLOCATION
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class GigapetaCom(SimpleHoster):
+ __name__ = "GigapetaCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?gigapeta\.com/dl/\w+"
+ __version__ = "0.01"
+ __description__ = """GigaPeta.com plugin - free only"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ SH_COOKIES = [("http://gigapeta.com", "lang", "us")]
+ FILE_NAME_PATTERN = r'<img src=".*" alt="file" />-->\s*(?P<N>.*?)\s*</td>'
+ FILE_SIZE_PATTERN = r'<th>\s*Size\s*</th>\s*<td>\s*(?P<S>.*?)\s*</td>'
+ FILE_OFFLINE_PATTERN = r'<div id="page_error">'
+
+ def handleFree(self):
+ captcha_key = str(randint(1, 100000000))
+ captcha_url = "http://gigapeta.com/img/captcha.gif?x=%s" % captcha_key
+
+ self.req.http.c.setopt(FOLLOWLOCATION, 0)
+
+ for i in range(5):
+ self.checkErrors()
+
+ captcha = self.decryptCaptcha(captcha_url)
+ self.html = self.load(self.pyfile.url, post={
+ "captcha_key": captcha_key,
+ "captcha": captcha,
+ "download": "Download"})
+
+ found = re.search(r"Location\s*:\s*(.*)", self.req.http.header, re.I)
+ if found:
+ download_url = found.group(1)
+ break
+ elif "Entered figures don&#96;t coincide with the picture" in self.html:
+ self.invalidCaptcha()
+ else:
+ self.fail("No valid captcha code entered")
+
+ self.req.http.c.setopt(FOLLOWLOCATION, 1)
+ self.logDebug("Download URL: %s" % download_url)
+ self.download(download_url)
+
+ def checkErrors(self):
+ if "All threads for IP" in self.html:
+ self.logDebug("Your IP is already downloading a file - wait and retry")
+ self.setWait(300, True)
+ self.wait()
+ self.retry()
+
+
+getInfo = create_getInfo(GigapetaCom)
diff --git a/pyload/plugins/hoster/GooIm.py b/pyload/plugins/hoster/GooIm.py
new file mode 100644
index 000000000..f96e6e6cc
--- /dev/null
+++ b/pyload/plugins/hoster/GooIm.py
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+import re
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class GooIm(SimpleHoster):
+ __name__ = "GooIm"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?goo\.im/.+"
+ __version__ = "0.02"
+ __description__ = """Goo.im hoster plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ FILE_NAME_PATTERN = r'<h3>Filename: (?P<N>.+)</h3>'
+ FILE_OFFLINE_PATTERN = r'The file you requested was not found'
+
+ def setup(self):
+ self.chunkLimit = -1
+ self.multiDL = self.resumeDownload = True
+
+ def handleFree(self):
+ self.html = self.load(self.pyfile.url)
+ m = re.search(r'MD5sum: (?P<MD5>[0-9a-z]{32})</h3>', self.html)
+ if m:
+ self.check_data = {"md5": m.group('MD5')}
+ self.setWait(10)
+ self.wait()
+
+ header = self.load(self.pyfile.url, just_header=True)
+ if header['location']:
+ self.logDebug("Direct link: " + header['location'])
+ self.download(header['location'])
+ else:
+ self.parseError("Unable to detect direct download link")
+
+
+getInfo = create_getInfo(GooIm)
diff --git a/pyload/plugins/hoster/HellshareCz.py b/pyload/plugins/hoster/HellshareCz.py
new file mode 100644
index 000000000..5fdcca7ae
--- /dev/null
+++ b/pyload/plugins/hoster/HellshareCz.py
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class HellshareCz(SimpleHoster):
+ __name__ = "HellshareCz"
+ __type__ = "hoster"
+ __pattern__ = r"(http://(?:.*\.)*hellshare\.(?:cz|com|sk|hu|pl)/[^?]*/\d+).*"
+ __version__ = "0.82"
+ __description__ = """Hellshare.cz - premium only"""
+ __author_name__ = ("zoidberg")
+
+ FILE_NAME_PATTERN = r'<h1 id="filename"[^>]*>(?P<N>[^<]+)</h1>'
+ FILE_SIZE_PATTERN = r'<strong id="FileSize_master">(?P<S>[0-9.]*)&nbsp;(?P<U>[kKMG])i?B</strong>'
+ FILE_OFFLINE_PATTERN = r'<h1>File not found.</h1>'
+ SHOW_WINDOW_PATTERN = r'<a href="([^?]+/(\d+)/\?do=(fileDownloadButton|relatedFileDownloadButton-\2)-showDownloadWindow)"'
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = True if self.account else False
+ self.chunkLimit = 1
+
+ def process(self, pyfile):
+ if not self.account:
+ self.fail("User not logged in")
+ pyfile.url = re.search(self.__pattern__, pyfile.url).group(1)
+ self.html = self.load(pyfile.url, decode=True)
+ self.getFileInfo()
+ if not self.checkTrafficLeft():
+ self.fail("Not enough traffic left for user %s." % self.user)
+
+ found = re.search(self.SHOW_WINDOW_PATTERN, self.html)
+ if not found:
+ self.parseError('SHOW WINDOW')
+ self.url = "http://www.hellshare.com" + found.group(1)
+ self.logDebug("DOWNLOAD URL: " + self.url)
+
+ self.download(self.url)
+
+
+getInfo = create_getInfo(HellshareCz)
diff --git a/pyload/plugins/hoster/HellspyCz.py b/pyload/plugins/hoster/HellspyCz.py
new file mode 100644
index 000000000..2e0746ff4
--- /dev/null
+++ b/pyload/plugins/hoster/HellspyCz.py
@@ -0,0 +1,73 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class HellspyCz(SimpleHoster):
+ __name__ = "HellspyCz"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)*(?:hellspy\.(?:cz|com|sk|hu|pl)|sciagaj.pl)(/\S+/\d+)/?.*"
+ __version__ = "0.27"
+ __description__ = """HellSpy.cz"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FILE_SIZE_PATTERN = r'<span class="filesize right">(?P<S>[0-9.]+)\s*<span>(?P<U>[kKMG])i?B'
+ FILE_NAME_PATTERN = r'<h1 title="(?P<N>.*?)"'
+ FILE_OFFLINE_PATTERN = r'<h2>(404 - Page|File) not found</h2>'
+ FILE_URL_REPLACEMENTS = [(__pattern__, r"http://www.hellspy.com\1")]
+
+ CREDIT_LEFT_PATTERN = r'<strong>Credits: </strong>\s*(\d+)'
+ DOWNLOAD_AGAIN_PATTERN = r'<a id="button-download-start"[^>]*title="You can download the file without deducting your credit.">'
+ DOWNLOAD_URL_PATTERN = r"launchFullDownload\('([^']+)'"
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = True
+ self.chunkLimit = 1
+
+ def handleFree(self):
+ self.fail("Only premium users can download from HellSpy.cz")
+
+ def handlePremium(self):
+ # set PHPSESSID cookie
+ cj = self.account.getAccountCookies(self.user)
+ cj.setCookie(".hellspy.com", "PHPSESSID", self.account.phpsessid)
+ self.logDebug("PHPSESSID: " + cj.getCookie("PHPSESSID"))
+
+ info = self.account.getAccountInfo(self.user, True)
+ self.logInfo("User %s has %i credits left" % (self.user, info["trafficleft"] / 1024))
+
+ if self.pyfile.size / 1024 > info["trafficleft"]:
+ self.logWarning("Not enough credit left to download file")
+
+ # get premium download URL and download
+ self.html = self.load(self.pyfile.url + "?download=1")
+ found = re.search(self.DOWNLOAD_URL_PATTERN, self.html)
+ if not found:
+ self.parseError("Download URL")
+ url = found.group(1)
+ self.logDebug("Download URL: " + url)
+ self.download(url)
+
+ info = self.account.getAccountInfo(self.user, True)
+ self.logInfo("User %s has %i credits left" % (self.user, info["trafficleft"] / 1024))
+
+
+getInfo = create_getInfo(HellspyCz)
diff --git a/pyload/plugins/hoster/HotfileCom.py b/pyload/plugins/hoster/HotfileCom.py
new file mode 100644
index 000000000..255acad33
--- /dev/null
+++ b/pyload/plugins/hoster/HotfileCom.py
@@ -0,0 +1,140 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Hoster import Hoster
+from module.plugins.internal.CaptchaService import ReCaptcha
+
+from module.network.RequestFactory import getURL
+from module.utils import chunks
+
+
+
+def getInfo(urls):
+ api_url_base = "http://api.hotfile.com/"
+
+ for chunk in chunks(urls, 90):
+ api_param_file = {"action": "checklinks", "links": ",".join(chunk),
+ "fields": "id,status,name,size"} #api only supports old style links
+ src = getURL(api_url_base, post=api_param_file, decode=True)
+ result = []
+ for i, res in enumerate(src.split("\n")):
+ if not res:
+ continue
+ fields = res.split(",")
+
+ if fields[1] in ("1", "2"):
+ status = 2
+ else:
+ status = 1
+
+ result.append((fields[2], int(fields[3]), status, chunk[i]))
+ yield result
+
+
+class HotfileCom(Hoster):
+ __name__ = "HotfileCom"
+ __type__ = "hoster"
+ __pattern__ = r"https?://(www.)?hotfile\.com/dl/\d+/[0-9a-zA-Z]+/"
+ __version__ = "0.36"
+ __description__ = """Hotfile.com Download Hoster"""
+ __author_name__ = ("sitacuisses", "spoob", "mkaay", "JoKoT3")
+ __author_mail__ = ("sitacuisses@yhoo.de", "spoob@pyload.org", "mkaay@mkaay.de", "jokot3@gmail.com")
+
+ FILE_OFFLINE_PATTERN = r'File is removed'
+
+ def setup(self):
+ self.html = [None, None]
+ self.wantReconnect = False
+ self.htmlwithlink = None
+ self.url = None
+
+ if self.premium:
+ self.multiDL = self.resumeDownload = True
+ self.chunkLimit = -1
+ else:
+ self.multiDL = False
+ self.chunkLimit = 1
+
+ def apiCall(self, method, post, login=False):
+ if not self.account and login:
+ return
+ elif self.account and login:
+ return self.account.apiCall(method, post, self.user)
+ post.update({"action": method})
+ return self.load("http://api.hotfile.com/", post=post, decode=True)
+
+ def process(self, pyfile):
+ self.wantReconnect = False
+
+ args = {"links": self.pyfile.url, "fields": "id,status,name,size,sha1"}
+ resp = self.apiCall("checklinks", args)
+ self.api_data = {}
+ for k, v in zip(args["fields"].split(","), resp.strip().split(",")):
+ self.api_data[k] = v
+
+ if self.api_data["status"] == "0":
+ self.offline()
+
+ pyfile.name = self.api_data["name"]
+
+ if not self.premium:
+ self.downloadHTML()
+
+ if self.FILE_OFFLINE_PATTERN in self.html[0]:
+ self.offline()
+
+ self.setWait(self.getWaitTime())
+ self.wait()
+
+ self.freeDownload()
+ else:
+ dl = self.account.apiCall("getdirectdownloadlink", {"link": self.pyfile.url}, self.user)
+ #dl = unquote(dl).strip() <- Made problems
+ dl = dl.strip()
+ self.download(dl)
+
+ def downloadHTML(self):
+ self.html[0] = self.load(self.pyfile.url, get={"lang": "en"})
+
+ def freeDownload(self):
+
+ form_content = re.search(r"<form style=.*(\n<.*>\s*)*?[\n\t]?<tr>", self.html[0])
+ if form_content is None:
+ print self.html[0]
+ self.fail("Form not found in HTML. Can not proceed.")
+
+ form_content = form_content.group(0)
+ form_posts = dict(re.findall(r"<input\stype=hidden\sname=(\S*)\svalue=(\S*)>", form_content))
+
+ self.html[1] = self.load(self.pyfile.url, post=form_posts)
+
+ challenge = re.search(r"http://api\.recaptcha\.net/challenge\?k=([0-9A-Za-z]+)", self.html[1])
+
+ if challenge:
+ re_captcha = ReCaptcha(self)
+ challenge, result = re_captcha.challenge(challenge.group(1))
+
+ url = re.search(r'<form action="(/dl/[^"]+)', self.html[1])
+
+ self.html[1] = self.load("http://hotfile.com" + url.group(1), post={"action": "checkcaptcha",
+ "recaptcha_challenge_field": challenge,
+ "recaptcha_response_field": result})
+
+ if "Wrong Code. Please try again." in self.html[1]:
+ self.freeDownload()
+ return
+
+ file_url = re.search(r'a href="(http://hotfile\.com/get/\S*)"', self.html[1]).group(1)
+ self.download(file_url)
+
+ def getWaitTime(self):
+ free_limit_pattern = re.compile(r"timerend=d\.getTime\(\)\+(\d+);")
+ matches = free_limit_pattern.findall(self.html[0])
+ if matches:
+ wait_time = (sum([int(match) for match in matches]) / 1000) or 60
+ if wait_time > 300:
+ self.wantReconnect = True
+ return wait_time + 1
+ else:
+ self.fail("Don't know how long to wait. Cannot proceed.")
diff --git a/pyload/plugins/hoster/HundredEightyUploadCom.py b/pyload/plugins/hoster/HundredEightyUploadCom.py
new file mode 100644
index 000000000..3cf32d338
--- /dev/null
+++ b/pyload/plugins/hoster/HundredEightyUploadCom.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+# Test links (random.bin):
+# http://180upload.com/js9qdm6kjnrs
+
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
+
+class HundredEightyUploadCom(XFileSharingPro):
+ __name__ = "HundredEightyUploadCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)?180upload\.com/(\w+).*"
+ __version__ = "0.01"
+ __description__ = """180upload.com hoster plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ FILE_NAME_PATTERN = r'Filename:</b></td><td nowrap>(?P<N>.+)</td></tr>-->'
+ FILE_SIZE_PATTERN = r'Size:</b></td><td>(?P<S>[\d.]+) (?P<U>[A-Z]+)\s*<small>'
+
+ HOSTER_NAME = "180upload.com"
+
+
+getInfo = create_getInfo(HundredEightyUploadCom)
diff --git a/pyload/plugins/hoster/IFileWs.py b/pyload/plugins/hoster/IFileWs.py
new file mode 100644
index 000000000..160fe641c
--- /dev/null
+++ b/pyload/plugins/hoster/IFileWs.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
+
+class IFileWs(XFileSharingPro):
+ __name__ = "IFileWs"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?ifile\.ws/\w+(/.+)?"
+ __version__ = "0.01"
+ __description__ = """Ifile.ws hoster plugin"""
+ __author_name__ = ("z00nx")
+ __author_mail__ = ("z00nx0@gmail.com")
+
+ FILE_INFO_PATTERN = '<h1\s+style="display:inline;">(?P<N>[^<]+)</h1>\s+\[(?P<S>[^]]+)\]'
+ FILE_OFFLINE_PATTERN = 'File Not Found|The file was removed by administrator'
+ HOSTER_NAME = "ifile.ws"
+ LONG_WAIT_PATTERN = "(?P<M>\d(?=\s+minutes)).*(?P<S>\d+(?=\s+seconds))"
+
+
+getInfo = create_getInfo(IFileWs)
diff --git a/pyload/plugins/hoster/IcyFilesCom.py b/pyload/plugins/hoster/IcyFilesCom.py
new file mode 100644
index 000000000..53c934675
--- /dev/null
+++ b/pyload/plugins/hoster/IcyFilesCom.py
@@ -0,0 +1,112 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: godofdream
+"""
+
+import re
+from module.plugins.Hoster import Hoster
+from module.network.RequestFactory import getURL
+
+
+def getInfo(urls):
+ result = []
+ for url in urls:
+ html = getURL(url, decode=True)
+ if re.search(IcyFilesCom.FILE_OFFLINE_PATTERN, html):
+ # File offline
+ result.append((url, 0, 1, url))
+ else:
+ # Get file info
+ name = re.search(IcyFilesCom.FILE_NAME_PATTERN, html)
+ size = re.search(IcyFilesCom.SIZE_PATTERN, html)
+ if name is not None:
+ name = name.group(1)
+ size = (int(size.group(1)) * 1000000)
+ result.append((name, size, 2, url))
+ yield result
+
+
+class IcyFilesCom(Hoster):
+ __name__ = "IcyFilesCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?icyfiles\.com/(.*)"
+ __version__ = "0.05"
+ __description__ = """IcyFiles.com plugin - free only"""
+ __author_name__ = ("godofdream")
+ __author_mail__ = ("soilfiction@gmail.com")
+
+ FILE_NAME_PATTERN = r'<div id="file">(.*?)</div>'
+ SIZE_PATTERN = r'<li>(\d+) <span>Size/mb'
+ FILE_OFFLINE_PATTERN = r'The requested File cant be found'
+ WAIT_LONGER_PATTERN = r'All download tickets are in use\. please try it again in a few seconds'
+ WAIT_PATTERN = r'<div class="counter">(\d+)</div>'
+ TOOMUCH_PATTERN = r'Sorry dude, you have downloaded too much\. Please wait (\d+) seconds'
+
+ def setup(self):
+ self.multiDL = False
+
+ def process(self, pyfile):
+ self.html = self.load(pyfile.url, decode=True)
+ # check if offline
+ if re.search(self.FILE_OFFLINE_PATTERN, self.html):
+ self.offline()
+ # All Downloadtickets in use
+ timmy = re.search(self.WAIT_LONGER_PATTERN, self.html)
+ if timmy:
+ self.logDebug("waitforfreeslot")
+ self.waitForFreeSlot()
+ # Wait the waittime
+ timmy = re.search(self.WAIT_PATTERN, self.html)
+ if timmy:
+ self.logDebug("waiting", timmy.group(1))
+ self.setWait(int(timmy.group(1)) + 2, False)
+ self.wait()
+ # Downloaded to much
+ timmy = re.search(self.TOOMUCH_PATTERN, self.html)
+ if timmy:
+ self.logDebug("too much", timmy.group(1))
+ self.setWait(int(timmy.group(1)), True)
+ self.wait()
+ # Find Name
+ found = re.search(self.FILE_NAME_PATTERN, self.html)
+ if found is None:
+ self.fail("Parse error (NAME)")
+ pyfile.name = found.group(1)
+ # Get the URL
+ url = pyfile.url
+ found = re.search(self.__pattern__, url)
+ if found is None:
+ self.fail("Parse error (URL)")
+ download_url = "http://icyfiles.com/download.php?key=" + found.group(1)
+ self.download(download_url)
+ # check download
+ check = self.checkDownload({
+ "notfound": re.compile(r"^<head><title>404 Not Found</title>$"),
+ "skippedcountdown": re.compile(r"^Dont skip the countdown$"),
+ "waitforfreeslots": re.compile(self.WAIT_LONGER_PATTERN),
+ "downloadedtoomuch": re.compile(self.TOOMUCH_PATTERN)
+ })
+ if check == "skippedcountdown":
+ self.fail("Countdown error")
+ elif check == "notfound":
+ self.fail("404 Not found")
+ elif check == "waitforfreeslots":
+ self.waitForFreeSlot()
+ elif check == "downloadedtoomuch":
+ self.retry()
+
+ def waitForFreeSlot(self):
+ self.retry(60, 60, "Wait for free slot")
diff --git a/pyload/plugins/hoster/IfileIt.py b/pyload/plugins/hoster/IfileIt.py
new file mode 100644
index 000000000..0e3bdd227
--- /dev/null
+++ b/pyload/plugins/hoster/IfileIt.py
@@ -0,0 +1,75 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.common.json_layer import json_loads
+from module.plugins.internal.CaptchaService import ReCaptcha
+
+
+class IfileIt(SimpleHoster):
+ __name__ = "IfileIt"
+ __type__ = "hoster"
+ __pattern__ = r"^unmatchable$"
+ __version__ = "0.27"
+ __description__ = """Ifile.it"""
+ __author_name__ = ("zoidberg")
+
+ #EVAL_PATTERN = r'(eval\(function\(p,a,c,k,e,d\).*)'
+ #DEC_PATTERN = r"requestBtn_clickEvent[^}]*url:\s*([^,]+)"
+ DOWNLOAD_LINK_PATTERN = r'</span> If it doesn\'t, <a target="_blank" href="([^"]+)">'
+ RECAPTCHA_KEY_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';"
+ FILE_INFO_PATTERN = r'<span style="cursor: default;[^>]*>\s*(?P<N>.*?)\s*&nbsp;\s*<strong>\s*(?P<S>[0-9.]+)\s*(?P<U>[kKMG])i?B\s*</strong>\s*</span>'
+ FILE_OFFLINE_PATTERN = r'<span style="cursor: default;[^>]*>\s*&nbsp;\s*<strong>\s*</strong>\s*</span>'
+ TEMP_OFFLINE_PATTERN = r'<span class="msg_red">Downloading of this file is temporarily disabled</span>'
+
+ def handleFree(self):
+ ukey = re.search(self.__pattern__, self.pyfile.url).group(1)
+ json_url = 'http://ifile.it/new_download-request.json'
+ post_data = {"ukey": ukey, "ab": "0"}
+
+ json_response = json_loads(self.load(json_url, post=post_data))
+ self.logDebug(json_response)
+ if json_response['status'] == 3:
+ self.offline()
+
+ if json_response["captcha"]:
+ captcha_key = re.search(self.RECAPTCHA_KEY_PATTERN, self.html).group(1)
+ recaptcha = ReCaptcha(self)
+ post_data["ctype"] = "recaptcha"
+
+ for i in range(5):
+ post_data["recaptcha_challenge"], post_data["recaptcha_response"] = recaptcha.challenge(captcha_key)
+ json_response = json_loads(self.load(json_url, post=post_data))
+ self.logDebug(json_response)
+
+ if json_response["retry"]:
+ self.invalidCaptcha()
+ else:
+ self.correctCaptcha()
+ break
+ else:
+ self.fail("Incorrect captcha")
+
+ if not "ticket_url" in json_response:
+ self.parseError("Download URL")
+
+ self.download(json_response["ticket_url"])
+
+
+getInfo = create_getInfo(IfileIt)
diff --git a/pyload/plugins/hoster/IfolderRu.py b/pyload/plugins/hoster/IfolderRu.py
new file mode 100644
index 000000000..14e568f8f
--- /dev/null
+++ b/pyload/plugins/hoster/IfolderRu.py
@@ -0,0 +1,88 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class IfolderRu(SimpleHoster):
+ __name__ = "IfolderRu"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:[^.]*\.)?(?:ifolder\.ru|rusfolder\.(?:com|net|ru))/(?:files/)?(?P<ID>\d+).*"
+ __version__ = "0.38"
+ __description__ = """rusfolder.com / ifolder.ru"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FILE_SIZE_REPLACEMENTS = [(u'Кб', 'KB'), (u'Мб', 'MB'), (u'Гб', 'GB')]
+ FILE_NAME_PATTERN = ur'(?:<div><span>)?НазваМОе:(?:</span>)? <b>(?P<N>[^<]+)</b><(?:/div|br)>'
+ FILE_SIZE_PATTERN = ur'(?:<div><span>)?РазЌер:(?:</span>)? <b>(?P<S>[^<]+)</b><(?:/div|br)>'
+ FILE_OFFLINE_PATTERN = ur'<p>Ѐайл МПЌер <b>[^<]*</b> (Ме МайЎеМ|уЎалеМ) !!!</p>'
+
+ SESSION_ID_PATTERN = r'<a href=(http://ints.(?:rusfolder.com|ifolder.ru)/ints/sponsor/\?bi=\d*&session=([^&]+)&u=[^>]+)>'
+ INTS_SESSION_PATTERN = r'\(\'ints_session\'\);\s*if\(tag\)\{tag.value = "([^"]+)";\}'
+ HIDDEN_INPUT_PATTERN = r"var v = .*?name='([^']+)' value='1'"
+ DOWNLOAD_LINK_PATTERN = r'<a id="download_file_href" href="([^"]+)"'
+ WRONG_CAPTCHA_PATTERN = ur'<font color=Red>МеверМый кПЎ,<br>ввеЎОте еще раз</font><br>'
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = True if self.account else False
+ self.chunkLimit = 1
+
+ def process(self, pyfile):
+ file_id = re.search(self.__pattern__, pyfile.url).group('ID')
+ self.html = self.load("http://rusfolder.com/%s" % file_id, cookies=True, decode=True)
+ self.getFileInfo()
+
+ url = re.search(r"location\.href = '(http://ints\..*?=)'", self.html).group(1)
+ self.html = self.load(url, cookies=True, decode=True)
+
+ url, session_id = re.search(self.SESSION_ID_PATTERN, self.html).groups()
+ self.html = self.load(url, cookies=True, decode=True)
+
+ url = "http://ints.rusfolder.com/ints/frame/?session=%s" % session_id
+ self.html = self.load(url, cookies=True)
+
+ self.setWait(31, False)
+ self.wait()
+
+ captcha_url = "http://ints.rusfolder.com/random/images/?session=%s" % session_id
+ for i in range(5):
+ self.html = self.load(url, cookies=True)
+ action, inputs = self.parseHtmlForm('ID="Form1"')
+ inputs['ints_session'] = re.search(self.INTS_SESSION_PATTERN, self.html).group(1)
+ inputs[re.search(self.HIDDEN_INPUT_PATTERN, self.html).group(1)] = '1'
+ inputs['confirmed_number'] = self.decryptCaptcha(captcha_url, cookies=True)
+ inputs['action'] = '1'
+ self.logDebug(inputs)
+
+ self.html = self.load(url, decode=True, cookies=True, post=inputs)
+ if self.WRONG_CAPTCHA_PATTERN in self.html:
+ self.invalidCaptcha()
+ else:
+ break
+ else:
+ self.fail("Invalid captcha")
+
+ download_url = re.search(self.DOWNLOAD_LINK_PATTERN, self.html).group(1)
+ self.correctCaptcha()
+ self.logDebug("Download URL: %s" % download_url)
+ self.download(download_url)
+
+
+getInfo = create_getInfo(IfolderRu)
diff --git a/pyload/plugins/hoster/JumbofilesCom.py b/pyload/plugins/hoster/JumbofilesCom.py
new file mode 100644
index 000000000..1b8a2d73b
--- /dev/null
+++ b/pyload/plugins/hoster/JumbofilesCom.py
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class JumbofilesCom(SimpleHoster):
+ __name__ = "JumbofilesCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)*jumbofiles.com/(\w{12}).*"
+ __version__ = "0.02"
+ __description__ = """JumboFiles.com hoster plugin"""
+ __author_name__ = ("godofdream")
+ __author_mail__ = ("soilfiction@gmail.com")
+
+ FILE_INFO_PATTERN = '<TR><TD>(?P<N>[^<]+?)\s*<small>\((?P<S>[\d.]+)\s*(?P<U>[KMG][bB])\)</small></TD></TR>'
+ FILE_OFFLINE_PATTERN = 'Not Found or Deleted / Disabled due to inactivity or DMCA'
+ DIRECT_LINK_PATTERN = '<meta http-equiv="refresh" content="10;url=(.+)">'
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = True
+
+ def handleFree(self):
+ ukey = re.search(self.__pattern__, self.pyfile.url).group(1)
+ post_data = {"id": ukey, "op": "download3", "rand": ""}
+ html = self.load(self.pyfile.url, post=post_data, decode=True)
+ url = re.search(self.DIRECT_LINK_PATTERN, html).group(1)
+ self.logDebug("Download " + url)
+ self.download(url)
+
+
+getInfo = create_getInfo(JumbofilesCom)
diff --git a/pyload/plugins/hoster/Keep2shareCC.py b/pyload/plugins/hoster/Keep2shareCC.py
new file mode 100644
index 000000000..d2a13e35b
--- /dev/null
+++ b/pyload/plugins/hoster/Keep2shareCC.py
@@ -0,0 +1,94 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+# Test links (random.bin):
+# http://k2s.cc/file/527111edfb9ba/random.bin
+
+import re
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.plugins.internal.CaptchaService import ReCaptcha
+
+
+class Keep2shareCC(SimpleHoster):
+ __name__ = "Keep2shareCC"
+ __type__ = "hoster"
+ __pattern__ = r"https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P<ID>[a-zA-Z0-9]{13})"
+ __version__ = "0.05"
+ __description__ = """Keep2share.cc hoster plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ FILE_NAME_PATTERN = r'File: <span>(?P<N>.+)</span>'
+ FILE_SIZE_PATTERN = r'Size: (?P<S>[^<]+)</div>'
+ FILE_OFFLINE_PATTERN = r'File not found or deleted|Sorry, this file is blocked or deleted'
+
+ DIRECT_LINK_PATTERN = r'To download this file with slow speed, use <a href="([^"]+)">this link</a>'
+ WAIT_PATTERN = r'Please wait ([\d:]+) to download this file'
+
+ RECAPTCHA_KEY = '6LcYcN0SAAAAABtMlxKj7X0hRxOY8_2U86kI1vbb'
+
+ FILE_URL_REPLACEMENTS = [(__pattern__, r"http://www.keep2share.cc/file/\g<ID>")]
+
+ def handleFree(self):
+ fid = re.search(r'<input type="hidden" name="slow_id" value="([^"]+)">', self.html).group(1)
+ self.html = self.load(self.pyfile.url, post={'yt0': '', 'slow_id': fid})
+
+ m = re.search(self.WAIT_PATTERN, self.html)
+ if m:
+ wait_string = m.group(1)
+ wait_time = int(wait_string[0:2]) * 60 * 60 + int(wait_string[3:5]) * 60 + int(wait_string[6:8])
+ self.setWait(wait_time, True)
+ self.wait()
+ self.process(self.pyfile)
+
+ recaptcha = ReCaptcha(self)
+ for i in xrange(5):
+ challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
+ post_data = {'recaptcha_challenge_field': challenge,
+ 'recaptcha_response_field': response,
+ 'CaptchaForm%5Bcode%5D': '',
+ 'free': 1,
+ 'freeDownloadRequest': 1,
+ 'uniqueId': fid,
+ 'yt0': ''}
+
+ self.html = self.load(self.pyfile.url, post=post_data)
+
+ if 'recaptcha' not in self.html:
+ self.correctCaptcha()
+ self.setWait(30)
+ self.wait()
+ break
+ else:
+ self.logInfo('Wrong captcha')
+ self.invalidCaptcha()
+ else:
+ self.fail("All captcha attempts failed")
+
+ self.html = self.load(self.pyfile.url, post={'uniqueId': fid, 'free': 1})
+
+ dl = 'http://keep2share.cc'
+ m = re.search(self.DIRECT_LINK_PATTERN, self.html)
+ if not m:
+ self.parseError("Unable to detect direct link")
+ dl += m.group(1)
+ self.logDebug('Direct Link: ' + dl)
+ self.download(dl, disposition=True)
+
+
+getInfo = create_getInfo(Keep2shareCC)
diff --git a/pyload/plugins/hoster/LetitbitNet.py b/pyload/plugins/hoster/LetitbitNet.py
new file mode 100644
index 000000000..45f029c7b
--- /dev/null
+++ b/pyload/plugins/hoster/LetitbitNet.py
@@ -0,0 +1,171 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+# API Documentation:
+# http://api.letitbit.net/reg/static/api.pdf
+
+# Test links (random.bin):
+# http://letitbit.net/download/07874.0b5709a7d3beee2408bb1f2eefce/random.bin.html
+
+import re
+import urllib
+
+from module.plugins.internal.SimpleHoster import SimpleHoster
+from module.common.json_layer import json_loads, json_dumps
+from module.plugins.internal.CaptchaService import ReCaptcha
+
+
+def api_download_info(url):
+ json_data = ['yw7XQy2v9', ["download/info", {"link": url}]]
+ post_data = urllib.urlencode({'r': json_dumps(json_data)})
+ api_rep = urllib.urlopen('http://api.letitbit.net/json', data=post_data).read()
+ return json_loads(api_rep)
+
+
+def getInfo(urls):
+ for url in urls:
+ api_rep = api_download_info(url)
+ if api_rep['status'] == 'OK':
+ info = api_rep['data'][0]
+ yield (info['name'], info['size'], 2, url)
+ else:
+ yield (url, 0, 1, url)
+
+
+class LetitbitNet(SimpleHoster):
+ __name__ = "LetitbitNet"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)*(letitbit|shareflare).net/download/.*"
+ __version__ = "0.23"
+ __description__ = """letitbit.net"""
+ __author_name__ = ("zoidberg", "z00nx")
+ __author_mail__ = ("zoidberg@mujmail.cz", "z00nx0@gmail.com")
+
+ CHECK_URL_PATTERN = r"ajax_check_url\s*=\s*'((http://[^/]+)[^']+)';"
+ SECONDS_PATTERN = r"seconds\s*=\s*(\d+);"
+ CAPTCHA_CONTROL_FIELD = r"recaptcha_control_field\s=\s'(?P<value>[^']+)'"
+
+ DOMAIN = "http://letitbit.net"
+ FILE_URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "letitbit.net")]
+ RECAPTCHA_KEY = "6Lc9zdMSAAAAAF-7s2wuQ-036pLRbM0p8dDaQdAM"
+
+ def setup(self):
+ self.resumeDownload = True
+ #TODO confirm that resume works
+
+ def getFileInfo(self):
+ api_rep = api_download_info(self.pyfile.url)
+ if api_rep['status'] == 'OK':
+ self.api_data = api_rep['data'][0]
+ self.pyfile.name = self.api_data['name']
+ self.pyfile.size = self.api_data['size']
+ else:
+ self.offline()
+
+ def handleFree(self):
+ action, inputs = self.parseHtmlForm('id="ifree_form"')
+ if not action:
+ self.parseError("page 1 / ifree_form")
+ self.pyfile.size = float(inputs['sssize'])
+ self.logDebug(action, inputs)
+ inputs['desc'] = ""
+
+ self.html = self.load(self.DOMAIN + action, post=inputs, cookies=True)
+
+ # action, inputs = self.parseHtmlForm('id="d3_form"')
+ # if not action: self.parseError("page 2 / d3_form")
+ # #self.logDebug(action, inputs)
+ #
+ # self.html = self.load(action, post = inputs, cookies = True)
+ #
+ # try:
+ # ajax_check_url, captcha_url = re.search(self.CHECK_URL_PATTERN, self.html).groups()
+ # found = re.search(self.SECONDS_PATTERN, self.html)
+ # seconds = int(found.group(1)) if found else 60
+ # self.setWait(seconds+1)
+ # self.wait()
+ # except Exception, e:
+ # self.logError(e)
+ # self.parseError("page 3 / js")
+
+ found = re.search(self.SECONDS_PATTERN, self.html)
+ seconds = int(found.group(1)) if found else 60
+ self.logDebug("Seconds found", seconds)
+ found = re.search(self.CAPTCHA_CONTROL_FIELD, self.html)
+ recaptcha_control_field = found.group(1)
+ self.logDebug("ReCaptcha control field found", recaptcha_control_field)
+ self.setWait(seconds + 1)
+ self.wait()
+
+ response = self.load("%s/ajax/download3.php" % self.DOMAIN, post=" ", cookies=True)
+ if response != '1':
+ self.parseError('Unknown response - ajax_check_url')
+ self.logDebug(response)
+
+ recaptcha = ReCaptcha(self)
+ challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
+ post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response,
+ "recaptcha_control_field": recaptcha_control_field}
+ self.logDebug("Post data to send", post_data)
+ response = self.load('%s/ajax/check_recaptcha.php' % self.DOMAIN, post=post_data, cookies=True)
+ self.logDebug(response)
+ if not response:
+ self.invalidCaptcha()
+ if response == "error_free_download_blocked":
+ self.logInfo("Daily limit reached, waiting 24 hours")
+ self.setWait(24 * 60 * 60)
+ self.wait()
+ if response == "error_wrong_captcha":
+ self.logInfo("Wrong Captcha")
+ self.invalidCaptcha()
+ self.retry()
+ elif response.startswith('['):
+ urls = json_loads(response)
+ elif response.startswith('http://'):
+ urls = [response]
+ else:
+ self.parseError("Unknown response - captcha check")
+
+ self.correctCaptcha()
+
+ for download_url in urls:
+ try:
+ self.logDebug("Download URL", download_url)
+ self.download(download_url)
+ break
+ except Exception, e:
+ self.logError(e)
+ else:
+ self.fail("Download did not finish correctly")
+
+ def handlePremium(self):
+ api_key = self.user
+ premium_key = self.account.getAccountData(self.user)["password"]
+
+ json_data = [api_key, ["download/direct_links", {"pass": premium_key, "link": self.pyfile.url}]]
+ api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)})
+ self.logDebug('API Data: ' + api_rep)
+ api_rep = json_loads(api_rep)
+
+ if api_rep['status'] == 'FAIL':
+ self.fail(api_rep['data'])
+
+ direct_link = api_rep['data'][0][0]
+ self.logDebug('Direct Link: ' + direct_link)
+
+ self.download(direct_link, disposition=True)
diff --git a/pyload/plugins/hoster/LoadTo.py b/pyload/plugins/hoster/LoadTo.py
new file mode 100644
index 000000000..0f99c272a
--- /dev/null
+++ b/pyload/plugins/hoster/LoadTo.py
@@ -0,0 +1,61 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: halfman
+"""
+
+# Test links (random.bin):
+# http://www.load.to/dNsmgXRk4/random.bin
+# http://www.load.to/edbNTxcUb/random100.bin
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class LoadTo(SimpleHoster):
+ __name__ = "LoadTo"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?load\.to/\w+"
+ __version__ = "0.12"
+ __description__ = """Load.to hoster plugin"""
+ __author_name__ = ("halfman", "stickell")
+ __author_mail__ = ("Pulpan3@gmail.com", "l.stickell@yahoo.it")
+
+ FILE_INFO_PATTERN = r'<a [^>]+>(?P<N>.+)</a></h3>\s*Size: (?P<S>\d+) Bytes'
+ URL_PATTERN = r'<form method="post" action="(.+?)"'
+ FILE_OFFLINE_PATTERN = r'Can\'t find file. Please check URL.<br />'
+ WAIT_PATTERN = r'type="submit" value="Download \((\d+)\)"'
+
+ def setup(self):
+ self.multiDL = False
+
+ def process(self, pyfile):
+
+ self.html = self.load(pyfile.url, decode=True)
+
+ found = re.search(self.URL_PATTERN, self.html)
+ if not found:
+ self.parseError('URL')
+ download_url = found.group(1)
+
+ timmy = re.search(self.WAIT_PATTERN, self.html)
+ if timmy:
+ self.setWait(timmy.group(1))
+ self.wait()
+
+ self.download(download_url, disposition=True)
+
+
+getInfo = create_getInfo(LoadTo)
diff --git a/pyload/plugins/hoster/LuckyShareNet.py b/pyload/plugins/hoster/LuckyShareNet.py
new file mode 100644
index 000000000..08e44d9f6
--- /dev/null
+++ b/pyload/plugins/hoster/LuckyShareNet.py
@@ -0,0 +1,72 @@
+# -*- coding: utf-8 -*-
+
+import re
+from module.lib.bottle import json_loads
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.plugins.internal.CaptchaService import ReCaptcha
+
+
+class LuckyShareNet(SimpleHoster):
+ __name__ = "LuckyShareNet"
+ __type__ = "hoster"
+ __pattern__ = r"https?://(www\.)?luckyshare.net/(?P<ID>\d{10,})"
+ __version__ = "0.02"
+ __description__ = """LuckyShare.net Download Hoster"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ FILE_INFO_PATTERN = r"<h1 class='file_name'>(?P<N>\S+)</h1>\s*<span class='file_size'>Filesize: (?P<S>[\d.]+)(?P<U>\w+)</span>"
+ FILE_OFFLINE_PATTERN = 'There is no such file available'
+ RECAPTCHA_KEY = '6LdivsgSAAAAANWh-d7rPE1mus4yVWuSQIJKIYNw'
+
+ def parseJson(self, rep):
+ if 'AJAX Error' in rep:
+ html = self.load(self.pyfile.url, decode=True)
+ m = re.search(r"waitingtime = (\d+);", html)
+ if m:
+ waittime = int(m.group(1))
+ self.logDebug('You have to wait %d seconds between free downloads' % waittime)
+ self.retry(wait_time=waittime)
+ else:
+ self.parseError('Unable to detect wait time between free downloads')
+ elif 'Hash expired' in rep:
+ self.retry(reason='Hash expired')
+ return json_loads(rep)
+
+ # TODO: There should be a filesize limit for free downloads
+ # TODO: Some files could not be downloaded in free mode
+ def handleFree(self):
+ file_id = re.search(self.__pattern__, self.pyfile.url).group('ID')
+ self.logDebug('File ID: ' + file_id)
+ rep = self.load(r"http://luckyshare.net/download/request/type/time/file/" + file_id, decode=True)
+ self.logDebug('JSON: ' + rep)
+ json = self.parseJson(rep)
+
+ self.setWait(int(json['time']))
+ self.wait()
+
+ recaptcha = ReCaptcha(self)
+ for i in xrange(5):
+ challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
+ rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" %
+ (challenge, response, json['hash']), decode=True)
+ self.logDebug('JSON: ' + rep)
+ if 'link' in rep:
+ json.update(self.parseJson(rep))
+ self.correctCaptcha()
+ break
+ elif 'Verification failed' in rep:
+ self.logInfo('Wrong captcha')
+ self.invalidCaptcha()
+ else:
+ self.parseError('Unable to get downlaod link')
+
+ if not json['link']:
+ self.fail("No Download url retrieved/all captcha attempts failed")
+
+ self.logDebug('Direct URL: ' + json['link'])
+ self.download(json['link'])
+
+
+getInfo = create_getInfo(LuckyShareNet)
diff --git a/pyload/plugins/hoster/MediafireCom.py b/pyload/plugins/hoster/MediafireCom.py
new file mode 100644
index 000000000..494d0049e
--- /dev/null
+++ b/pyload/plugins/hoster/MediafireCom.py
@@ -0,0 +1,137 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
+from module.plugins.internal.CaptchaService import SolveMedia
+from module.network.RequestFactory import getURL
+
+
+def replace_eval(js_expr):
+ return js_expr.replace(r'eval("', '').replace(r"\'", r"'").replace(r'\"', r'"')
+
+
+def checkHTMLHeader(url):
+ try:
+ for i in range(3):
+ header = getURL(url, just_header=True)
+ for line in header.splitlines():
+ line = line.lower()
+ if 'location' in line:
+ url = line.split(':', 1)[1].strip()
+ if 'error.php?errno=320' in url:
+ return url, 1
+ if not url.startswith('http://'):
+ url = 'http://www.mediafire.com' + url
+ break
+ elif 'content-disposition' in line:
+ return url, 2
+ else:
+ break
+ except:
+ return url, 3
+
+ return url, 0
+
+
+def getInfo(urls):
+ for url in urls:
+ location, status = checkHTMLHeader(url)
+ if status:
+ file_info = (url, 0, status, url)
+ else:
+ file_info = parseFileInfo(MediafireCom, url, getURL(url, decode=True))
+ yield file_info
+
+
+class MediafireCom(SimpleHoster):
+ __name__ = "MediafireCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)*mediafire\.com/(file/|(view/?|download.php)?\?)(\w{11}|\w{15})($|/)"
+ __version__ = "0.79"
+ __description__ = """Mediafire.com plugin - free only"""
+ __author_name__ = ("zoidberg", "stickell")
+ __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+
+ DOWNLOAD_LINK_PATTERN = r'<div class="download_link"[^>]*(?:z-index:(?P<zindex>\d+))?[^>]*>\s*<a href="(?P<href>http://[^"]+)"'
+ JS_KEY_PATTERN = r"DoShow\('mfpromo1'\);[^{]*{((\w+)='';.*?)eval\(\2\);"
+ JS_ZMODULO_PATTERN = r"\('z-index'\)\) \% (\d+)\)\);"
+ SOLVEMEDIA_PATTERN = r'http://api\.solvemedia\.com/papi/challenge\.noscript\?k=([^"]+)'
+ PAGE1_ACTION_PATTERN = r'<link rel="canonical" href="([^"]+)"/>'
+ PASSWORD_PATTERN = r'<form name="form_password"'
+
+ FILE_NAME_PATTERN = r'<META NAME="description" CONTENT="(?P<N>[^"]+)"/>'
+ FILE_INFO_PATTERN = r"oFileSharePopup\.ald\('(?P<ID>[^']*)','(?P<N>[^']*)','(?P<S>[^']*)','','(?P<sha256>[^']*)'\)"
+ FILE_OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. </div>'
+
+ def setup(self):
+ self.multiDL = False
+
+ def process(self, pyfile):
+ pyfile.url = re.sub(r'/view/?\?', '/?', pyfile.url)
+
+ self.url, result = checkHTMLHeader(pyfile.url)
+ self.logDebug('Location (%d): %s' % (result, self.url))
+
+ if result == 0:
+ self.html = self.load(self.url, decode=True)
+ self.checkCaptcha()
+ self.multiDL = True
+ self.check_data = self.getFileInfo()
+
+ if self.account:
+ self.handlePremium()
+ else:
+ self.handleFree()
+ elif result == 1:
+ self.offline()
+ else:
+ self.multiDL = True
+ self.download(self.url, disposition=True)
+
+ def handleFree(self):
+ passwords = self.getPassword().splitlines()
+ while self.PASSWORD_PATTERN in self.html:
+ if len(passwords):
+ password = passwords.pop(0)
+ self.logInfo("Password protected link, trying " + password)
+ self.html = self.load(self.url, post={"downloadp": password})
+ else:
+ self.fail("No or incorrect password")
+
+ found = re.search(r'kNO = "(http://.*?)";', self.html)
+ if not found:
+ self.parseError("Download URL")
+ download_url = found.group(1)
+ self.logDebug("DOWNLOAD LINK:", download_url)
+
+ self.download(download_url)
+
+ def checkCaptcha(self):
+ for i in xrange(5):
+ found = re.search(self.SOLVEMEDIA_PATTERN, self.html)
+ if found:
+ captcha_key = found.group(1)
+ solvemedia = SolveMedia(self)
+ captcha_challenge, captcha_response = solvemedia.challenge(captcha_key)
+ self.html = self.load(self.url, post={"adcopy_challenge": captcha_challenge,
+ "adcopy_response": captcha_response}, decode=True)
+ else:
+ break
+ else:
+ self.fail("No valid recaptcha solution received")
diff --git a/pyload/plugins/hoster/MegaNz.py b/pyload/plugins/hoster/MegaNz.py
new file mode 100644
index 000000000..bf4223213
--- /dev/null
+++ b/pyload/plugins/hoster/MegaNz.py
@@ -0,0 +1,132 @@
+# -*- coding: utf-8 -*-
+
+import re
+import random
+from array import array
+from os import remove
+from base64 import standard_b64decode
+
+from Crypto.Cipher import AES
+from Crypto.Util import Counter
+
+from module.common.json_layer import json_loads, json_dumps
+from module.plugins.Hoster import Hoster
+
+#def getInfo(urls):
+# pass
+
+
+class MegaNz(Hoster):
+ __name__ = "MegaNz"
+ __type__ = "hoster"
+ __pattern__ = r"https?://([a-z0-9]+\.)?mega\.co\.nz/#!([a-zA-Z0-9!_\-]+)"
+ __version__ = "0.14"
+ __description__ = """mega.co.nz hoster plugin"""
+ __author_name__ = ("RaNaN", )
+ __author_mail__ = ("ranan@pyload.org", )
+
+ API_URL = "https://g.api.mega.co.nz/cs?id=%d"
+ FILE_SUFFIX = ".crypted"
+
+ def b64_decode(self, data):
+ data = data.replace("-", "+").replace("_", "/")
+ return standard_b64decode(data + '=' * (-len(data) % 4))
+
+ def getCipherKey(self, key):
+ """ Construct the cipher key from the given data """
+ a = array("I", key)
+ key_array = array("I", [a[0] ^ a[4], a[1] ^ a[5], a[2] ^ a[6], a[3] ^ a[7]])
+ return key_array
+
+ def callApi(self, **kwargs):
+ """ Dispatch a call to the api, see https://mega.co.nz/#developers """
+ # generate a session id, no idea where to obtain elsewhere
+ uid = random.randint(10 << 9, 10 ** 10)
+
+ resp = self.load(self.API_URL % uid, post=json_dumps([kwargs]))
+ self.logDebug("Api Response: " + resp)
+ return json_loads(resp)
+
+ def decryptAttr(self, data, key):
+
+ cbc = AES.new(self.getCipherKey(key), AES.MODE_CBC, "\0" * 16)
+ attr = cbc.decrypt(self.b64_decode(data))
+ self.logDebug("Decrypted Attr: " + attr)
+ if not attr.startswith("MEGA"):
+ self.fail(_("Decryption failed"))
+
+ # Data is padded, 0-bytes must be stripped
+ return json_loads(attr.replace("MEGA", "").rstrip("\0").strip())
+
+ def decryptFile(self, key):
+ """ Decrypts the file at lastDownload` """
+
+ # upper 64 bit of counter start
+ n = key[16:24]
+
+ # convert counter to long and shift bytes
+ ctr = Counter.new(128, initial_value=long(n.encode("hex"), 16) << 64)
+ cipher = AES.new(self.getCipherKey(key), AES.MODE_CTR, counter=ctr)
+
+ self.pyfile.setStatus("decrypting")
+
+ file_crypted = self.lastDownload
+ file_decrypted = file_crypted.rsplit(self.FILE_SUFFIX)[0]
+ f = open(file_crypted, "rb")
+ df = open(file_decrypted, "wb")
+
+ # TODO: calculate CBC-MAC for checksum
+
+ size = 2 ** 15 # buffer size, 32k
+ while True:
+ buf = f.read(size)
+ if not buf:
+ break
+
+ df.write(cipher.decrypt(buf))
+
+ f.close()
+ df.close()
+ remove(file_crypted)
+
+ self.lastDownload = file_decrypted
+
+ def process(self, pyfile):
+
+ key = None
+
+ # match is guaranteed because plugin was chosen to handle url
+ node = re.search(self.__pattern__, pyfile.url).group(2)
+ if "!" in node:
+ node, key = node.split("!")
+
+ self.logDebug("File id: %s | Key: %s" % (node, key))
+
+ if not key:
+ self.fail(_("No file key provided in the URL"))
+
+ # g is for requesting a download url
+ # this is similar to the calls in the mega js app, documentation is very bad
+ dl = self.callApi(a="g", g=1, p=node, ssl=1)[0]
+
+ if "e" in dl:
+ e = dl["e"]
+ # ETEMPUNAVAIL (-18): Resource temporarily not available, please try again later
+ if e == -18:
+ self.retry()
+ else:
+ self.fail(_("Error code:") + e)
+
+ # TODO: map other error codes, e.g
+ # EACCESS (-11): Access violation (e.g., trying to write to a read-only share)
+
+ key = self.b64_decode(key)
+ attr = self.decryptAttr(dl["at"], key)
+
+ pyfile.name = attr["n"] + self.FILE_SUFFIX
+
+ self.download(dl["g"])
+ self.decryptFile(key)
+
+ # Everything is finished and final name can be set
+ pyfile.name = attr["n"]
diff --git a/pyload/plugins/hoster/MegacrypterCom.py b/pyload/plugins/hoster/MegacrypterCom.py
new file mode 100644
index 000000000..c166146dd
--- /dev/null
+++ b/pyload/plugins/hoster/MegacrypterCom.py
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+import re
+
+from module.common.json_layer import json_loads, json_dumps
+from module.plugins.hoster.MegaNz import MegaNz
+
+
+class MegacrypterCom(MegaNz):
+ __name__ = "MegacrypterCom"
+ __type__ = "hoster"
+ __pattern__ = r"(https?://[a-z0-9]{0,10}\.?megacrypter\.com/[a-zA-Z0-9!_\-]+)"
+ __version__ = "0.2"
+ __description__ = """megacrypter plugin, based and inherits from RaNaN's MegaNz plugin"""
+ __author_name__ = ("GonzaloSR", )
+ __author_mail__ = ("gonzalo@gonzalosr.com", )
+
+ API_URL = "http://megacrypter.com/api"
+ FILE_SUFFIX = ".crypted"
+
+ def callApi(self, **kwargs):
+ """ Dispatch a call to the api, see megacrypter.com/api_doc """
+ self.logDebug("JSON request: " + json_dumps(kwargs))
+ resp = self.load(self.API_URL, post=json_dumps(kwargs))
+ self.logDebug("API Response: " + resp)
+ return json_loads(resp)
+
+ def process(self, pyfile):
+ # match is guaranteed because plugin was chosen to handle url
+ node = re.search(self.__pattern__, pyfile.url).group(1)
+
+ # get Mega.co.nz link info
+ info = self.callApi(link=node, m="info")
+
+ # get crypted file URL
+ dl = self.callApi(link=node, m="dl")
+
+ # TODO: map error codes, implement password protection
+ # if info["pass"] == true:
+ # crypted_file_key, md5_file_key = info["key"].split("#")
+
+ key = self.b64_decode(info["key"])
+
+ pyfile.name = info["name"] + self.FILE_SUFFIX
+
+ self.download(dl["url"])
+ self.decryptFile(key)
+
+ # Everything is finished and final name can be set
+ pyfile.name = info["name"]
diff --git a/pyload/plugins/hoster/MegasharesCom.py b/pyload/plugins/hoster/MegasharesCom.py
new file mode 100644
index 000000000..26cf8ab8e
--- /dev/null
+++ b/pyload/plugins/hoster/MegasharesCom.py
@@ -0,0 +1,114 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from time import time
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class MegasharesCom(SimpleHoster):
+ __name__ = "MegasharesCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(\w+\.)?megashares.com/.*"
+ __version__ = "0.24"
+ __description__ = """megashares.com plugin - free only"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FILE_NAME_PATTERN = '<h1 class="black xxl"[^>]*title="(?P<N>[^"]+)">'
+ FILE_SIZE_PATTERN = '<strong><span class="black">Filesize:</span></strong> (?P<S>[0-9.]+) (?P<U>[kKMG])i?B<br />'
+ DOWNLOAD_URL_PATTERN = r'<div id="show_download_button_%d"[^>]*>\s*<a href="([^"]+)">'
+ PASSPORT_LEFT_PATTERN = r'Your Download Passport is: <[^>]*>(\w+).*\s*You have\s*<[^>]*>\s*([0-9.]+) ([kKMG]i?B)'
+ PASSPORT_RENEW_PATTERN = r'Your download passport will renew in\s*<strong>(\d+)</strong>:<strong>(\d+)</strong>:<strong>(\d+)</strong>'
+ REACTIVATE_NUM_PATTERN = r'<input[^>]*id="random_num" value="(\d+)" />'
+ REACTIVATE_PASSPORT_PATTERN = r'<input[^>]*id="passport_num" value="(\w+)" />'
+ REQUEST_URI_PATTERN = r'var request_uri = "([^"]+)";'
+ NO_SLOTS_PATTERN = r'<dd class="red">All download slots for this link are currently filled'
+ FILE_OFFLINE_PATTERN = r'<dd class="red">(Invalid Link Request|Link has been deleted)'
+
+ def setup(self):
+ self.resumeDownload = True
+ self.multiDL = self.premium
+
+ def handlePremium(self):
+ self.handleDownload(True)
+
+ def handleFree(self):
+ self.html = self.load(self.pyfile.url, decode=True)
+
+ if self.NO_SLOTS_PATTERN in self.html:
+ self.retry(wait_time=300)
+
+ self.getFileInfo()
+ #if self.pyfile.size > 576716800: self.fail("This file is too large for free download")
+
+ # Reactivate passport if needed
+ found = re.search(self.REACTIVATE_PASSPORT_PATTERN, self.html)
+ if found:
+ passport_num = found.group(1)
+ request_uri = re.search(self.REQUEST_URI_PATTERN, self.html).group(1)
+
+ for _ in range(5):
+ random_num = re.search(self.REACTIVATE_NUM_PATTERN, self.html).group(1)
+
+ verifyinput = self.decryptCaptcha(
+ "http://d01.megashares.com/index.php?secgfx=gfx&random_num=%s" % random_num)
+ self.logInfo("Reactivating passport %s: %s %s" % (passport_num, random_num, verifyinput))
+
+ url = ("http://d01.megashares.com%s&rs=check_passport_renewal" % request_uri +
+ "&rsargs[]=%s&rsargs[]=%s&rsargs[]=%s" % (verifyinput, random_num, passport_num) +
+ "&rsargs[]=replace_sec_pprenewal&rsrnd=%s" % str(int(time() * 1000)))
+ self.logDebug(url)
+ response = self.load(url)
+
+ if 'Thank you for reactivating your passport.' in response:
+ self.correctCaptcha()
+ self.retry(0)
+ else:
+ self.invalidCaptcha()
+ else:
+ self.fail("Failed to reactivate passport")
+
+ # Check traffic left on passport
+ found = re.search(self.PASSPORT_LEFT_PATTERN, self.html)
+ if not found:
+ self.fail('Passport not found')
+ self.logInfo("Download passport: %s" % found.group(1))
+ data_left = float(found.group(2)) * 1024 ** {'KB': 1, 'MB': 2, 'GB': 3}[found.group(3)]
+ self.logInfo("Data left: %s %s (%d MB needed)" % (found.group(2), found.group(3), self.pyfile.size / 1048576))
+
+ if not data_left:
+ found = re.search(self.PASSPORT_RENEW_PATTERN, self.html)
+ renew = (found.group(1) + 60 * (found.group(2) + 60 * found.group(3))) if found else 600
+ self.retry(renew, 15, "Unable to get passport")
+
+ self.handleDownload(False)
+
+ def handleDownload(self, premium=False):
+ # Find download link;
+ found = re.search(self.DOWNLOAD_URL_PATTERN % (1 if premium else 2), self.html)
+ msg = '%s download URL' % ('Premium' if premium else 'Free')
+ if not found:
+ self.parseError(msg)
+
+ download_url = found.group(1)
+ self.logDebug("%s: %s" % (msg, download_url))
+ self.download(download_url)
+
+
+getInfo = create_getInfo(MegasharesCom)
diff --git a/pyload/plugins/hoster/MovReelCom.py b/pyload/plugins/hoster/MovReelCom.py
new file mode 100644
index 000000000..5d8754ee7
--- /dev/null
+++ b/pyload/plugins/hoster/MovReelCom.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+#import re
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+#from pycurl import FOLLOWLOCATION, LOW_SPEED_TIME
+
+class MovReelCom(XFileSharingPro):
+ __name__ = "MovReelCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://movreel.com/.*"
+ __version__ = "1.20"
+ __description__ = """MovReel.com hoster plugin"""
+ __author_name__ = ("JorisV83")
+ __author_mail__ = ("jorisv83-pyload@yahoo.com")
+
+ #FILE_NAME_PATTERN = r'<b>Filename:</b>(?P<N>.*?)<br>'
+ #FILE_SIZE_PATTERN = r'<b>Size:</b>(?P<S>.*?)<br>'
+ FILE_INFO_PATTERN = r'<h3>(?P<N>.+?) <small><sup>(?P<S>[\d.]+) (?P<U>..)</sup> </small></h3>'
+ FILE_OFFLINE_PATTERN = r'<b>File Not Found</b><br><br>'
+ DIRECT_LINK_PATTERN = r'<a href="(http://[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*/.*)">Download Link</a>'
+ #OVR_DOWNLOAD_LINK_PATTERN = "var file_link = '(.*)';"
+ HOSTER_NAME = "movreel.com"
+
+getInfo = create_getInfo(MovReelCom)
diff --git a/pyload/plugins/hoster/MultiDebridCom.py b/pyload/plugins/hoster/MultiDebridCom.py
new file mode 100644
index 000000000..e38a16cbb
--- /dev/null
+++ b/pyload/plugins/hoster/MultiDebridCom.py
@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+import re
+
+from pyload.plugins.Hoster import Hoster
+from pyload.utils import json_loads
+
+
+class MultiDebridCom(Hoster):
+ __name__ = "MultiDebridCom"
+ __version__ = "0.03"
+ __type__ = "hoster"
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"),
+ ("hosterList", "str", "Hoster list (comma separated)", ""),
+ ("unloadFailing", "bool", "Revert to standard download if download fails", "False"),
+ ("interval", "int", "Reload interval in hours (0 to disable)", "24")]
+ __pattern__ = r"http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/dl/"
+ __description__ = """Multi-debrid.com hoster plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ def setup(self):
+ self.chunkLimit = -1
+ self.resumeDownload = True
+
+ def process(self, pyfile):
+ if re.match(self.__pattern__, pyfile.url):
+ new_url = pyfile.url
+ elif not self.account:
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "Multi-debrid.com")
+ self.fail("No Multi-debrid.com account provided")
+ else:
+ self.logDebug("Original URL: %s" % pyfile.url)
+ page = self.req.load('http://multi-debrid.com/api.php',
+ get={'user': self.user, 'pass': self.account.getAccountData(self.user)['password'],
+ 'link': pyfile.url})
+ self.logDebug("JSON data: " + page)
+ page = json_loads(page)
+ if page['status'] != 'ok':
+ self.fail('Unable to unrestrict link')
+ new_url = page['link']
+
+ if new_url != pyfile.url:
+ self.logDebug("Unrestricted URL: " + new_url)
+
+ self.download(new_url, disposition=True)
diff --git a/pyload/plugins/hoster/MultishareCz.py b/pyload/plugins/hoster/MultishareCz.py
new file mode 100644
index 000000000..f9289a923
--- /dev/null
+++ b/pyload/plugins/hoster/MultishareCz.py
@@ -0,0 +1,82 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from random import random
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class MultishareCz(SimpleHoster):
+ __name__ = "MultishareCz"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)?multishare.cz/stahnout/(?P<ID>\d+).*"
+ __version__ = "0.34"
+ __description__ = """MultiShare.cz"""
+ __author_name__ = ("zoidberg")
+
+ FILE_INFO_PATTERN = ur'(?:<li>Název|Soubor): <strong>(?P<N>[^<]+)</strong><(?:/li><li|br)>Velikost: <strong>(?P<S>[^<]+)</strong>'
+ FILE_OFFLINE_PATTERN = ur'<h1>Stáhnout soubor</h1><p><strong>PoşadovanÜ soubor neexistuje.</strong></p>'
+ FILE_SIZE_REPLACEMENTS = [('&nbsp;', '')]
+
+ def process(self, pyfile):
+ msurl = re.match(self.__pattern__, pyfile.url)
+ if msurl:
+ self.fileID = msurl.group('ID')
+ self.html = self.load(pyfile.url, decode=True)
+ self.getFileInfo()
+
+ if self.premium:
+ self.handlePremium()
+ else:
+ self.handleFree()
+ else:
+ self.handleOverriden()
+
+ def handleFree(self):
+ self.download("http://www.multishare.cz/html/download_free.php?ID=%s" % self.fileID)
+
+ def handlePremium(self):
+ if not self.checkCredit():
+ self.logWarning("Not enough credit left to download file")
+ self.resetAccount()
+
+ self.download("http://www.multishare.cz/html/download_premium.php?ID=%s" % self.fileID)
+
+ def handleOverriden(self):
+ if not self.premium:
+ self.fail("Only premium users can download from other hosters")
+
+ self.html = self.load('http://www.multishare.cz/html/mms_ajax.php', post={"link": self.pyfile.url}, decode=True)
+ self.getFileInfo()
+
+ if not self.checkCredit():
+ self.fail("Not enough credit left to download file")
+
+ url = "http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random() * 10000 * random())
+ params = {"u_ID": self.acc_info["u_ID"], "u_hash": self.acc_info["u_hash"], "link": self.pyfile.url}
+ self.logDebug(url, params)
+ self.download(url, get=params)
+
+ def checkCredit(self):
+ self.acc_info = self.account.getAccountInfo(self.user, True)
+ self.logInfo("User %s has %i MB left" % (self.user, self.acc_info["trafficleft"] / 1024))
+
+ return self.pyfile.size / 1024 <= self.acc_info["trafficleft"]
+
+
+getInfo = create_getInfo(MultishareCz)
diff --git a/pyload/plugins/hoster/MyvideoDe.py b/pyload/plugins/hoster/MyvideoDe.py
new file mode 100644
index 000000000..1bd73e376
--- /dev/null
+++ b/pyload/plugins/hoster/MyvideoDe.py
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Hoster import Hoster
+from module.unescape import unescape
+
+
+class MyvideoDe(Hoster):
+ __name__ = "MyvideoDe"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?myvideo.de/watch/"
+ __version__ = "0.9"
+ __description__ = """Myvideo.de Video Download Hoster"""
+ __author_name__ = ("spoob")
+ __author_mail__ = ("spoob@pyload.org")
+
+ def process(self, pyfile):
+ self.pyfile = pyfile
+ self.download_html()
+ pyfile.name = self.get_file_name()
+ self.download(self.get_file_url())
+
+ def download_html(self):
+ self.html = self.load(self.pyfile.url)
+
+ def get_file_url(self):
+ videoId = re.search(r"addVariable\('_videoid','(.*)'\);p.addParam\('quality'", self.html).group(1)
+ videoServer = re.search("rel='image_src' href='(.*)thumbs/.*' />", self.html).group(1)
+ file_url = videoServer + videoId + ".flv"
+ return file_url
+
+ def get_file_name(self):
+ file_name_pattern = r"<h1 class='globalHd'>(.*)</h1>"
+ return unescape(re.search(file_name_pattern, self.html).group(1).replace("/", "") + '.flv')
+
+ def file_exists(self):
+ self.download_html()
+ self.load(str(self.pyfile.url), cookies=False, just_header=True)
+ if self.req.lastEffectiveURL == "http://www.myvideo.de/":
+ return False
+ return True
diff --git a/pyload/plugins/hoster/NarodRu.py b/pyload/plugins/hoster/NarodRu.py
new file mode 100644
index 000000000..590268910
--- /dev/null
+++ b/pyload/plugins/hoster/NarodRu.py
@@ -0,0 +1,70 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from random import random
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class NarodRu(SimpleHoster):
+ __name__ = "NarodRu"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?narod(\.yandex)?\.ru/(disk|start/[0-9]+\.\w+-narod\.yandex\.ru)/(?P<ID>\d+)/.+"
+ __version__ = "0.1"
+ __description__ = """Narod.ru"""
+ __author_name__ = ("zoidberg")
+
+ FILE_NAME_PATTERN = r'<dt class="name">(?:<[^<]*>)*(?P<N>[^<]+)</dt>'
+ FILE_SIZE_PATTERN = r'<dd class="size">(?P<S>\d[^<]*)</dd>'
+ FILE_OFFLINE_PATTERN = r'<title>404</title>|Ѐайл уЎалеМ с сервОса|ЗакПМчОлся срПк храМеМОя файла\.'
+
+ FILE_SIZE_REPLACEMENTS = [(u'КБ', 'KB'), (u'МБ', 'MB'), (u'ГБ', 'GB')]
+ FILE_URL_REPLACEMENTS = [("narod.yandex.ru/", "narod.ru/"),
+ (r"/start/[0-9]+\.\w+-narod\.yandex\.ru/([0-9]{6,15})/\w+/(\w+)", r"/disk/\1/\2")]
+
+ CAPTCHA_PATTERN = r'<number url="(.*?)">(\w+)</number>'
+ DOWNLOAD_LINK_PATTERN = r'<a class="h-link" rel="yandex_bar" href="(.+?)">'
+
+ def handleFree(self):
+ for i in range(5):
+ self.html = self.load('http://narod.ru/disk/getcapchaxml/?rnd=%d' % int(random() * 777))
+ found = re.search(self.CAPTCHA_PATTERN, self.html)
+ if not found:
+ self.parseError('Captcha')
+ post_data = {"action": "sendcapcha"}
+ captcha_url, post_data['key'] = found.groups()
+ post_data['rep'] = self.decryptCaptcha(captcha_url)
+
+ self.html = self.load(self.pyfile.url, post=post_data, decode=True)
+ found = re.search(self.DOWNLOAD_LINK_PATTERN, self.html)
+ if found:
+ url = 'http://narod.ru' + found.group(1)
+ self.correctCaptcha()
+ break
+ elif u'<b class="error-msg"><strong>ОшОблОсь?</strong>' in self.html:
+ self.invalidCaptcha()
+ else:
+ self.parseError('Download link')
+ else:
+ self.fail("No valid captcha code entered")
+
+ self.logDebug('Download link: ' + url)
+ self.download(url)
+
+
+getInfo = create_getInfo(NarodRu)
diff --git a/pyload/plugins/hoster/NetloadIn.py b/pyload/plugins/hoster/NetloadIn.py
new file mode 100644
index 000000000..71c8dd4f2
--- /dev/null
+++ b/pyload/plugins/hoster/NetloadIn.py
@@ -0,0 +1,255 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from time import sleep, time
+
+from module.plugins.Hoster import Hoster
+from module.network.RequestFactory import getURL
+from module.plugins.Plugin import chunks
+
+
+def getInfo(urls):
+ ## returns list of tupels (name, size (in bytes), status (see FileDatabase), url)
+
+ apiurl = "http://api.netload.in/info.php?auth=Zf9SnQh9WiReEsb18akjvQGqT0I830e8&bz=1&md5=1&file_id="
+ id_regex = re.compile(NetloadIn.__pattern__)
+ urls_per_query = 80
+
+ for chunk in chunks(urls, urls_per_query):
+ ids = ""
+ for url in chunk:
+ match = id_regex.search(url)
+ if match:
+ ids = ids + match.group(1) + ";"
+
+ api = getURL(apiurl + ids, decode=True)
+
+ if api is None or len(api) < 10:
+ print "Netload prefetch: failed "
+ return
+ if api.find("unknown_auth") >= 0:
+ print "Netload prefetch: Outdated auth code "
+ return
+
+ result = []
+
+ for i, r in enumerate(api.splitlines()):
+ try:
+ tmp = r.split(";")
+ try:
+ size = int(tmp[2])
+ except:
+ size = 0
+ result.append((tmp[1], size, 2 if tmp[3] == "online" else 1, chunk[i] ))
+ except:
+ print "Netload prefetch: Error while processing response: "
+ print r
+
+ yield result
+
+
+class NetloadIn(Hoster):
+ __name__ = "NetloadIn"
+ __type__ = "hoster"
+ __pattern__ = r"https?://.*netload\.in/(?:datei(.*?)(?:\.htm|/)|index.php?id=10&file_id=)"
+ __version__ = "0.45"
+ __description__ = """Netload.in Download Hoster"""
+ __author_name__ = ("spoob", "RaNaN", "Gregy")
+ __author_mail__ = ("spoob@pyload.org", "ranan@pyload.org", "gregy@gregy.cz")
+
+ def setup(self):
+ self.multiDL = self.resumeDownload = self.premium
+
+ def process(self, pyfile):
+ self.url = pyfile.url
+ self.prepare()
+ self.pyfile.setStatus("downloading")
+ self.proceed(self.url)
+
+ def prepare(self):
+ self.download_api_data()
+
+ if self.api_data and self.api_data["filename"]:
+ self.pyfile.name = self.api_data["filename"]
+
+ if self.premium:
+ self.logDebug("Netload: Use Premium Account")
+ settings = self.load("http://www.netload.in/index.php?id=2&lang=en")
+ if '<option value="2" selected="selected">Direkter Download' in settings:
+ self.logDebug("Using direct download")
+ return True
+ else:
+ self.logDebug("Direct downloads not enabled. Parsing html for a download URL")
+
+ if self.download_html():
+ return True
+ else:
+ self.fail("Failed")
+ return False
+
+ def download_api_data(self, n=0):
+ url = self.url
+ id_regex = re.compile(self.__pattern__)
+ match = id_regex.search(url)
+
+ if match:
+ #normalize url
+ self.url = 'http://www.netload.in/datei%s.htm' % match.group(1)
+ self.logDebug("URL: %s" % self.url)
+ else:
+ self.api_data = False
+ return
+
+ apiurl = "http://api.netload.in/info.php"
+ src = self.load(apiurl, cookies=False,
+ get={"file_id": match.group(1), "auth": "Zf9SnQh9WiReEsb18akjvQGqT0I830e8", "bz": "1",
+ "md5": "1"}, decode=True).strip()
+ if not src and n <= 3:
+ sleep(0.2)
+ self.download_api_data(n + 1)
+ return
+
+ self.logDebug("Netload: APIDATA: " + src)
+ self.api_data = {}
+ if src and ";" in src and src not in ("unknown file_data", "unknown_server_data", "No input file specified."):
+ lines = src.split(";")
+ self.api_data["exists"] = True
+ self.api_data["fileid"] = lines[0]
+ self.api_data["filename"] = lines[1]
+ self.api_data["size"] = lines[2]
+ self.api_data["status"] = lines[3]
+ if self.api_data["status"] == "online":
+ self.api_data["checksum"] = lines[4].strip()
+ else:
+ self.api_data = False # check manually since api data is useless sometimes
+
+ if lines[0] == lines[1] and lines[2] == "0": # useless api data
+ self.api_data = False
+ else:
+ self.api_data = False
+
+ def final_wait(self, page):
+ wait_time = self.get_wait_time(page)
+ self.setWait(wait_time)
+ self.logDebug("Netload: final wait %d seconds" % wait_time)
+ self.wait()
+ self.url = self.get_file_url(page)
+
+ def download_html(self):
+ self.logDebug("Netload: Entering download_html")
+ page = self.load(self.url, decode=True)
+ t = time() + 30
+
+ if "/share/templates/download_hddcrash.tpl" in page:
+ self.logError("Netload HDD Crash")
+ self.fail(_("File temporarily not available"))
+
+ if not self.api_data:
+ self.logDebug("API Data may be useless, get details from html page")
+
+ if "* The file was deleted" in page:
+ self.offline()
+
+ name = re.search(r'class="dl_first_filename">([^<]+)', page, re.MULTILINE)
+ # the found filename is not truncated
+ if name:
+ name = name.group(1).strip()
+ if not name.endswith(".."):
+ self.pyfile.name = name
+
+ captchawaited = False
+ for i in range(10):
+
+ if not page:
+ page = self.load(self.url)
+ t = time() + 30
+
+ if "/share/templates/download_hddcrash.tpl" in page:
+ self.logError("Netload HDD Crash")
+ self.fail(_("File temporarily not available"))
+
+ self.logDebug("Netload: try number %d " % i)
+
+ if ">Your download is being prepared.<" in page:
+ self.logDebug("Netload: We will prepare your download")
+ self.final_wait(page)
+ return True
+ if ">An access request has been made from IP address <" in page:
+ wait = self.get_wait_time(page)
+ if wait == 0:
+ self.logDebug("Netload: Wait was 0 setting 30")
+ wait = 30
+ self.logInfo(_("Netload: waiting between downloads %d s." % wait))
+ self.wantReconnect = True
+ self.setWait(wait)
+ self.wait()
+
+ return self.download_html()
+
+ self.logDebug("Netload: Trying to find captcha")
+
+ try:
+ url_captcha_html = "http://netload.in/" + re.search('(index.php\?id=10&amp;.*&amp;captcha=1)',
+ page).group(1).replace("amp;", "")
+ except:
+ page = None
+ continue
+
+ try:
+ page = self.load(url_captcha_html, cookies=True)
+ captcha_url = "http://netload.in/" + re.search('(share/includes/captcha.php\?t=\d*)', page).group(1)
+ except:
+ self.logDebug("Netload: Could not find captcha, try again from beginning")
+ captchawaited = False
+ continue
+
+ file_id = re.search('<input name="file_id" type="hidden" value="(.*)" />', page).group(1)
+ if not captchawaited:
+ wait = self.get_wait_time(page)
+ if i == 0:
+ self.pyfile.waitUntil = time() # dont wait contrary to time on website
+ else:
+ self.pyfile.waitUntil = t
+ self.logInfo(_("Netload: waiting for captcha %d s.") % (self.pyfile.waitUntil - time()))
+ #self.setWait(wait)
+ self.wait()
+ captchawaited = True
+
+ captcha = self.decryptCaptcha(captcha_url)
+ page = self.load("http://netload.in/index.php?id=10", post={"file_id": file_id, "captcha_check": captcha},
+ cookies=True)
+
+ return False
+
+ def get_file_url(self, page):
+ try:
+ file_url_pattern = r"<a class=\"Orange_Link\" href=\"(http://.+)\".?>Or click here"
+ attempt = re.search(file_url_pattern, page)
+ if attempt is not None:
+ return attempt.group(1)
+ else:
+ self.logDebug("Netload: Backup try for final link")
+ file_url_pattern = r"<a href=\"(.+)\" class=\"Orange_Link\">Click here"
+ attempt = re.search(file_url_pattern, page)
+ return "http://netload.in/" + attempt.group(1)
+ except:
+ self.logDebug("Netload: Getting final link failed")
+ return None
+
+ def get_wait_time(self, page):
+ wait_seconds = int(re.search(r"countdown\((.+),'change\(\)'\)", page).group(1)) / 100
+ return wait_seconds
+
+ def proceed(self, url):
+ self.logDebug("Netload: Downloading..")
+
+ self.download(url, disposition=True)
+
+ check = self.checkDownload({"empty": re.compile(r"^$"), "offline": re.compile("The file was deleted")})
+
+ if check == "empty":
+ self.logInfo(_("Downloaded File was empty"))
+ self.retry()
+ elif check == "offline":
+ self.offline()
diff --git a/pyload/plugins/hoster/NovafileCom.py b/pyload/plugins/hoster/NovafileCom.py
new file mode 100644
index 000000000..599ec5f7d
--- /dev/null
+++ b/pyload/plugins/hoster/NovafileCom.py
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+
+# Test links (random.bin):
+# http://novafile.com/vfun4z6o2cit
+# http://novafile.com/s6zrr5wemuz4
+
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
+
+class NovafileCom(XFileSharingPro):
+ __name__ = "NovafileCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)*novafile\.com/\w{12}"
+ __version__ = "0.02"
+ __description__ = """novafile.com hoster plugin"""
+ __author_name__ = ("zoidberg", "stickell")
+ __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+
+ FILE_SIZE_PATTERN = r'<div class="size">(?P<S>.+?)</div>'
+ ERROR_PATTERN = r'class="alert[^"]*alert-separate"[^>]*>\s*(?:<p>)?(.*?)\s*</'
+ DIRECT_LINK_PATTERN = r'<a href="(http://s\d+\.novafile\.com/.*?)" class="btn btn-green">Download File</a>'
+ WAIT_PATTERN = r'<p>Please wait <span id="count"[^>]*>(\d+)</span> seconds</p>'
+
+ HOSTER_NAME = "novafile.com"
+
+ def setup(self):
+ self.multiDL = False
+
+
+getInfo = create_getInfo(NovafileCom)
diff --git a/pyload/plugins/hoster/NowDownloadEu.py b/pyload/plugins/hoster/NowDownloadEu.py
new file mode 100644
index 000000000..b5e6b6493
--- /dev/null
+++ b/pyload/plugins/hoster/NowDownloadEu.py
@@ -0,0 +1,73 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.utils import fixup
+
+
+class NowDownloadEu(SimpleHoster):
+ __name__ = "NowDownloadEu"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?nowdownload\.(ch|eu|co)/(dl/|download\.php\?id=)(?P<ID>[a-z0-9]+)"
+ __version__ = "0.03"
+ __description__ = """NowDownloadCh"""
+ __author_name__ = ("godofdream", "Walter Purcaro")
+ __author_mail__ = ("", "vuolter@gmail.com")
+
+ FILE_INFO_PATTERN = r'Downloading</span> <br> (?P<N>.*) (?P<S>[0-9,.]+) (?P<U>[kKMG])i?B </h4>'
+ FILE_OFFLINE_PATTERN = r'(This file does not exist!)'
+ FILE_TOKEN_PATTERN = r'"(/api/token\.php\?token=[a-z0-9]+)"'
+ FILE_CONTINUE_PATTERN = r'"(/dl2/[a-z0-9]+/[a-z0-9]+)"'
+ FILE_WAIT_PATTERN = r'\.countdown\(\{until: \+(\d+),'
+ FILE_DOWNLOAD_LINK = r'"(http://f\d+\.nowdownload\.ch/dl/[a-z0-9]+/[a-z0-9]+/[^<>"]*?)"'
+
+ FILE_NAME_REPLACEMENTS = [("&#?\w+;", fixup), (r'<[^>]*>', '')]
+
+ def setup(self):
+ self.wantReconnect = False
+ self.multiDL = self.resumeDownload = True
+ self.chunkLimit = -1
+
+ def handleFree(self):
+ tokenlink = re.search(self.FILE_TOKEN_PATTERN, self.html)
+ continuelink = re.search(self.FILE_CONTINUE_PATTERN, self.html)
+ if not tokenlink or not continuelink:
+ self.fail('Plugin out of Date')
+
+ found = re.search(self.FILE_WAIT_PATTERN, self.html)
+ if found:
+ wait = int(found.group(1))
+ else
+ wait = 60
+
+ baseurl = "http://www.nowdownload.ch"
+ self.html = self.load(baseurl + str(tokenlink.group(1)))
+ self.setWait(wait)
+ self.wait()
+
+ self.html = self.load(baseurl + str(continuelink.group(1)))
+
+ url = re.search(self.FILE_DOWNLOAD_LINK, self.html)
+ if not url:
+ self.fail('Download Link not Found (Plugin out of Date?)')
+ self.logDebug('Download link: ' + str(url.group(1)))
+ self.download(str(url.group(1)))
+
+
+getInfo = create_getInfo(NowDownloadEu)
diff --git a/pyload/plugins/hoster/OneFichierCom.py b/pyload/plugins/hoster/OneFichierCom.py
new file mode 100644
index 000000000..54bf1d1fa
--- /dev/null
+++ b/pyload/plugins/hoster/OneFichierCom.py
@@ -0,0 +1,64 @@
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class OneFichierCom(SimpleHoster):
+ __name__ = "OneFichierCom"
+ __type__ = "hoster"
+ __pattern__ = r"(http://(\w+)\.((1fichier|d(es)?fichiers|pjointe)\.(com|fr|net|org)|(cjoint|mesfichiers|piecejointe|oi)\.(org|net)|tenvoi\.(com|org|net)|dl4free\.com|alterupload\.com|megadl.fr))"
+ __version__ = "0.48"
+ __description__ = """1fichier.com download hoster"""
+ __author_name__ = ("fragonib", "the-razer", "zoidberg", "imclem")
+ __author_mail__ = ("fragonib[AT]yahoo[DOT]es", "daniel_ AT gmx DOT net", "zoidberg@mujmail.cz", "imclem on github")
+
+ FILE_NAME_PATTERN = r'">File name :</th>\s*<td>(?P<N>[^<]+)</td>'
+ FILE_SIZE_PATTERN = r'<th>File size :</th>\s*<td>(?P<S>[^<]+)</td>'
+ FILE_OFFLINE_PATTERN = r'The (requested)? file (could not be found|has been deleted)'
+ FILE_URL_REPLACEMENTS = [(r'(http://[^/]*).*', r'\1/en/')]
+
+ DOWNLOAD_LINK_PATTERN = r'<br/>&nbsp;<br/>&nbsp;<br/>&nbsp;\s+<a href="(?P<url>http://.*?)"'
+ PASSWORD_PROTECTED_TOKEN = "protected by password"
+ WAITING_PATTERN = "Warning ! Without premium status, you can download only one file at a time and you must wait up to (\d+) minutes between each downloads."
+
+ def process(self, pyfile):
+ found = re.search(self.__pattern__, pyfile.url)
+ file_id = found.group(2)
+ url = "http://%s.%s/en/" % (found.group(2), found.group(3))
+ self.html = self.load(url, decode=True)
+
+ found = re.search(self.WAITING_PATTERN, self.html)
+ if found:
+ self.waitAndRetry(int(found.group(1)) * 60)
+
+ self.getFileInfo()
+
+ url, inputs = self.parseHtmlForm('action="http://%s' % file_id)
+ if not url or not inputs:
+ self.parseError("Download link not found")
+
+ # Check for protection
+ if "pass" in inputs:
+ inputs['pass'] = self.getPassword()
+
+ self.download(url, post=inputs)
+
+ # Check download
+ self.checkDownloadedFile()
+
+ def checkDownloadedFile(self):
+ check = self.checkDownload({"wait": self.WAITING_PATTERN})
+ if check == "wait":
+ self.waitAndRetry(int(self.lastcheck.group(1)) * 60)
+
+ def waitAndRetry(self, wait_time):
+ self.setWait(wait_time, True)
+ self.wait()
+ self.retry()
+
+ def setup(self):
+ self.multiDL = self.premium
+ self.resumeDownload = True
+
+getInfo = create_getInfo(OneFichierCom)
diff --git a/pyload/plugins/hoster/PornhostCom.py b/pyload/plugins/hoster/PornhostCom.py
new file mode 100644
index 000000000..1d340694b
--- /dev/null
+++ b/pyload/plugins/hoster/PornhostCom.py
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Hoster import Hoster
+
+
+class PornhostCom(Hoster):
+ __name__ = "PornhostCom"
+ __type__ = "hoster"
+ __pattern__ = r'http://[\w\.]*?pornhost\.com/([0-9]+/[0-9]+\.html|[0-9]+)'
+ __version__ = "0.2"
+ __description__ = """Pornhost.com Download Hoster"""
+ __author_name__ = ("jeix")
+ __author_mail__ = ("jeix@hasnomail.de")
+
+ def process(self, pyfile):
+ self.download_html()
+ if not self.file_exists():
+ self.offline()
+
+ pyfile.name = self.get_file_name()
+ self.download(self.get_file_url())
+
+ ### old interface
+ def download_html(self):
+ url = self.pyfile.url
+ self.html = self.load(url)
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if self.html is None:
+ self.download_html()
+
+ file_url = re.search(r'download this file</label>.*?<a href="(.*?)"', self.html)
+ if not file_url:
+ file_url = re.search(r'"(http://dl[0-9]+\.pornhost\.com/files/.*?/.*?/.*?/.*?/.*?/.*?\..*?)"', self.html)
+ if not file_url:
+ file_url = re.search(r'width: 894px; height: 675px">.*?<img src="(.*?)"', self.html)
+ if not file_url:
+ file_url = re.search(r'"http://file[0-9]+\.pornhost\.com/[0-9]+/.*?"',
+ self.html) # TODO: fix this one since it doesn't match
+
+ file_url = file_url.group(1).strip()
+
+ return file_url
+
+ def get_file_name(self):
+ if self.html is None:
+ self.download_html()
+
+ name = re.search(r'<title>pornhost\.com - free file hosting with a twist - gallery(.*?)</title>', self.html)
+ if not name:
+ name = re.search(r'id="url" value="http://www\.pornhost\.com/(.*?)/"', self.html)
+ if not name:
+ name = re.search(r'<title>pornhost\.com - free file hosting with a twist -(.*?)</title>', self.html)
+ if not name:
+ name = re.search(r'"http://file[0-9]+\.pornhost\.com/.*?/(.*?)"', self.html)
+
+ name = name.group(1).strip() + ".flv"
+
+ return name
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html is None:
+ self.download_html()
+
+ if (re.search(r'gallery not found', self.html) is not None or
+ re.search(r'You will be redirected to', self.html) is not None):
+ return False
+ else:
+ return True
diff --git a/pyload/plugins/hoster/PornhubCom.py b/pyload/plugins/hoster/PornhubCom.py
new file mode 100644
index 000000000..7bbb8d919
--- /dev/null
+++ b/pyload/plugins/hoster/PornhubCom.py
@@ -0,0 +1,84 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Hoster import Hoster
+
+
+class PornhubCom(Hoster):
+ __name__ = "PornhubCom"
+ __type__ = "hoster"
+ __pattern__ = r'http://[\w\.]*?pornhub\.com/view_video\.php\?viewkey=[\w\d]+'
+ __version__ = "0.5"
+ __description__ = """Pornhub.com Download Hoster"""
+ __author_name__ = ("jeix")
+ __author_mail__ = ("jeix@hasnomail.de")
+
+ def process(self, pyfile):
+ self.download_html()
+ if not self.file_exists():
+ self.offline()
+
+ pyfile.name = self.get_file_name()
+ self.download(self.get_file_url())
+
+ def download_html(self):
+ url = self.pyfile.url
+ self.html = self.load(url)
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if self.html is None:
+ self.download_html()
+
+ url = "http://www.pornhub.com//gateway.php"
+ video_id = self.pyfile.url.split('=')[-1]
+ # thanks to jD team for this one v
+ post_data = "\x00\x03\x00\x00\x00\x01\x00\x0c\x70\x6c\x61\x79\x65\x72\x43\x6f\x6e\x66\x69\x67\x00\x02\x2f\x31\x00\x00\x00\x44\x0a\x00\x00\x00\x03\x02\x00"
+ post_data += chr(len(video_id))
+ post_data += video_id
+ post_data += "\x02\x00\x02\x2d\x31\x02\x00\x20"
+ post_data += "add299463d4410c6d1b1c418868225f7"
+
+ content = self.req.load(url, post=str(post_data))
+
+ new_content = ""
+ for x in content:
+ if ord(x) < 32 or ord(x) > 176:
+ new_content += '#'
+ else:
+ new_content += x
+
+ content = new_content
+
+ file_url = re.search(r'flv_url.*(http.*?)##post_roll', content).group(1)
+
+ return file_url
+
+ def get_file_name(self):
+ if self.html is None:
+ self.download_html()
+
+ match = re.search(r'<title[^>]+>([^<]+) - ', self.html)
+ if match:
+ name = match.group(1)
+ else:
+ matches = re.findall('<h1>(.*?)</h1>', self.html)
+ if len(matches) > 1:
+ name = matches[1]
+ else:
+ name = matches[0]
+
+ return name + '.flv'
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html is None:
+ self.download_html()
+
+ if re.search(r'This video is no longer in our database or is in conversion', self.html) is not None:
+ return False
+ else:
+ return True
diff --git a/pyload/plugins/hoster/Premium4Me.py b/pyload/plugins/hoster/Premium4Me.py
new file mode 100644
index 000000000..d6c154693
--- /dev/null
+++ b/pyload/plugins/hoster/Premium4Me.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from urllib import quote
+from os.path import exists
+from os import remove
+
+from module.plugins.Hoster import Hoster
+from module.utils import fs_encode
+
+
+class Premium4Me(Hoster):
+ __name__ = "Premium4Me"
+ __version__ = "0.08"
+ __type__ = "hoster"
+
+ __pattern__ = r"http://premium.to/.*"
+ __description__ = """Premium.to hoster plugin"""
+ __author_name__ = ("RaNaN", "zoidberg", "stickell")
+ __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+
+ def setup(self):
+ self.resumeDownload = True
+ self.chunkLimit = 1
+
+ def process(self, pyfile):
+ if not self.account:
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "premium.to")
+ self.fail("No premium.to account provided")
+
+ self.logDebug("premium.to: Old URL: %s" % pyfile.url)
+
+ tra = self.getTraffic()
+
+ #raise timeout to 2min
+ self.req.setOption("timeout", 120)
+
+ self.download(
+ "http://premium.to/api/getfile.php?authcode=%s&link=%s" % (self.account.authcode, quote(pyfile.url, "")),
+ disposition=True)
+
+ check = self.checkDownload({"nopremium": "No premium account available"})
+
+ if check == "nopremium":
+ self.retry(60, 300, 'No premium account available')
+
+ err = ''
+ if self.req.http.code == '420':
+ # Custom error code send - fail
+ lastDownload = fs_encode(self.lastDownload)
+
+ if exists(lastDownload):
+ f = open(lastDownload, "rb")
+ err = f.read(256).strip()
+ f.close()
+ remove(lastDownload)
+ else:
+ err = 'File does not exist'
+
+ trb = self.getTraffic()
+ self.logInfo("Filesize: %d, Traffic used %d, traffic left %d" % (pyfile.size, tra - trb, trb))
+
+ if err:
+ self.fail(err)
+
+ def getTraffic(self):
+ try:
+ traffic = int(self.load("http://premium.to/api/traffic.php?authcode=%s" % self.account.authcode))
+ except:
+ traffic = 0
+ return traffic
diff --git a/pyload/plugins/hoster/PremiumizeMe.py b/pyload/plugins/hoster/PremiumizeMe.py
new file mode 100644
index 000000000..c5c09857f
--- /dev/null
+++ b/pyload/plugins/hoster/PremiumizeMe.py
@@ -0,0 +1,55 @@
+from module.plugins.Hoster import Hoster
+
+from module.common.json_layer import json_loads
+
+
+class PremiumizeMe(Hoster):
+ __name__ = "PremiumizeMe"
+ __version__ = "0.12"
+ __type__ = "hoster"
+ __description__ = """Premiumize.Me hoster plugin"""
+
+ # Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady
+ # create the regex patterns for us using getHosters in our PremiumizeMe hook.
+ __pattern__ = None
+
+ __author_name__ = ("Florian Franzen")
+ __author_mail__ = ("FlorianFranzen@gmail.com")
+
+ def process(self, pyfile):
+ # Check account
+ if not self.account or not self.account.canUse():
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "premiumize.me")
+ self.fail("No valid premiumize.me account provided")
+
+ # In some cases hostsers do not supply us with a filename at download, so we
+ # are going to set a fall back filename (e.g. for freakshare or xfileshare)
+ self.pyfile.name = self.pyfile.name.split('/').pop() # Remove everthing before last slash
+
+ # Correction for automatic assigned filename: Removing html at end if needed
+ suffix_to_remove = ["html", "htm", "php", "php3", "asp", "shtm", "shtml", "cfml", "cfm"]
+ temp = self.pyfile.name.split('.')
+ if temp.pop() in suffix_to_remove:
+ self.pyfile.name = ".".join(temp)
+
+ # Get account data
+ (user, data) = self.account.selectAccount()
+
+ # Get rewritten link using the premiumize.me api v1 (see https://secure.premiumize.me/?show=api)
+ answer = self.load(
+ "https://api.premiumize.me/pm-api/v1.php?method=directdownloadlink&params[login]=%s&params[pass]=%s&params[link]=%s" % (
+ user, data['password'], self.pyfile.url))
+ data = json_loads(answer)
+
+ # Check status and decide what to do
+ status = data['status']
+ if status == 200:
+ self.download(data['result']['location'], disposition=True)
+ elif status == 400:
+ self.fail("Invalid link")
+ elif status == 404:
+ self.offline()
+ elif status >= 500:
+ self.tempOffline()
+ else:
+ self.fail(data['statusmessage'])
diff --git a/pyload/plugins/hoster/PutlockerCom.py b/pyload/plugins/hoster/PutlockerCom.py
new file mode 100644
index 000000000..7b9ac1f84
--- /dev/null
+++ b/pyload/plugins/hoster/PutlockerCom.py
@@ -0,0 +1,96 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: jeix
+"""
+
+import re
+from os import rename
+
+from module.plugins.internal.SimpleHoster import SimpleHoster
+
+
+class PutlockerCom(SimpleHoster):
+ __name__ = "PutlockerCom"
+ __type__ = "hoster"
+ __pattern__ = r'http://(?:www\.)?putlocker\.com/(mobile/)?(file|embed)/(?P<ID>[A-Z0-9]+)'
+ __version__ = "0.31"
+ __description__ = """Putlocker.Com"""
+ __author_name__ = ("jeix", "stickell", "Walter Purcaro")
+ __author_mail__ = ("", "l.stickell@yahoo.it", "vuolter@gmail.com")
+
+ FILE_OFFLINE_PATTERN = r"This file doesn't exist, or has been removed."
+ FILE_INFO_PATTERN = r'site-content">\s*<h1>(?P<N>.+)<strong>\( (?P<S>[^)]+) \)</strong></h1>'
+
+ FILE_URL_REPLACEMENTS = [(__pattern__, r'http://www.putlocker.com/file/\g<ID>')]
+ HOSTER_NAME = "putlocker.com"
+
+ def setup(self):
+ self.multiDL = self.resumeDownload = True
+ self.chunkLimit = -1
+
+ def handleFree(self):
+ name = self.pyfile.name
+ link = self._getLink()
+ self.logDebug("Direct link: " + link)
+ self.download(link, disposition=True)
+ self.processName(name)
+
+ def _getLink(self):
+ hash_data = re.search(r'<input type="hidden" value="([a-z0-9]+)" name="hash">', self.html)
+ if not hash_data:
+ self.parseError('Unable to detect hash')
+
+ post_data = {"hash": hash_data.group(1), "confirm": "Continue+as+Free+User"}
+ self.html = self.load(self.pyfile.url, post=post_data)
+ if (">You have exceeded the daily stream limit for your country\\. You can wait until tomorrow" in self.html or
+ "(>This content server has been temporarily disabled for upgrades|Try again soon\\. You can still download it below\\.<)" in self.html):
+ self.retry(wait_time=7200, reason="Download limit exceeded or server disabled") # 2 hours wait
+
+ patterns = (r'(/get_file\.php\?id=[A-Z0-9]+&key=[A-Za-z0-9=]+&original=1)',
+ r'(/get_file\.php\?download=[A-Z0-9]+&key=[a-z0-9]+)',
+ r'(/get_file\.php\?download=[A-Z0-9]+&key=[a-z0-9]+&original=1)',
+ r'<a href="/gopro\.php">Tired of ads and waiting\? Go Pro!</a>[\t\n\rn ]+</div>[\t\n\rn ]+<a href="(/.*?)"')
+ for pattern in patterns:
+ link = re.search(pattern, self.html)
+ if link:
+ break
+ else:
+ link = re.search(r"playlist: '(/get_file\.php\?stream=[A-Za-z0-9=]+)'", self.html)
+ if link:
+ self.html = self.load("http://www.%s%s" % (self.HOSTER_NAME, link.group(1)))
+ link = re.search(r'media:content url="(http://.*?)"', self.html)
+ if not link:
+ pattern = "\"(http://media\\-b\\d+\\.%s\\.%s/download/\\d+/.*?)\"" % self.HOSTER_NAME.rsplit(".")
+ link = re.search(pattern, self.html)
+ else:
+ self.parseError('Unable to detect a download link')
+
+ link = link.group(1).replace("&amp;", "&")
+ if link.startswith("http://"):
+ return link
+ else:
+ return "http://www.%s%s" % (self.HOSTER_NAME, link)
+
+ def processName(self, name_old):
+ name = self.pyfile.name
+ if name <= name_old:
+ return
+ name_new = re.sub(r'\.[^.]+$', "", name_old) + name[len(name_old):]
+ filename = self.lastDownload
+ self.pyfile.name = name_new
+ rename(filename, filename.rsplit(name)[0] + name_new)
+ self.logInfo("%(name)s renamed to %(newname)s" % {"name": name, "newname": name_new})
diff --git a/pyload/plugins/hoster/QuickshareCz.py b/pyload/plugins/hoster/QuickshareCz.py
new file mode 100644
index 000000000..a781d7eff
--- /dev/null
+++ b/pyload/plugins/hoster/QuickshareCz.py
@@ -0,0 +1,103 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from pycurl import FOLLOWLOCATION
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class QuickshareCz(SimpleHoster):
+ __name__ = "QuickshareCz"
+ __type__ = "hoster"
+ __pattern__ = r"http://.*quickshare.cz/stahnout-soubor/.*"
+ __version__ = "0.54"
+ __description__ = """Quickshare.cz"""
+ __author_name__ = ("zoidberg")
+
+ FILE_NAME_PATTERN = r'<th width="145px">Název:</th>\s*<td style="word-wrap:break-word;">(?P<N>[^<]+)</td>'
+ FILE_SIZE_PATTERN = r'<th>Velikost:</th>\s*<td>(?P<S>[0-9.]+) (?P<U>[kKMG])i?B</td>'
+ FILE_OFFLINE_PATTERN = r'<script type="text/javascript">location.href=\'/chyba\';</script>'
+
+ def process(self, pyfile):
+ self.html = self.load(pyfile.url, decode=True)
+ self.getFileInfo()
+
+ # parse js variables
+ self.jsvars = dict((x, y.strip("'")) for x, y in re.findall(r"var (\w+) = ([0-9.]+|'[^']*')", self.html))
+ self.logDebug(self.jsvars)
+ pyfile.name = self.jsvars['ID3']
+
+ # determine download type - free or premium
+ if self.premium:
+ if 'UU_prihlasen' in self.jsvars:
+ if self.jsvars['UU_prihlasen'] == '0':
+ self.logWarning('User not logged in')
+ self.relogin(self.user)
+ self.retry()
+ elif float(self.jsvars['UU_kredit']) < float(self.jsvars['kredit_odecet']):
+ self.logWarning('Not enough credit left')
+ self.premium = False
+
+ if self.premium:
+ self.handlePremium()
+ else:
+ self.handleFree()
+
+ check = self.checkDownload({"err": re.compile(r"\AChyba!")}, max_size=100)
+ if check == "err":
+ self.fail("File not found or plugin defect")
+
+ def handleFree(self):
+ # get download url
+ download_url = '%s/download.php' % self.jsvars['server']
+ data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ('ID1', 'ID2', 'ID3', 'ID4'))
+ self.logDebug("FREE URL1:" + download_url, data)
+
+ self.req.http.c.setopt(FOLLOWLOCATION, 0)
+ self.load(download_url, post=data)
+ self.header = self.req.http.header
+ self.req.http.c.setopt(FOLLOWLOCATION, 1)
+
+ found = re.search("Location\s*:\s*(.*)", self.header, re.I)
+ if not found:
+ self.fail('File not found')
+ download_url = found.group(1)
+ self.logDebug("FREE URL2:" + download_url)
+
+ # check errors
+ found = re.search(r'/chyba/(\d+)', download_url)
+ if found:
+ if found.group(1) == '1':
+ self.retry(max_tries=60, wait_time=120, reason="This IP is already downloading")
+ elif found.group(1) == '2':
+ self.retry(max_tries=60, wait_time=60, reason="No free slots available")
+ else:
+ self.fail('Error %d' % found.group(1))
+
+ # download file
+ self.download(download_url)
+
+ def handlePremium(self):
+ download_url = '%s/download_premium.php' % self.jsvars['server']
+ data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ('ID1', 'ID2', 'ID4', 'ID5'))
+ self.logDebug("PREMIUM URL:" + download_url, data)
+ self.download(download_url, get=data)
+
+
+getInfo = create_getInfo(QuickshareCz)
diff --git a/pyload/plugins/hoster/RPNetBiz.py b/pyload/plugins/hoster/RPNetBiz.py
new file mode 100644
index 000000000..ae8ccf8a9
--- /dev/null
+++ b/pyload/plugins/hoster/RPNetBiz.py
@@ -0,0 +1,76 @@
+import re
+
+from module.plugins.Hoster import Hoster
+from module.common.json_layer import json_loads
+
+
+class RPNetBiz(Hoster):
+ __name__ = "RPNetBiz"
+ __version__ = "0.1"
+ __type__ = "hoster"
+ __description__ = """RPNet.Biz hoster plugin"""
+ __pattern__ = r"https?://.*rpnet\.biz"
+ __author_name__ = ("Dman")
+ __author_mail__ = ("dmanugm@gmail.com")
+
+ def setup(self):
+ self.chunkLimit = -1
+ self.resumeDownload = True
+
+ def process(self, pyfile):
+
+ if re.match(self.__pattern__, pyfile.url):
+ link_status = {'generated': pyfile.url}
+ elif not self.account:
+ # Check account
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "rpnet")
+ self.fail("No rpnet account provided")
+ else:
+ (user, data) = self.account.selectAccount()
+
+ self.logDebug("Original URL: %s" % pyfile.url)
+ # Get the download link
+ response = self.load("https://premium.rpnet.biz/client_api.php",
+ get={"username": user, "password": data['password'],
+ "action": "generate", "links": self.pyfile.url})
+
+ self.logDebug("JSON data: %s" % response)
+ link_status = json_loads(response)['links'][0] # get the first link... since we only queried one
+
+ # Check if we only have an id as a HDD link
+ if 'id' in link_status:
+ self.logDebug("Need to wait at least 30 seconds before requery")
+ self.setWait(30) # wait for 30 seconds
+ self.wait()
+ # 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
+ my_try = 0
+ while (my_try <= max_tries):
+ self.logDebug("Try: %d ; Max Tries: %d" % (my_try, max_tries))
+ response = self.load("https://premium.rpnet.biz/client_api.php",
+ get={"username": user, "password": data['password'],
+ "action": "downloadInformation", "id": link_status['id']})
+ self.logDebug("JSON data hdd query: %s" % response)
+ download_status = json_loads(response)['download']
+
+ if download_status['status'] == '100':
+ link_status['generated'] = download_status['rpnet_link']
+ self.logDebug("Successfully downloaded to rpnet HDD: %s" % link_status['generated'])
+ break
+ else:
+ self.logDebug("At %s%% for the file download" % download_status['status'])
+
+ self.setWait(30)
+ self.wait()
+ my_try += 1
+
+ if my_try > max_tries: # We went over the limit!
+ self.fail("Waited for about 15 minutes for download to finish but failed")
+
+ if 'generated' in link_status:
+ self.download(link_status['generated'], disposition=True)
+ elif 'error' in link_status:
+ self.fail(link_status['error'])
+ else:
+ self.fail("Something went wrong, not supposed to enter here")
diff --git a/pyload/plugins/hoster/RapidgatorNet.py b/pyload/plugins/hoster/RapidgatorNet.py
new file mode 100644
index 000000000..611d2ba5d
--- /dev/null
+++ b/pyload/plugins/hoster/RapidgatorNet.py
@@ -0,0 +1,196 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from pycurl import HTTPHEADER
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.plugins.internal.CaptchaService import ReCaptcha, SolveMedia, AdsCaptcha
+from module.common.json_layer import json_loads
+from module.network.HTTPRequest import BadHeader
+
+
+class RapidgatorNet(SimpleHoster):
+ __name__ = "RapidgatorNet"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?(rapidgator.net)/file/(\w+)"
+ __version__ = "0.19"
+ __description__ = """rapidgator.net"""
+ __author_name__ = ("zoidberg", "chrox", "stickell")
+
+ API_URL = 'http://rapidgator.net/api/file'
+
+ FILE_NAME_PATTERN = r'Downloading:(?:\s*<[^>]*>)*\s*(?P<N>.*?)(?:\s*<[^>]*>)'
+ FILE_SIZE_PATTERN = r'File size:\s*<strong>(?P<S>.*?)</strong>'
+ FILE_OFFLINE_PATTERN = r'<title>File not found</title>'
+
+ JSVARS_PATTERN = r"\s+var\s*(startTimerUrl|getDownloadUrl|captchaUrl|fid|secs)\s*=\s*'?(.*?)'?;"
+ DOWNLOAD_LINK_PATTERN = r"return '(http[^']+)';\s*}\s*}\s*}?\);"
+ RECAPTCHA_KEY_PATTERN = r'"http://api.recaptcha.net/challenge?k=(.*?)"'
+ ADSCAPTCHA_SRC_PATTERN = r'(http://api.adscaptcha.com/Get.aspx[^"\']*)'
+ SOLVEMEDIA_PATTERN = r'http:\/\/api\.solvemedia\.com\/papi\/challenge\.script\?k=(.*?)"'
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = False
+ self.sid = None
+ self.chunkLimit = 1
+ self.req.setOption("timeout", 120)
+
+ def process(self, pyfile):
+ if self.account:
+ self.sid = self.account.getAccountData(self.user).get('SID', None)
+
+ if self.sid:
+ self.handlePremium()
+ else:
+ self.handleFree()
+
+ def getAPIResponse(self, cmd):
+ try:
+ json = self.load('%s/%s' % (self.API_URL, cmd),
+ get={'sid': self.sid,
+ 'url': self.pyfile.url}, decode=True)
+ self.logDebug('API:%s' % cmd, json, "SID: %s" % self.sid)
+ json = json_loads(json)
+ status = json['response_status']
+ msg = json['response_details']
+ except BadHeader, e:
+ self.logError('API:%s' % cmd, e, "SID: %s" % self.sid)
+ status = e.code
+ msg = e
+
+ if status == 200:
+ return json['response']
+ elif status == 423:
+ self.account.empty(self.user)
+ self.retry()
+ else:
+ self.account.relogin(self.user)
+ self.retry(wait_time=60)
+
+ def handlePremium(self):
+ #self.logDebug("ACCOUNT_DATA", self.account.getAccountData(self.user))
+ self.api_data = self.getAPIResponse('info')
+ self.api_data['md5'] = self.api_data['hash']
+ self.pyfile.name = self.api_data['filename']
+ self.pyfile.size = self.api_data['size']
+ url = self.getAPIResponse('download')['url']
+ self.multiDL = True
+ self.download(url)
+
+ def handleFree(self):
+ self.html = self.load(self.pyfile.url, decode=True)
+ self.getFileInfo()
+
+ if ("You can download files up to 500 MB in free mode" in self.html or
+ "This file can be downloaded by premium only" in self.html):
+ self.fail("Premium account needed for download")
+
+ self.checkWait()
+
+ jsvars = dict(re.findall(self.JSVARS_PATTERN, self.html))
+ self.logDebug(jsvars)
+
+ self.req.http.lastURL = self.pyfile.url
+ self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
+
+ url = "http://rapidgator.net%s?fid=%s" % (
+ jsvars.get('startTimerUrl', '/download/AjaxStartTimer'), jsvars["fid"])
+ jsvars.update(self.getJsonResponse(url))
+
+ self.setWait(int(jsvars.get('secs', 30)) + 1, False)
+ self.wait()
+
+ url = "http://rapidgator.net%s?sid=%s" % (
+ jsvars.get('getDownloadUrl', '/download/AjaxGetDownload'), jsvars["sid"])
+ jsvars.update(self.getJsonResponse(url))
+
+ self.req.http.lastURL = self.pyfile.url
+ self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With:"])
+
+ url = "http://rapidgator.net%s" % jsvars.get('captchaUrl', '/download/captcha')
+ self.html = self.load(url)
+ found = re.search(self.ADSCAPTCHA_SRC_PATTERN, self.html)
+ if found:
+ captcha_key = found.group(1)
+ captcha = AdsCaptcha(self)
+ else:
+ found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html)
+ if found:
+ captcha_key = found.group(1)
+ captcha = ReCaptcha(self)
+
+ else:
+ found = re.search(self.SOLVEMEDIA_PATTERN, self.html)
+ if found:
+ captcha_key = found.group(1)
+ captcha = SolveMedia(self)
+ else:
+ self.parseError("Captcha")
+
+ for i in range(5):
+ self.checkWait()
+ captcha_challenge, captcha_response = captcha.challenge(captcha_key)
+
+ self.html = self.load(url, post={
+ "DownloadCaptchaForm[captcha]": "",
+ "adcopy_challenge": captcha_challenge,
+ "adcopy_response": captcha_response
+ })
+
+ if 'The verification code is incorrect' in self.html:
+ self.invalidCaptcha()
+ else:
+ self.correctCaptcha()
+ break
+ else:
+ self.fail("No valid captcha solution received")
+
+ found = re.search(self.DOWNLOAD_LINK_PATTERN, self.html)
+ if not found:
+ self.parseError("download link")
+ download_url = found.group(1)
+ self.logDebug(download_url)
+ self.download(download_url)
+
+ def checkWait(self):
+ found = re.search(r"(?:Delay between downloads must be not less than|Try again in)\s*(\d+)\s*(hour|min)",
+ self.html)
+ if found:
+ wait_time = int(found.group(1)) * {"hour": 60, "min": 1}[found.group(2)]
+ else:
+ found = re.search(r"You have reached your (daily|hourly) downloads limit", self.html)
+ if found:
+ wait_time = 60
+ else:
+ return
+
+ self.logDebug("Waiting %d minutes" % wait_time)
+ self.setWait(wait_time * 60, True)
+ self.wait()
+ self.retry(max_tries=24)
+
+ def getJsonResponse(self, url):
+ response = self.load(url, decode=True)
+ if not response.startswith('{'):
+ self.retry()
+ self.logDebug(url, response)
+ return json_loads(response)
+
+
+getInfo = create_getInfo(RapidgatorNet)
diff --git a/pyload/plugins/hoster/RapidshareCom.py b/pyload/plugins/hoster/RapidshareCom.py
new file mode 100644
index 000000000..9828bf4ce
--- /dev/null
+++ b/pyload/plugins/hoster/RapidshareCom.py
@@ -0,0 +1,230 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# v1.36
+# * fixed call checkfiles subroutine
+# v1.35
+# * fixed rs-urls in handleFree(..) and freeWait(..)
+# * removed getInfo(..) function as it was not used anywhere (in this file)
+# * removed some (old?) comment blocks
+
+import re
+
+from module.network.RequestFactory import getURL
+from module.plugins.Hoster import Hoster
+
+
+def getInfo(urls):
+ ids = ""
+ names = ""
+
+ p = re.compile(RapidshareCom.__pattern__)
+
+ for url in urls:
+ r = p.search(url)
+ if r.group("name"):
+ ids += "," + r.group("id")
+ names += "," + r.group("name")
+ elif r.group("name_new"):
+ ids += "," + r.group("id_new")
+ names += "," + r.group("name_new")
+
+ url = "http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=checkfiles&files=%s&filenames=%s" % (ids[1:], names[1:])
+
+ api = getURL(url)
+ result = []
+ i = 0
+ for res in api.split():
+ tmp = res.split(",")
+ if tmp[4] in ("0", "4", "5"):
+ status = 1
+ elif tmp[4] == "1":
+ status = 2
+ else:
+ status = 3
+
+ result.append((tmp[1], tmp[2], status, urls[i]))
+ i += 1
+
+ yield result
+
+
+class RapidshareCom(Hoster):
+ __name__ = "RapidshareCom"
+ __type__ = "hoster"
+ __pattern__ = r"https?://[\w\.]*?rapidshare.com/(?:files/(?P<id>\d*?)/(?P<name>[^?]+)|#!download\|(?:\w+)\|(?P<id_new>\d+)\|(?P<name_new>[^|]+))"
+ __version__ = "1.39"
+ __description__ = """Rapidshare.com Download Hoster"""
+ __config__ = [["server",
+ "Cogent;Deutsche Telekom;Level(3);Level(3) #2;GlobalCrossing;Level(3) #3;Teleglobe;GlobalCrossing #2;TeliaSonera #2;Teleglobe #2;TeliaSonera #3;TeliaSonera",
+ "Preferred Server", "None"]]
+ __author_name__ = ("spoob", "RaNaN", "mkaay")
+ __author_mail__ = ("spoob@pyload.org", "ranan@pyload.org", "mkaay@mkaay.de")
+
+ def setup(self):
+ self.html = None
+ self.no_download = True
+ self.api_data = None
+ self.offset = 0
+ self.dl_dict = {}
+
+ self.id = None
+ self.name = None
+
+ self.chunkLimit = -1 if self.premium else 1
+ self.multiDL = self.resumeDownload = self.premium
+
+ def process(self, pyfile):
+ self.url = self.pyfile.url
+ self.prepare()
+
+ def prepare(self):
+ m = re.search(self.__pattern__, self.url)
+
+ if m.group("name"):
+ self.id = m.group("id")
+ self.name = m.group("name")
+ else:
+ self.id = m.group("id_new")
+ self.name = m.group("name_new")
+
+ self.download_api_data()
+ if self.api_data["status"] == "1":
+ self.pyfile.name = self.get_file_name()
+
+ if self.premium:
+ self.handlePremium()
+ else:
+ self.handleFree()
+
+ elif self.api_data["status"] == "2":
+ self.logInfo(_("Rapidshare: Traffic Share (direct download)"))
+ self.pyfile.name = self.get_file_name()
+
+ self.download(self.pyfile.url, get={"directstart": 1})
+
+ elif self.api_data["status"] in ("0", "4", "5"):
+ self.offline()
+ elif self.api_data["status"] == "3":
+ self.tempOffline()
+ else:
+ self.fail("Unknown response code.")
+
+ def handleFree(self):
+
+ while self.no_download:
+ self.dl_dict = self.freeWait()
+
+ #tmp = "#!download|%(server)s|%(id)s|%(name)s|%(size)s"
+ download = "http://%(host)s/cgi-bin/rsapi.cgi?sub=download&editparentlocation=0&bin=1&fileid=%(id)s&filename=%(name)s&dlauth=%(auth)s" % self.dl_dict
+
+ self.logDebug("RS API Request: %s" % download)
+ self.download(download, ref=False)
+
+ check = self.checkDownload({"ip": "You need RapidPro to download more files from your IP address",
+ "auth": "Download auth invalid"})
+ if check == "ip":
+ self.setWait(60)
+ self.logInfo(_("Already downloading from this ip address, waiting 60 seconds"))
+ self.wait()
+ self.handleFree()
+ elif check == "auth":
+ self.logInfo(_("Invalid Auth Code, download will be restarted"))
+ self.offset += 5
+ self.handleFree()
+
+ def handlePremium(self):
+ info = self.account.getAccountInfo(self.user, True)
+ self.logDebug("%s: Use Premium Account" % self.__name__)
+ url = self.api_data["mirror"]
+ self.download(url, get={"directstart": 1})
+
+ def download_api_data(self, force=False):
+ """
+ http://images.rapidshare.com/apidoc.txt
+ """
+ if self.api_data and not force:
+ return
+ api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi"
+ api_param_file = {"sub": "checkfiles", "incmd5": "1", "files": self.id, "filenames": self.name}
+ src = self.load(api_url_base, cookies=False, get=api_param_file).strip()
+ self.logDebug("RS INFO API: %s" % src)
+ if src.startswith("ERROR"):
+ return
+ fields = src.split(",")
+
+ # status codes:
+ # 0=File not found
+ # 1=File OK (Anonymous downloading)
+ # 3=Server down
+ # 4=File marked as illegal
+ # 5=Anonymous file locked, because it has more than 10 downloads already
+ # 50+n=File OK (TrafficShare direct download type "n" without any logging.)
+ # 100+n=File OK (TrafficShare direct download type "n" with logging.
+ # Read our privacy policy to see what is logged.)
+
+ self.api_data = {"fileid": fields[0], "filename": fields[1], "size": int(fields[2]), "serverid": fields[3],
+ "status": fields[4], "shorthost": fields[5], "checksum": fields[6].strip().lower()}
+
+ if int(self.api_data["status"]) > 100:
+ self.api_data["status"] = str(int(self.api_data["status"]) - 100)
+ elif int(self.api_data["status"]) > 50:
+ self.api_data["status"] = str(int(self.api_data["status"]) - 50)
+
+ self.api_data["mirror"] = "http://rs%(serverid)s%(shorthost)s.rapidshare.com/files/%(fileid)s/%(filename)s" % self.api_data
+
+ def freeWait(self):
+ """downloads html with the important information
+ """
+ self.no_download = True
+
+ id = self.id
+ name = self.name
+
+ prepare = "https://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=download&fileid=%(id)s&filename=%(name)s&try=1&cbf=RSAPIDispatcher&cbid=1" % {
+ "name": name, "id": id}
+
+ self.logDebug("RS API Request: %s" % prepare)
+ result = self.load(prepare, ref=False)
+ self.logDebug("RS API Result: %s" % result)
+
+ between_wait = re.search("You need to wait (\d+) seconds", result)
+
+ if "You need RapidPro to download more files from your IP address" in result:
+ self.setWait(60)
+ self.logInfo(_("Already downloading from this ip address, waiting 60 seconds"))
+ self.wait()
+ elif ("Too many users downloading from this server right now" in result or
+ "All free download slots are full" in result):
+ self.setWait(120)
+ self.logInfo(_("RapidShareCom: No free slots"))
+ self.wait()
+ elif "This file is too big to download it for free" in result:
+ self.fail(_("You need a premium account for this file"))
+ elif "Filename invalid." in result:
+ self.fail(_("Filename reported invalid"))
+ elif between_wait:
+ self.setWait(int(between_wait.group(1)))
+ self.wantReconnect = True
+ self.wait()
+ else:
+ self.no_download = False
+
+ tmp, info = result.split(":")
+ data = info.split(",")
+
+ dl_dict = {"id": id,
+ "name": name,
+ "host": data[0],
+ "auth": data[1],
+ "server": self.api_data["serverid"],
+ "size": self.api_data["size"]}
+ self.setWait(int(data[2]) + 2 + self.offset)
+ self.wait()
+
+ return dl_dict
+
+ def get_file_name(self):
+ if self.api_data["filename"]:
+ return self.api_data["filename"]
+ return self.url.split("/")[-1]
diff --git a/pyload/plugins/hoster/RarefileNet.py b/pyload/plugins/hoster/RarefileNet.py
new file mode 100644
index 000000000..1ede51953
--- /dev/null
+++ b/pyload/plugins/hoster/RarefileNet.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+from module.utils import html_unescape
+
+
+class RarefileNet(XFileSharingPro):
+ __name__ = "RarefileNet"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)*rarefile.net/\w{12}"
+ __version__ = "0.03"
+ __description__ = """Rarefile.net hoster plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FILE_NAME_PATTERN = r'<td><font color="red">(?P<N>.*?)</font></td>'
+ FILE_SIZE_PATTERN = r'<td>Size : (?P<S>.+?)&nbsp;'
+ DIRECT_LINK_PATTERN = r'<a href="(?P<link>[^"]+)">(?P=link)</a>'
+ HOSTER_NAME = "rarefile.net"
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = self.premium
+
+ def handleCaptcha(self, inputs):
+ captcha_div = re.search(r'<b>Enter code.*?<div.*?>(.*?)</div>', self.html, re.S).group(1)
+ self.logDebug(captcha_div)
+ numerals = re.findall('<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div))
+ inputs['code'] = "".join([a[1] for a in sorted(numerals, key=lambda num: int(num[0]))])
+ self.logDebug("CAPTCHA", inputs['code'], numerals)
+ return 3
+
+
+getInfo = create_getInfo(RarefileNet)
diff --git a/pyload/plugins/hoster/RealdebridCom.py b/pyload/plugins/hoster/RealdebridCom.py
new file mode 100644
index 000000000..40ee96df9
--- /dev/null
+++ b/pyload/plugins/hoster/RealdebridCom.py
@@ -0,0 +1,89 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from time import time
+from urllib import quote, unquote
+from random import randrange
+
+from module.utils import parseFileSize
+from module.common.json_layer import json_loads
+from module.plugins.Hoster import Hoster
+
+
+class RealdebridCom(Hoster):
+ __name__ = "RealdebridCom"
+ __version__ = "0.53"
+ __type__ = "hoster"
+
+ __pattern__ = r"https?://.*real-debrid\..*"
+ __description__ = """Real-Debrid.com hoster plugin"""
+ __author_name__ = ("Devirex, Hazzard")
+ __author_mail__ = ("naibaf_11@yahoo.de")
+
+ def getFilename(self, url):
+ try:
+ name = unquote(url.rsplit("/", 1)[1])
+ except IndexError:
+ name = "Unknown_Filename..."
+ if not name or name.endswith(".."): # incomplete filename, append random stuff
+ name += "%s.tmp" % randrange(100, 999)
+ return name
+
+ def setup(self):
+ self.chunkLimit = 3
+ self.resumeDownload = True
+
+ def process(self, pyfile):
+ if re.match(self.__pattern__, pyfile.url):
+ new_url = pyfile.url
+ elif not self.account:
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "Real-debrid")
+ self.fail("No Real-debrid account provided")
+ else:
+ self.logDebug("Old URL: %s" % pyfile.url)
+ password = self.getPassword().splitlines()
+ if not password:
+ password = ""
+ else:
+ password = password[0]
+
+ url = "https://real-debrid.com/ajax/unrestrict.php?lang=en&link=%s&password=%s&time=%s" % (
+ quote(pyfile.url, ""), password, int(time() * 1000))
+ page = self.load(url)
+ data = json_loads(page)
+
+ self.logDebug("Returned Data: %s" % data)
+
+ if data["error"] != 0:
+ if data["message"] == "Your file is unavailable on the hoster.":
+ self.offline()
+ else:
+ self.logWarning(data["message"])
+ self.tempOffline()
+ else:
+ if self.pyfile.name is not None and self.pyfile.name.endswith('.tmp') and data["file_name"]:
+ self.pyfile.name = data["file_name"]
+ self.pyfile.size = parseFileSize(data["file_size"])
+ new_url = data['generated_links'][0][-1]
+
+ if self.getConfig("https"):
+ new_url = new_url.replace("http://", "https://")
+ else:
+ new_url = new_url.replace("https://", "http://")
+
+ if new_url != pyfile.url:
+ self.logDebug("New URL: %s" % new_url)
+
+ if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown") or pyfile.name.endswith('..'):
+ #only use when name wasnt already set
+ pyfile.name = self.getFilename(new_url)
+
+ self.download(new_url, disposition=True)
+
+ check = self.checkDownload(
+ {"error": "<title>An error occured while processing your request</title>"})
+
+ if check == "error":
+ #usual this download can safely be retried
+ self.retry(reason="An error occured while generating link.", wait_time=60)
diff --git a/pyload/plugins/hoster/RedtubeCom.py b/pyload/plugins/hoster/RedtubeCom.py
new file mode 100644
index 000000000..caf33eeac
--- /dev/null
+++ b/pyload/plugins/hoster/RedtubeCom.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Hoster import Hoster
+from module.unescape import unescape
+
+
+class RedtubeCom(Hoster):
+ __name__ = "RedtubeCom"
+ __type__ = "hoster"
+ __pattern__ = r'http://[\w\.]*?redtube\.com/\d+'
+ __version__ = "0.2"
+ __description__ = """Redtube.com Download Hoster"""
+ __author_name__ = ("jeix")
+ __author_mail__ = ("jeix@hasnomail.de")
+
+ def process(self, pyfile):
+ self.download_html()
+ if not self.file_exists():
+ self.offline()
+
+ pyfile.name = self.get_file_name()
+ self.download(self.get_file_url())
+
+ def download_html(self):
+ url = self.pyfile.url
+ self.html = self.load(url)
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if self.html is None:
+ self.download_html()
+
+ file_url = unescape(re.search(r'hashlink=(http.*?)"', self.html).group(1))
+
+ return file_url
+
+ def get_file_name(self):
+ if self.html is None:
+ self.download_html()
+
+ name = re.search('<title>(.*?)- RedTube - Free Porn Videos</title>', self.html).group(1).strip() + ".flv"
+ return name
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html is None:
+ self.download_html()
+
+ if re.search(r'This video has been removed.', self.html) is not None:
+ return False
+ else:
+ return True
diff --git a/pyload/plugins/hoster/RehostTo.py b/pyload/plugins/hoster/RehostTo.py
new file mode 100644
index 000000000..bb6110415
--- /dev/null
+++ b/pyload/plugins/hoster/RehostTo.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from urllib import quote, unquote
+from module.plugins.Hoster import Hoster
+
+
+class RehostTo(Hoster):
+ __name__ = "RehostTo"
+ __version__ = "0.13"
+ __type__ = "hoster"
+ __pattern__ = r"https?://.*rehost.to\..*"
+ __description__ = """rehost.com hoster plugin"""
+ __author_name__ = ("RaNaN")
+ __author_mail__ = ("RaNaN@pyload.org")
+
+ def getFilename(self, url):
+ return unquote(url.rsplit("/", 1)[1])
+
+ def setup(self):
+ self.chunkLimit = 1
+ self.resumeDownload = True
+
+ def process(self, pyfile):
+ if not self.account:
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "rehost.to")
+ self.fail("No rehost.to account provided")
+
+ data = self.account.getAccountInfo(self.user)
+ long_ses = data["long_ses"]
+
+ self.logDebug("Rehost.to: Old URL: %s" % pyfile.url)
+ new_url = "http://rehost.to/process_download.php?user=cookie&pass=%s&dl=%s" % (long_ses, quote(pyfile.url, ""))
+
+ #raise timeout to 2min
+ self.req.setOption("timeout", 120)
+
+ self.download(new_url, disposition=True)
diff --git a/pyload/plugins/hoster/ReloadCc.py b/pyload/plugins/hoster/ReloadCc.py
new file mode 100644
index 000000000..2295c792a
--- /dev/null
+++ b/pyload/plugins/hoster/ReloadCc.py
@@ -0,0 +1,113 @@
+from module.plugins.Hoster import Hoster
+
+from module.common.json_layer import json_loads
+
+from module.network.HTTPRequest import BadHeader
+
+
+class ReloadCc(Hoster):
+ __name__ = "ReloadCc"
+ __version__ = "0.5"
+ __type__ = "hoster"
+ __description__ = """Reload.Cc hoster plugin"""
+
+ # Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady
+ # create the regex patterns for us using getHosters in our ReloadCc hook.
+ __pattern__ = None
+
+ __author_name__ = ("Reload Team")
+ __author_mail__ = ("hello@reload.cc")
+
+ def process(self, pyfile):
+ # Check account
+ if not self.account or not self.account.canUse():
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "reload.cc")
+ self.fail("No valid reload.cc account provided")
+
+ # In some cases hostsers do not supply us with a filename at download, so we
+ # are going to set a fall back filename (e.g. for freakshare or xfileshare)
+ self.pyfile.name = self.pyfile.name.split('/').pop() # Remove everthing before last slash
+
+ # Correction for automatic assigned filename: Removing html at end if needed
+ suffix_to_remove = ["html", "htm", "php", "php3", "asp", "shtm", "shtml", "cfml", "cfm"]
+ temp = self.pyfile.name.split('.')
+ if temp.pop() in suffix_to_remove:
+ self.pyfile.name = ".".join(temp)
+
+ # Get account data
+ (user, data) = self.account.selectAccount()
+
+ query_params = dict(
+ via='pyload',
+ v=1,
+ user=user,
+ uri=self.pyfile.url
+ )
+
+ try:
+ query_params.update(dict(hash=self.account.infos[user]['pwdhash']))
+ except Exception:
+ query_params.update(dict(pwd=data['password']))
+
+ try:
+ answer = self.load("http://api.reload.cc/dl", get=query_params)
+ except BadHeader, e:
+ if e.code == 400:
+ self.fail("The URI is not supported by Reload.cc.")
+ elif e.code == 401:
+ self.fail("Wrong username or password")
+ elif e.code == 402:
+ self.fail("Your account is inactive. A payment is required for downloading!")
+ elif e.code == 403:
+ self.fail("Your account is disabled. Please contact the Reload.cc support!")
+ elif e.code == 409:
+ self.logWarning("The hoster seems to be a limited hoster and you've used your daily traffic for this hoster: %s" % self.pyfile.url)
+ # Wait for 6 hours and retry up to 4 times => one day
+ self.retry(max_retries=4, wait_time=(3600 * 6), reason="Limited hoster traffic limit exceeded")
+ elif e.code == 429:
+ # Too many connections, wait 2 minutes and try again
+ self.retry(max_retries=5, wait_time=120, reason="Too many concurrent connections")
+ elif e.code == 503:
+ # Retry in 10 minutes
+ self.retry(wait_time=600,
+ reason="Reload.cc is currently in maintenance mode! Please check again later.")
+ else:
+ self.fail(
+ "Internal error within Reload.cc. Please contact the Reload.cc support for further information.")
+ return
+
+ data = json_loads(answer)
+
+ # Check status and decide what to do
+ status = data.get('status', None)
+ if status == "ok":
+ conn_limit = data.get('msg', 0)
+ # API says these connections are limited
+ # Make sure this limit is used - the download will fail if not
+ if conn_limit > 0:
+ try:
+ self.limitDL = int(conn_limit)
+ except ValueError:
+ self.limitDL = 1
+ else:
+ self.limitDL = 0
+
+ try:
+ self.download(data['link'], disposition=True)
+ except BadHeader, e:
+ if e.code == 404:
+ self.fail("File Not Found")
+ elif e.code == 412:
+ self.fail("File access password is wrong")
+ elif e.code == 417:
+ self.fail("Password required for file access")
+ elif e.code == 429:
+ # Too many connections, wait 2 minutes and try again
+ self.retry(max_retries=5, wait_time=120, reason="Too many concurrent connections")
+ else:
+ self.fail(
+ "Internal error within Reload.cc. Please contact the Reload.cc support for further information."
+ )
+ return
+ else:
+ self.fail("Internal error within Reload.cc. Please contact the Reload.cc support for further information.")
diff --git a/pyload/plugins/hoster/RgHostNet.py b/pyload/plugins/hoster/RgHostNet.py
new file mode 100644
index 000000000..a46b51733
--- /dev/null
+++ b/pyload/plugins/hoster/RgHostNet.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class RgHostNet(SimpleHoster):
+ __name__ = "RgHostNet"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?rghost\.net/\d+(?:r=\d+)?"
+ __version__ = "0.01"
+ __description__ = """RgHost.net Download Hoster"""
+ __author_name__ = ("z00nx")
+ __author_mail__ = ("z00nx0@gmail.com")
+
+ FILE_INFO_PATTERN = r'<h1>\s+(<a[^>]+>)?(?P<N>[^<]+)(</a>)?\s+<small[^>]+>\s+\((?P<S>[^)]+)\)\s+</small>\s+</h1>'
+ FILE_OFFLINE_PATTERN = r'File is deleted|this page is not found'
+ DOWNLOAD_LINK_PATTERN = '''<a\s+href="([^"]+)"\s+class="btn\s+large\s+download"[^>]+>Download</a>'''
+
+ def handleFree(self):
+ found = re.search(self.DOWNLOAD_LINK_PATTERN, self.html)
+ if not found:
+ self.parseError("Unable to detect the direct link")
+ download_link = found.group(1)
+ self.download(download_link, disposition=True)
+
+getInfo = create_getInfo(RgHostNet)
diff --git a/pyload/plugins/hoster/RyushareCom.py b/pyload/plugins/hoster/RyushareCom.py
new file mode 100644
index 000000000..675eaddde
--- /dev/null
+++ b/pyload/plugins/hoster/RyushareCom.py
@@ -0,0 +1,89 @@
+# -*- coding: utf-8 -*-
+
+# Test links (random.bin):
+# http://ryushare.com/cl0jy8ric2js/random.bin
+
+import re
+
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+from module.plugins.internal.CaptchaService import SolveMedia
+
+
+class RyushareCom(XFileSharingPro):
+ __name__ = "RyushareCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)*?ryushare.com/\w{11,}"
+ __version__ = "0.13"
+ __description__ = """ryushare.com hoster plugin"""
+ __author_name__ = ("zoidberg", "stickell","quareevo")
+ __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it","quareevo@arcor.de")
+
+ HOSTER_NAME = "ryushare.com"
+
+ WAIT_PATTERN = r'You have to wait ((?P<hour>\d+) hour[s]?, )?((?P<min>\d+) minute[s], )?(?P<sec>\d+) second[s]'
+ DIRECT_LINK_PATTERN = r'(http://([^/]*?ryushare.com|\d+\.\d+\.\d+\.\d+)(:\d+/d/|/files/\w+/\w+/)[^"\'<]+)'
+ SOLVEMEDIA_PATTERN = r'http:\/\/api\.solvemedia\.com\/papi\/challenge\.script\?k=(.*?)"'
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = True
+ if not self.premium:
+ self.limitDL = 2
+ # Up to 3 chunks allowed in free downloads. Unknown for premium
+ self.chunkLimit = 3
+
+ def getDownloadLink(self):
+ retry = False
+ self.html = self.load(self.pyfile.url)
+ action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")})
+ if 'method_premium' in inputs:
+ del inputs['method_premium']
+
+ self.html = self.load(self.pyfile.url, post=inputs)
+ action, inputs = self.parseHtmlForm('F1')
+
+ self.setWait(65)
+ # Wait
+ if 'You have reached the download-limit!!!' in self.html:
+ self.setWait(3600, True)
+ retry = True
+
+ match = re.search(self.WAIT_PATTERN, self.html)
+ if match:
+ m = match.groupdict(0)
+ waittime = int(m["hour"])*60*60 + int(m['min']) * 60 + int(m['sec'])
+ self.setWait(waittime, True)
+ retry = True
+
+ self.wait()
+ if retry:
+ self.retry()
+
+ for i in xrange(5):
+
+ m = re.search(self.SOLVEMEDIA_PATTERN, self.html)
+ if not m:
+ self.parseError("Error parsing captcha")
+
+ captchaKey = m.group(1)
+ captcha = SolveMedia(self)
+ challenge, response = captcha.challenge(captchaKey)
+
+ inputs["adcopy_challenge"] = challenge
+ inputs["adcopy_response"] = response
+
+ self.html = self.load(self.pyfile.url, post = inputs)
+ if "WRONG CAPTCHA" in self.html:
+ self.invalidCaptcha()
+ self.logInfo("Invalid Captcha")
+ else:
+ self.correctCaptcha()
+ break
+
+ else:
+ self.fail("You have entered 5 invalid captcha codes")
+
+ if 'Click here to download' in self.html:
+ m = re.search(r'<a href="([^"]+)">Click here to download</a>', self.html)
+ return m.group(1)
+
+getInfo = create_getInfo(RyushareCom)
diff --git a/pyload/plugins/hoster/SecureUploadEu.py b/pyload/plugins/hoster/SecureUploadEu.py
new file mode 100644
index 000000000..dc220c508
--- /dev/null
+++ b/pyload/plugins/hoster/SecureUploadEu.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
+
+class SecureUploadEu(XFileSharingPro):
+ __name__ = "SecureUploadEu"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?secureupload\.eu/(\w){12}(/\w+)"
+ __version__ = "0.01"
+ __description__ = """SecureUpload.eu hoster plugin"""
+ __author_name__ = ("z00nx")
+ __author_mail__ = ("z00nx0@gmail.com")
+
+ HOSTER_NAME = "secureupload.eu"
+ FILE_INFO_PATTERN = '<h3>Downloading (?P<N>[^<]+) \((?P<S>[^<]+)\)</h3>'
+ FILE_OFFLINE_PATTERN = 'The file was removed|File Not Found'
+
+
+getInfo = create_getInfo(SecureUploadEu)
diff --git a/pyload/plugins/hoster/SendmywayCom.py b/pyload/plugins/hoster/SendmywayCom.py
new file mode 100644
index 000000000..9b4fc14bc
--- /dev/null
+++ b/pyload/plugins/hoster/SendmywayCom.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
+
+class SendmywayCom(XFileSharingPro):
+ __name__ = "SendmywayCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)*?sendmyway.com/\w{12}"
+ __version__ = "0.01"
+ __description__ = """SendMyWay hoster plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FILE_NAME_PATTERN = r'<p class="file-name" ><.*?>\s*(?P<N>.+)'
+ FILE_SIZE_PATTERN = r'<small>\((?P<S>\d+) bytes\)</small>'
+ HOSTER_NAME = "sendmyway.com"
+
+
+getInfo = create_getInfo(SendmywayCom)
diff --git a/pyload/plugins/hoster/SendspaceCom.py b/pyload/plugins/hoster/SendspaceCom.py
new file mode 100644
index 000000000..729ee17bc
--- /dev/null
+++ b/pyload/plugins/hoster/SendspaceCom.py
@@ -0,0 +1,70 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class SendspaceCom(SimpleHoster):
+ __name__ = "SendspaceCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?sendspace.com/file/.*"
+ __version__ = "0.13"
+ __description__ = """sendspace.com plugin - free only"""
+ __author_name__ = ("zoidberg")
+
+ DOWNLOAD_URL_PATTERN = r'<a id="download_button" href="([^"]+)"'
+ FILE_NAME_PATTERN = r'<h2 class="bgray">\s*<(?:b|strong)>(?P<N>[^<]+)</'
+ FILE_SIZE_PATTERN = r'<div class="file_description reverse margin_center">\s*<b>File Size:</b>\s*(?P<S>[0-9.]+)(?P<U>[kKMG])i?B\s*</div>'
+ FILE_OFFLINE_PATTERN = r'<div class="msg error" style="cursor: default">Sorry, the file you requested is not available.</div>'
+ CAPTCHA_PATTERN = r'<td><img src="(/captchas/captcha.php?captcha=([^"]+))"></td>'
+ USER_CAPTCHA_PATTERN = r'<td><img src="/captchas/captcha.php?user=([^"]+))"></td>'
+
+ def handleFree(self):
+ params = {}
+ for i in range(3):
+ found = re.search(self.DOWNLOAD_URL_PATTERN, self.html)
+ if found:
+ if 'captcha_hash' in params:
+ self.correctCaptcha()
+ download_url = found.group(1)
+ break
+
+ found = re.search(self.CAPTCHA_PATTERN, self.html)
+ if found:
+ if 'captcha_hash' in params:
+ self.invalidCaptcha()
+ captcha_url1 = "http://www.sendspace.com/" + found.group(1)
+ found = re.search(self.USER_CAPTCHA_PATTERN, self.html)
+ captcha_url2 = "http://www.sendspace.com/" + found.group(1)
+ params = {'captcha_hash': found.group(2),
+ 'captcha_submit': 'Verify',
+ 'captcha_answer': self.decryptCaptcha(captcha_url1) + " " + self.decryptCaptcha(captcha_url2)}
+ else:
+ params = {'download': "Regular Download"}
+
+ self.logDebug(params)
+ self.html = self.load(self.pyfile.url, post=params)
+ else:
+ self.fail("Download link not found")
+
+ self.logDebug("Download URL: %s" % download_url)
+ self.download(download_url)
+
+
+create_getInfo(SendspaceCom)
diff --git a/pyload/plugins/hoster/Share4webCom.py b/pyload/plugins/hoster/Share4webCom.py
new file mode 100644
index 000000000..ead808024
--- /dev/null
+++ b/pyload/plugins/hoster/Share4webCom.py
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.hoster.UnibytesCom import UnibytesCom
+from module.plugins.internal.SimpleHoster import create_getInfo
+
+
+class Share4webCom(UnibytesCom):
+ __name__ = "Share4webCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?share4web\.com/get/\w+"
+ __version__ = "0.1"
+ __description__ = """Share4web.com"""
+ __author_name__ = ("zoidberg")
+
+ DOMAIN = 'http://www.share4web.com'
+
+
+getInfo = create_getInfo(UnibytesCom)
diff --git a/pyload/plugins/hoster/Share76Com.py b/pyload/plugins/hoster/Share76Com.py
new file mode 100644
index 000000000..b48780652
--- /dev/null
+++ b/pyload/plugins/hoster/Share76Com.py
@@ -0,0 +1,17 @@
+# -*- coding: utf-8 -*-
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
+
+class Share76Com(XFileSharingPro):
+ __name__ = "Share76Com"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)*?share76.com/\w{12}"
+ __version__ = "0.03"
+ __description__ = """share76.com hoster plugin"""
+ __author_name__ = ("me")
+
+ FILE_INFO_PATTERN = r'<h2>\s*File:\s*<font[^>]*>(?P<N>[^>]+)</font>\s*\[<font[^>]*>(?P<S>[0-9.]+) (?P<U>[kKMG])i?B</font>\]</h2>'
+ HOSTER_NAME = "share76.com"
+
+
+getInfo = create_getInfo(Share76Com)
diff --git a/pyload/plugins/hoster/ShareFilesCo.py b/pyload/plugins/hoster/ShareFilesCo.py
new file mode 100644
index 000000000..245e20ea6
--- /dev/null
+++ b/pyload/plugins/hoster/ShareFilesCo.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+import re
+
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
+
+class ShareFilesCo(XFileSharingPro):
+ __name__ = "ShareFilesCo"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?sharefiles\.co/\w{12}"
+ __version__ = "0.01"
+ __description__ = """Sharefiles.co hoster plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ HOSTER_NAME = "sharefiles.co"
+
+ def startDownload(self, link):
+ link = link.strip()
+ if link.startswith('http://adf.ly'):
+ link = re.sub('http://adf.ly/\d+/', '', link)
+ if self.captcha:
+ self.correctCaptcha()
+ self.logDebug('DIRECT LINK: %s' % link)
+ self.download(link)
+
+
+getInfo = create_getInfo(ShareFilesCo)
diff --git a/pyload/plugins/hoster/ShareRapidCom.py b/pyload/plugins/hoster/ShareRapidCom.py
new file mode 100644
index 000000000..82f98d73c
--- /dev/null
+++ b/pyload/plugins/hoster/ShareRapidCom.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+
+from pycurl import HTTPHEADER
+from module.network.HTTPRequest import BadHeader
+from module.network.RequestFactory import getRequest
+from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo, replace_patterns
+
+
+def getInfo(urls):
+ h = getRequest()
+ h.c.setopt(HTTPHEADER,
+ ["Accept: text/html",
+ "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0"])
+ for url in urls:
+ html = h.load(url, decode=True)
+ file_info = parseFileInfo(ShareRapidCom, replace_patterns(url, ShareRapidCom.FILE_URL_REPLACEMENTS), html)
+ yield file_info
+
+
+class ShareRapidCom(SimpleHoster):
+ __name__ = "ShareRapidCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?((share(-?rapid\.(biz|com|cz|info|eu|net|org|pl|sk)|-(central|credit|free|net)\.cz|-ms\.net)|(s-?rapid|rapids)\.(cz|sk))|(e-stahuj|mediatack|premium-rapidshare|rapidshare-premium|qiuck)\.cz|kadzet\.com|stahuj-zdarma\.eu|strelci\.net|universal-share\.com)/stahuj/(?P<id>\w+)"
+ __version__ = "0.53"
+ __description__ = """Share-rapid.com plugin - premium only"""
+ __author_name__ = ("MikyWoW", "zoidberg", "stickell")
+ __author_mail__ = ("MikyWoW@seznam.cz", "zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+
+ FILE_NAME_PATTERN = r'<h1[^>]*><span[^>]*>(?:<a[^>]*>)?(?P<N>[^<]+)'
+ FILE_SIZE_PATTERN = r'<td class="i">Velikost:</td>\s*<td class="h"><strong>\s*(?P<S>[0-9.]+) (?P<U>[kKMG])i?B</strong></td>'
+ FILE_OFFLINE_PATTERN = ur'Nastala chyba 404|Soubor byl smazán'
+
+ DOWNLOAD_URL_PATTERN = r'<a href="([^"]+)" title="Stahnout">([^<]+)</a>'
+ ERR_LOGIN_PATTERN = ur'<div class="error_div"><strong>Stahování je přístupné pouze přihlášenÃœm uÅŸivatelům'
+ ERR_CREDIT_PATTERN = ur'<div class="error_div"><strong>Stahování zdarma je moÅŸné jen přes náš'
+
+ FILE_URL_REPLACEMENTS = [(__pattern__, r'http://share-rapid.com/stahuj/\g<id>')]
+
+ def setup(self):
+ self.chunkLimit = 1
+ self.resumeDownload = True
+
+ def process(self, pyfile):
+ if not self.account:
+ self.fail("User not logged in")
+
+ try:
+ self.html = self.load(pyfile.url, decode=True)
+ except BadHeader, e:
+ self.account.relogin(self.user)
+ self.retry(3, 0, str(e))
+
+ self.getFileInfo()
+
+ found = re.search(self.DOWNLOAD_URL_PATTERN, self.html)
+ if found:
+ link = found.group(1)
+ self.logDebug("Premium link: %s" % link)
+
+ self.download(link, disposition=True)
+ else:
+ if re.search(self.ERR_LOGIN_PATTERN, self.html):
+ self.relogin(self.user)
+ self.retry(3, 0, "User login failed")
+ elif re.search(self.ERR_CREDIT_PATTERN, self.html):
+ self.fail("Not enough credit left")
+ else:
+ self.fail("Download link not found")
diff --git a/pyload/plugins/hoster/SharebeesCom.py b/pyload/plugins/hoster/SharebeesCom.py
new file mode 100644
index 000000000..cc1173fea
--- /dev/null
+++ b/pyload/plugins/hoster/SharebeesCom.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
+
+class SharebeesCom(XFileSharingPro):
+ __name__ = "SharebeesCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)*?sharebees.com/\w{12}"
+ __version__ = "0.01"
+ __description__ = """ShareBees hoster plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FILE_NAME_PATTERN = r'<p class="file-name" ><.*?>\s*(?P<N>.+)'
+ FILE_SIZE_PATTERN = r'<small>\((?P<S>\d+) bytes\)</small>'
+ FORM_PATTERN = 'F1'
+ HOSTER_NAME = "sharebees.com"
+
+
+getInfo = create_getInfo(SharebeesCom)
diff --git a/pyload/plugins/hoster/ShareonlineBiz.py b/pyload/plugins/hoster/ShareonlineBiz.py
new file mode 100644
index 000000000..7c0f9c069
--- /dev/null
+++ b/pyload/plugins/hoster/ShareonlineBiz.py
@@ -0,0 +1,209 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from base64 import b64decode
+import hashlib
+import random
+from time import time, sleep
+
+from module.plugins.Hoster import Hoster
+from module.network.RequestFactory import getURL
+from module.plugins.Plugin import chunks
+from module.plugins.internal.CaptchaService import ReCaptcha as _ReCaptcha
+
+
+def getInfo(urls):
+ api_url_base = "http://api.share-online.biz/linkcheck.php"
+
+ for chunk in chunks(urls, 90):
+ api_param_file = {"links": "\n".join(x.replace("http://www.share-online.biz/dl/", "").rstrip("/") for x in
+ chunk)} # api only supports old style links
+ src = getURL(api_url_base, post=api_param_file, decode=True)
+ result = []
+ for i, res in enumerate(src.split("\n")):
+ if not res:
+ continue
+ fields = res.split(";")
+
+ if fields[1] == "OK":
+ status = 2
+ elif fields[1] in ("DELETED", "NOT FOUND"):
+ status = 1
+ else:
+ status = 3
+
+ result.append((fields[2], int(fields[3]), status, chunk[i]))
+ yield result
+
+
+#suppress ocr plugin
+class ReCaptcha(_ReCaptcha):
+ def result(self, server, challenge):
+ return self.plugin.decryptCaptcha("%simage" % server, get={"c": challenge},
+ cookies=True, forceUser=True, imgtype="jpg")
+
+
+class ShareonlineBiz(Hoster):
+ __name__ = "ShareonlineBiz"
+ __type__ = "hoster"
+ __pattern__ = r"http://[\w\.]*?(share\-online\.biz|egoshare\.com)/(download.php\?id\=|dl/)[\w]+"
+ __version__ = "0.36"
+ __description__ = """Shareonline.biz Download Hoster"""
+ __author_name__ = ("spoob", "mkaay", "zoidberg")
+ __author_mail__ = ("spoob@pyload.org", "mkaay@mkaay.de", "zoidberg@mujmail.cz")
+
+ ERROR_INFO_PATTERN = r'<p class="b">Information:</p>\s*<div>\s*<strong>(.*?)</strong>'
+
+ def setup(self):
+ # range request not working?
+ # api supports resume, only one chunk
+ # website isn't supporting resuming in first place
+ self.file_id = re.search(r"(id\=|/dl/)([a-zA-Z0-9]+)", self.pyfile.url).group(2)
+ self.pyfile.url = "http://www.share-online.biz/dl/" + self.file_id
+
+ self.resumeDownload = self.premium
+ self.multiDL = False
+ #self.chunkLimit = 1
+
+ self.check_data = None
+
+ def process(self, pyfile):
+ if self.premium:
+ self.handleAPIPremium()
+ #web-download fallback removed - didn't work anyway
+ else:
+ self.handleFree()
+
+ # check = self.checkDownload({"failure": re.compile(self.ERROR_INFO_PATTERN)})
+ # if check == "failure":
+ # try:
+ # self.retry(reason = self.lastCheck.group(1).decode("utf8"))
+ # except:
+ # self.retry(reason = "Unknown error")
+
+ if self.api_data:
+ self.check_data = {"size": int(self.api_data['size']), "md5": self.api_data['md5']}
+
+ def downloadAPIData(self):
+ api_url_base = "http://api.share-online.biz/linkcheck.php?md5=1"
+ api_param_file = {"links": self.pyfile.url.replace(
+ "http://www.share-online.biz/dl/", "")} # api only supports old style links
+ src = self.load(api_url_base, cookies=False, post=api_param_file, decode=True)
+
+ fields = src.split(";")
+ self.api_data = {"fileid": fields[0],
+ "status": fields[1]}
+ if not self.api_data["status"] == "OK":
+ self.offline()
+ self.api_data["filename"] = fields[2]
+ self.api_data["size"] = fields[3] # in bytes
+ self.api_data["md5"] = fields[4].strip().lower().replace("\n\n", "") # md5
+
+ def handleFree(self):
+ self.downloadAPIData()
+ self.pyfile.name = self.api_data["filename"]
+ self.pyfile.size = int(self.api_data["size"])
+
+ self.html = self.load(self.pyfile.url, cookies=True) # refer, stuff
+ self.setWait(3)
+ self.wait()
+
+ self.html = self.load("%s/free/" % self.pyfile.url, post={"dl_free": "1", "choice": "free"}, decode=True)
+ self.checkErrors()
+
+ found = re.search(r'var wait=(\d+);', self.html)
+
+ recaptcha = ReCaptcha(self)
+ for i in range(5):
+ challenge, response = recaptcha.challenge("6LdatrsSAAAAAHZrB70txiV5p-8Iv8BtVxlTtjKX")
+ self.setWait(int(found.group(1)) if found else 30)
+ response = self.load("%s/free/captcha/%d" % (self.pyfile.url, int(time() * 1000)), post={
+ 'dl_free': '1',
+ 'recaptcha_challenge_field': challenge,
+ 'recaptcha_response_field': response})
+
+ if not response == '0':
+ break
+
+ else:
+ self.fail("No valid captcha solution received")
+
+ download_url = response.decode("base64")
+ self.logDebug(download_url)
+ if not download_url.startswith("http://"):
+ self.parseError("download url")
+
+ self.wait()
+ self.download(download_url)
+ # check download
+ check = self.checkDownload({
+ "cookie": re.compile(r'<div id="dl_failure"'),
+ "fail": re.compile(r"<title>Share-Online")
+ })
+ if check == "cookie":
+ self.retry(5, 60, "Cookie failure")
+ elif check == "fail":
+ self.retry(5, 300, "Download failed")
+
+ def checkErrors(self):
+ found = re.search(r"/failure/(.*?)/1", self.req.lastEffectiveURL)
+ if found:
+ err = found.group(1)
+ found = re.search(self.ERROR_INFO_PATTERN, self.html)
+ msg = found.group(1) if found else ""
+ self.logError(err, msg or "Unknown error occurred")
+
+ if err in ('freelimit', 'size', 'proxy'):
+ self.fail(msg or "Premium account needed")
+ if err in 'invalid':
+ self.fail(msg or "File not available")
+ elif err in 'server':
+ self.setWait(600, False)
+ elif err in 'expired':
+ self.setWait(30, False)
+ else:
+ self.setWait(300, True)
+
+ self.wait()
+ self.retry(max_tries=25, reason=msg)
+
+ def handleAPIPremium(self): # should be working better
+ self.account.getAccountInfo(self.user, True)
+ src = self.load("http://api.share-online.biz/account.php",
+ {"username": self.user, "password": self.account.accounts[self.user]["password"],
+ "act": "download", "lid": self.file_id})
+
+ self.api_data = dlinfo = {}
+ for line in src.splitlines():
+ key, value = line.split(": ")
+ dlinfo[key.lower()] = value
+
+ self.logDebug(dlinfo)
+ if not dlinfo["status"] == "online":
+ self.offline()
+
+ self.pyfile.name = dlinfo["name"]
+ self.pyfile.size = int(dlinfo["size"])
+
+ dlLink = dlinfo["url"]
+ if dlLink == "server_under_maintenance":
+ self.tempoffline()
+ else:
+ self.multiDL = True
+ self.download(dlLink)
+
+ def checksum(self, local_file):
+ if self.api_data and "md5" in self.api_data and self.api_data["md5"]:
+ h = hashlib.md5()
+ f = open(local_file, "rb")
+ h.update(f.read())
+ f.close()
+ hexd = h.hexdigest()
+ if hexd == self.api_data["md5"]:
+ return True, 0
+ else:
+ return False, 1
+ else:
+ self.logWarning("MD5 checksum missing")
+ return True, 5
diff --git a/pyload/plugins/hoster/ShareplaceCom.py b/pyload/plugins/hoster/ShareplaceCom.py
new file mode 100644
index 000000000..e51c3160f
--- /dev/null
+++ b/pyload/plugins/hoster/ShareplaceCom.py
@@ -0,0 +1,80 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+import urllib
+from module.plugins.Hoster import Hoster
+
+
+class ShareplaceCom(Hoster):
+ __name__ = "ShareplaceCom"
+ __type__ = "hoster"
+ __pattern__ = r"(http://)?(www\.)?shareplace\.(com|org)/\?[a-zA-Z0-9]+"
+ __version__ = "0.11"
+ __description__ = """Shareplace.com Download Hoster"""
+ __author_name__ = ("ACCakut, based on YourfilesTo by jeix and skydancer")
+ __author_mail__ = ("none")
+
+ def process(self, pyfile):
+ self.pyfile = pyfile
+ self.prepare()
+ self.download(self.get_file_url())
+
+ def prepare(self):
+ if not self.file_exists():
+ self.offline()
+
+ self.pyfile.name = self.get_file_name()
+
+ wait_time = self.get_waiting_time()
+ self.setWait(wait_time)
+ self.logDebug("%s: Waiting %d seconds." % (self.__name__, wait_time))
+ self.wait()
+
+ def get_waiting_time(self):
+ if self.html is None:
+ self.download_html()
+
+ #var zzipitime = 15;
+ m = re.search(r'var zzipitime = (\d+);', self.html)
+ if m:
+ sec = int(m.group(1))
+ else:
+ sec = 0
+
+ return sec
+
+ def download_html(self):
+ url = re.sub("shareplace.com\/\?", "shareplace.com//index1.php/?a=", self.pyfile.url)
+ self.html = self.load(url, decode=True)
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ url = re.search(r"var beer = '(.*?)';", self.html)
+ if url:
+ url = url.group(1)
+ url = urllib.unquote(
+ url.replace("http://http:/", "").replace("vvvvvvvvv", "").replace("lllllllll", "").replace(
+ "teletubbies", ""))
+ self.logDebug("URL: %s" % url)
+ return url
+ else:
+ self.fail("absolute filepath could not be found. offline? ")
+
+ def get_file_name(self):
+ if self.html is None:
+ self.download_html()
+
+ return re.search("<title>\s*(.*?)\s*</title>", self.html).group(1)
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html is None:
+ self.download_html()
+
+ if re.search(r"HTTP Status 404", self.html) is not None:
+ return False
+ else:
+ return True
diff --git a/pyload/plugins/hoster/ShragleCom.py b/pyload/plugins/hoster/ShragleCom.py
new file mode 100644
index 000000000..5d19afbc7
--- /dev/null
+++ b/pyload/plugins/hoster/ShragleCom.py
@@ -0,0 +1,104 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from pycurl import FOLLOWLOCATION
+
+from module.plugins.Hoster import Hoster
+from module.plugins.internal.SimpleHoster import parseHtmlForm
+from module.plugins.internal.CaptchaService import ReCaptcha
+from module.network.RequestFactory import getURL
+
+API_KEY = "078e5ca290d728fd874121030efb4a0d"
+
+
+def parseFileInfo(self, url):
+ file_id = re.match(self.__pattern__, url).group('ID')
+
+ data = getURL("http://www.cloudnator.com/api.php?key=%s&action=getStatus&fileID=%s" % (API_KEY, file_id),
+ decode=True).split()
+
+ if len(data) == 4:
+ name, size, md5, status = data
+ size = int(size)
+
+ if hasattr(self, "check_data"):
+ self.checkdata = {"size": size, "md5": md5}
+
+ return name, size, 2 if status == "0" else 1, url
+ else:
+ return url, 0, 1, url
+
+
+def getInfo(urls):
+ for url in urls:
+ file_info = parseFileInfo(ShragleCom, url)
+ yield file_info
+
+
+class ShragleCom(Hoster):
+ __name__ = "ShragleCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www.)?(cloudnator|shragle).com/files/(?P<ID>.*?)/"
+ __version__ = "0.21"
+ __description__ = """Cloudnator.com (Shragle.com) Download PLugin"""
+ __author_name__ = ("RaNaN", "zoidberg")
+ __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz")
+
+ def setup(self):
+ self.multiDL = False
+ self.check_data = None
+
+ def process(self, pyfile):
+ #get file status and info
+ self.pyfile.name, self.pyfile.size, status = parseFileInfo(self, pyfile.url)[:3]
+ if status != 2:
+ self.offline()
+
+ self.handleFree()
+
+ def handleFree(self):
+ self.html = self.load(self.pyfile.url)
+
+ #get wait time
+ found = re.search('\s*var\sdownloadWait\s=\s(\d+);', self.html)
+ self.setWait(int(found.group(1)) if found else 30)
+
+ #parse download form
+ action, inputs = parseHtmlForm('id="download', self.html)
+
+ #solve captcha
+ found = re.search('recaptcha/api/(?:challenge|noscript)?k=(.+?)', self.html)
+ captcha_key = found.group(1) if found else "6LdEFb0SAAAAAAwM70vnYo2AkiVkCx-xmfniatHz"
+
+ recaptcha = ReCaptcha(self)
+
+ inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key)
+ self.wait()
+
+ #validate
+ self.req.http.c.setopt(FOLLOWLOCATION, 0)
+ self.html = self.load(action, post=inputs)
+
+ found = re.search(r"Location\s*:\s*(\S*)", self.req.http.header, re.I)
+ if found:
+ self.correctCaptcha()
+ download_url = found.group(1)
+ else:
+ if "Sicherheitscode falsch" in self.html:
+ self.invalidCaptcha()
+ self.retry(max_tries=5, reason="Invalid captcha")
+ else:
+ self.fail("Invalid session")
+
+ #download
+ self.req.http.c.setopt(FOLLOWLOCATION, 1)
+ self.download(download_url)
+
+ check = self.checkDownload({
+ "ip_blocked": re.compile(r'<div class="error".*IP.*loading')
+ })
+ if check == "ip_blocked":
+ self.setWait(1800, True)
+ self.wait()
+ self.retry()
diff --git a/pyload/plugins/hoster/SimplydebridCom.py b/pyload/plugins/hoster/SimplydebridCom.py
new file mode 100644
index 000000000..67cc39255
--- /dev/null
+++ b/pyload/plugins/hoster/SimplydebridCom.py
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from urllib import quote, unquote
+import re
+
+from module.plugins.Hoster import Hoster
+
+
+class SimplydebridCom(Hoster):
+ __name__ = "SimplydebridCom"
+ __version__ = "0.1"
+ __type__ = "hoster"
+ __pattern__ = r"http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/sd.php/*"
+ __description__ = """simply-debrid.com hoster plugin"""
+ __author_name__ = ("Kagenoshin")
+ __author_mail__ = ("kagenoshin@gmx.ch")
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = True
+ self.chunkLimit = 1
+
+ def process(self, pyfile):
+ if not self.account:
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "simply-debrid.com")
+ self.fail("No simply-debrid.com account provided")
+
+ self.logDebug("Old URL: %s" % pyfile.url)
+
+ #fix the links for simply-debrid.com!
+ new_url = pyfile.url
+ new_url = new_url.replace("clz.to", "cloudzer.net/file")
+ new_url = new_url.replace("http://share-online", "http://www.share-online")
+ new_url = new_url.replace("ul.to", "uploaded.net/file")
+ new_url = new_url.replace("uploaded.com", "uploaded.net")
+ new_url = new_url.replace("filerio.com", "filerio.in")
+ new_url = new_url.replace("lumfile.com", "lumfile.se")
+ if('fileparadox' in new_url):
+ new_url = new_url.replace("http://", "https://")
+
+ if re.match(self.__pattern__, new_url):
+ new_url = new_url
+
+ self.logDebug("New URL: %s" % new_url)
+
+ if not re.match(self.__pattern__, new_url):
+ page = self.load('http://simply-debrid.com/api.php', get={'dl': new_url}) #+'&u='+self.user+'&p='+self.account.getAccountData(self.user)['password'])
+ if 'tiger Link' in page or 'Invalid Link' in page or ('API' in page and 'ERROR' in page):
+ self.fail('Unable to unrestrict link')
+ new_url = page
+
+ self.setWait(5)
+ self.wait()
+ self.logDebug("Unrestricted URL: " + new_url)
+
+ self.download(new_url, disposition=True)
+
+ check = self.checkDownload({"bad1": "No address associated with hostname", "bad2": "<html"})
+
+ if check == "bad1" or check == "bad2":
+ self.retry(24, 150, 'Bad file downloaded')
diff --git a/pyload/plugins/hoster/SockshareCom.py b/pyload/plugins/hoster/SockshareCom.py
new file mode 100644
index 000000000..b2635d8bc
--- /dev/null
+++ b/pyload/plugins/hoster/SockshareCom.py
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: Walter Purcaro
+"""
+
+from module.plugins.hoster.PutlockerCom import PutlockerCom
+
+
+class SockshareCom(PutlockerCom):
+ __name__ = "SockshareCom"
+ __type__ = "hoster"
+ __pattern__ = r'http://(?:www\.)?sockshare\.com/(mobile/)?(file|embed)/(?P<ID>[A-Z0-9]+)'
+ __version__ = "0.01"
+ __description__ = """Sockshare.Com"""
+ __author_name__ = ("Walter Purcaro")
+ __author_mail__ = ("vuolter@gmail.com")
+
+ FILE_URL_REPLACEMENTS = [(__pattern__, r'http://www.sockshare.com/file/\g<ID>')]
+ HOSTER_NAME = "sockshare.com"
diff --git a/pyload/plugins/hoster/SpeedLoadOrg.py b/pyload/plugins/hoster/SpeedLoadOrg.py
new file mode 100644
index 000000000..5687fae85
--- /dev/null
+++ b/pyload/plugins/hoster/SpeedLoadOrg.py
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo
+
+
+class SpeedLoadOrg(DeadHoster):
+ __name__ = "SpeedLoadOrg"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?speedload\.org/(?P<ID>\w+)"
+ __version__ = "1.02"
+ __description__ = """Speedload.org hoster plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+
+getInfo = create_getInfo(SpeedLoadOrg)
diff --git a/pyload/plugins/hoster/SpeedfileCz.py b/pyload/plugins/hoster/SpeedfileCz.py
new file mode 100644
index 000000000..3475ea29e
--- /dev/null
+++ b/pyload/plugins/hoster/SpeedfileCz.py
@@ -0,0 +1,67 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class SpeedfileCz(SimpleHoster):
+ __name__ = "SpeedFileCz"
+ __type__ = "hoster"
+ __pattern__ = r"http://speedfile.cz/.*"
+ __version__ = "0.31"
+ __description__ = """speedfile.cz"""
+ __author_name__ = ("zoidberg")
+
+ FILE_NAME_PATTERN = r'<meta property="og:title" content="(?P<N>[^"]+)" />'
+ FILE_SIZE_PATTERN = r'<strong><big>(?P<S>[0-9.]+) (?P<U>[kKMG])i?B'
+ URL_PATTERN = r'<a id="request" class="caps" href="([^"]+)" rel="nofollow">'
+ FILE_OFFLINE_PATTERN = r'<title>Speedfile \| 404'
+ WAIT_PATTERN = r'"requestedAt":(\d+),"allowedAt":(\d+),"adUri"'
+
+ def setup(self):
+ self.multiDL = False
+
+ def process(self, pyfile):
+ self.html = self.load(pyfile.url, decode=True)
+
+ if re.search(self.FILE_OFFLINE_PATTERN, self.html):
+ self.offline()
+
+ found = re.search(self.FILE_NAME_PATTERN, self.html)
+ if found is None:
+ self.fail("Parse error (NAME)")
+ pyfile.name = found.group(1)
+
+ found = re.search(self.URL_PATTERN, self.html)
+ if found is None:
+ self.fail("Parse error (URL)")
+ download_url = "http://speedfile.cz/" + found.group(1)
+
+ self.html = self.load(download_url)
+ self.logDebug(self.html)
+ found = re.search(self.WAIT_PATTERN, self.html)
+ if found is None:
+ self.fail("Parse error (WAIT)")
+ self.setWait(int(found.group(2)) - int(found.group(1)))
+ self.wait()
+
+ self.download(download_url)
+
+
+create_getInfo(SpeedfileCz)
diff --git a/pyload/plugins/hoster/StreamCz.py b/pyload/plugins/hoster/StreamCz.py
new file mode 100644
index 000000000..a575b205e
--- /dev/null
+++ b/pyload/plugins/hoster/StreamCz.py
@@ -0,0 +1,80 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.Hoster import Hoster
+from module.network.RequestFactory import getURL
+
+
+def getInfo(urls):
+ result = []
+
+ for url in urls:
+
+ html = getURL(url)
+ if re.search(StreamCz.FILE_OFFLINE_PATTERN, html):
+ # File offline
+ result.append((url, 0, 1, url))
+ else:
+ result.append((url, 0, 2, url))
+ yield result
+
+
+class StreamCz(Hoster):
+ __name__ = "StreamCz"
+ __type__ = "hoster"
+ __pattern__ = r"http://www.stream.cz/[^/]+/\d+.*"
+ __version__ = "0.1"
+ __description__ = """stream.cz"""
+ __author_name__ = ("zoidberg")
+
+ FILE_OFFLINE_PATTERN = r'<h1 class="commonTitle">Str.nku nebylo mo.n. nal.zt \(404\)</h1>'
+ FILE_NAME_PATTERN = r'<link rel="video_src" href="http://www.stream.cz/\w+/(\d+)-([^"]+)" />'
+ CDN_PATTERN = r'<param name="flashvars" value="[^"]*&id=(?P<ID>\d+)(?:&cdnLQ=(?P<cdnLQ>\d*))?(?:&cdnHQ=(?P<cdnHQ>\d*))?(?:&cdnHD=(?P<cdnHD>\d*))?&'
+
+ def setup(self):
+ self.multiDL = True
+ self.resumeDownload = True
+
+ def process(self, pyfile):
+
+ self.html = self.load(pyfile.url, decode=True)
+
+ if re.search(self.FILE_OFFLINE_PATTERN, self.html):
+ self.offline()
+
+ found = re.search(self.CDN_PATTERN, self.html)
+ if found is None:
+ self.fail("Parse error (CDN)")
+ cdn = found.groupdict()
+ self.logDebug(cdn)
+ for cdnkey in ("cdnHD", "cdnHQ", "cdnLQ"):
+ if cdnkey in cdn and cdn[cdnkey] > '':
+ cdnid = cdn[cdnkey]
+ break
+ else:
+ self.fail("Stream URL not found")
+
+ found = re.search(self.FILE_NAME_PATTERN, self.html)
+ if found is None:
+ self.fail("Parse error (NAME)")
+ pyfile.name = "%s-%s.%s.mp4" % (found.group(2), found.group(1), cdnkey[-2:])
+
+ download_url = "http://cdn-dispatcher.stream.cz/?id=" + cdnid
+ self.logInfo("STREAM (%s): %s" % (cdnkey[-2:], download_url))
+ self.download(download_url)
diff --git a/pyload/plugins/hoster/StreamcloudEu.py b/pyload/plugins/hoster/StreamcloudEu.py
new file mode 100644
index 000000000..dd9bf9429
--- /dev/null
+++ b/pyload/plugins/hoster/StreamcloudEu.py
@@ -0,0 +1,118 @@
+# -*- coding: utf-8 -*-
+from time import sleep
+import re
+
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+from module.network.HTTPRequest import HTTPRequest
+
+
+class StreamcloudEu(XFileSharingPro):
+ __name__ = "StreamcloudEu"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?streamcloud\.eu/\S+"
+ __version__ = "0.02"
+ __description__ = """Streamcloud.eu hoster plugin"""
+ __author_name__ = ("seoester")
+ __author_mail__ = ("seoester@googlemail.com")
+
+ HOSTER_NAME = "streamcloud.eu"
+ DIRECT_LINK_PATTERN = r'file: "(http://(stor|cdn)\d+\.streamcloud.eu:?\d*/.*/video\.mp4)",'
+
+ def setup(self):
+ super(StreamcloudEu, self).setup()
+ self.multiDL = True
+
+ def getDownloadLink(self):
+ found = re.search(self.DIRECT_LINK_PATTERN, self.html, re.S)
+ if found:
+ return found.group(1)
+
+ for i in range(5):
+ self.logDebug("Getting download link: #%d" % i)
+ data = self.getPostParameters()
+ httpRequest = HTTPRequest(options=self.req.options)
+ httpRequest.cj = self.req.cj
+ sleep(10)
+ self.html = httpRequest.load(self.pyfile.url, post=data, referer=False, cookies=True, decode=True)
+ self.header = httpRequest.header
+
+ found = re.search("Location\s*:\s*(.*)", self.header, re.I)
+ if found:
+ break
+
+ found = re.search(self.DIRECT_LINK_PATTERN, self.html, re.S)
+ if found:
+ break
+
+ else:
+ if self.errmsg and 'captcha' in self.errmsg:
+ self.fail("No valid captcha code entered")
+ else:
+ self.fail("Download link not found")
+
+ return found.group(1)
+
+ def getPostParameters(self):
+ for i in range(3):
+ if not self.errmsg:
+ self.checkErrors()
+
+ if hasattr(self, "FORM_PATTERN"):
+ action, inputs = self.parseHtmlForm(self.FORM_PATTERN)
+ else:
+ action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")})
+
+ if not inputs:
+ action, inputs = self.parseHtmlForm('F1')
+ if not inputs:
+ if self.errmsg:
+ self.retry()
+ else:
+ self.parseError("Form not found")
+
+ self.logDebug(self.HOSTER_NAME, inputs)
+
+ if 'op' in inputs and inputs['op'] in ('download1', 'download2', 'download3'):
+ if "password" in inputs:
+ if self.passwords:
+ inputs['password'] = self.passwords.pop(0)
+ else:
+ self.fail("No or invalid passport")
+
+ if not self.premium:
+ found = re.search(self.WAIT_PATTERN, self.html)
+ if found:
+ wait_time = int(found.group(1)) + 1
+ self.setWait(wait_time, False)
+ else:
+ wait_time = 0
+
+ self.captcha = self.handleCaptcha(inputs)
+
+ if wait_time:
+ self.wait()
+
+ self.errmsg = None
+ self.logDebug("getPostParameters {0}".format(i))
+ return inputs
+
+ else:
+ inputs['referer'] = self.pyfile.url
+
+ if self.premium:
+ inputs['method_premium'] = "Premium Download"
+ if 'method_free' in inputs:
+ del inputs['method_free']
+ else:
+ inputs['method_free'] = "Free Download"
+ if 'method_premium' in inputs:
+ del inputs['method_premium']
+
+ self.html = self.load(self.pyfile.url, post=inputs, ref=False)
+ self.errmsg = None
+
+ else:
+ self.parseError('FORM: %s' % (inputs['op'] if 'op' in inputs else 'UNKNOWN'))
+
+
+getInfo = create_getInfo(StreamcloudEu)
diff --git a/pyload/plugins/hoster/TurbobitNet.py b/pyload/plugins/hoster/TurbobitNet.py
new file mode 100644
index 000000000..d574d1fa7
--- /dev/null
+++ b/pyload/plugins/hoster/TurbobitNet.py
@@ -0,0 +1,182 @@
+# -*- coding: utf-8 -*-
+"""
+ Copyright (C) 2012 pyLoad team
+ Copyright (C) 2012 JD-Team support@jdownloader.org
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+import random
+from urllib import quote
+from binascii import hexlify, unhexlify
+import time
+from pycurl import HTTPHEADER
+
+from Crypto.Cipher import ARC4
+from module.network.RequestFactory import getURL
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp
+from module.plugins.internal.CaptchaService import ReCaptcha
+
+
+class TurbobitNet(SimpleHoster):
+ __name__ = "TurbobitNet"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)?(turbobit.net|unextfiles.com)/(?!download/folder/)(?:download/free/)?(?P<ID>\w+).*"
+ __version__ = "0.10"
+ __description__ = """Turbobit.net plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ # long filenames are shortened
+ FILE_INFO_PATTERN = r"<span class='file-icon1[^>]*>(?P<N>[^<]+)</span>\s*\((?P<S>[^\)]+)\)\s*</h1>"
+ FILE_NAME_PATTERN = r'<meta name="keywords" content="\s+(?P<N>[^,]+)' # full name but missing on page2
+ FILE_OFFLINE_PATTERN = r'<h2>File Not Found</h2>|html\(\'File (?:was )?not found'
+ FILE_URL_REPLACEMENTS = [(r"http://(?:\w*\.)?(turbobit.net|unextfiles.com)/(?:download/free/)?(?P<ID>\w+).*",
+ "http://turbobit.net/\g<ID>.html")]
+ SH_COOKIES = [("turbobit.net", "user_lang", "en")]
+
+ CAPTCHA_KEY_PATTERN = r'src="http://api\.recaptcha\.net/challenge\?k=([^"]+)"'
+ DOWNLOAD_URL_PATTERN = r'(?P<url>/download/redirect/[^"\']+)'
+ LIMIT_WAIT_PATTERN = r'<div id="time-limit-text">\s*.*?<span id=\'timeout\'>(\d+)</span>'
+ CAPTCHA_SRC_PATTERN = r'<img alt="Captcha" src="(.*?)"'
+
+ def handleFree(self):
+ self.url = "http://turbobit.net/download/free/%s" % self.file_info['ID']
+ self.html = self.load(self.url)
+
+ rtUpdate = self.getRtUpdate()
+
+ self.solveCaptcha()
+ self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
+ self.url = self.getDownloadUrl(rtUpdate)
+
+ self.wait()
+ self.html = self.load(self.url)
+ self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With:"])
+ self.downloadFile()
+
+ def solveCaptcha(self):
+ for i in range(5):
+ found = re.search(self.LIMIT_WAIT_PATTERN, self.html)
+ if found:
+ wait_time = int(found.group(1))
+ self.setWait(wait_time, wait_time > 60)
+ self.wait()
+ self.retry()
+
+ action, inputs = self.parseHtmlForm("action='#'")
+ if not inputs:
+ self.parseError("captcha form")
+ self.logDebug(inputs)
+
+ if inputs['captcha_type'] == 'recaptcha':
+ recaptcha = ReCaptcha(self)
+ found = re.search(self.CAPTCHA_KEY_PATTERN, self.html)
+ captcha_key = found.group(1) if found else '6LcTGLoSAAAAAHCWY9TTIrQfjUlxu6kZlTYP50_c'
+ inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(
+ captcha_key)
+ else:
+ found = re.search(self.CAPTCHA_SRC_PATTERN, self.html)
+ if not found:
+ self.parseError('captcha')
+ captcha_url = found.group(1)
+ inputs['captcha_response'] = self.decryptCaptcha(captcha_url)
+
+ self.logDebug(inputs)
+ self.html = self.load(self.url, post=inputs)
+
+ if not "<div class='download-timer-header'>" in self.html:
+ self.invalidCaptcha()
+ else:
+ self.correctCaptcha()
+ break
+ else:
+ self.fail("Invalid captcha")
+
+ def getRtUpdate(self):
+ rtUpdate = self.getStorage("rtUpdate")
+ if not rtUpdate:
+ if self.getStorage("version") != self.__version__ or int(
+ self.getStorage("timestamp", 0)) + 86400000 < timestamp():
+ # that's right, we are even using jdownloader updates
+ rtUpdate = getURL("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.logDebug("rtUpdate")
+ self.setStorage("rtUpdate", rtUpdate)
+ self.setStorage("timestamp", timestamp())
+ self.setStorage("version", self.__version__)
+ else:
+ self.logError("Unable to download, wait for update...")
+ self.tempOffline()
+
+ return rtUpdate
+
+ def getDownloadUrl(self, rtUpdate):
+ self.req.http.lastURL = self.url
+
+ found = re.search("(/\w+/timeout\.js\?\w+=)([^\"\'<>]+)", self.html)
+ url = "http://turbobit.net%s%s" % (found.groups() if found else (
+ '/files/timeout.js?ver=', ''.join(random.choice('0123456789ABCDEF') for x in range(32))))
+ fun = self.load(url)
+
+ self.setWait(65, False)
+
+ for b in [1, 3]:
+ self.jscode = "var id = \'%s\';var b = %d;var inn = \'%s\';%sout" % (
+ self.file_info['ID'], b, quote(fun), rtUpdate)
+
+ try:
+ out = self.js.eval(self.jscode)
+ self.logDebug("URL", self.js.engine, out)
+ if out.startswith('/download/'):
+ return "http://turbobit.net%s" % out.strip()
+ except Exception, e:
+ self.logError(e)
+ else:
+ if self.retries >= 2:
+ # retry with updated js
+ self.delStorage("rtUpdate")
+ self.retry()
+
+ def decrypt(self, data):
+ cipher = ARC4.new(hexlify('E\x15\xa1\x9e\xa3M\xa0\xc6\xa0\x84\xb6H\x83\xa8o\xa0'))
+ return unhexlify(cipher.encrypt(unhexlify(data)))
+
+ def getLocalTimeString(self):
+ lt = time.localtime()
+ tz = time.altzone if lt.tm_isdst else time.timezone
+ return "%s GMT%+03d%02d" % (time.strftime("%a %b %d %Y %H:%M:%S", lt), -tz // 3600, tz % 3600)
+
+ def handlePremium(self):
+ self.logDebug("Premium download as user %s" % self.user)
+ self.downloadFile()
+
+ def downloadFile(self):
+ found = re.search(self.DOWNLOAD_URL_PATTERN, self.html)
+ if not found:
+ self.parseError("download link")
+ self.url = "http://turbobit.net" + found.group('url')
+ self.logDebug(self.url)
+ self.download(self.url)
+
+
+getInfo = create_getInfo(TurbobitNet)
diff --git a/pyload/plugins/hoster/TurbouploadCom.py b/pyload/plugins/hoster/TurbouploadCom.py
new file mode 100644
index 000000000..12dad7906
--- /dev/null
+++ b/pyload/plugins/hoster/TurbouploadCom.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.internal.DeadHoster import DeadHoster as EasybytezCom, create_getInfo
+
+
+class TurbouploadCom(EasybytezCom):
+ __name__ = "TurbouploadCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)?turboupload.com/(\w+).*"
+ __version__ = "0.02"
+ __description__ = """turboupload.com"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ # shares code with EasybytezCom
+
+ DIRECT_LINK_PATTERN = r'<a href="(http://turboupload.com/files/[^"]+)">\1</a>'
+
+ def handleFree(self):
+ self.html = self.load(self.pyfile.url, post=self.getPostParameters(), ref=True, cookies=True)
+ found = re.search(self.DIRECT_LINK_PATTERN, self.html)
+ if not found:
+ self.parseError('Download Link')
+ url = found.group(1)
+ self.logDebug('URL: ' + url)
+ self.download(url)
+
+
+getInfo = create_getInfo(TurbouploadCom)
diff --git a/pyload/plugins/hoster/TusfilesNet.py b/pyload/plugins/hoster/TusfilesNet.py
new file mode 100644
index 000000000..e4a64cfdc
--- /dev/null
+++ b/pyload/plugins/hoster/TusfilesNet.py
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
+
+class TusfilesNet(XFileSharingPro):
+ __name__ = "TusfilesNet"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?tusfiles\.net/\w{12}"
+ __version__ = "0.01"
+ __description__ = """Tusfiles.net hoster plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ FILE_INFO_PATTERN = r'<li>(?P<N>[^<]+)</li>\s+<li><b>Size:</b> <small>(?P<S>[\d.]+) (?P<U>\w+)</small></li>'
+ FILE_OFFLINE_PATTERN = r'The file you were looking for could not be found'
+ HOSTER_NAME = "tusfiles.net"
+
+ def setup(self):
+ self.chunkLimit = 1
+ self.resumeDownload = self.multiDL = True
+ if self.premium:
+ self.limitDL = 5
+ elif self.account:
+ self.limitDL = 3
+ else:
+ self.limitDL = 2
+
+
+getInfo = create_getInfo(TusfilesNet)
diff --git a/pyload/plugins/hoster/TwoSharedCom.py b/pyload/plugins/hoster/TwoSharedCom.py
new file mode 100644
index 000000000..5d1cd835b
--- /dev/null
+++ b/pyload/plugins/hoster/TwoSharedCom.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class TwoSharedCom(SimpleHoster):
+ __name__ = "TwoSharedCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://[\w\.]*?2shared.com/(account/)?(download|get|file|document|photo|video|audio)/.*"
+ __version__ = "0.11"
+ __description__ = """2Shared Download Hoster"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FILE_NAME_PATTERN = r'<h1>(?P<N>.*)</h1>'
+ FILE_SIZE_PATTERN = r'<span class="dtitle">File size:</span>\s*(?P<S>[0-9,.]+) (?P<U>[kKMG])i?B'
+ FILE_OFFLINE_PATTERN = r'The file link that you requested is not valid\.|This file was deleted\.'
+ DOWNLOAD_URL_PATTERN = r"window.location ='([^']+)';"
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = True
+
+ def handleFree(self):
+ found = re.search(self.DOWNLOAD_URL_PATTERN, self.html)
+ if not found:
+ self.parseError('Download link')
+ link = found.group(1)
+ self.logDebug("Download URL %s" % link)
+
+ self.download(link)
+
+
+getInfo = create_getInfo(TwoSharedCom)
diff --git a/pyload/plugins/hoster/UlozTo.py b/pyload/plugins/hoster/UlozTo.py
new file mode 100644
index 000000000..fe0bc671e
--- /dev/null
+++ b/pyload/plugins/hoster/UlozTo.py
@@ -0,0 +1,158 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+def convertDecimalPrefix(m):
+ # decimal prefixes used in filesize and traffic
+ return ("%%.%df" % {'k': 3, 'M': 6, 'G': 9}[m.group(2)] % float(m.group(1))).replace('.', '')
+
+
+class UlozTo(SimpleHoster):
+ __name__ = "UlozTo"
+ __type__ = "hoster"
+ __pattern__ = r"http://(\w*\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj.cz|zachowajto.pl)/(?:live/)?(?P<id>\w+/[^/?]*)"
+ __version__ = "0.93"
+ __description__ = """uloz.to"""
+ __author_name__ = ("zoidberg")
+
+ FILE_NAME_PATTERN = r'<a href="#download" class="jsShowDownload">(?P<N>[^<]+)</a>'
+ FILE_SIZE_PATTERN = r'<span id="fileSize">.*?(?P<S>[0-9.]+\s[kMG]?B)</span>'
+ FILE_INFO_PATTERN = r'<p>File <strong>(?P<N>[^<]+)</strong> is password protected</p>'
+ FILE_OFFLINE_PATTERN = r'<title>404 - Page not found</title>|<h1 class="h1">File (has been deleted|was banned)</h1>'
+ FILE_SIZE_REPLACEMENTS = [('([0-9.]+)\s([kMG])B', convertDecimalPrefix)]
+ FILE_URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "www.ulozto.net")]
+
+ PASSWD_PATTERN = r'<div class="passwordProtectedFile">'
+ VIPLINK_PATTERN = r'<a href="[^"]*\?disclaimer=1" class="linkVip">'
+ FREE_URL_PATTERN = r'<div class="freeDownloadForm"><form action="([^"]+)"'
+ PREMIUM_URL_PATTERN = r'<div class="downloadForm"><form action="([^"]+)"'
+
+ def setup(self):
+ self.multiDL = self.premium
+ self.resumeDownload = True
+
+ def process(self, pyfile):
+ pyfile.url = re.sub(r"(?<=http://)([^/]+)", "www.ulozto.net", pyfile.url)
+ self.html = self.load(pyfile.url, decode=True, cookies=True)
+
+ passwords = self.getPassword().splitlines()
+ while self.PASSWD_PATTERN in self.html:
+ if passwords:
+ password = passwords.pop(0)
+ self.logInfo("Password protected link, trying " + password)
+ self.html = self.load(pyfile.url, get={"do": "passwordProtectedForm-submit"},
+ post={"password": password, "password_send": 'Send'}, cookies=True)
+ else:
+ self.fail("No or incorrect password")
+
+ if re.search(self.VIPLINK_PATTERN, self.html):
+ self.html = self.load(pyfile.url, get={"disclaimer": "1"})
+
+ self.file_info = self.getFileInfo()
+
+ if self.premium and self.checkTrafficLeft():
+ self.handlePremium()
+ else:
+ self.handleFree()
+
+ self.doCheckDownload()
+
+ def handleFree(self):
+ action, inputs = self.parseHtmlForm('id="frm-downloadDialog-freeDownloadForm"')
+ if not action or not inputs:
+ self.parseError("free download form")
+
+ # get and decrypt captcha
+ captcha_id_field = captcha_text_field = None
+
+ for key in inputs.keys():
+ found = re.match("captcha.*(id|text|value)", key)
+ if found:
+ if found.group(1) == "id":
+ captcha_id_field = key
+ else:
+ captcha_text_field = key
+
+ if not captcha_id_field or not captcha_text_field:
+ self.parseError("CAPTCHA form changed")
+
+ # captcha_id = self.getStorage("captcha_id")
+ # captcha_text = self.getStorage("captcha_text")
+ #
+ # if not captcha_id or not captcha_text:
+
+ captcha_id = inputs[captcha_id_field]
+ captcha_text = self.decryptCaptcha("http://img.uloz.to/captcha/%s.png" % captcha_id)
+
+ self.logDebug(' CAPTCHA ID:' + captcha_id + ' CAPTCHA TEXT:' + captcha_text)
+
+ # self.setStorage("captcha_id", captcha_id)
+ # self.setStorage("captcha_text", captcha_text)
+
+ self.multiDL = True
+
+ inputs.update({captcha_id_field: captcha_id, captcha_text_field: captcha_text})
+
+ self.download("http://www.ulozto.net" + action, post=inputs, cookies=True, disposition=True)
+
+ def handlePremium(self):
+ self.download(self.pyfile.url + "?do=directDownload", disposition=True)
+ #parsed_url = self.findDownloadURL(premium=True)
+ #self.download(parsed_url, post={"download": "Download"})
+
+ def findDownloadURL(self, premium=False):
+ msg = "%s link" % ("Premium" if premium else "Free")
+ found = re.search(self.PREMIUM_URL_PATTERN if premium else self.FREE_URL_PATTERN, self.html)
+ if not found:
+ self.parseError(msg)
+ parsed_url = "http://www.ulozto.net" + found.group(1)
+ self.logDebug("%s: %s" % (msg, parsed_url))
+ return parsed_url
+
+ def doCheckDownload(self):
+ check = self.checkDownload({
+ "wrong_captcha": re.compile(r'<ul class="error">\s*<li>Error rewriting the text.</li>'),
+ "offline": re.compile(self.FILE_OFFLINE_PATTERN),
+ "passwd": self.PASSWD_PATTERN,
+ "server_error": 'src="http://img.ulozto.cz/error403/vykricnik.jpg"', # paralell dl, server overload etc.
+ "not_found": "<title>UloÅŸ.to</title>"
+ })
+
+ if check == "wrong_captcha":
+ self.delStorage("captcha_id")
+ self.delStorage("captcha_text")
+ self.invalidCaptcha()
+ self.retry(reason="Wrong captcha code")
+ elif check == "offline":
+ self.offline()
+ elif check == "passwd":
+ self.fail("Wrong password")
+ elif check == "server_error":
+ self.logError("Server error, try downloading later")
+ self.multiDL = False
+ self.setWait(3600, True)
+ self.wait()
+ self.retry()
+ elif check == "not_found":
+ self.fail("Server error - file not downloadable")
+
+
+getInfo = create_getInfo(UlozTo)
diff --git a/pyload/plugins/hoster/UloziskoSk.py b/pyload/plugins/hoster/UloziskoSk.py
new file mode 100644
index 000000000..7060dff65
--- /dev/null
+++ b/pyload/plugins/hoster/UloziskoSk.py
@@ -0,0 +1,80 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError
+
+
+class UloziskoSk(SimpleHoster):
+ __name__ = "UloziskoSk"
+ __type__ = "hoster"
+ __pattern__ = r"http://(\w*\.)?ulozisko.sk/.*"
+ __version__ = "0.23"
+ __description__ = """Ulozisko.sk"""
+ __author_name__ = ("zoidberg")
+
+ URL_PATTERN = r'<form name = "formular" action = "([^"]+)" method = "post">'
+ ID_PATTERN = r'<input type = "hidden" name = "id" value = "([^"]+)" />'
+ FILE_NAME_PATTERN = r'<div class="down1">(?P<N>[^<]+)</div>'
+ FILE_SIZE_PATTERN = ur'Veğkosť súboru: <strong>(?P<S>[0-9.]+) (?P<U>[kKMG])i?B</strong><br />'
+ CAPTCHA_PATTERN = r'<img src="(/obrazky/obrazky.php\?fid=[^"]+)" alt="" />'
+ FILE_OFFLINE_PATTERN = ur'<span class = "red">ZadanÜ súbor neexistuje z jedného z nasledujúcich dÎvodov:</span>'
+ IMG_PATTERN = ur'<strong>PRE ZVÄČŠENIE KLIKNITE NA OBRÁZOK</strong><br /><a href = "([^"]+)">'
+
+ def process(self, pyfile):
+ self.html = self.load(pyfile.url, decode=True)
+ self.getFileInfo()
+
+ found = re.search(self.IMG_PATTERN, self.html)
+ if found:
+ url = "http://ulozisko.sk" + found.group(1)
+ self.download(url)
+ else:
+ self.handleFree()
+
+ def handleFree(self):
+ found = re.search(self.URL_PATTERN, self.html)
+ if found is None:
+ raise PluginParseError('URL')
+ parsed_url = 'http://www.ulozisko.sk' + found.group(1)
+
+ found = re.search(self.ID_PATTERN, self.html)
+ if found is None:
+ raise PluginParseError('ID')
+ id = found.group(1)
+
+ self.logDebug('URL:' + parsed_url + ' ID:' + id)
+
+ found = re.search(self.CAPTCHA_PATTERN, self.html)
+ if found is None:
+ raise PluginParseError('CAPTCHA')
+ captcha_url = 'http://www.ulozisko.sk' + found.group(1)
+
+ captcha = self.decryptCaptcha(captcha_url, cookies=True)
+
+ self.logDebug('CAPTCHA_URL:' + captcha_url + ' CAPTCHA:' + captcha)
+
+ self.download(parsed_url, post={
+ "antispam": captcha,
+ "id": id,
+ "name": self.pyfile.name,
+ "but": "++++STIAHNI+S%DABOR++++"
+ })
+
+
+getInfo = create_getInfo(UloziskoSk)
diff --git a/pyload/plugins/hoster/UnibytesCom.py b/pyload/plugins/hoster/UnibytesCom.py
new file mode 100644
index 000000000..d13f01ef3
--- /dev/null
+++ b/pyload/plugins/hoster/UnibytesCom.py
@@ -0,0 +1,82 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from pycurl import FOLLOWLOCATION
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class UnibytesCom(SimpleHoster):
+ __name__ = "UnibytesCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?unibytes\.com/[a-zA-Z0-9-._ ]{11}B"
+ __version__ = "0.1"
+ __description__ = """UniBytes.com"""
+ __author_name__ = ("zoidberg")
+
+ FILE_INFO_PATTERN = r'<span[^>]*?id="fileName"[^>]*>(?P<N>[^>]+)</span>\s*\((?P<S>\d.*?)\)'
+ DOMAIN = 'http://www.unibytes.com'
+
+ WAIT_PATTERN = r'Wait for <span id="slowRest">(\d+)</span> sec'
+ DOWNLOAD_LINK_PATTERN = r'<a href="([^"]+)">Download</a>'
+
+ def handleFree(self):
+ action, post_data = self.parseHtmlForm('id="startForm"')
+ self.req.http.c.setopt(FOLLOWLOCATION, 0)
+
+ for i in range(8):
+ self.logDebug(action, post_data)
+ self.html = self.load(self.DOMAIN + action, post=post_data)
+
+ found = re.search(r'location:\s*(\S+)', self.req.http.header, re.I)
+ if found:
+ url = found.group(1)
+ break
+
+ if '>Somebody else is already downloading using your IP-address<' in self.html:
+ self.setWait(600, True)
+ self.wait()
+ self.retry()
+
+ if post_data['step'] == 'last':
+ found = re.search(self.DOWNLOAD_LINK_PATTERN, self.html)
+ if found:
+ url = found.group(1)
+ self.correctCaptcha()
+ break
+ else:
+ self.invalidCaptcha()
+
+ last_step = post_data['step']
+ action, post_data = self.parseHtmlForm('id="stepForm"')
+
+ if last_step == 'timer':
+ found = re.search(self.WAIT_PATTERN, self.html)
+ self.setWait(int(found.group(1)) if found else 60, False)
+ self.wait()
+ elif last_step in ('captcha', 'last'):
+ post_data['captcha'] = self.decryptCaptcha(self.DOMAIN + '/captcha.jpg')
+ else:
+ self.fail("No valid captcha code entered")
+
+ self.logDebug('Download link: ' + url)
+ self.req.http.c.setopt(FOLLOWLOCATION, 1)
+ self.download(url)
+
+
+getInfo = create_getInfo(UnibytesCom)
diff --git a/pyload/plugins/hoster/UnrestrictLi.py b/pyload/plugins/hoster/UnrestrictLi.py
new file mode 100644
index 000000000..a3fe5ff5d
--- /dev/null
+++ b/pyload/plugins/hoster/UnrestrictLi.py
@@ -0,0 +1,101 @@
+# -*- coding: utf-8 -*-
+
+############################################################################
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU Affero General Public License as #
+# published by the Free Software Foundation, either version 3 of the #
+# License, or (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU Affero General Public License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+import re
+from datetime import datetime, timedelta
+
+from module.plugins.Hoster import Hoster
+from module.common.json_layer import json_loads
+
+
+def secondsToMidnight():
+ # Seconds until 00:10 GMT+2
+ now = datetime.utcnow() + timedelta(hours=2)
+ if now.hour is 0 and now.minute < 10:
+ midnight = now
+ else:
+ midnight = now + timedelta(days=1)
+ midnight = midnight.replace(hour=0, minute=10, second=0, microsecond=0)
+ return int((midnight - now).total_seconds())
+
+
+class UnrestrictLi(Hoster):
+ __name__ = "UnrestrictLi"
+ __version__ = "0.11"
+ __type__ = "hoster"
+ __pattern__ = r"https?://.*(unrestrict|unr)\.li"
+ __description__ = """Unrestrict.li hoster plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ def setup(self):
+ self.chunkLimit = 16
+ self.resumeDownload = True
+
+ def process(self, pyfile):
+ if re.match(self.__pattern__, pyfile.url):
+ new_url = pyfile.url
+ elif not self.account:
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "Unrestrict.li")
+ self.fail("No Unrestrict.li account provided")
+ else:
+ self.logDebug("Old URL: %s" % pyfile.url)
+ for i in xrange(5):
+ page = self.req.load('https://unrestrict.li/unrestrict.php',
+ post={'link': pyfile.url, 'domain': 'long'})
+ self.logDebug("JSON data: " + page)
+ if page != '':
+ break
+ else:
+ self.logInfo("Unable to get API data, waiting 1 minute and retry")
+ self.retry(5, 60, "Unable to get API data")
+
+ if 'Expired session' in page or ("You are not allowed to "
+ "download from this host" in page and self.premium):
+ self.account.relogin(self.user)
+ self.retry()
+ elif "File offline" in page:
+ self.offline()
+ elif "You are not allowed to download from this host" in page:
+ self.fail("You are not allowed to download from this host")
+ elif "You have reached your daily limit for this host" in page:
+ self.logInfo("Reached daily limit for this host. Waiting until 00:10 GMT+2")
+ self.retry(5, secondsToMidnight(), "Daily limit for this host reached")
+ elif "ERROR_HOSTER_TEMPORARILY_UNAVAILABLE" in page:
+ self.logInfo("Hoster temporarily unavailable, waiting 1 minute and retry")
+ self.retry(5, 60, "Hoster is temporarily unavailable")
+ page = json_loads(page)
+ new_url = page.keys()[0]
+ self.api_data = page[new_url]
+
+ if new_url != pyfile.url:
+ self.logDebug("New URL: " + new_url)
+
+ if hasattr(self, 'api_data'):
+ self.setNameSize()
+
+ self.download(new_url, disposition=True)
+
+ if self.getConfig("history"):
+ self.load("https://unrestrict.li/history/&delete=all")
+ self.logInfo("Download history deleted")
+
+ def setNameSize(self):
+ if 'name' in self.api_data:
+ self.pyfile.name = self.api_data['name']
+ if 'size' in self.api_data:
+ self.pyfile.size = self.api_data['size']
diff --git a/pyload/plugins/hoster/UploadStationCom.py b/pyload/plugins/hoster/UploadStationCom.py
new file mode 100644
index 000000000..2831facac
--- /dev/null
+++ b/pyload/plugins/hoster/UploadStationCom.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+from module.plugins.hoster.FileserveCom import FileserveCom, checkFile
+from module.plugins.Plugin import chunks
+
+
+class UploadStationCom(FileserveCom):
+ __name__ = "UploadStationCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?uploadstation\.com/file/(?P<id>[A-Za-z0-9]+)"
+ __version__ = "0.51"
+ __description__ = """UploadStation.Com File Download Hoster"""
+ __author_name__ = ("fragonib", "zoidberg")
+ __author_mail__ = ("fragonib[AT]yahoo[DOT]es", "zoidberg@mujmail.cz")
+
+ URLS = ['http://www.uploadstation.com/file/', 'http://www.uploadstation.com/check-links.php',
+ 'http://www.uploadstation.com/checkReCaptcha.php']
+ LINKCHECK_TR = r'<div class="details (?:white|grey)">(.*?)\t{9}</div>'
+ LINKCHECK_TD = r'<div class="(?:col )?col\d">(?:<[^>]*>|&nbsp;)*([^<]*)'
+
+ LONG_WAIT_PATTERN = r'<h1>You have to wait (\d+) (\w+) to download the next file\.</h1>'
+
+
+def getInfo(urls):
+ for chunk in chunks(urls, 100):
+ yield checkFile(UploadStationCom, chunk)
diff --git a/pyload/plugins/hoster/UploadedTo.py b/pyload/plugins/hoster/UploadedTo.py
new file mode 100644
index 000000000..88a8edebb
--- /dev/null
+++ b/pyload/plugins/hoster/UploadedTo.py
@@ -0,0 +1,231 @@
+# -*- coding: utf-8 -*-
+
+# Test links (random.bin):
+# http://ul.to/044yug9o
+# http://ul.to/gzfhd0xs
+
+import re
+from time import sleep
+
+from module.utils import html_unescape, parseFileSize
+
+from module.plugins.Hoster import Hoster
+from module.network.RequestFactory import getURL
+from module.plugins.Plugin import chunks
+from module.plugins.internal.CaptchaService import ReCaptcha
+
+key = "bGhGMkllZXByd2VEZnU5Y2NXbHhYVlZ5cEE1bkEzRUw=".decode('base64')
+
+
+def getID(url):
+ """ returns id from file url"""
+ m = re.match(UploadedTo.__pattern__, url)
+ return m.group('ID')
+
+
+def getAPIData(urls):
+ post = {"apikey": key}
+
+ idMap = {}
+
+ for i, url in enumerate(urls):
+ id = getID(url)
+ post["id_%s" % i] = id
+ idMap[id] = url
+
+ for i in xrange(5):
+ api = unicode(getURL("http://uploaded.net/api/filemultiple", post=post, decode=False), 'iso-8859-1')
+ if api != "can't find request":
+ break
+ else:
+ sleep(3)
+
+ result = {}
+
+ if api:
+ for line in api.splitlines():
+ data = line.split(",", 4)
+ if data[1] in idMap:
+ result[data[1]] = (data[0], data[2], data[4], data[3], idMap[data[1]])
+
+ return result
+
+
+def parseFileInfo(self, url='', html=''):
+ if not html and hasattr(self, "html"):
+ html = self.html
+ name, size, status, found, fileid = url, 0, 3, None, None
+
+ if re.search(self.FILE_OFFLINE_PATTERN, html):
+ # File offline
+ status = 1
+ else:
+ found = re.search(self.FILE_INFO_PATTERN, html)
+ if found:
+ name, fileid = html_unescape(found.group('N')), found.group('ID')
+ size = parseFileSize(found.group('S'))
+ status = 2
+
+ return name, size, status, fileid
+
+
+def getInfo(urls):
+ for chunk in chunks(urls, 80):
+ result = []
+
+ api = getAPIData(chunk)
+
+ for data in api.itervalues():
+ if data[0] == "online":
+ result.append((html_unescape(data[2]), data[1], 2, data[4]))
+
+ elif data[0] == "offline":
+ result.append((data[4], 0, 1, data[4]))
+
+ yield result
+
+
+class UploadedTo(Hoster):
+ __name__ = "UploadedTo"
+ __type__ = "hoster"
+ __pattern__ = r"https?://[\w\.-]*?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P<ID>\w+)"
+ __version__ = "0.72"
+ __description__ = """Uploaded.net Download Hoster"""
+ __author_name__ = ("spoob", "mkaay", "zoidberg", "netpok", "stickell")
+ __author_mail__ = ("spoob@pyload.org", "mkaay@mkaay.de", "zoidberg@mujmail.cz",
+ "netpok@gmail.com", "l.stickell@yahoo.it")
+
+ FILE_INFO_PATTERN = r'<a href="file/(?P<ID>\w+)" id="filename">(?P<N>[^<]+)</a> &nbsp;\s*<small[^>]*>(?P<S>[^<]+)</small>'
+ FILE_OFFLINE_PATTERN = r'<small class="cL">Error: 404</small>'
+ DL_LIMIT_PATTERN = "You have reached the max. number of possible free downloads for this hour"
+
+ def setup(self):
+ self.multiDL = self.resumeDownload = self.premium
+ self.chunkLimit = 1 # critical problems with more chunks
+
+ self.fileID = getID(self.pyfile.url)
+ self.pyfile.url = "http://uploaded.net/file/%s" % self.fileID
+
+ def process(self, pyfile):
+ self.load("http://uploaded.net/language/en", just_header=True)
+
+ api = getAPIData([pyfile.url])
+
+ # TODO: fallback to parse from site, because api sometimes delivers wrong status codes
+
+ if not api:
+ self.logWarning("No response for API call")
+
+ self.html = unicode(self.load(pyfile.url, decode=False), 'iso-8859-1')
+ name, size, status, self.fileID = parseFileInfo(self)
+ self.logDebug(name, size, status, self.fileID)
+ if status == 1:
+ self.offline()
+ elif status == 2:
+ pyfile.name, pyfile.size = name, size
+ else:
+ self.fail('Parse error - file info')
+ elif api == 'Access denied':
+ self.fail(_("API key invalid"))
+
+ else:
+ if self.fileID not in api:
+ self.offline()
+
+ self.data = api[self.fileID]
+ if self.data[0] != "online":
+ self.offline()
+
+ pyfile.name = html_unescape(self.data[2])
+
+ # self.pyfile.name = self.get_file_name()
+
+ if self.premium:
+ self.handlePremium()
+ else:
+ self.handleFree()
+
+ def handlePremium(self):
+ info = self.account.getAccountInfo(self.user, True)
+ self.logDebug("%(name)s: Use Premium Account (%(left)sGB left)" % {"name": self.__name__,
+ "left": info["trafficleft"] / 1024 / 1024})
+ if int(self.data[1]) / 1024 > info["trafficleft"]:
+ self.logInfo(_("%s: Not enough traffic left" % self.__name__))
+ self.account.empty(self.user)
+ self.resetAccount()
+ self.fail(_("Traffic exceeded"))
+
+ header = self.load("http://uploaded.net/file/%s" % self.fileID, just_header=True)
+ if "location" in header:
+ #Direct download
+ print "Direct Download: " + header['location']
+ self.download(header['location'])
+ else:
+ #Indirect download
+ self.html = self.load("http://uploaded.net/file/%s" % self.fileID)
+ found = re.search(r'<div class="tfree".*\s*<form method="post" action="(.*?)"', self.html)
+ if not found:
+ self.fail("Download URL not found. Try to enable direct downloads.")
+ url = found.group(1)
+ print "Premium URL: " + url
+ self.download(url, post={})
+
+ def handleFree(self):
+ self.html = self.load(self.pyfile.url, decode=True)
+
+ if 'var free_enabled = false;' in self.html:
+ self.logError("Free-download capacities exhausted.")
+ self.retry(24, 300)
+
+ found = re.search(r"Current waiting period: <span>(\d+)</span> seconds", self.html)
+ if not found:
+ self.fail("File not downloadable for free users")
+ self.setWait(int(found.group(1)))
+
+ js = self.load("http://uploaded.net/js/download.js", decode=True)
+
+ challengeId = re.search(r'Recaptcha\.create\("([^"]+)', js)
+
+ url = "http://uploaded.net/io/ticket/captcha/%s" % self.fileID
+ downloadURL = ""
+
+ for i in range(5):
+ re_captcha = ReCaptcha(self)
+ challenge, result = re_captcha.challenge(challengeId.group(1))
+ options = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": result}
+ self.wait()
+
+ result = self.load(url, post=options)
+ self.logDebug("result: %s" % result)
+
+ if "limit-size" in result:
+ self.fail("File too big for free download")
+ elif "limit-slot" in result: # Temporary restriction so just wait a bit
+ self.setWait(30 * 60, True)
+ self.wait()
+ self.retry()
+ elif "limit-parallel" in result:
+ self.fail("Cannot download in parallel")
+ elif self.DL_LIMIT_PATTERN in result: # limit-dl
+ self.setWait(3 * 60 * 60, True)
+ self.wait()
+ self.retry()
+ elif 'err:"captcha"' in result:
+ self.logError("ul.net captcha is disabled")
+ self.invalidCaptcha()
+ elif "type:'download'" in result:
+ self.correctCaptcha()
+ downloadURL = re.search("url:'([^']+)", result).group(1)
+ break
+ else:
+ self.fail("Unknown error '%s'")
+
+ if not downloadURL:
+ self.fail("No Download url retrieved/all captcha attempts failed")
+
+ self.download(downloadURL, disposition=True)
+ check = self.checkDownload({"limit-dl": self.DL_LIMIT_PATTERN})
+ if check == "limit-dl":
+ self.setWait(3 * 60 * 60, True)
+ self.wait()
+ self.retry()
diff --git a/pyload/plugins/hoster/UploadheroCom.py b/pyload/plugins/hoster/UploadheroCom.py
new file mode 100644
index 000000000..7b047e028
--- /dev/null
+++ b/pyload/plugins/hoster/UploadheroCom.py
@@ -0,0 +1,90 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+# Test link (random.bin):
+# http://uploadhero.co/dl/wQBRAVSM
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class UploadheroCom(SimpleHoster):
+ __name__ = "UploadheroCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?uploadhero\.com?/dl/\w+"
+ __version__ = "0.15"
+ __description__ = """UploadHero.co plugin"""
+ __author_name__ = ("mcmyst", "zoidberg")
+ __author_mail__ = ("mcmyst@hotmail.fr", "zoidberg@mujmail.cz")
+
+ SH_COOKIES = [("http://uploadhero.co", "lang", "en")]
+ FILE_NAME_PATTERN = r'<div class="nom_de_fichier">(?P<N>.*?)</div>'
+ FILE_SIZE_PATTERN = r'Taille du fichier : </span><strong>(?P<S>.*?)</strong>'
+ FILE_OFFLINE_PATTERN = r'<p class="titre_dl_2">|<div class="raison"><strong>Le lien du fichier ci-dessus n\'existe plus.'
+
+ DOWNLOAD_URL_PATTERN = r'<a href="([^"]+)" id="downloadnow"'
+
+ IP_BLOCKED_PATTERN = r'href="(/lightbox_block_download.php\?min=.*?)"'
+ IP_WAIT_PATTERN = r'<span id="minutes">(\d+)</span>.*\s*<span id="seconds">(\d+)</span>'
+
+ CAPTCHA_PATTERN = r'"(/captchadl\.php\?[a-z0-9]+)"'
+ FREE_URL_PATTERN = r'var magicomfg = \'<a href="(http://[^<>"]*?)"|"(http://storage\d+\.uploadhero\.co/\?d=[A-Za-z0-9]+/[^<>"/]+)"'
+
+ def handleFree(self):
+ self.checkErrors()
+
+ found = re.search(self.CAPTCHA_PATTERN, self.html)
+ if not found:
+ self.parseError("Captcha URL")
+ captcha_url = "http://uploadhero.co" + found.group(1)
+
+ for i in range(5):
+ captcha = self.decryptCaptcha(captcha_url)
+ self.html = self.load(self.pyfile.url, get={"code": captcha})
+ found = re.search(self.FREE_URL_PATTERN, self.html)
+ if found:
+ self.correctCaptcha()
+ download_url = found.group(1) or found.group(2)
+ break
+ else:
+ self.invalidCaptcha()
+ else:
+ self.fail("No valid captcha code entered")
+
+ self.download(download_url)
+
+ def handlePremium(self):
+ self.logDebug("%s: Use Premium Account" % self.__name__)
+ self.html = self.load(self.pyfile.url)
+ link = re.search(self.DOWNLOAD_URL_PATTERN, self.html).group(1)
+ self.logDebug("Downloading link : '%s'" % link)
+ self.download(link)
+
+ def checkErrors(self):
+ found = re.search(self.IP_BLOCKED_PATTERN, self.html)
+ if found:
+ self.html = self.load("http://uploadhero.co%s" % found.group(1))
+
+ found = re.search(self.IP_WAIT_PATTERN, self.html)
+ wait_time = (int(found.group(1)) * 60 + int(found.group(2))) if found else 300
+ self.setWait(wait_time, True)
+ self.wait()
+ self.retry()
+
+
+getInfo = create_getInfo(UploadheroCom)
diff --git a/pyload/plugins/hoster/UploadingCom.py b/pyload/plugins/hoster/UploadingCom.py
new file mode 100644
index 000000000..1da571460
--- /dev/null
+++ b/pyload/plugins/hoster/UploadingCom.py
@@ -0,0 +1,113 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: jeix
+"""
+
+import re
+from pycurl import HTTPHEADER
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp
+from module.common.json_layer import json_loads
+
+
+class UploadingCom(SimpleHoster):
+ __name__ = "UploadingCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?uploading\.com/files/(?:get/)?(?P<ID>[\w\d]+)"
+ __version__ = "0.33"
+ __description__ = """Uploading.Com File Download Hoster"""
+ __author_name__ = ("jeix", "mkaay", "zoidberg")
+ __author_mail__ = ("jeix@hasnomail.de", "mkaay@mkaay.de", "zoidberg@mujmail.cz")
+
+ FILE_NAME_PATTERN = r'<title>Download (?P<N>.*?) for free on uploading.com</title>'
+ FILE_SIZE_PATTERN = r'<span>File size: (?P<S>.*?)</span>'
+ FILE_OFFLINE_PATTERN = r'<h2.*?>The requested file is not found</h2>'
+
+ def process(self, pyfile):
+ # set lang to english
+ self.req.cj.setCookie("uploading.com", "lang", "1")
+ self.req.cj.setCookie("uploading.com", "language", "1")
+ self.req.cj.setCookie("uploading.com", "setlang", "en")
+ self.req.cj.setCookie("uploading.com", "_lang", "en")
+
+ if not "/get/" in self.pyfile.url:
+ self.pyfile.url = self.pyfile.url.replace("/files", "/files/get")
+
+ self.html = self.load(pyfile.url, decode=True)
+ self.file_info = self.getFileInfo()
+
+ if self.premium:
+ self.handlePremium()
+ else:
+ self.handleFree()
+
+ def handlePremium(self):
+ postData = {'action': 'get_link',
+ 'code': self.file_info['ID'],
+ 'pass': 'undefined'}
+
+ self.html = self.load('http://uploading.com/files/get/?JsHttpRequest=%d-xml' % timestamp(), post=postData)
+ url = re.search(r'"link"\s*:\s*"(.*?)"', self.html)
+ if url:
+ url = url.group(1).replace("\\/", "/")
+ self.download(url)
+
+ raise Exception("Plugin defect.")
+
+ def handleFree(self):
+ found = re.search('<h2>((Daily )?Download Limit)</h2>', self.html)
+ if found:
+ self.pyfile.error = found.group(1)
+ self.logWarning(self.pyfile.error)
+ self.retry(max_tries=6, wait_time=21600 if found.group(2) else 900, reason=self.pyfile.error)
+
+ ajax_url = "http://uploading.com/files/get/?ajax"
+ self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
+ self.req.http.lastURL = self.pyfile.url
+
+ response = json_loads(self.load(ajax_url, post={'action': 'second_page', 'code': self.file_info['ID']}))
+ if 'answer' in response and 'wait_time' in response['answer']:
+ wait_time = int(response['answer']['wait_time'])
+ self.logInfo("%s: Waiting %d seconds." % (self.__name__, wait_time))
+ self.setWait(wait_time)
+ self.wait()
+ else:
+ self.pluginParseError("AJAX/WAIT")
+
+ response = json_loads(
+ self.load(ajax_url, post={'action': 'get_link', 'code': self.file_info['ID'], 'pass': 'false'}))
+ if 'answer' in response and 'link' in response['answer']:
+ url = response['answer']['link']
+ else:
+ self.pluginParseError("AJAX/URL")
+
+ self.html = self.load(url)
+ found = re.search(r'<form id="file_form" action="(.*?)"', self.html)
+ if found:
+ url = found.group(1)
+ else:
+ self.pluginParseError("URL")
+
+ self.download(url)
+
+ check = self.checkDownload({"html": re.compile("\A<!DOCTYPE html PUBLIC")})
+ if check == "html":
+ self.logWarning("Redirected to a HTML page, wait 10 minutes and retry")
+ self.setWait(600, True)
+ self.wait()
+
+
+getInfo = create_getInfo(UploadingCom)
diff --git a/pyload/plugins/hoster/UptoboxCom.py b/pyload/plugins/hoster/UptoboxCom.py
new file mode 100644
index 000000000..fe05bf916
--- /dev/null
+++ b/pyload/plugins/hoster/UptoboxCom.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+
+
+class UptoboxCom(XFileSharingPro):
+ __name__ = "UptoboxCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)*?uptobox.com/\w{12}"
+ __version__ = "0.06"
+ __description__ = """Uptobox.com hoster plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FILE_INFO_PATTERN = r'<h2>\s*Download File\s*<span[^>]*>(?P<N>[^>]+)</span></h2>\s*[^\(]*\((?P<S>[^\)]+)\)</h2>'
+ FILE_OFFLINE_PATTERN = r'<center>File Not Found</center>'
+ HOSTER_NAME = "uptobox.com"
+
+
+getInfo = create_getInfo(UptoboxCom)
diff --git a/pyload/plugins/hoster/VeehdCom.py b/pyload/plugins/hoster/VeehdCom.py
new file mode 100644
index 000000000..88bcb20ad
--- /dev/null
+++ b/pyload/plugins/hoster/VeehdCom.py
@@ -0,0 +1,80 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import re
+from module.plugins.Hoster import Hoster
+
+
+class VeehdCom(Hoster):
+ __name__ = 'VeehdCom'
+ __type__ = 'hoster'
+ __pattern__ = r'http://veehd\.com/video/\d+_\S+'
+ __config__ = [
+ ('filename_spaces', 'bool', "Allow spaces in filename", 'False'),
+ ('replacement_char', 'str', "Filename replacement character", '_'),
+ ]
+ __version__ = '0.23'
+ __description__ = """Veehd.com Download Hoster"""
+ __author_name__ = ('cat')
+ __author_mail__ = ('cat@pyload')
+
+ def _debug(self, msg):
+ self.logDebug('[%s] %s' % (self.__name__, msg))
+
+ def setup(self):
+ self.html = None
+ self.multiDL = True
+ self.req.canContinue = True
+
+ def process(self, pyfile):
+ self.download_html()
+ if not self.file_exists():
+ self.offline()
+
+ pyfile.name = self.get_file_name()
+ self.download(self.get_file_url())
+
+ def download_html(self):
+ url = self.pyfile.url
+ self._debug("Requesting page: %s" % (repr(url),))
+ self.html = self.load(url)
+
+ def file_exists(self):
+ if self.html is None:
+ self.download_html()
+
+ if '<title>Veehd</title>' in self.html:
+ return False
+ return True
+
+ def get_file_name(self):
+ if self.html is None:
+ self.download_html()
+
+ match = re.search(r'<title[^>]*>([^<]+) on Veehd</title>', self.html)
+ if not match:
+ self.fail("video title not found")
+ name = match.group(1)
+
+ # replace unwanted characters in filename
+ if self.getConfig('filename_spaces'):
+ pattern = '[^0-9A-Za-z\.\ ]+'
+ else:
+ pattern = '[^0-9A-Za-z\.]+'
+
+ name = re.sub(pattern, self.getConfig('replacement_char'),
+ name)
+ return name + '.avi'
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if self.html is None:
+ self.download_html()
+
+ match = re.search(r'<embed type="video/divx" src="(http://([^/]*\.)?veehd\.com/dl/[^"]+)"',
+ self.html)
+ if not match:
+ self.fail("embedded video url not found")
+ file_url = match.group(1)
+
+ return file_url
diff --git a/pyload/plugins/hoster/WarserverCz.py b/pyload/plugins/hoster/WarserverCz.py
new file mode 100644
index 000000000..ee580fbdd
--- /dev/null
+++ b/pyload/plugins/hoster/WarserverCz.py
@@ -0,0 +1,75 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+#similar to coolshare.cz (down)
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.network.HTTPRequest import BadHeader
+from module.utils import html_unescape
+
+
+class WarserverCz(SimpleHoster):
+ __name__ = "WarserverCz"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)?warserver.cz/stahnout/(?P<ID>\d+)/.+"
+ __version__ = "0.12"
+ __description__ = """Warserver.cz"""
+ __author_name__ = ("zoidberg")
+
+ FILE_NAME_PATTERN = r'<h1.*?>(?P<N>[^<]+)</h1>'
+ FILE_SIZE_PATTERN = r'<li>Velikost: <strong>(?P<S>[^<]+)</strong>'
+ FILE_OFFLINE_PATTERN = r'<h1>Soubor nenalezen</h1>'
+
+ PREMIUM_URL_PATTERN = r'href="(http://[^/]+/dwn-premium.php.*?)"'
+ DOMAIN = "http://csd01.coolshare.cz"
+
+ DOMAIN = "http://s01.warserver.cz"
+
+ def handleFree(self):
+ try:
+ self.download("%s/dwn-free.php?fid=%s" % (self.DOMAIN, self.file_info['ID']))
+ except BadHeader, e:
+ self.logError(e)
+ if e.code == 403:
+ self.longWait(60, 60)
+ else:
+ raise
+ self.checkDownloadedFile()
+
+ def handlePremium(self):
+ found = re.search(self.PREMIUM_URL_PATTERN, self.html)
+ if not found:
+ self.parseError("Premium URL")
+ url = html_unescape(found.group(1))
+ self.logDebug("Premium URL: " + url)
+ if not url.startswith("http://"):
+ self.resetAccount()
+ self.download(url)
+ self.checkDownloadedFile()
+
+ def checkDownloadedFile(self):
+ check = self.checkDownload({
+ "offline": ">404 Not Found<"
+ })
+
+ if check == "offline":
+ self.offline()
+
+
+getInfo = create_getInfo(WarserverCz)
diff --git a/pyload/plugins/hoster/WebshareCz.py b/pyload/plugins/hoster/WebshareCz.py
new file mode 100644
index 000000000..1c9ddb290
--- /dev/null
+++ b/pyload/plugins/hoster/WebshareCz.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class WebshareCz(SimpleHoster):
+ __name__ = "WebshareCz"
+ __type__ = "hoster"
+ __pattern__ = r"http://(\w+\.)?webshare.cz/(stahnout/)?(?P<ID>\w{10})-.+"
+ __version__ = "0.12"
+ __description__ = """WebShare.cz"""
+ __author_name__ = ("zoidberg")
+
+ FILE_NAME_PATTERN = r'<h3>Stahujete soubor: </h3>\s*<div class="textbox">(?P<N>[^<]+)</div>'
+ FILE_SIZE_PATTERN = r'<h3>Velikost souboru je: </h3>\s*<div class="textbox">(?P<S>[^<]+)</div>'
+ FILE_OFFLINE_PATTERN = r'<h3>Soubor ".*?" nebyl nalezen.</h3>'
+
+ DOWNLOAD_LINK_PATTERN = r'id="download_link" href="(?P<url>.*?)"'
+
+ def handleFree(self):
+ url_a = re.search(r"(var l.*)", self.html).group(1)
+ url_b = re.search(r"(var keyStr.*)", self.html).group(1)
+ url = self.js.eval("%s\n%s\ndec(l)" % (url_a, url_b))
+
+ self.logDebug('Download link: ' + url)
+ self.download(url)
+
+
+getInfo = create_getInfo(WebshareCz)
diff --git a/pyload/plugins/hoster/WrzucTo.py b/pyload/plugins/hoster/WrzucTo.py
new file mode 100644
index 000000000..861e7f11e
--- /dev/null
+++ b/pyload/plugins/hoster/WrzucTo.py
@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from pycurl import HTTPHEADER
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+
+
+class WrzucTo(SimpleHoster):
+ __name__ = "WrzucTo"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w+\.)*?wrzuc\.to/([a-zA-Z0-9]+(\.wt|\.html)|(\w+/?linki/[a-zA-Z0-9]+))"
+ __version__ = "0.01"
+ __description__ = """Wrzuc.to plugin - free only"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ SH_COOKIES = [("http://www.wrzuc.to", "language", "en")]
+ FILE_SIZE_PATTERN = r'class="info">\s*<tr>\s*<td>(?P<S>.*?)</td>'
+ FILE_NAME_PATTERN = r'id="file_info">\s*<strong>(?P<N>.*?)</strong>'
+
+ def setup(self):
+ self.multiDL = True
+
+ def handleFree(self):
+ data = dict(re.findall(r'(md5|file): "(.*?)"', self.html))
+ if len(data) != 2:
+ self.parseError('File ID')
+
+ self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
+ self.req.http.lastURL = self.pyfile.url
+ self.load("http://www.wrzuc.to/ajax/server/prepair", post={"md5": data['md5']})
+
+ self.req.http.lastURL = self.pyfile.url
+ self.html = self.load("http://www.wrzuc.to/ajax/server/download_link", post={"file": data['file']})
+
+ data.update(re.findall(r'"(download_link|server_id)":"(.*?)"', self.html))
+ if len(data) != 4:
+ self.parseError('Download URL')
+
+ download_url = "http://%s.wrzuc.to/pobierz/%s" % (data['server_id'], data['download_link'])
+ self.logDebug("Download URL: %s" % download_url)
+ self.download(download_url)
+
+
+getInfo = create_getInfo(WrzucTo)
diff --git a/pyload/plugins/hoster/WuploadCom.py b/pyload/plugins/hoster/WuploadCom.py
new file mode 100644
index 000000000..aaeeb59fd
--- /dev/null
+++ b/pyload/plugins/hoster/WuploadCom.py
@@ -0,0 +1,239 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+import string
+from urllib import unquote
+
+from module.plugins.Hoster import Hoster
+from module.plugins.internal.CaptchaService import ReCaptcha
+from module.plugins.Plugin import chunks
+
+from module.network.RequestFactory import getURL
+from module.common.json_layer import json_loads
+
+
+def getInfo(urls):
+ for chunk in chunks(urls, 20):
+ result = []
+ ids = dict()
+ for url in chunk:
+ id = getId(url)
+ if id:
+ ids[id] = url
+ else:
+ result.append((None, 0, 1, url))
+
+ if len(ids) > 0:
+ check_url = "http://api.wupload.com/link?method=getInfo&format=json&ids=" + ",".join(ids.keys())
+ response = json_loads(getURL(check_url).decode("utf8", "ignore"))
+ for item in response["FSApi_Link"]["getInfo"]["response"]["links"]:
+ if item["status"] != "AVAILABLE":
+ result.append((None, 0, 1, ids[str(item["id"])]))
+ else:
+ result.append((unquote(item["filename"]), item["size"], 2, ids[str(item["id"])]))
+ yield result
+
+
+def getId(url):
+ match = re.search(WuploadCom.FILE_ID_PATTERN, url)
+ if match:
+ return string.replace(match.group("id"), "/", "-")
+ else:
+ return None
+
+
+class WuploadCom(Hoster):
+ __name__ = "WuploadCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://[\w\.]*?wupload\..*?/file/(([a-z][0-9]+/)?[0-9]+)(/.*)?"
+ __version__ = "0.22"
+ __description__ = """Wupload com"""
+ __author_name__ = ("jeix", "paulking")
+ __author_mail__ = ("jeix@hasnomail.de", "")
+
+ API_ADDRESS = "http://api.wupload.com"
+ URL_DOMAIN_PATTERN = r'(?P<prefix>.*?)(?P<domain>.wupload\..+?)(?P<suffix>/.*)'
+ FILE_ID_PATTERN = r'/file/(?P<id>([a-z][0-9]+/)?[0-9]+)(/.*)?'
+ FILE_LINK_PATTERN = r'<p><a href="(http://.+?\.wupload\..+?)"><span>Download Now'
+ WAIT_TIME_PATTERN = r'countDownDelay = (?P<wait>\d+)'
+ WAIT_TM_PATTERN = r"name='tm' value='(.*?)' />"
+ WAIT_TM_HASH_PATTERN = r"name='tm_hash' value='(.*?)' />"
+ CAPTCHA_TYPE1_PATTERN = r'Recaptcha.create\("(.*?)",'
+ CAPTCHA_TYPE2_PATTERN = r'id="recaptcha_image"><img style="display: block;" src="(.+)image?c=(.+?)"'
+
+ def setup(self):
+ if not self.premium:
+ self.chunkLimit = 1
+ self.multiDL = False
+
+ def process(self, pyfile):
+ self.pyfile = pyfile
+
+ self.pyfile.url = self.checkFile(self.pyfile.url)
+
+ if self.premium:
+ self.downloadPremium()
+ else:
+ self.downloadFree()
+
+ def checkFile(self, url):
+ id = getId(url)
+ self.logDebug("file id is %s" % id)
+ if id:
+ # Use the api to check the current status of the file and fixup data
+ check_url = self.API_ADDRESS + "/link?method=getInfo&format=json&ids=%s" % id
+ result = json_loads(self.load(check_url, decode=True))
+ item = result["FSApi_Link"]["getInfo"]["response"]["links"][0]
+ self.logDebug("api check returns %s" % item)
+
+ if item["status"] != "AVAILABLE":
+ self.offline()
+ if item["is_password_protected"] != 0:
+ self.fail("This file is password protected")
+
+ # ignored this check due to false api information
+ #if item["is_premium_only"] != 0 and not self.premium:
+ # self.fail("need premium account for file")
+
+ self.pyfile.name = unquote(item["filename"])
+
+ # Fix the url and resolve the domain to the correct regional variation
+ url = item["url"]
+ urlparts = re.search(self.URL_DOMAIN_PATTERN, url)
+ if urlparts:
+ url = urlparts.group("prefix") + self.getDomain() + urlparts.group("suffix")
+ self.logDebug("localised url is %s" % url)
+ return url
+ else:
+ self.fail("Invalid URL")
+
+ def getDomain(self):
+ result = json_loads(
+ self.load(self.API_ADDRESS + "/utility?method=getWuploadDomainForCurrentIp&format=json", decode=True))
+ self.logDebug("%s: response to get domain %s" % (self.__name__, result))
+ return result["FSApi_Utility"]["getWuploadDomainForCurrentIp"]["response"]
+
+ def downloadPremium(self):
+ self.logDebug("Premium download")
+
+ api = self.API_ADDRESS + "/link?method=getDownloadLink&u=%%s&p=%%s&ids=%s" % getId(self.pyfile.url)
+
+ result = json_loads(self.load(api % (self.user, self.account.getAccountData(self.user)["password"])))
+ links = result["FSApi_Link"]["getDownloadLink"]["response"]["links"]
+
+ #wupload seems to return list and no dicts
+ if type(links) == dict:
+ info = links.values()[0]
+ else:
+ info = links[0]
+
+ if "status" in info and info["status"] == "NOT_AVAILABLE":
+ self.tempOffline()
+
+ self.download(info["url"])
+
+ def downloadFree(self):
+ self.logDebug("Free download")
+ # Get initial page
+ self.html = self.load(self.pyfile.url)
+ url = self.pyfile.url + "?start=1"
+ self.html = self.load(url)
+ self.handleErrors()
+
+ finalUrl = re.search(self.FILE_LINK_PATTERN, self.html)
+
+ if not finalUrl:
+ self.doWait(url)
+
+ chall = re.search(self.CAPTCHA_TYPE1_PATTERN, self.html)
+ chall2 = re.search(self.CAPTCHA_TYPE2_PATTERN, self.html)
+ if chall or chall2:
+ for i in range(5):
+ re_captcha = ReCaptcha(self)
+ if chall:
+ self.logDebug("Captcha type1")
+ challenge, result = re_captcha.challenge(chall.group(1))
+ else:
+ self.logDebug("Captcha type2")
+ server = chall2.group(1)
+ challenge = chall2.group(2)
+ result = re_captcha.result(server, challenge)
+
+ postData = {"recaptcha_challenge_field": challenge,
+ "recaptcha_response_field": result}
+
+ self.html = self.load(url, post=postData)
+ self.handleErrors()
+ chall = re.search(self.CAPTCHA_TYPE1_PATTERN, self.html)
+ chall2 = re.search(self.CAPTCHA_TYPE2_PATTERN, self.html)
+
+ if chall or chall2:
+ self.invalidCaptcha()
+ else:
+ self.correctCaptcha()
+ break
+
+ finalUrl = re.search(self.FILE_LINK_PATTERN, self.html)
+
+ if not finalUrl:
+ self.fail("Couldn't find free download link")
+
+ self.logDebug("got download url %s" % finalUrl.group(1))
+ self.download(finalUrl.group(1))
+
+ def doWait(self, url):
+ # If the current page requires us to wait then wait and move to the next page as required
+
+ # There maybe more than one wait period. The extended wait if download limits have been exceeded (in which case we try reconnect)
+ # and the short wait before every download. Visually these are the same, the difference is that one includes a code to allow
+ # progress to the next page
+
+ waitSearch = re.search(self.WAIT_TIME_PATTERN, self.html)
+ while waitSearch:
+ wait = int(waitSearch.group("wait"))
+ if wait > 300:
+ self.wantReconnect = True
+
+ self.setWait(wait)
+ self.logDebug("Waiting %d seconds." % wait)
+ self.wait()
+
+ tm = re.search(self.WAIT_TM_PATTERN, self.html)
+ tm_hash = re.search(self.WAIT_TM_HASH_PATTERN, self.html)
+
+ if tm and tm_hash:
+ tm = tm.group(1)
+ tm_hash = tm_hash.group(1)
+ self.html = self.load(url, post={"tm": tm, "tm_hash": tm_hash})
+ self.handleErrors()
+ break
+ else:
+ self.html = self.load(url)
+ self.handleErrors()
+ waitSearch = re.search(self.WAIT_TIME_PATTERN, self.html)
+
+ def handleErrors(self):
+ if "This file is available for premium users only." in self.html:
+ self.fail("need premium account for file")
+
+ if "The file that you're trying to download is larger than" in self.html:
+ self.fail("need premium account for file")
+
+ if "Free users may only download 1 file at a time" in self.html:
+ self.fail("only 1 file at a time for free users")
+
+ if "Free user can not download files" in self.html:
+ self.fail("need premium account for file")
+
+ if "Download session in progress" in self.html:
+ self.fail("already downloading")
+
+ if "This file is password protected" in self.html:
+ self.fail("This file is password protected")
+
+ if "An Error Occurred" in self.html:
+ self.fail("A server error occured.")
+
+ if "This file was deleted" in self.html:
+ self.offline()
diff --git a/pyload/plugins/hoster/X7To.py b/pyload/plugins/hoster/X7To.py
new file mode 100644
index 000000000..59ec6ed06
--- /dev/null
+++ b/pyload/plugins/hoster/X7To.py
@@ -0,0 +1,88 @@
+# -*- coding: utf-8 -*-
+import re
+
+from module.plugins.Hoster import Hoster
+
+
+def getInfo(urls):
+ yield [(url, 0, 1, url) for url in urls]
+
+
+class X7To(Hoster):
+ __name__ = "X7To"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www.)?x7.to/"
+ __version__ = "0.4"
+ __description__ = """X7.To File Download Hoster"""
+ __author_name__ = ("ernieb")
+ __author_mail__ = ("ernieb")
+
+ FILE_INFO_PATTERN = r'<meta name="description" content="Download: (.*?) \(([0-9,.]+) (KB|MB|GB)\)'
+
+ def setup(self):
+ self.multiDL = self.resumeDownload = False
+ self.chunkLimit = 1
+
+ self.file_id = re.search(r"http://x7.to/([a-zA-Z0-9]+)", self.pyfile.url).group(1)
+ self.logDebug("file id is %s" % self.file_id)
+ self.pyfile.url = "http://x7.to/" + self.file_id
+
+ def process(self, pyfile):
+ self.fail("Hoster not longer available")
+
+ def handlePremium(self):
+ # check if over limit first
+ overLimit = re.search(r'<a onClick="cUser.buyTraffic\(\)" id="DL">', self.html)
+ if overLimit:
+ self.logDebug("over limit, falling back to free")
+ self.handleFree()
+ else:
+ realurl = re.search(r'<a href="(http://stor.*?)" id="DL">', self.html)
+ if realurl:
+ realurl = realurl.group(1)
+ self.logDebug("premium url found %s" % realurl)
+ else:
+ self.logDebug("premium link not found")
+ self.download(realurl)
+
+ def handleFree(self):
+ # find file id
+ file_id = re.search(r"var dlID = '(.*?)'", self.html)
+ if not file_id:
+ self.fail("Free download id not found")
+
+ file_url = "http://x7.to/james/ticket/dl/" + file_id.group(1)
+ self.logDebug("download id %s" % file_id.group(1))
+
+ self.html = self.load(file_url, ref=False, decode=True)
+
+ # deal with errors
+ if "limit-dl" in self.html:
+ self.logDebug("Limit reached ... waiting")
+ self.setWait(900, True)
+ self.wait()
+ self.retry()
+
+ if "limit-parallel" in self.html:
+ self.fail("Cannot download in parallel")
+
+ # no waiting required, go to download
+ waitCheck = re.search(r"wait:(\d*),", self.html)
+ if waitCheck:
+ waitCheck = int(waitCheck.group(1))
+ self.setWait(waitCheck)
+ self.wait()
+
+ urlCheck = re.search(r"url:'(.*?)'", self.html)
+ url = None
+ if urlCheck:
+ url = urlCheck.group(1)
+ self.logDebug("free url found %s" % url)
+
+ if url:
+ try:
+ self.download(url)
+ except:
+ self.logDebug("downloading url failed: %s" % url)
+ else:
+ self.fail("Free download url found")
diff --git a/pyload/plugins/hoster/XFileSharingPro.py b/pyload/plugins/hoster/XFileSharingPro.py
new file mode 100644
index 000000000..d6fb31307
--- /dev/null
+++ b/pyload/plugins/hoster/XFileSharingPro.py
@@ -0,0 +1,334 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from random import random
+from urllib import unquote
+from urlparse import urlparse
+from pycurl import FOLLOWLOCATION, LOW_SPEED_TIME
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError
+from module.plugins.internal.CaptchaService import ReCaptcha, SolveMedia
+from module.utils import html_unescape
+from module.network.RequestFactory import getURL
+
+
+class XFileSharingPro(SimpleHoster):
+ """
+ Common base for XFileSharingPro hosters like EasybytezCom, CramitIn, FiledinoCom...
+ Some hosters may work straight away when added to __pattern__
+ However, most of them will NOT work because they are either down or running a customized version
+ """
+ __name__ = "XFileSharingPro"
+ __type__ = "hoster"
+ __pattern__ = r"^unmatchable$"
+ __version__ = "0.23"
+ __description__ = """XFileSharingPro common hoster base"""
+ __author_name__ = ("zoidberg", "stickell")
+ __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+
+ FILE_NAME_PATTERN = r'<input type="hidden" name="fname" value="(?P<N>[^"]+)"'
+ FILE_SIZE_PATTERN = r'You have requested <font color="red">[^<]+</font> \((?P<S>[^<]+)\)</font>'
+ FILE_INFO_PATTERN = r'<tr><td align=right><b>Filename:</b></td><td nowrap>(?P<N>[^<]+)</td></tr>\s*.*?<small>\((?P<S>[^<]+)\)</small>'
+ FILE_OFFLINE_PATTERN = r'<(b|h[1-6])>File Not Found</(b|h[1-6])>'
+
+ WAIT_PATTERN = r'<span id="countdown_str">.*?>(\d+)</span>'
+ LONG_WAIT_PATTERN = r'(?P<H>\d+(?=\s*hour))?.*?(?P<M>\d+(?=\s*minute))?.*?(?P<S>\d+(?=\s*second))?'
+ OVR_DOWNLOAD_LINK_PATTERN = r'<h2>Download Link</h2>\s*<textarea[^>]*>([^<]+)'
+ OVR_KILL_LINK_PATTERN = r'<h2>Delete Link</h2>\s*<textarea[^>]*>([^<]+)'
+ CAPTCHA_URL_PATTERN = r'(http://[^"\']+?/captchas?/[^"\']+)'
+ RECAPTCHA_URL_PATTERN = r'http://[^"\']+?recaptcha[^"\']+?\?k=([^"\']+)"'
+ CAPTCHA_DIV_PATTERN = r'<b>Enter code.*?<div.*?>(.*?)</div>'
+ SOLVEMEDIA_PATTERN = r'http:\/\/api\.solvemedia\.com\/papi\/challenge\.script\?k=(.*?)"'
+ ERROR_PATTERN = r'class=["\']err["\'][^>]*>(.*?)</'
+
+ def setup(self):
+ if self.__name__ == "XFileSharingPro":
+ self.__pattern__ = self.core.pluginManager.hosterPlugins[self.__name__]['pattern']
+ self.multiDL = True
+ else:
+ self.resumeDownload = self.multiDL = self.premium
+
+ self.chunkLimit = 1
+
+ def process(self, pyfile):
+ self.prepare()
+
+ if not re.match(self.__pattern__, self.pyfile.url):
+ if self.premium:
+ self.handleOverriden()
+ else:
+ self.fail("Only premium users can download from other hosters with %s" % self.HOSTER_NAME)
+ else:
+ try:
+ # Due to a 0.4.9 core bug self.load would use cookies even if
+ # cookies=False. Workaround using getURL to avoid cookies.
+ # Can be reverted in 0.5 as the cookies bug has been fixed.
+ self.html = getURL(pyfile.url, decode=True)
+ self.file_info = self.getFileInfo()
+ except PluginParseError:
+ self.file_info = None
+
+ self.location = self.getDirectDownloadLink()
+
+ if not self.file_info:
+ pyfile.name = html_unescape(unquote(urlparse(
+ self.location if self.location else pyfile.url).path.split("/")[-1]))
+
+ if self.location:
+ self.startDownload(self.location)
+ elif self.premium:
+ self.handlePremium()
+ else:
+ self.handleFree()
+
+ def prepare(self):
+ """ Initialize important variables """
+ if not hasattr(self, "HOSTER_NAME"):
+ self.HOSTER_NAME = re.search(self.__pattern__, self.pyfile.url).group(1)
+ if not hasattr(self, "DIRECT_LINK_PATTERN"):
+ self.DIRECT_LINK_PATTERN = r'(http://([^/]*?%s|\d+\.\d+\.\d+\.\d+)(:\d+/d/|(?:/files)?/\d+/\w+/)[^"\'<]+)' % self.HOSTER_NAME
+
+ self.captcha = self.errmsg = None
+ self.passwords = self.getPassword().splitlines()
+
+ def getDirectDownloadLink(self):
+ """ Get download link for premium users with direct download enabled """
+ self.req.http.lastURL = self.pyfile.url
+
+ self.req.http.c.setopt(FOLLOWLOCATION, 0)
+ self.html = self.load(self.pyfile.url, cookies=True, decode=True)
+ self.header = self.req.http.header
+ self.req.http.c.setopt(FOLLOWLOCATION, 1)
+
+ location = None
+ found = re.search(r"Location\s*:\s*(.*)", self.header, re.I)
+ if found and re.match(self.DIRECT_LINK_PATTERN, found.group(1)):
+ location = found.group(1).strip()
+
+ return location
+
+ def handleFree(self):
+ url = self.getDownloadLink()
+ self.logDebug("Download URL: %s" % url)
+ self.startDownload(url)
+
+ def getDownloadLink(self):
+ for i in range(5):
+ self.logDebug("Getting download link: #%d" % i)
+ data = self.getPostParameters()
+
+ self.req.http.c.setopt(FOLLOWLOCATION, 0)
+ self.html = self.load(self.pyfile.url, post=data, ref=True, decode=True)
+ self.header = self.req.http.header
+ self.req.http.c.setopt(FOLLOWLOCATION, 1)
+
+ found = re.search(r"Location\s*:\s*(.*)", self.header, re.I)
+ if found:
+ break
+
+ found = re.search(self.DIRECT_LINK_PATTERN, self.html, re.S)
+ if found:
+ break
+
+ else:
+ if self.errmsg and 'captcha' in self.errmsg:
+ self.fail("No valid captcha code entered")
+ else:
+ self.fail("Download link not found")
+
+ return found.group(1)
+
+ def handlePremium(self):
+ self.html = self.load(self.pyfile.url, post=self.getPostParameters())
+ found = re.search(self.DIRECT_LINK_PATTERN, self.html)
+ if not found:
+ self.parseError('DIRECT LINK')
+ self.startDownload(found.group(1))
+
+ def handleOverriden(self):
+ #only tested with easybytez.com
+ self.html = self.load("http://www.%s/" % self.HOSTER_NAME)
+ action, inputs = self.parseHtmlForm('')
+ upload_id = "%012d" % int(random() * 10 ** 12)
+ action += upload_id + "&js_on=1&utype=prem&upload_type=url"
+ inputs['tos'] = '1'
+ inputs['url_mass'] = self.pyfile.url
+ inputs['up1oad_type'] = 'url'
+
+ self.logDebug(self.HOSTER_NAME, action, inputs)
+ #wait for file to upload to easybytez.com
+ self.req.http.c.setopt(LOW_SPEED_TIME, 600)
+ self.html = self.load(action, post=inputs)
+
+ action, inputs = self.parseHtmlForm('F1')
+ if not inputs:
+ self.parseError('TEXTAREA')
+ self.logDebug(self.HOSTER_NAME, inputs)
+ if inputs['st'] == 'OK':
+ self.html = self.load(action, post=inputs)
+ elif inputs['st'] == 'Can not leech file':
+ self.retry(max_tries=20, wait_time=180, reason=inputs['st'])
+ else:
+ self.fail(inputs['st'])
+
+ #get easybytez.com link for uploaded file
+ found = re.search(self.OVR_DOWNLOAD_LINK_PATTERN, self.html)
+ if not found:
+ self.parseError('DIRECT LINK (OVR)')
+ self.pyfile.url = found.group(1)
+ header = self.load(self.pyfile.url, just_header=True)
+ if 'location' in header: # Direct link
+ self.startDownload(self.pyfile.url)
+ else:
+ self.retry()
+
+ def startDownload(self, link):
+ link = link.strip()
+ if self.captcha:
+ self.correctCaptcha()
+ self.logDebug('DIRECT LINK: %s' % link)
+ self.download(link, disposition=True)
+
+ def checkErrors(self):
+ found = re.search(self.ERROR_PATTERN, self.html)
+ if found:
+ self.errmsg = found.group(1)
+ self.logWarning(re.sub(r"<.*?>", " ", self.errmsg))
+
+ if 'wait' in self.errmsg:
+ wait_time = sum([int(v) * {"hour": 3600, "minute": 60, "second": 1}[u] for v, u in
+ re.findall(r'(\d+)\s*(hour|minute|second)?', self.errmsg)])
+ self.setWait(wait_time, True)
+ self.wait()
+ elif 'captcha' in self.errmsg:
+ self.invalidCaptcha()
+ elif 'premium' in self.errmsg and 'require' in self.errmsg:
+ self.fail("File can be downloaded by premium users only")
+ elif 'limit' in self.errmsg:
+ self.setWait(3600, True)
+ self.wait()
+ self.retry(25)
+ elif 'countdown' in self.errmsg or 'Expired session' in self.errmsg:
+ self.retry(3)
+ elif 'maintenance' in self.errmsg:
+ self.tempOffline()
+ elif 'download files up to' in self.errmsg:
+ self.fail("File too large for free download")
+ else:
+ self.fail(self.errmsg)
+
+ else:
+ self.errmsg = None
+
+ return self.errmsg
+
+ def getPostParameters(self):
+ for _ in range(3):
+ if not self.errmsg:
+ self.checkErrors()
+
+ if hasattr(self, "FORM_PATTERN"):
+ action, inputs = self.parseHtmlForm(self.FORM_PATTERN)
+ else:
+ action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")})
+
+ if not inputs:
+ action, inputs = self.parseHtmlForm('F1')
+ if not inputs:
+ if self.errmsg:
+ self.retry()
+ else:
+ self.parseError("Form not found")
+
+ self.logDebug(self.HOSTER_NAME, inputs)
+
+ if 'op' in inputs and inputs['op'] in ('download2', 'download3'):
+ if "password" in inputs:
+ if self.passwords:
+ inputs['password'] = self.passwords.pop(0)
+ else:
+ self.fail("No or invalid passport")
+
+ if not self.premium:
+ found = re.search(self.WAIT_PATTERN, self.html)
+ if found:
+ wait_time = int(found.group(1)) + 1
+ self.setWait(wait_time, False)
+ else:
+ wait_time = 0
+
+ self.captcha = self.handleCaptcha(inputs)
+
+ if wait_time:
+ self.wait()
+
+ self.errmsg = None
+ return inputs
+
+ else:
+ inputs['referer'] = self.pyfile.url
+
+ if self.premium:
+ inputs['method_premium'] = "Premium Download"
+ if 'method_free' in inputs:
+ del inputs['method_free']
+ else:
+ inputs['method_free'] = "Free Download"
+ if 'method_premium' in inputs:
+ del inputs['method_premium']
+
+ self.html = self.load(self.pyfile.url, post=inputs, ref=True)
+ self.errmsg = None
+
+ else:
+ self.parseError('FORM: %s' % (inputs['op'] if 'op' in inputs else 'UNKNOWN'))
+
+ def handleCaptcha(self, inputs):
+ found = re.search(self.RECAPTCHA_URL_PATTERN, self.html)
+ if found:
+ recaptcha_key = unquote(found.group(1))
+ self.logDebug("RECAPTCHA KEY: %s" % recaptcha_key)
+ recaptcha = ReCaptcha(self)
+ inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(recaptcha_key)
+ return 1
+ else:
+ found = re.search(self.CAPTCHA_URL_PATTERN, self.html)
+ if found:
+ captcha_url = found.group(1)
+ inputs['code'] = self.decryptCaptcha(captcha_url)
+ return 2
+ else:
+ found = re.search(self.CAPTCHA_DIV_PATTERN, self.html, re.S)
+ if found:
+ captcha_div = found.group(1)
+ self.logDebug(captcha_div)
+ numerals = re.findall(r'<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div))
+ inputs['code'] = "".join([a[1] for a in sorted(numerals, key=lambda num: int(num[0]))])
+ self.logDebug("CAPTCHA", inputs['code'], numerals)
+ return 3
+ else:
+ found = re.search(self.SOLVEMEDIA_PATTERN, self.html)
+ if found:
+ captcha_key = found.group(1)
+ captcha = SolveMedia(self)
+ inputs['adcopy_challenge'], inputs['adcopy_response'] = captcha.challenge(captcha_key)
+ return 4
+ return 0
+
+
+getInfo = create_getInfo(XFileSharingPro)
diff --git a/pyload/plugins/hoster/XHamsterCom.py b/pyload/plugins/hoster/XHamsterCom.py
new file mode 100644
index 000000000..721f1cb75
--- /dev/null
+++ b/pyload/plugins/hoster/XHamsterCom.py
@@ -0,0 +1,118 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from urllib import unquote
+
+from module.plugins.Hoster import Hoster
+from module.common.json_layer import json_loads
+
+
+def clean_json(json_expr):
+ json_expr = re.sub('[\n\r]', '', json_expr)
+ json_expr = re.sub(' +', '', json_expr)
+ json_expr = re.sub('\'', '"', json_expr)
+
+ return json_expr
+
+
+class XHamsterCom(Hoster):
+ __name__ = "XHamsterCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?xhamster\.com/movies/.+"
+ __version__ = "0.11"
+ __config__ = [("type", ".mp4;.flv", "Preferred type", ".mp4")]
+ __description__ = """XHamster.com Video Download Hoster"""
+
+ def process(self, pyfile):
+ self.pyfile = pyfile
+
+ if not self.file_exists():
+ self.offline()
+
+ if self.getConfig("type"):
+ self.desired_fmt = self.getConfig("type")
+
+ self.pyfile.name = self.get_file_name() + self.desired_fmt
+ self.download(self.get_file_url())
+
+ def download_html(self):
+ url = self.pyfile.url
+ self.html = self.load(url)
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if self.html is None:
+ self.download_html()
+
+ flashvar_pattern = re.compile('flashvars = ({.*?});', re.DOTALL)
+ json_flashvar = flashvar_pattern.search(self.html)
+
+ if json_flashvar is None:
+ self.fail("Parse error (flashvars)")
+
+ j = clean_json(json_flashvar.group(1))
+ flashvars = json_loads(j)
+
+ if flashvars["srv"]:
+ srv_url = flashvars["srv"] + '/'
+ else:
+ self.fail("Parse error (srv_url)")
+
+ if flashvars["url_mode"]:
+ url_mode = flashvars["url_mode"]
+ else:
+ self.fail("Parse error (url_mode)")
+
+ if self.desired_fmt == ".mp4":
+ file_url = re.search(r"<a href=\"" + srv_url + "(.+?)\"", self.html)
+ if file_url is None:
+ self.fail("Parse error (file_url)")
+ file_url = file_url.group(1)
+ long_url = srv_url + file_url
+ self.logDebug(_("long_url: %s") % long_url)
+ else:
+ if flashvars["file"]:
+ file_url = unquote(flashvars["file"])
+ else:
+ self.fail("Parse error (file_url)")
+
+ if url_mode == '3':
+ long_url = file_url
+ self.logDebug(_("long_url: %s") % long_url)
+ else:
+ long_url = srv_url + "key=" + file_url
+ self.logDebug(_("long_url: %s") % long_url)
+
+ return long_url
+
+ def get_file_name(self):
+ if self.html is None:
+ self.download_html()
+
+ file_name_pattern = r"<title>(.*?) - xHamster\.com</title>"
+ file_name = re.search(file_name_pattern, self.html)
+ if file_name is None:
+ file_name_pattern = r"<h1 >(.*)</h1>"
+ file_name = re.search(file_name_pattern, self.html)
+ if file_name is None:
+ file_name_pattern = r"http://[www.]+xhamster\.com/movies/.*/(.*?)\.html?"
+ file_name = re.search(file_name_pattern, self.pyfile.url)
+ if file_name is None:
+ file_name_pattern = r"<div id=\"element_str_id\" style=\"display:none;\">(.*)</div>"
+ file_name = re.search(file_name_pattern, self.html)
+ if file_name is None:
+ return "Unknown"
+
+ return file_name.group(1)
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html is None:
+ self.download_html()
+ if re.search(r"(.*Video not found.*)", self.html) is not None:
+ return False
+ else:
+ return True
diff --git a/pyload/plugins/hoster/XVideosCom.py b/pyload/plugins/hoster/XVideosCom.py
new file mode 100644
index 000000000..48a1f934d
--- /dev/null
+++ b/pyload/plugins/hoster/XVideosCom.py
@@ -0,0 +1,19 @@
+import re
+import urllib
+
+from module.plugins.Hoster import Hoster
+
+
+class XVideosCom(Hoster):
+ __name__ = "XVideos.com"
+ __version__ = "0.1"
+ __pattern__ = r"http://www\.xvideos\.com/video([0-9]+)/.*"
+ __config__ = []
+
+ def process(self, pyfile):
+ site = self.load(pyfile.url)
+ pyfile.name = "%s (%s).flv" % (
+ re.search(r"<h2>([^<]+)<span", site).group(1),
+ re.search(self.__pattern__, pyfile.url).group(1),
+ )
+ self.download(urllib.unquote(re.search(r"flv_url=([^&]+)&", site).group(1)))
diff --git a/pyload/plugins/hoster/Xdcc.py b/pyload/plugins/hoster/Xdcc.py
new file mode 100644
index 000000000..bd8c6025a
--- /dev/null
+++ b/pyload/plugins/hoster/Xdcc.py
@@ -0,0 +1,224 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: jeix
+"""
+
+from os.path import join
+from os.path import exists
+from os import makedirs
+import re
+import sys
+import time
+import socket
+import struct
+from select import select
+
+from module.utils import save_join
+from module.plugins.Hoster import Hoster
+
+
+class Xdcc(Hoster):
+ __name__ = "Xdcc"
+ __version__ = "0.32"
+ __pattern__ = r'xdcc://.*?(/#?.*?)?/.*?/#?\d+/?' # xdcc://irc.Abjects.net/#channel/[XDCC]|Shit/#0004/
+ __type__ = "hoster"
+ __config__ = [
+ ("nick", "str", "Nickname", "pyload"),
+ ("ident", "str", "Ident", "pyloadident"),
+ ("realname", "str", "Realname", "pyloadreal")
+ ]
+ __description__ = """A Plugin that allows you to download from an IRC XDCC bot"""
+ __author_name__ = ("jeix")
+ __author_mail__ = ("jeix@hasnomail.com")
+
+ def setup(self):
+ self.debug = 0 # 0,1,2
+ self.timeout = 30
+ self.multiDL = False
+
+ def process(self, pyfile):
+ # change request type
+ self.req = pyfile.m.core.requestFactory.getRequest(self.__name__, type="XDCC")
+
+ self.pyfile = pyfile
+ for i in range(0, 3):
+ try:
+ nmn = self.doDownload(pyfile.url)
+ self.logDebug("%s: Download of %s finished." % (self.__name__, nmn))
+ return
+ except socket.error, e:
+ if hasattr(e, "errno"):
+ errno = e.errno
+ else:
+ errno = e.args[0]
+
+ if errno in (10054,):
+ self.logDebug("XDCC: Server blocked our ip, retry in 5 min")
+ self.setWait(300)
+ self.wait()
+ continue
+
+ self.fail("Failed due to socket errors. Code: %d" % errno)
+
+ self.fail("Server blocked our ip, retry again later manually")
+
+ def doDownload(self, url):
+ self.pyfile.setStatus("waiting") # real link
+
+ download_folder = self.config['general']['download_folder']
+ location = join(download_folder, self.pyfile.package().folder.decode(sys.getfilesystemencoding()))
+ if not exists(location):
+ makedirs(location)
+
+ m = re.search(r'xdcc://(.*?)/#?(.*?)/(.*?)/#?(\d+)/?', url)
+ server = m.group(1)
+ chan = m.group(2)
+ bot = m.group(3)
+ pack = m.group(4)
+ nick = self.getConfig('nick')
+ ident = self.getConfig('ident')
+ real = self.getConfig('realname')
+
+ temp = server.split(':')
+ ln = len(temp)
+ if ln == 2:
+ host, port = temp
+ elif ln == 1:
+ host, port = temp[0], 6667
+ else:
+ self.fail("Invalid hostname for IRC Server (%s)" % server)
+
+ #######################
+ # CONNECT TO IRC AND IDLE FOR REAL LINK
+ dl_time = time.time()
+
+ sock = socket.socket()
+ sock.connect((host, int(port)))
+ if nick == "pyload":
+ nick = "pyload-%d" % (time.time() % 1000) # last 3 digits
+ sock.send("NICK %s\r\n" % nick)
+ sock.send("USER %s %s bla :%s\r\n" % (ident, host, real))
+ time.sleep(3)
+ sock.send("JOIN #%s\r\n" % chan)
+ sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack))
+
+ # IRC recv loop
+ readbuffer = ""
+ done = False
+ retry = None
+ m = None
+ while True:
+
+ # done is set if we got our real link
+ if done:
+ break
+
+ if retry:
+ if time.time() > retry:
+ retry = None
+ dl_time = time.time()
+ sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack))
+
+ else:
+ if (dl_time + self.timeout) < time.time(): # todo: add in config
+ sock.send("QUIT :byebye\r\n")
+ sock.close()
+ self.fail("XDCC Bot did not answer")
+
+ fdset = select([sock], [], [], 0)
+ if sock not in fdset[0]:
+ continue
+
+ readbuffer += sock.recv(1024)
+ temp = readbuffer.split("\n")
+ readbuffer = temp.pop()
+
+ for line in temp:
+ if self.debug is 2:
+ print "*> " + unicode(line, errors='ignore')
+ line = line.rstrip()
+ first = line.split()
+
+ if first[0] == "PING":
+ sock.send("PONG %s\r\n" % first[1])
+
+ if first[0] == "ERROR":
+ self.fail("IRC-Error: %s" % line)
+
+ msg = line.split(None, 3)
+ if len(msg) != 4:
+ continue
+
+ msg = {
+ "origin": msg[0][1:],
+ "action": msg[1],
+ "target": msg[2],
+ "text": msg[3][1:]
+ }
+
+ if nick == msg["target"][0:len(nick)] and "PRIVMSG" == msg["action"]:
+ if msg["text"] == "\x01VERSION\x01":
+ self.logDebug("XDCC: Sending CTCP VERSION.")
+ sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface"))
+ elif msg["text"] == "\x01TIME\x01":
+ self.logDebug("Sending CTCP TIME.")
+ sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time()))
+ elif msg["text"] == "\x01LAG\x01":
+ pass # don't know how to answer
+
+ if not (bot == msg["origin"][0:len(bot)]
+ and nick == msg["target"][0:len(nick)]
+ and msg["action"] in ("PRIVMSG", "NOTICE")):
+ continue
+
+ if self.debug is 1:
+ print "%s: %s" % (msg["origin"], msg["text"])
+
+ if "You already requested that pack" in msg["text"]:
+ retry = time.time() + 300
+
+ if "you must be on a known channel to request a pack" in msg["text"]:
+ self.fail("Wrong channel")
+
+ m = re.match('\x01DCC SEND (.*?) (\d+) (\d+)(?: (\d+))?\x01', msg["text"])
+ if m:
+ done = True
+
+ # get connection data
+ ip = socket.inet_ntoa(struct.pack('L', socket.ntohl(int(m.group(2)))))
+ port = int(m.group(3))
+ packname = m.group(1)
+
+ if len(m.groups()) > 3:
+ self.req.filesize = int(m.group(4))
+
+ self.pyfile.name = packname
+ filename = save_join(location, packname)
+ self.logInfo("XDCC: Downloading %s from %s:%d" % (packname, ip, port))
+
+ self.pyfile.setStatus("downloading")
+ newname = self.req.download(ip, port, filename, sock, self.pyfile.setProgress)
+ if newname and newname != filename:
+ self.logInfo("%(name)s saved as %(newname)s" % {"name": self.pyfile.name, "newname": newname})
+ filename = newname
+
+ # kill IRC socket
+ # sock.send("QUIT :byebye\r\n")
+ sock.close()
+
+ self.lastDownload = filename
+ return self.lastDownload
diff --git a/pyload/plugins/hoster/YibaishiwuCom.py b/pyload/plugins/hoster/YibaishiwuCom.py
new file mode 100644
index 000000000..37eaa17e5
--- /dev/null
+++ b/pyload/plugins/hoster/YibaishiwuCom.py
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.common.json_layer import json_loads
+
+
+class YibaishiwuCom(SimpleHoster):
+ __name__ = "YibaishiwuCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?(?:u\.)?115.com/file/(?P<ID>\w+)"
+ __version__ = "0.12"
+ __description__ = """115.com"""
+ __author_name__ = ("zoidberg")
+
+ FILE_NAME_PATTERN = r"file_name: '(?P<N>[^']+)'"
+ FILE_SIZE_PATTERN = r"file_size: '(?P<S>[^']+)'"
+ FILE_OFFLINE_PATTERN = ur'<h3><i style="color:red;">哎呀提取码䞍存圚䞍劚搜搜看吧</i></h3>'
+
+ AJAX_URL_PATTERN = r'(/\?ct=(pickcode|download)[^"\']+)'
+
+ def handleFree(self):
+ found = re.search(self.AJAX_URL_PATTERN, self.html)
+ if not found:
+ self.parseError("AJAX URL")
+ url = found.group(1)
+ self.logDebug(('FREEUSER' if found.group(2) == 'download' else 'GUEST') + ' URL', url)
+
+ response = json_loads(self.load("http://115.com" + url, decode=False))
+ for mirror in (response['urls'] if 'urls' in response else response['data'] if 'data' in response else []):
+ try:
+ url = mirror['url'].replace('\\', '')
+ self.logDebug("Trying URL: " + url)
+ self.download(url)
+ break
+ except:
+ continue
+ else:
+ self.fail('No working link found')
+
+
+getInfo = create_getInfo(YibaishiwuCom)
diff --git a/pyload/plugins/hoster/YoupornCom.py b/pyload/plugins/hoster/YoupornCom.py
new file mode 100644
index 000000000..b0d594ca5
--- /dev/null
+++ b/pyload/plugins/hoster/YoupornCom.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Hoster import Hoster
+
+
+class YoupornCom(Hoster):
+ __name__ = "YoupornCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(www\.)?youporn\.com/watch/.+"
+ __version__ = "0.2"
+ __description__ = """Youporn.com Video Download Hoster"""
+ __author_name__ = ("willnix")
+ __author_mail__ = ("willnix@pyload.org")
+
+ def process(self, pyfile):
+ self.pyfile = pyfile
+
+ if not self.file_exists():
+ self.offline()
+
+ self.pyfile.name = self.get_file_name()
+ self.download(self.get_file_url())
+
+ def download_html(self):
+ url = self.pyfile.url
+ self.html = self.load(url, post={"user_choice": "Enter"}, cookies=False)
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ if self.html is None:
+ self.download_html()
+
+ file_url = re.search(r'(http://download\.youporn\.com/download/\d+\?save=1)">', self.html).group(1)
+ return file_url
+
+ def get_file_name(self):
+ if self.html is None:
+ self.download_html()
+
+ file_name_pattern = r"<title>(.*) - Free Porn Videos - YouPorn</title>"
+ return re.search(file_name_pattern, self.html).group(1).replace("&amp;", "&").replace("/", "") + '.flv'
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html is None:
+ self.download_html()
+ if re.search(r"(.*invalid video_id.*)", self.html) is not None:
+ return False
+ else:
+ return True
diff --git a/pyload/plugins/hoster/YourfilesTo.py b/pyload/plugins/hoster/YourfilesTo.py
new file mode 100644
index 000000000..0fd094f61
--- /dev/null
+++ b/pyload/plugins/hoster/YourfilesTo.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+import urllib
+from module.plugins.Hoster import Hoster
+
+
+class YourfilesTo(Hoster):
+ __name__ = "YourfilesTo"
+ __type__ = "hoster"
+ __pattern__ = r"(http://)?(www\.)?yourfiles\.(to|biz)/\?d=[a-zA-Z0-9]+"
+ __version__ = "0.21"
+ __description__ = """Youfiles.to Download Hoster"""
+ __author_name__ = ("jeix", "skydancer")
+ __author_mail__ = ("jeix@hasnomail.de", "skydancer@hasnomail.de")
+
+ def process(self, pyfile):
+ self.pyfile = pyfile
+ self.prepare()
+ self.download(self.get_file_url())
+
+ def prepare(self):
+ if not self.file_exists():
+ self.offline()
+
+ self.pyfile.name = self.get_file_name()
+
+ wait_time = self.get_waiting_time()
+ self.setWait(wait_time)
+ self.logDebug("%s: Waiting %d seconds." % (self.__name__, wait_time))
+ self.wait()
+
+ def get_waiting_time(self):
+ if self.html is None:
+ self.download_html()
+
+ #var zzipitime = 15;
+ m = re.search(r'var zzipitime = (\d+);', self.html)
+ if m:
+ sec = int(m.group(1))
+ else:
+ sec = 0
+
+ return sec
+
+ def download_html(self):
+ url = self.pyfile.url
+ self.html = self.load(url)
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ url = re.search(r"var bla = '(.*?)';", self.html)
+ if url:
+ url = url.group(1)
+ url = urllib.unquote(url.replace("http://http:/http://", "http://").replace("dumdidum", ""))
+ return url
+ else:
+ self.fail("absolute filepath could not be found. offline? ")
+
+ def get_file_name(self):
+ if self.html is None:
+ self.download_html()
+
+ return re.search("<title>(.*)</title>", self.html).group(1)
+
+ def file_exists(self):
+ """ returns True or False
+ """
+ if self.html is None:
+ self.download_html()
+
+ if re.search(r"HTTP Status 404", self.html) is not None:
+ return False
+ else:
+ return True
diff --git a/pyload/plugins/hoster/YoutubeCom.py b/pyload/plugins/hoster/YoutubeCom.py
new file mode 100644
index 000000000..319eb36e6
--- /dev/null
+++ b/pyload/plugins/hoster/YoutubeCom.py
@@ -0,0 +1,168 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+import subprocess
+import os
+from urllib import unquote
+
+from module.utils import html_unescape
+from module.plugins.Hoster import Hoster
+
+
+def which(program):
+ """Works exactly like the unix command which
+
+ Courtesy of http://stackoverflow.com/a/377028/675646"""
+
+ def is_exe(fpath):
+ return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
+
+ fpath, fname = os.path.split(program)
+ if fpath:
+ if is_exe(program):
+ return program
+ else:
+ for path in os.environ["PATH"].split(os.pathsep):
+ path = path.strip('"')
+ exe_file = os.path.join(path, program)
+ if is_exe(exe_file):
+ return exe_file
+
+ return None
+
+
+class YoutubeCom(Hoster):
+ __name__ = "YoutubeCom"
+ __type__ = "hoster"
+ __pattern__ = r"https?://(?:[^/]*?)youtube\.com/watch.*?[?&]v=.*"
+ __version__ = "0.38"
+ __config__ = [("quality", "sd;hd;fullhd;240p;360p;480p;720p;1080p;3072p", "Quality Setting", "hd"),
+ ("fmt", "int", "FMT/ITAG Number (5-102, 0 for auto)", 0),
+ (".mp4", "bool", "Allow .mp4", True),
+ (".flv", "bool", "Allow .flv", True),
+ (".webm", "bool", "Allow .webm", False),
+ (".3gp", "bool", "Allow .3gp", False),
+ ("3d", "bool", "Prefer 3D", False)]
+ __description__ = """Youtube.com Video Download Hoster"""
+ __author_name__ = ("spoob", "zoidberg")
+ __author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz")
+
+ # name, width, height, quality ranking, 3D
+ formats = {5: (".flv", 400, 240, 1, False),
+ 6: (".flv", 640, 400, 4, False),
+ 17: (".3gp", 176, 144, 0, False),
+ 18: (".mp4", 480, 360, 2, False),
+ 22: (".mp4", 1280, 720, 8, False),
+ 43: (".webm", 640, 360, 3, False),
+ 34: (".flv", 640, 360, 4, False),
+ 35: (".flv", 854, 480, 6, False),
+ 36: (".3gp", 400, 240, 1, False),
+ 37: (".mp4", 1920, 1080, 9, False),
+ 38: (".mp4", 4096, 3072, 10, False),
+ 44: (".webm", 854, 480, 5, False),
+ 45: (".webm", 1280, 720, 7, False),
+ 46: (".webm", 1920, 1080, 9, False),
+ 82: (".mp4", 640, 360, 3, True),
+ 83: (".mp4", 400, 240, 1, True),
+ 84: (".mp4", 1280, 720, 8, True),
+ 85: (".mp4", 1920, 1080, 9, True),
+ 100: (".webm", 640, 360, 3, True),
+ 101: (".webm", 640, 360, 4, True),
+ 102: (".webm", 1280, 720, 8, True)}
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = True
+
+ def process(self, pyfile):
+ html = self.load(pyfile.url, decode=True)
+
+ if re.search(r'<div id="player-unavailable" class="\s*player-width player-height\s*">', html):
+ self.offline()
+
+ if "We have been receiving a large volume of requests from your network." in html:
+ self.tempOffline()
+
+ #get config
+ use3d = self.getConfig("3d")
+ if use3d:
+ quality = {"sd": 82, "hd": 84, "fullhd": 85, "240p": 83, "360p": 82,
+ "480p": 82, "720p": 84, "1080p": 85, "3072p": 85}
+ else:
+ quality = {"sd": 18, "hd": 22, "fullhd": 37, "240p": 5, "360p": 18,
+ "480p": 35, "720p": 22, "1080p": 37, "3072p": 38}
+ desired_fmt = self.getConfig("fmt")
+ if desired_fmt and desired_fmt not in self.formats:
+ self.logWarning("FMT %d unknown - using default." % desired_fmt)
+ desired_fmt = 0
+ if not desired_fmt:
+ desired_fmt = quality.get(self.getConfig("quality"), 18)
+
+ #parse available streams
+ streams = re.search(r'"url_encoded_fmt_stream_map": "(.*?)",', html).group(1)
+ streams = [x.split('\u0026') for x in streams.split(',')]
+ streams = [dict((y.split('=', 1)) for y in x) for x in streams]
+ streams = [(int(x['itag']), "%s&signature=%s" % (unquote(x['url']), x['sig'])) for x in streams]
+ #self.logDebug("Found links: %s" % streams)
+ self.logDebug("AVAILABLE STREAMS: %s" % [x[0] for x in streams])
+
+ #build dictionary of supported itags (3D/2D)
+ allowed = lambda x: self.getConfig(self.formats[x][0])
+ streams = [x for x in streams if x[0] in self.formats and allowed(x[0])]
+ if not streams:
+ self.fail("No available stream meets your preferences")
+ fmt_dict = dict([x for x in streams if self.formats[x[0]][4] == use3d] or streams)
+
+ self.logDebug("DESIRED STREAM: ITAG:%d (%s) %sfound, %sallowed" %
+ (desired_fmt, "%s %dx%d Q:%d 3D:%s" % self.formats[desired_fmt],
+ "" if desired_fmt in fmt_dict else "NOT ", "" if allowed(desired_fmt) else "NOT "))
+
+ #return fmt nearest to quality index
+ if desired_fmt in fmt_dict and allowed(desired_fmt):
+ fmt = desired_fmt
+ else:
+ sel = lambda x: self.formats[x][3] # select quality index
+ comp = lambda x, y: abs(sel(x) - sel(y))
+
+ self.logDebug("Choosing nearest fmt: %s" % [(x, allowed(x), comp(x, desired_fmt)) for x in fmt_dict.keys()])
+ fmt = reduce(lambda x, y: x if comp(x, desired_fmt) <= comp(y, desired_fmt) and
+ sel(x) > sel(y) else y, fmt_dict.keys())
+
+ self.logDebug("Chosen fmt: %s" % fmt)
+ url = fmt_dict[fmt]
+ self.logDebug("URL: %s" % url)
+
+ #set file name
+ file_suffix = self.formats[fmt][0] if fmt in self.formats else ".flv"
+ file_name_pattern = '<meta name="title" content="(.+?)">'
+ name = re.search(file_name_pattern, html).group(1).replace("/", "")
+
+ # Cleaning invalid characters from the file name
+ name = name.encode('ascii', 'replace')
+
+ pyfile.name = html_unescape(name)
+
+ time = re.search(r"t=((\d+)m)?(\d+)s", pyfile.url)
+ ffmpeg = which("ffmpeg")
+ if ffmpeg and time:
+ m, s = time.groups()[1:]
+ if not m:
+ m = "0"
+
+ pyfile.name += " (starting at %s:%s)" % (m, s)
+ pyfile.name += file_suffix
+
+ filename = self.download(url)
+
+ if ffmpeg and time:
+ inputfile = filename + "_"
+ os.rename(filename, inputfile)
+
+ subprocess.call([
+ ffmpeg,
+ "-ss", "00:%s:%s" % (m, s),
+ "-i", inputfile,
+ "-vcodec", "copy",
+ "-acodec", "copy",
+ filename])
+ os.remove(inputfile)
diff --git a/pyload/plugins/hoster/ZDF.py b/pyload/plugins/hoster/ZDF.py
new file mode 100644
index 000000000..9940fd078
--- /dev/null
+++ b/pyload/plugins/hoster/ZDF.py
@@ -0,0 +1,47 @@
+import re
+from xml.etree.ElementTree import fromstring
+
+from module.plugins.Hoster import Hoster
+
+XML_API = "http://www.zdf.de/ZDFmediathek/xmlservice/web/beitragsDetails?id=%i"
+
+
+class ZDF(Hoster):
+ # Based on zdfm by Roland Beermann
+ # http://github.com/enkore/zdfm/
+ __name__ = "ZDF Mediathek"
+ __version__ = "0.7"
+ __pattern__ = r"http://www\.zdf\.de/ZDFmediathek/[^0-9]*([0-9]+)[^0-9]*"
+ __config__ = []
+
+ @staticmethod
+ def video_key(video):
+ return (
+ int(video.findtext("videoBitrate", "0")),
+ any(f.text == "progressive" for f in video.iter("facet")),
+ )
+
+ @staticmethod
+ def video_valid(video):
+ return video.findtext("url").startswith("http") and video.findtext("url").endswith(".mp4")
+
+ @staticmethod
+ def get_id(url):
+ return int(re.search(r"[^0-9]*([0-9]+)[^0-9]*", url).group(1))
+
+ def process(self, pyfile):
+ xml = fromstring(self.load(XML_API % self.get_id(pyfile.url)))
+
+ status = xml.findtext("./status/statuscode")
+ if status != "ok":
+ self.fail("Error retrieving manifest.")
+
+ video = xml.find("video")
+ title = video.findtext("information/title")
+
+ pyfile.name = title
+
+ target_url = sorted((v for v in video.iter("formitaet") if self.video_valid(v)),
+ key=self.video_key)[-1].findtext("url")
+
+ self.download(target_url)
diff --git a/pyload/plugins/hoster/ZeveraCom.py b/pyload/plugins/hoster/ZeveraCom.py
new file mode 100644
index 000000000..e8b832a13
--- /dev/null
+++ b/pyload/plugins/hoster/ZeveraCom.py
@@ -0,0 +1,106 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from module.plugins.Hoster import Hoster
+
+
+class ZeveraCom(Hoster):
+ __name__ = "ZeveraCom"
+ __version__ = "0.21"
+ __type__ = "hoster"
+ __pattern__ = r"http://zevera.com/.*"
+ __description__ = """zevera.com hoster plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = True
+ self.chunkLimit = 1
+
+ def process(self, pyfile):
+ if not self.account:
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "zevera.com")
+ self.fail("No zevera.com account provided")
+
+ self.logDebug("zevera.com: Old URL: %s" % pyfile.url)
+
+ if self.account.getAPIData(self.req, cmd="checklink", olink=pyfile.url) != "Alive":
+ self.fail("Offline or not downloadable - contact Zevera support")
+
+ header = self.account.getAPIData(self.req, just_header=True, cmd="generatedownloaddirect", olink=pyfile.url)
+ if not "location" in header:
+ self.fail("Unable to initialize download - contact Zevera support")
+
+ self.download(header['location'], disposition=True)
+
+ check = self.checkDownload({"error": 'action="ErrorDownload.aspx'})
+ if check == "error":
+ self.fail("Error response received - contact Zevera support")
+
+ # BitAPI not used - defunct, probably abandoned by Zevera
+ #
+ # api_url = "http://zevera.com/API.ashx"
+ #
+ # def process(self, pyfile):
+ # if not self.account:
+ # self.logError(_("Please enter your zevera.com account or deactivate this plugin"))
+ # self.fail("No zevera.com account provided")
+ #
+ # self.logDebug("zevera.com: Old URL: %s" % pyfile.url)
+ #
+ # last_size = retries = 0
+ # olink = self.pyfile.url #quote(self.pyfile.url.encode('utf_8'))
+ #
+ # for i in range(100):
+ # self.retData = self.account.loadAPIRequest(self.req, cmd = 'download_request', olink = olink)
+ # self.checkAPIErrors(self.retData)
+ #
+ # if self.retData['FileInfo']['StatusID'] == 100:
+ # break
+ # elif self.retData['FileInfo']['StatusID'] == 99:
+ # self.fail('Failed to initialize download (99)')
+ # else:
+ # if self.retData['FileInfo']['Progress']['BytesReceived'] <= last_size:
+ # if retries >= 6:
+ # self.fail('Failed to initialize download (%d)' % self.retData['FileInfo']['StatusID'] )
+ # retries += 1
+ # else:
+ # retries = 0
+ #
+ # last_size = self.retData['FileInfo']['Progress']['BytesReceived']
+ #
+ # self.setWait(self.retData['Update_Wait'])
+ # self.wait()
+ #
+ # pyfile.name = self.retData['FileInfo']['RealFileName']
+ # pyfile.size = self.retData['FileInfo']['FileSizeInBytes']
+ #
+ # self.retData = self.account.loadAPIRequest(self.req, cmd = 'download_start',
+ # FileID = self.retData['FileInfo']['FileID'])
+ # self.checkAPIErrors(self.retData)
+ #
+ # self.download(self.api_url, get = {
+ # 'cmd': "open_stream",
+ # 'login': self.account.loginname,
+ # 'pass': self.account.password,
+ # 'FileID': self.retData['FileInfo']['FileID'],
+ # 'startBytes': 0
+ # }
+ # )
+ #
+ # def checkAPIErrors(self, retData):
+ # if not retData:
+ # self.fail('Unknown API response')
+ #
+ # if retData['ErrorCode']:
+ # self.logError(retData['ErrorCode'], retData['ErrorMessage'])
+ # #self.fail('ERROR: ' + retData['ErrorMessage'])
+ #
+ # if self.pyfile.size / 1024000 > retData['AccountInfo']['AvailableTODAYTrafficForUseInMBytes']:
+ # self.logWarning("Not enough data left to download the file")
+ #
+ # def crazyDecode(self, ustring):
+ # # accepts decoded ie. unicode string - API response is double-quoted, double-utf8-encoded
+ # # no idea what the proper order of calling these functions would be :-/
+ # return html_unescape(unquote(unquote(ustring.replace(
+ # '@DELIMITER@','#'))).encode('raw_unicode_escape').decode('utf-8'))
diff --git a/pyload/plugins/hoster/ZippyshareCom.py b/pyload/plugins/hoster/ZippyshareCom.py
new file mode 100644
index 000000000..c98679a22
--- /dev/null
+++ b/pyload/plugins/hoster/ZippyshareCom.py
@@ -0,0 +1,220 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# Test links (random.bin):
+# http://www29.zippyshare.com/v/55578602/file.html
+
+import re
+import subprocess
+import tempfile
+import os
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp
+from module.plugins.internal.CaptchaService import ReCaptcha
+from module.common.json_layer import json_loads
+
+
+class ZippyshareCom(SimpleHoster):
+ __name__ = "ZippyshareCom"
+ __type__ = "hoster"
+ __pattern__ = r"(?P<HOST>http://www\d{0,2}\.zippyshare.com)/v(?:/|iew.jsp.*key=)(?P<KEY>\d+)"
+ __version__ = "0.41"
+ __description__ = """Zippyshare.com Download Hoster"""
+ __author_name__ = ("spoob", "zoidberg", "stickell")
+ __author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+ __config__ = [("swfdump_path", "string", "Path to swfdump", "")]
+
+ FILE_NAME_PATTERN = r'>Name:</font>\s*<font [^>]*>(?P<N>[^<]+)</font><br />'
+ FILE_SIZE_PATTERN = r'>Size:</font>\s*<font [^>]*>(?P<S>[0-9.,]+) (?P<U>[kKMG]+)i?B</font><br />'
+ FILE_INFO_PATTERN = r'document\.getElementById\(\'dlbutton\'\)\.href = "[^;]*/(?P<N>[^"]+)";'
+ FILE_OFFLINE_PATTERN = r'>File does not exist on this server</div>'
+
+ SH_COOKIES = [('zippyshare.com', 'ziplocale', 'en')]
+
+ DOWNLOAD_URL_PATTERN = r"<script type=\"text/javascript\">([^<]*?)(document\.getElementById\('dlbutton'\).href = [^;]+;)"
+ SEED_PATTERN = r'swfobject.embedSWF\("([^"]+)".*?seed: (\d+)'
+ CAPTCHA_KEY_PATTERN = r'Recaptcha.create\("([^"]+)"'
+ CAPTCHA_SHORTENCODE_PATTERN = r"shortencode: '([^']+)'"
+ CAPTCHA_DOWNLOAD_PATTERN = r"document.location = '([^']+)'"
+
+ LAST_KNOWN_VALUES = (9, 2374755) # time = (seed * multiply) % modulo
+
+ def setup(self):
+ self.multiDL = True
+
+ def handleFree(self):
+ url = self.get_file_url()
+ if not url:
+ self.fail("Download URL not found.")
+ self.logDebug("Download URL: %s" % url)
+ self.download(url)
+
+ check = self.checkDownload({
+ "swf_values": re.compile(self.SEED_PATTERN)
+ })
+
+ if check == "swf_values":
+ swf_sts = self.getStorage("swf_sts")
+ if not swf_sts:
+ self.setStorage("swf_sts", 2)
+ self.setStorage("swf_stamp", 0)
+ elif swf_sts == '1':
+ self.setStorage("swf_sts", 2)
+
+ self.retry(max_tries=1)
+
+ def get_file_url(self):
+ """ returns the absolute downloadable filepath
+ """
+ url = None
+
+ found = re.search(self.DOWNLOAD_URL_PATTERN, self.html, re.S)
+ #Method #1: JS eval
+ if found and re.search(r'span id="omg" class="(\d*)"', self.html):
+ js = "\n".join(found.groups())
+ d = re.search(r'span id="omg" class="(\d*)"', self.html).group(1)
+ regex = r"document.getElementById\('omg'\).getAttribute\('class'\)"
+ js = re.sub(regex, d, js)
+ regex = r"document.getElementById\(\\*'dlbutton\\*'\).href = "
+ js = re.sub(regex, '', js)
+ url = self.js.eval(js)
+ elif found and re.search(r"document.getElementById\(\\*'dlbutton\\*'\).omg", self.html):
+ js = "\n".join(found.groups())
+ regex = r"document.getElementById\(\\*'dlbutton\\*'\).omg"
+ omg = re.search(regex + r" = ([^;]+);", js).group(1)
+ js = re.sub(regex + r" = ([^;]+);", '', js)
+ js = re.sub(regex, omg, js)
+ js = re.sub(r"document.getElementById\(\\*'dlbutton\\*'\).href = ", '', js)
+ url = self.js.eval(js)
+ else:
+ #Method #2: SWF eval
+ url = self.swf_eval()
+
+ if not url:
+ #Method #3: Captcha
+ url = self.do_recaptcha()
+
+ return self.file_info['HOST'] + url
+
+ def swf_eval(self):
+ multiply = modulo = None
+ seed_search = re.search(self.SEED_PATTERN, self.html)
+ if seed_search:
+ swf_url, file_seed = seed_search.groups()
+
+ swf_sts = self.getStorage("swf_sts")
+ swf_stamp = int(self.getStorage("swf_stamp") or 0)
+ swf_version = self.getStorage("version")
+ self.logDebug("SWF", swf_sts, swf_stamp, swf_version)
+
+ if not swf_sts:
+ self.logDebug('Using default values')
+ multiply, modulo = self.LAST_KNOWN_VALUES
+ elif swf_sts == "1":
+ self.logDebug('Using stored values')
+ multiply = self.getStorage("multiply")
+ modulo = self.getStorage("modulo")
+ elif swf_sts == "2":
+ if swf_version < self.__version__:
+ self.logDebug('Reverting to default values')
+ self.setStorage("swf_sts", "")
+ self.setStorage("version", self.__version__)
+ multiply, modulo = self.LAST_KNOWN_VALUES
+ elif (swf_stamp + 3600000) < timestamp():
+ swfdump = self.get_swfdump_path()
+ if swfdump:
+ multiply, modulo = self.get_swf_values(self.file_info['HOST'] + swf_url, swfdump)
+ else:
+ self.logWarning("Swfdump not found. Install swftools to bypass captcha.")
+
+ if multiply and modulo:
+ self.logDebug("TIME = (%s * %s) %s" % (file_seed, multiply, modulo))
+ url = "/download?key=%s&time=%d" % (self.file_info['KEY'],
+ (int(file_seed) * int(multiply)) % int(modulo))
+ return url
+
+ return None
+
+ def get_swf_values(self, swf_url, swfdump):
+ self.logDebug('Parsing values from %s' % swf_url)
+ multiply = modulo = None
+
+ fd, fpath = tempfile.mkstemp()
+ try:
+ swf_data = self.load(swf_url)
+ os.write(fd, swf_data)
+
+ p = subprocess.Popen([swfdump, '-a', fpath], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ out, err = p.communicate()
+
+ if err:
+ self.logError(err)
+ else:
+ m_str = re.search(r'::break.*?{(.*?)}', out, re.S).group(1)
+ multiply = re.search(r'pushbyte (\d+)', m_str).group(1)
+ modulo = re.search(r'pushint (\d+)', m_str).group(1)
+ finally:
+ os.close(fd)
+ os.remove(fpath)
+
+ if multiply and modulo:
+ self.setStorage("multiply", multiply)
+ self.setStorage("modulo", modulo)
+ self.setStorage("swf_sts", 1)
+ self.setStorage("version", self.__version__)
+ else:
+ self.logError("Parsing SWF failed: swfdump not installed or plugin out of date")
+ self.setStorage("swf_sts", 2)
+
+ self.setStorage("swf_stamp", timestamp())
+
+ return multiply, modulo
+
+ def get_swfdump_path(self):
+ # used for detecting if swfdump is installed
+ def is_exe(ppath):
+ return os.path.isfile(ppath) and os.access(ppath, os.X_OK)
+
+ program = self.getConfig("swfdump_path") or "swfdump"
+ swfdump = None
+ ppath, pname = os.path.split(program)
+ if ppath:
+ if is_exe(program):
+ swfdump = program
+ else:
+ for ppath in os.environ["PATH"].split(os.pathsep):
+ exe_file = os.path.join(ppath, program)
+ if is_exe(exe_file):
+ swfdump = exe_file
+
+ # return path to the executable or None if not found
+ return swfdump
+
+ def do_recaptcha(self):
+ self.logDebug('Trying to solve captcha')
+ captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group(1)
+ shortencode = re.search(self.CAPTCHA_SHORTENCODE_PATTERN, self.html).group(1)
+ url = re.search(self.CAPTCHA_DOWNLOAD_PATTERN, self.html).group(1)
+
+ recaptcha = ReCaptcha(self)
+
+ for i in range(5):
+ challenge, code = recaptcha.challenge(captcha_key)
+
+ response = json_loads(self.load(self.file_info['HOST'] + '/rest/captcha/test',
+ post={'challenge': challenge,
+ 'response': code,
+ 'shortencode': shortencode}))
+ self.logDebug("reCaptcha response : %s" % response)
+ if response == True:
+ self.correctCaptcha()
+ break
+ else:
+ self.invalidCaptcha()
+ else:
+ self.fail("Invalid captcha")
+
+ return url
+
+
+getInfo = create_getInfo(ZippyshareCom)
diff --git a/pyload/plugins/hoster/__init__.py b/pyload/plugins/hoster/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/pyload/plugins/hoster/__init__.py
diff --git a/pyload/plugins/internal/AbstractExtractor.py b/pyload/plugins/internal/AbstractExtractor.py
new file mode 100644
index 000000000..3ce76b6fa
--- /dev/null
+++ b/pyload/plugins/internal/AbstractExtractor.py
@@ -0,0 +1,97 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+class ArchiveError(Exception):
+ pass
+
+class CRCError(Exception):
+ pass
+
+class WrongPassword(Exception):
+ pass
+
+class AbtractExtractor:
+
+ __version__ = "0.1"
+
+ @staticmethod
+ def checkDeps():
+ """ Check if system satisfies dependencies
+ :return: boolean
+ """
+ return True
+
+ @staticmethod
+ def getTargets(files_ids):
+ """ Filter suited targets from list of filename id tuple list
+ :param files_ids: List of file paths
+ :return: List of targets, id tuple list
+ """
+ raise NotImplementedError
+
+
+ def __init__(self, m, file, out, fullpath, overwrite, excludefiles, renice):
+ """Initialize extractor for specific file
+
+ :param m: ExtractArchive addon plugin
+ :param file: Absolute file path
+ :param out: Absolute path to destination directory
+ :param fullpath: Extract to fullpath
+ :param overwrite: Overwrite existing archives
+ :param renice: Renice value
+ """
+ self.m = m
+ self.file = file
+ self.out = out
+ self.fullpath = fullpath
+ self.overwrite = overwrite
+ self.excludefiles = excludefiles
+ self.renice = renice
+ self.files = [] # Store extracted files here
+
+
+ def init(self):
+ """ Initialize additional data structures """
+ pass
+
+
+ def checkArchive(self):
+ """Check if password is needed. Raise ArchiveError if integrity is
+ questionable.
+
+ :return: boolean
+ :raises ArchiveError
+ """
+ return False
+
+ def checkPassword(self, password):
+ """ Check if the given password is/might be correct.
+ If it can not be decided at this point return true.
+
+ :param password:
+ :return: boolean
+ """
+ return True
+
+ def extract(self, progress, 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 WrongPassword
+ :raises CRCError
+ :raises ArchiveError
+ :return:
+ """
+ raise NotImplementedError
+
+ def getDeleteFiles(self):
+ """Return list of files to delete, do *not* delete them here.
+
+ :return: List with paths of files to delete
+ """
+ raise NotImplementedError
+
+ def getExtractedFiles(self):
+ """Populate self.files at some point while extracting"""
+ return self.files
diff --git a/pyload/plugins/internal/CaptchaService.py b/pyload/plugins/internal/CaptchaService.py
new file mode 100644
index 000000000..4f903e3e6
--- /dev/null
+++ b/pyload/plugins/internal/CaptchaService.py
@@ -0,0 +1,75 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+
+class CaptchaService():
+ __version__ = "0.02"
+
+ def __init__(self, plugin):
+ self.plugin = plugin
+
+class ReCaptcha():
+ def __init__(self, plugin):
+ self.plugin = plugin
+
+ def challenge(self, id):
+ js = self.plugin.req.load("http://www.google.com/recaptcha/api/challenge", get={"k":id}, cookies=True)
+
+ try:
+ challenge = re.search("challenge : '(.*?)',", js).group(1)
+ server = re.search("server : '(.*?)',", js).group(1)
+ except:
+ self.plugin.fail("recaptcha error")
+ result = self.result(server,challenge)
+
+ return challenge, result
+
+ def result(self, server, challenge):
+ return self.plugin.decryptCaptcha("%simage"%server, get={"c":challenge}, cookies=True, forceUser=True, imgtype="jpg")
+
+class AdsCaptcha(CaptchaService):
+ def challenge(self, src):
+ js = self.plugin.req.load(src, cookies=True)
+
+ try:
+ challenge = re.search("challenge: '(.*?)',", js).group(1)
+ server = re.search("server: '(.*?)',", js).group(1)
+ except:
+ self.plugin.fail("adscaptcha error")
+ result = self.result(server,challenge)
+
+ return challenge, result
+
+ def result(self, server, challenge):
+ return self.plugin.decryptCaptcha("%sChallenge.aspx" % server, get={"cid": challenge, "dummy": random()}, cookies=True, imgtype="jpg")
+
+class SolveMedia(CaptchaService):
+
+ def challenge(self, src):
+ html = self.plugin.req.load("http://api.solvemedia.com/papi/challenge.noscript?k=%s" % src, cookies=True)
+ try:
+ challenge = re.search(r'<input type=hidden name="adcopy_challenge" id="adcopy_challenge" value="([^"]+)">', html).group(1)
+ except:
+ self.plugin.fail("solvmedia error")
+ result = self.result(challenge)
+
+ return challenge, result
+
+ def result(self,challenge):
+ return self.plugin.decryptCaptcha("http://api.solvemedia.com/papi/media?c=%s" % challenge,imgtype="gif") \ No newline at end of file
diff --git a/pyload/plugins/internal/DeadCrypter.py b/pyload/plugins/internal/DeadCrypter.py
new file mode 100644
index 000000000..805f781af
--- /dev/null
+++ b/pyload/plugins/internal/DeadCrypter.py
@@ -0,0 +1,14 @@
+from module.plugins.Crypter import Crypter as _Crypter
+
+
+class DeadCrypter(_Crypter):
+ __name__ = "DeadCrypter"
+ __type__ = "crypter"
+ __pattern__ = r""
+ __version__ = "0.01"
+ __description__ = """Crypter is no longer available"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ def setup(self):
+ self.fail("Crypter is no longer available")
diff --git a/pyload/plugins/internal/DeadHoster.py b/pyload/plugins/internal/DeadHoster.py
new file mode 100644
index 000000000..e180e2384
--- /dev/null
+++ b/pyload/plugins/internal/DeadHoster.py
@@ -0,0 +1,18 @@
+from module.plugins.Hoster import Hoster as _Hoster
+
+def create_getInfo(plugin):
+ def getInfo(urls):
+ yield [('#N/A: ' + url, 0, 1, url) for url in urls]
+ return getInfo
+
+class DeadHoster(_Hoster):
+ __name__ = "DeadHoster"
+ __type__ = "hoster"
+ __pattern__ = r""
+ __version__ = "0.11"
+ __description__ = """Hoster is no longer available"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ def setup(self):
+ self.fail("Hoster is no longer available") \ No newline at end of file
diff --git a/pyload/plugins/internal/NetloadInOCR.py b/pyload/plugins/internal/NetloadInOCR.py
new file mode 100644
index 000000000..e50978701
--- /dev/null
+++ b/pyload/plugins/internal/NetloadInOCR.py
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+
+from OCR import OCR
+
+class NetloadInOCR(OCR):
+ __version__ = 0.1
+
+ def __init__(self):
+ OCR.__init__(self)
+
+ def get_captcha(self, image):
+ self.load_image(image)
+ self.to_greyscale()
+ self.clean(3)
+ self.clean(3)
+ self.run_tesser(True, True, False, False)
+
+ self.result_captcha = self.result_captcha.replace(" ", "")[:4] # cut to 4 numbers
+
+ return self.result_captcha
+
+if __name__ == '__main__':
+ import urllib
+ ocr = NetloadInOCR()
+ urllib.urlretrieve("http://netload.in/share/includes/captcha.php", "captcha.png")
+
+ print ocr.get_captcha('captcha.png')
diff --git a/pyload/plugins/internal/OCR.py b/pyload/plugins/internal/OCR.py
new file mode 100644
index 000000000..9f8b7ef8c
--- /dev/null
+++ b/pyload/plugins/internal/OCR.py
@@ -0,0 +1,314 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+#Copyright (C) 2009 kingzero, RaNaN
+#
+#This program is free software; you can redistribute it and/or modify
+#it under the terms of the GNU General Public License as published by
+#the Free Software Foundation; either version 3 of the License,
+#or (at your option) any later version.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#See the GNU General Public License for more details.
+#
+#You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+###
+from __future__ import with_statement
+import os
+from os.path import join
+from os.path import abspath
+import logging
+import subprocess
+#import tempfile
+
+import Image
+import TiffImagePlugin
+import PngImagePlugin
+import GifImagePlugin
+import JpegImagePlugin
+
+
+class OCR(object):
+ __version__ = 0.1
+
+ def __init__(self):
+ self.logger = logging.getLogger("log")
+
+ def load_image(self, image):
+ self.image = Image.open(image)
+ self.pixels = self.image.load()
+ self.result_captcha = ''
+
+ def unload(self):
+ """delete all tmp images"""
+ pass
+
+ def threshold(self, value):
+ self.image = self.image.point(lambda a: a * value + 10)
+
+ def run(self, command):
+ """Run a command"""
+
+ popen = subprocess.Popen(command, bufsize = -1, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ popen.wait()
+ output = popen.stdout.read() +" | "+ popen.stderr.read()
+ popen.stdout.close()
+ popen.stderr.close()
+ self.logger.debug("Tesseract ReturnCode %s Output: %s" % (popen.returncode, output))
+
+ def run_tesser(self, subset=False, digits=True, lowercase=True, uppercase=True):
+ #self.logger.debug("create tmp tif")
+
+
+ #tmp = tempfile.NamedTemporaryFile(suffix=".tif")
+ tmp = open(join("tmp", "tmpTif_%s.tif" % self.__name__), "wb")
+ tmp.close()
+ #self.logger.debug("create tmp txt")
+ #tmpTxt = tempfile.NamedTemporaryFile(suffix=".txt")
+ tmpTxt = open(join("tmp", "tmpTxt_%s.txt" % self.__name__), "wb")
+ tmpTxt.close()
+
+ self.logger.debug("save tiff")
+ self.image.save(tmp.name, 'TIFF')
+
+ if os.name == "nt":
+ tessparams = [join(pypath,"tesseract","tesseract.exe")]
+ else:
+ tessparams = ['tesseract']
+
+ tessparams.extend( [abspath(tmp.name), abspath(tmpTxt.name).replace(".txt", "")] )
+
+ if subset and (digits or lowercase or uppercase):
+ #self.logger.debug("create temp subset config")
+ #tmpSub = tempfile.NamedTemporaryFile(suffix=".subset")
+ tmpSub = open(join("tmp", "tmpSub_%s.subset" % self.__name__), "wb")
+ tmpSub.write("tessedit_char_whitelist ")
+ if digits:
+ tmpSub.write("0123456789")
+ if lowercase:
+ tmpSub.write("abcdefghijklmnopqrstuvwxyz")
+ if uppercase:
+ tmpSub.write("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
+ tmpSub.write("\n")
+ tessparams.append("nobatch")
+ tessparams.append(abspath(tmpSub.name))
+ tmpSub.close()
+
+ self.logger.debug("run tesseract")
+ self.run(tessparams)
+ self.logger.debug("read txt")
+
+ try:
+ with open(tmpTxt.name, 'r') as f:
+ self.result_captcha = f.read().replace("\n", "")
+ except:
+ self.result_captcha = ""
+
+ self.logger.debug(self.result_captcha)
+ try:
+ os.remove(tmp.name)
+ os.remove(tmpTxt.name)
+ if subset and (digits or lowercase or uppercase):
+ os.remove(tmpSub.name)
+ except:
+ pass
+
+ def get_captcha(self, name):
+ raise NotImplementedError
+
+ def to_greyscale(self):
+ if self.image.mode != 'L':
+ self.image = self.image.convert('L')
+
+ self.pixels = self.image.load()
+
+ def eval_black_white(self, limit):
+ self.pixels = self.image.load()
+ w, h = self.image.size
+ for x in xrange(w):
+ for y in xrange(h):
+ if self.pixels[x, y] > limit:
+ self.pixels[x, y] = 255
+ else:
+ self.pixels[x, y] = 0
+
+ def clean(self, allowed):
+ pixels = self.pixels
+
+ w, h = self.image.size
+
+ for x in xrange(w):
+ for y in xrange(h):
+ if pixels[x, y] == 255: continue
+ # no point in processing white pixels since we only want to remove black pixel
+ count = 0
+
+ try:
+ if pixels[x-1, y-1] != 255: count += 1
+ if pixels[x-1, y] != 255: count += 1
+ if pixels[x-1, y + 1] != 255: count += 1
+ if pixels[x, y + 1] != 255: count += 1
+ if pixels[x + 1, y + 1] != 255: count += 1
+ if pixels[x + 1, y] != 255: count += 1
+ if pixels[x + 1, y-1] != 255: count += 1
+ if pixels[x, y-1] != 255: count += 1
+ except:
+ pass
+
+ # not enough neighbors are dark pixels so mark this pixel
+ # to be changed to white
+ if count < allowed:
+ pixels[x, y] = 1
+
+ # second pass: this time set all 1's to 255 (white)
+ for x in xrange(w):
+ for y in xrange(h):
+ if pixels[x, y] == 1: pixels[x, y] = 255
+
+ self.pixels = pixels
+
+ def derotate_by_average(self):
+ """rotate by checking each angle and guess most suitable"""
+
+ w, h = self.image.size
+ pixels = self.pixels
+
+ for x in xrange(w):
+ for y in xrange(h):
+ if pixels[x, y] == 0:
+ pixels[x, y] = 155
+
+ highest = {}
+ counts = {}
+
+ for angle in range(-45, 45):
+
+ tmpimage = self.image.rotate(angle)
+
+ pixels = tmpimage.load()
+
+ w, h = self.image.size
+
+ for x in xrange(w):
+ for y in xrange(h):
+ if pixels[x, y] == 0:
+ pixels[x, y] = 255
+
+
+ count = {}
+
+ for x in xrange(w):
+ count[x] = 0
+ for y in xrange(h):
+ if pixels[x, y] == 155:
+ count[x] += 1
+
+ sum = 0
+ cnt = 0
+
+ for x in count.values():
+ if x != 0:
+ sum += x
+ cnt += 1
+
+ avg = sum / cnt
+ counts[angle] = cnt
+ highest[angle] = 0
+ for x in count.values():
+ if x > highest[angle]:
+ highest[angle] = x
+
+ highest[angle] = highest[angle] - avg
+
+ hkey = 0
+ hvalue = 0
+
+ for key, value in highest.iteritems():
+ if value > hvalue:
+ hkey = key
+ hvalue = value
+
+ self.image = self.image.rotate(hkey)
+ pixels = self.image.load()
+
+ for x in xrange(w):
+ for y in xrange(h):
+ if pixels[x, y] == 0:
+ pixels[x, y] = 255
+
+ if pixels[x, y] == 155:
+ pixels[x, y] = 0
+
+ self.pixels = pixels
+
+ def split_captcha_letters(self):
+ captcha = self.image
+ started = False
+ letters = []
+ width, height = captcha.size
+ bottomY, topY = 0, height
+ pixels = captcha.load()
+
+ for x in xrange(width):
+ black_pixel_in_col = False
+ for y in xrange(height):
+ if pixels[x, y] != 255:
+ if not started:
+ started = True
+ firstX = x
+ lastX = x
+
+ if y > bottomY: bottomY = y
+ if y < topY: topY = y
+ if x > lastX: lastX = x
+
+ black_pixel_in_col = True
+
+ if black_pixel_in_col == False and started == True:
+ rect = (firstX, topY, lastX, bottomY)
+ new_captcha = captcha.crop(rect)
+
+ w, h = new_captcha.size
+ if w > 5 and h > 5:
+ letters.append(new_captcha)
+
+ started = False
+ bottomY, topY = 0, height
+
+ return letters
+
+ def correct(self, values, var=None):
+
+ if var:
+ result = var
+ else:
+ result = self.result_captcha
+
+ for key, item in values.iteritems():
+
+ if key.__class__ == str:
+ result = result.replace(key, item)
+ else:
+ for expr in key:
+ result = result.replace(expr, item)
+
+ if var:
+ return result
+ else:
+ self.result_captcha = result
+
+
+if __name__ == '__main__':
+ ocr = OCR()
+ ocr.load_image("B.jpg")
+ ocr.to_greyscale()
+ ocr.eval_black_white(140)
+ ocr.derotate_by_average()
+ ocr.run_tesser()
+ print "Tesseract", ocr.result_captcha
+ ocr.image.save("derotated.jpg")
+
diff --git a/pyload/plugins/internal/ShareonlineBizOCR.py b/pyload/plugins/internal/ShareonlineBizOCR.py
new file mode 100644
index 000000000..c5c2e92e8
--- /dev/null
+++ b/pyload/plugins/internal/ShareonlineBizOCR.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+#Copyright (C) 2009 kingzero, RaNaN
+#
+#This program is free software; you can redistribute it and/or modify
+#it under the terms of the GNU General Public License as published by
+#the Free Software Foundation; either version 3 of the License,
+#or (at your option) any later version.
+#
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#See the GNU General Public License for more details.
+#
+#You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+###
+from OCR import OCR
+
+class ShareonlineBizOCR(OCR):
+ __version__ = 0.1
+
+ def __init__(self):
+ OCR.__init__(self)
+
+ def get_captcha(self, image):
+ self.load_image(image)
+ self.to_greyscale()
+ self.image = self.image.resize((160, 50))
+ self.pixels = self.image.load()
+ self.threshold(1.85)
+ #self.eval_black_white(240)
+ #self.derotate_by_average()
+
+ letters = self.split_captcha_letters()
+
+ final = ""
+ for letter in letters:
+ self.image = letter
+ self.run_tesser(True, True, False, False)
+ final += self.result_captcha
+
+ return final
+
+ #tesseract at 60%
+
+if __name__ == '__main__':
+ import urllib
+ ocr = ShareonlineBizOCR()
+ urllib.urlretrieve("http://www.share-online.biz/captcha.php", "captcha.jpeg")
+ print ocr.get_captcha('captcha.jpeg')
diff --git a/pyload/plugins/internal/SimpleCrypter.py b/pyload/plugins/internal/SimpleCrypter.py
new file mode 100644
index 000000000..d8132f4b3
--- /dev/null
+++ b/pyload/plugins/internal/SimpleCrypter.py
@@ -0,0 +1,98 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+
+from pyload.plugins.Crypter import Crypter, Package
+from pyload.utils import html_unescape
+
+
+class SimpleCrypter(Crypter):
+ __name__ = "SimpleCrypter"
+ __version__ = "0.06"
+ __pattern__ = None
+ __type__ = "crypter"
+ __description__ = """Base crypter plugin"""
+ __author_name__ = ("stickell", "zoidberg")
+ __author_mail__ = ("l.stickell@yahoo.it", "zoidberg@mujmail.cz")
+ """
+ These patterns should be defined by each crypter:
+
+ LINK_PATTERN: group(1) must be a download link
+ example: <div class="link"><a href="(http://speedload.org/\w+)
+
+ TITLE_PATTERN: (optional) the group defined by 'title' should be the title
+ example: <title>Files of: (?P<title>[^<]+) folder</title>
+
+ If it's impossible to extract the links using the LINK_PATTERN only you can override the getLinks method.
+
+ If the links are disposed on multiple pages you need to define a pattern:
+
+ PAGES_PATTERN: the group defined by 'pages' must be the total number of pages
+
+ and a function:
+
+ loadPage(self, page_n):
+ must return the html of the page number 'page_n'
+ """
+
+ def decryptURL(self, url):
+ self.html = self.load(url, decode=True)
+
+ package_name = self.getPackageName()
+ self.package_links = self.getLinks()
+
+ if hasattr(self, 'PAGES_PATTERN') and hasattr(self, 'loadPage'):
+ self.handleMultiPages()
+
+ self.logDebug('Package has %d links' % len(self.package_links))
+
+ if self.package_links:
+ return Package(package_name, self.package_links)
+ else:
+ self.fail('Could not extract any links')
+
+
+ def getLinks(self):
+ """
+ Returns the links extracted from self.html
+ You should override this only if it's impossible to extract links using only the LINK_PATTERN.
+ """
+ return re.findall(self.LINK_PATTERN, self.html)
+
+ def getPackageName(self):
+ if hasattr(self, 'TITLE_PATTERN'):
+ m = re.search(self.TITLE_PATTERN, self.html)
+ if m:
+ name = html_unescape(m.group('title').strip())
+ self.logDebug("Found name [%s] in package info" % (name))
+ return name
+
+ return None
+
+ def handleMultiPages(self):
+ pages = re.search(self.PAGES_PATTERN, self.html)
+ if pages:
+ pages = int(pages.group('pages'))
+ else:
+ pages = 1
+
+ for p in range(2, pages + 1):
+ self.html = self.loadPage(p)
+ self.package_links += self.getLinks()
diff --git a/pyload/plugins/internal/SimpleHoster.py b/pyload/plugins/internal/SimpleHoster.py
new file mode 100644
index 000000000..856d3fde6
--- /dev/null
+++ b/pyload/plugins/internal/SimpleHoster.py
@@ -0,0 +1,278 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+from urlparse import urlparse
+import re
+from time import time
+
+from module.plugins.Hoster import Hoster
+from module.utils import html_unescape, fixup, parseFileSize
+from module.network.RequestFactory import getURL
+from module.network.CookieJar import CookieJar
+
+
+def replace_patterns(string, ruleslist):
+ for r in ruleslist:
+ rf, rt = r
+ string = re.sub(rf, rt, string)
+ #self.logDebug(rf, rt, string)
+ return string
+
+
+def set_cookies(cj, cookies):
+ for cookie in cookies:
+ if isinstance(cookie, tuple) and len(cookie) == 3:
+ domain, name, value = cookie
+ cj.setCookie(domain, name, value)
+
+
+def parseHtmlTagAttrValue(attr_name, tag):
+ m = re.search(r"%s\s*=\s*([\"']?)((?<=\")[^\"]+|(?<=')[^']+|[^>\s\"'][^>\s]*)\1" % attr_name, tag, re.I)
+ return m.group(2) if m else None
+
+
+def parseHtmlForm(attr_str, html, input_names=None):
+ for form in re.finditer(r"(?P<tag><form[^>]*%s[^>]*>)(?P<content>.*?)</?(form|body|html)[^>]*>" % attr_str,
+ html, re.S | re.I):
+ inputs = {}
+ action = parseHtmlTagAttrValue("action", form.group('tag'))
+ for inputtag in re.finditer(r'(<(input|textarea)[^>]*>)([^<]*(?=</\2)|)', form.group('content'), re.S | re.I):
+ name = parseHtmlTagAttrValue("name", inputtag.group(1))
+ if name:
+ value = parseHtmlTagAttrValue("value", inputtag.group(1))
+ if value is None:
+ inputs[name] = inputtag.group(3) or ''
+ else:
+ inputs[name] = value
+
+ if isinstance(input_names, dict):
+ # check input attributes
+ for key, val in input_names.items():
+ if key in inputs:
+ if isinstance(val, basestring) and inputs[key] == val:
+ continue
+ elif isinstance(val, tuple) and inputs[key] in val:
+ continue
+ elif hasattr(val, "search") and re.match(val, inputs[key]):
+ continue
+ 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
+
+
+def parseFileInfo(self, url='', html=''):
+ info = {"name": url, "size": 0, "status": 3}
+
+ if hasattr(self, "pyfile"):
+ url = self.pyfile.url
+
+ if hasattr(self, "req") and self.req.http.code == '404':
+ info['status'] = 1
+ else:
+ if not html and hasattr(self, "html"):
+ html = self.html
+ if isinstance(self.SH_BROKEN_ENCODING, (str, unicode)):
+ html = unicode(html, self.SH_BROKEN_ENCODING)
+ if hasattr(self, "html"):
+ self.html = html
+
+ if hasattr(self, "FILE_OFFLINE_PATTERN") and re.search(self.FILE_OFFLINE_PATTERN, html):
+ # File offline
+ info['status'] = 1
+ else:
+ online = False
+ try:
+ info.update(re.match(self.__pattern__, url).groupdict())
+ except:
+ pass
+
+ for pattern in ("FILE_INFO_PATTERN", "FILE_NAME_PATTERN", "FILE_SIZE_PATTERN"):
+ try:
+ info.update(re.search(getattr(self, pattern), html).groupdict())
+ online = True
+ except AttributeError:
+ continue
+
+ if online:
+ # File online, return name and size
+ info['status'] = 2
+ if 'N' in info:
+ info['name'] = replace_patterns(info['N'], self.FILE_NAME_REPLACEMENTS)
+ if 'S' in info:
+ size = replace_patterns(info['S'] + info['U'] if 'U' in info else info['S'],
+ self.FILE_SIZE_REPLACEMENTS)
+ info['size'] = parseFileSize(size)
+ elif isinstance(info['size'], (str, unicode)):
+ if 'units' in info:
+ info['size'] += info['units']
+ info['size'] = parseFileSize(info['size'])
+
+ if hasattr(self, "file_info"):
+ self.file_info = info
+
+ return info['name'], info['size'], info['status'], url
+
+
+def create_getInfo(plugin):
+ def getInfo(urls):
+ for url in urls:
+ cj = CookieJar(plugin.__name__)
+ if isinstance(plugin.SH_COOKIES, list):
+ set_cookies(cj, plugin.SH_COOKIES)
+ file_info = parseFileInfo(plugin, url, getURL(replace_patterns(url, plugin.FILE_URL_REPLACEMENTS),
+ decode=not plugin.SH_BROKEN_ENCODING, cookies=cj))
+ yield file_info
+
+ return getInfo
+
+
+def timestamp():
+ return int(time() * 1000)
+
+
+class PluginParseError(Exception):
+ def __init__(self, msg):
+ Exception.__init__(self)
+ self.value = 'Parse error (%s) - plugin may be out of date' % msg
+
+ def __str__(self):
+ return repr(self.value)
+
+
+class SimpleHoster(Hoster):
+ __name__ = "SimpleHoster"
+ __version__ = "0.31"
+ __pattern__ = None
+ __type__ = "hoster"
+ __description__ = """Base hoster plugin"""
+ __author_name__ = ("zoidberg", "stickell")
+ __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+ """
+ These patterns should be defined by each hoster:
+ FILE_INFO_PATTERN = r'(?P<N>file_name) (?P<S>file_size) (?P<U>units)'
+ or FILE_NAME_PATTERN = r'(?P<N>file_name)'
+ and FILE_SIZE_PATTERN = r'(?P<S>file_size) (?P<U>units)'
+ FILE_OFFLINE_PATTERN = r'File (deleted|not found)'
+ TEMP_OFFLINE_PATTERN = r'Server maintainance'
+
+ You can also define a PREMIUM_ONLY_PATTERN to detect links that can be downloaded only with a premium account.
+ """
+
+ FILE_SIZE_REPLACEMENTS = []
+ FILE_NAME_REPLACEMENTS = [("&#?\w+;", fixup)]
+ FILE_URL_REPLACEMENTS = []
+
+ SH_BROKEN_ENCODING = False # Set to True or encoding name if encoding in http header is not correct
+ SH_COOKIES = True # or False or list of tuples [(domain, name, value)]
+ SH_CHECK_TRAFFIC = False # True = force check traffic left for a premium account
+
+ def init(self):
+ self.file_info = {}
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = self.premium
+ if isinstance(self.SH_COOKIES, list):
+ set_cookies(self.req.cj, self.SH_COOKIES)
+
+ def process(self, pyfile):
+ pyfile.url = replace_patterns(pyfile.url, self.FILE_URL_REPLACEMENTS)
+ self.req.setOption("timeout", 120)
+ # Due to a 0.4.9 core bug self.load would keep previous cookies even if overridden by cookies parameter.
+ # Workaround using getURL. Can be reverted in 0.5 as the cookies bug has been fixed.
+ self.html = getURL(pyfile.url, decode=not self.SH_BROKEN_ENCODING, cookies=self.SH_COOKIES)
+ self.getFileInfo()
+ if self.premium and (not self.SH_CHECK_TRAFFIC or self.checkTrafficLeft()):
+ self.handlePremium()
+ else:
+ # This line is required due to the getURL workaround. Can be removed in 0.5
+ self.html = self.load(pyfile.url, decode=not self.SH_BROKEN_ENCODING, cookies=self.SH_COOKIES)
+ if hasattr(self, 'PREMIUM_ONLY_PATTERN') and re.search(self.PREMIUM_ONLY_PATTERN, self.html):
+ self.fail("This link require a premium account")
+ self.handleFree()
+
+ def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False, decode=False):
+ if type(url) == unicode: url = url.encode('utf8')
+ return Hoster.load(self, url=url, get=get, post=post, ref=ref, cookies=cookies,
+ just_header=just_header, decode=decode)
+
+ def getFileInfo(self):
+ self.logDebug("URL: %s" % self.pyfile.url)
+ if hasattr(self, "TEMP_OFFLINE_PATTERN") and re.search(self.TEMP_OFFLINE_PATTERN, self.html):
+ self.tempOffline()
+
+ name, size, status = parseFileInfo(self)[:3]
+
+ if status == 1:
+ self.offline()
+ elif status != 2:
+ self.logDebug(self.file_info)
+ self.parseError('File info')
+
+ if name:
+ self.pyfile.name = name
+ else:
+ self.pyfile.name = html_unescape(urlparse(self.pyfile.url).path.split("/")[-1])
+
+ if size:
+ self.pyfile.size = size
+ else:
+ self.logError("File size not parsed")
+
+ self.logDebug("FILE NAME: %s FILE SIZE: %s" % (self.pyfile.name, self.pyfile.size))
+ return self.file_info
+
+ def handleFree(self):
+ self.fail("Free download not implemented")
+
+ def handlePremium(self):
+ self.fail("Premium download not implemented")
+
+ def parseError(self, msg):
+ raise PluginParseError(msg)
+
+ def longWait(self, wait_time=None, max_tries=3):
+ if wait_time and isinstance(wait_time, (int, long, float)):
+ time_str = "%dh %dm" % divmod(wait_time / 60, 60)
+ else:
+ wait_time = 900
+ time_str = "(unknown time)"
+ max_tries = 100
+
+ self.logInfo("Download limit reached, reconnect or wait %s" % time_str)
+
+ self.setWait(wait_time, True)
+ self.wait()
+ self.retry(max_tries=max_tries, reason="Download limit reached")
+
+ def parseHtmlForm(self, attr_str='', input_names=None):
+ return parseHtmlForm(attr_str, self.html, input_names)
+
+ def checkTrafficLeft(self):
+ traffic = self.account.getAccountInfo(self.user, True)["trafficleft"]
+ if traffic == -1:
+ return True
+ size = self.pyfile.size / 1024
+ self.logInfo("Filesize: %i KiB, Traffic left for user %s: %i KiB" % (size, self.user, traffic))
+ return size <= traffic
diff --git a/pyload/plugins/internal/UnRar.py b/pyload/plugins/internal/UnRar.py
new file mode 100644
index 000000000..e406f124e
--- /dev/null
+++ b/pyload/plugins/internal/UnRar.py
@@ -0,0 +1,215 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: RaNaN
+"""
+
+import os
+import re
+from glob import glob
+from subprocess import Popen, PIPE
+from string import digits
+
+from module.utils.fs import save_join, decode, fs_encode
+from module.plugins.internal.AbstractExtractor import AbtractExtractor, WrongPassword, ArchiveError, CRCError
+
+class UnRar(AbtractExtractor):
+ __name__ = "UnRar"
+ __version__ = "0.14"
+
+ # there are some more uncovered rar formats
+ re_splitfile = re.compile(r"(.*)\.part(\d+)\.rar$", re.I)
+ re_partfiles = re.compile(r".*\.(rar|r[0-9]+)", re.I)
+ re_filelist = re.compile(r"(.+)\s+(\d+)\s+(\d+)\s+")
+ re_wrongpwd = re.compile("(Corrupt file or wrong password|password incorrect)", re.I)
+ CMD = "unrar"
+
+ @staticmethod
+ def checkDeps():
+ if os.name == "nt":
+ UnRar.CMD = save_join(pypath, "UnRAR.exe")
+ p = Popen([UnRar.CMD], stdout=PIPE, stderr=PIPE)
+ p.communicate()
+ else:
+ try:
+ p = Popen([UnRar.CMD], stdout=PIPE, stderr=PIPE)
+ p.communicate()
+ except OSError:
+
+ #fallback to rar
+ UnRar.CMD = "rar"
+ p = Popen([UnRar.CMD], stdout=PIPE, stderr=PIPE)
+ p.communicate()
+
+ return True
+
+ @staticmethod
+ def getTargets(files_ids):
+ result = []
+
+ for file, id in files_ids:
+ if not file.endswith(".rar"): continue
+
+ match = UnRar.re_splitfile.findall(file)
+ if match:
+ #only add first parts
+ if int(match[0][1]) == 1:
+ result.append((file, id))
+ else:
+ result.append((file, id))
+
+ return result
+
+
+ def init(self):
+ self.passwordProtected = False
+ self.headerProtected = False #list files will not work without password
+ self.smallestFile = None #small file to test passwords
+ self.password = "" #save the correct password
+
+ def checkArchive(self):
+ p = self.call_unrar("l", "-v", fs_encode(self.file))
+ out, err = p.communicate()
+ if self.re_wrongpwd.search(err):
+ self.passwordProtected = True
+ self.headerProtected = True
+ return True
+
+ # output only used to check if passworded files are present
+ for name, size, packed in self.re_filelist.findall(out):
+ if name.startswith("*"):
+ self.passwordProtected = True
+ return True
+
+ self.listContent()
+ if not self.files:
+ raise ArchiveError("Empty Archive")
+
+ return False
+
+ def checkPassword(self, password):
+ #at this point we can only verify header protected files
+ if self.headerProtected:
+ p = self.call_unrar("l", "-v", fs_encode(self.file), password=password)
+ out, err = p.communicate()
+ if self.re_wrongpwd.search(err):
+ return False
+
+ return True
+
+
+ def extract(self, progress, password=None):
+ command = "x" if self.fullpath else "e"
+
+ p = self.call_unrar(command, fs_encode(self.file), self.out, password=password)
+ renice(p.pid, self.renice)
+
+ progress(0)
+ progressstring = ""
+ while True:
+ c = p.stdout.read(1)
+ # quit loop on eof
+ if not c:
+ break
+ # reading a percentage sign -> set progress and restart
+ if c == '%':
+ progress(int(progressstring))
+ progressstring = ""
+ # not reading a digit -> therefore restart
+ elif c not in digits:
+ progressstring = ""
+ # add digit to progressstring
+ else:
+ progressstring = progressstring + c
+ progress(100)
+
+ # retrieve stderr
+ err = p.stderr.read()
+
+ if "CRC failed" in err and not password and not self.passwordProtected:
+ raise CRCError
+ elif "CRC failed" in err:
+ raise WrongPassword
+ if err.strip(): #raise error if anything is on stderr
+ raise ArchiveError(err.strip())
+ if p.returncode:
+ raise ArchiveError("Process terminated")
+
+ if not self.files:
+ self.password = password
+ self.listContent()
+
+
+ def getDeleteFiles(self):
+ if ".part" in self.file:
+ return glob(re.sub("(?<=\.part)([01]+)", "*", self.file, re.IGNORECASE))
+ # get files which matches .r* and filter unsuited files out
+ parts = glob(re.sub(r"(?<=\.r)ar$", "*", self.file, re.IGNORECASE))
+ return filter(lambda x: self.re_partfiles.match(x), parts)
+
+ def listContent(self):
+ command = "vb" if self.fullpath else "lb"
+ p = self.call_unrar(command, "-v", fs_encode(self.file), password=self.password)
+ out, err = p.communicate()
+
+ if "Cannot open" in err:
+ raise ArchiveError("Cannot open file")
+
+ if err.strip(): # only log error at this point
+ self.m.logError(err.strip())
+
+ result = set()
+
+ for f in decode(out).splitlines():
+ f = f.strip()
+ result.add(save_join(self.out, f))
+
+ self.files = result
+
+
+ def call_unrar(self, command, *xargs, **kwargs):
+ args = []
+ #overwrite flag
+ args.append("-o+") if self.overwrite else args.append("-o-")
+
+ if self.excludefiles:
+ for word in self.excludefiles.split(';'):
+ args.append("-x%s" % word )
+
+ # assume yes on all queries
+ args.append("-y")
+
+ #set a password
+ if "password" in kwargs and kwargs["password"]:
+ args.append("-p%s" % kwargs["password"])
+ else:
+ args.append("-p-")
+
+ #NOTE: return codes are not reliable, some kind of threading, cleanup whatever issue
+ call = [self.CMD, command] + args + list(xargs)
+ self.m.logDebug(" ".join([decode(arg) for arg in call]))
+
+ p = Popen(call, stdout=PIPE, stderr=PIPE)
+
+ return p
+
+
+def renice(pid, value):
+ if os.name != "nt" and value:
+ try:
+ Popen(["renice", str(value), str(pid)], stdout=PIPE, stderr=PIPE, bufsize=-1)
+ except:
+ print "Renice failed"
diff --git a/pyload/plugins/internal/UnZip.py b/pyload/plugins/internal/UnZip.py
new file mode 100644
index 000000000..9aa9ac75c
--- /dev/null
+++ b/pyload/plugins/internal/UnZip.py
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: RaNaN
+"""
+
+import zipfile
+import sys
+
+from module.plugins.internal.AbstractExtractor import AbtractExtractor
+
+class UnZip(AbtractExtractor):
+ __name__ = "UnZip"
+ __version__ = "0.1"
+
+ @staticmethod
+ def checkDeps():
+ return sys.version_info[:2] >= (2, 6)
+
+ @staticmethod
+ def getTargets(files_ids):
+ result = []
+
+ for file, id in files_ids:
+ if file.endswith(".zip"):
+ result.append((file, id))
+
+ return result
+
+ def extract(self, progress, password=None):
+ z = zipfile.ZipFile(self.file)
+ self.files = z.namelist()
+ z.extractall(self.out)
+
+ def getDeleteFiles(self):
+ return [self.file] \ No newline at end of file
diff --git a/pyload/plugins/internal/XFSPAccount.py b/pyload/plugins/internal/XFSPAccount.py
new file mode 100644
index 000000000..8333c7265
--- /dev/null
+++ b/pyload/plugins/internal/XFSPAccount.py
@@ -0,0 +1,79 @@
+# -*- coding: utf-8 -*-
+
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from time import mktime, strptime
+from module.plugins.Account import Account
+from module.plugins.internal.SimpleHoster import parseHtmlForm
+from module.utils import parseFileSize
+
+class XFSPAccount(Account):
+ __name__ = "XFSPAccount"
+ __version__ = "0.05"
+ __type__ = "account"
+ __description__ = """XFileSharingPro account base"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ MAIN_PAGE = None
+
+ VALID_UNTIL_PATTERN = r'>Premium.[Aa]ccount expire:</TD><TD><b>([^<]+)</b>'
+ TRAFFIC_LEFT_PATTERN = r'>Traffic available today:</TD><TD><b>([^<]+)</b>'
+
+ def loadAccountInfo(self, user, req):
+ html = req.load(self.MAIN_PAGE + "?op=my_account", decode = True)
+
+ validuntil = trafficleft = None
+ premium = True if '>Renew premium<' in html else False
+
+ found = re.search(self.VALID_UNTIL_PATTERN, html)
+ if found:
+ premium = True
+ trafficleft = -1
+ try:
+ self.logDebug(found.group(1))
+ validuntil = mktime(strptime(found.group(1), "%d %B %Y"))
+ except Exception, e:
+ self.logError(e)
+ else:
+ found = re.search(self.TRAFFIC_LEFT_PATTERN, html)
+ if found:
+ trafficleft = found.group(1)
+ if "Unlimited" in trafficleft:
+ premium = True
+ else:
+ trafficleft = parseFileSize(trafficleft) / 1024
+
+ return ({"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium})
+
+ def login(self, user, data, req):
+ html = req.load('%slogin.html' % self.MAIN_PAGE, decode = True)
+
+ action, inputs = parseHtmlForm('name="FL"', html)
+ if not inputs:
+ inputs = {"op": "login",
+ "redirect": self.MAIN_PAGE}
+
+ inputs.update({"login": user,
+ "password": data['password']})
+
+ html = req.load(self.MAIN_PAGE, post = inputs, decode = True)
+
+ if 'Incorrect Login or Password' in html or '>Error<' in html:
+ self.wrongPassword() \ No newline at end of file
diff --git a/pyload/plugins/internal/__init__.py b/pyload/plugins/internal/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/pyload/plugins/internal/__init__.py
diff --git a/pyload/plugins/network/CurlChunk.py b/pyload/plugins/network/CurlChunk.py
new file mode 100644
index 000000000..75be9ce6c
--- /dev/null
+++ b/pyload/plugins/network/CurlChunk.py
@@ -0,0 +1,303 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+###############################################################################
+# Copyright(c) 2008-2013 pyLoad Team
+# http://www.pyload.org
+#
+# This file is part of pyLoad.
+# pyLoad is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# Subjected to the terms and conditions in LICENSE
+#
+# @author: RaNaN
+###############################################################################
+
+from os import remove, stat, fsync
+from os.path import exists
+from time import sleep
+from re import search
+
+import codecs
+import pycurl
+
+from pyload.utils import remove_chars
+from pyload.utils.fs import fs_encode, fs_decode
+
+from CurlRequest import CurlRequest
+
+class WrongFormat(Exception):
+ pass
+
+
+class ChunkInfo():
+ def __init__(self, name):
+ self.name = fs_decode(name)
+ self.size = 0
+ self.resume = False
+ self.chunks = []
+
+ def __repr__(self):
+ ret = "ChunkInfo: %s, %s\n" % (self.name, self.size)
+ for i, c in enumerate(self.chunks):
+ ret += "%s# %s\n" % (i, c[1])
+
+ return ret
+
+ def setSize(self, size):
+ self.size = int(size)
+
+ def addChunk(self, name, range):
+ self.chunks.append((name, range))
+
+ def clear(self):
+ self.chunks = []
+
+ def createChunks(self, chunks):
+ self.clear()
+ chunk_size = self.size / chunks
+
+ current = 0
+ for i in range(chunks):
+ end = self.size - 1 if (i == chunks - 1) else current + chunk_size
+ self.addChunk("%s.chunk%s" % (self.name, i), (current, end))
+ current += chunk_size + 1
+
+
+ def save(self):
+ fs_name = fs_encode("%s.chunks" % self.name)
+ fh = codecs.open(fs_name, "w", "utf_8")
+ fh.write("name:%s\n" % self.name)
+ fh.write("size:%s\n" % self.size)
+ for i, c in enumerate(self.chunks):
+ fh.write("#%d:\n" % i)
+ fh.write("\tname:%s\n" % c[0])
+ fh.write("\trange:%i-%i\n" % c[1])
+ fh.close()
+
+ @staticmethod
+ def load(name):
+ fs_name = fs_encode("%s.chunks" % name)
+ if not exists(fs_name):
+ raise IOError()
+ fh = codecs.open(fs_name, "r", "utf_8")
+ name = fh.readline()[:-1]
+ size = fh.readline()[:-1]
+ if name.startswith("name:") and size.startswith("size:"):
+ name = name[5:]
+ size = size[5:]
+ else:
+ fh.close()
+ raise WrongFormat()
+ ci = ChunkInfo(name)
+ ci.loaded = True
+ ci.setSize(size)
+ while True:
+ if not fh.readline(): #skip line
+ break
+ name = fh.readline()[1:-1]
+ range = fh.readline()[1:-1]
+ if name.startswith("name:") and range.startswith("range:"):
+ name = name[5:]
+ range = range[6:].split("-")
+ else:
+ raise WrongFormat()
+
+ ci.addChunk(name, (long(range[0]), long(range[1])))
+ fh.close()
+ return ci
+
+ def remove(self):
+ fs_name = fs_encode("%s.chunks" % self.name)
+ if exists(fs_name): remove(fs_name)
+
+ def getCount(self):
+ return len(self.chunks)
+
+ def getChunkName(self, index):
+ return self.chunks[index][0]
+
+ def getChunkRange(self, index):
+ return self.chunks[index][1]
+
+
+class CurlChunk(CurlRequest):
+ def __init__(self, id, parent, range=None, resume=False):
+ self.setContext(*parent.getContext())
+
+ self.id = id
+ self.p = parent # CurlDownload instance
+ self.range = range # tuple (start, end)
+ self.resume = resume
+ self.log = parent.log
+
+ self.size = range[1] - range[0] if range else -1
+ self.arrived = 0
+ self.lastURL = self.p.referer
+
+ self.c = pycurl.Curl()
+
+ self.header = ""
+ self.headerParsed = False #indicates if the header has been processed
+
+ self.fp = None #file handle
+
+ self.initContext()
+
+ self.BOMChecked = False # check and remove byte order mark
+
+ self.rep = None
+
+ self.sleep = 0.000
+ self.lastSize = 0
+ # next to last size
+ self.nLastSize = 0
+
+ def __repr__(self):
+ return "<CurlChunk id=%d, size=%d, arrived=%d>" % (self.id, self.size, self.arrived)
+
+ @property
+ def cj(self):
+ return self.p.context
+
+ def getHandle(self):
+ """ returns a Curl handle ready to use for perform/multiperform """
+
+ self.setRequestContext(self.p.url, self.p.get, self.p.post, self.p.referer, self.p.cookies)
+ self.c.setopt(pycurl.WRITEFUNCTION, self.writeBody)
+ self.c.setopt(pycurl.HEADERFUNCTION, self.writeHeader)
+
+ # request all bytes, since some servers in russia seems to have a defect arihmetic unit
+
+ fs_name = fs_encode(self.p.info.getChunkName(self.id))
+ if self.resume:
+ self.fp = open(fs_name, "ab")
+ self.arrived = self.fp.tell()
+ if not self.arrived:
+ self.arrived = stat(fs_name).st_size
+
+ if self.range:
+ #do nothing if chunk already finished
+ if self.arrived + self.range[0] >= self.range[1]: return None
+
+ if self.id == len(self.p.info.chunks) - 1: #as last chunk dont set end range, so we get everything
+ range = "%i-" % (self.arrived + self.range[0])
+ else:
+ range = "%i-%i" % (self.arrived + self.range[0], min(self.range[1] + 1, self.p.size - 1))
+
+ self.log.debug("Chunked resume with range %s" % range)
+ self.c.setopt(pycurl.RANGE, range)
+ else:
+ self.log.debug("Resume File from %i" % self.arrived)
+ self.c.setopt(pycurl.RESUME_FROM, self.arrived)
+
+ else:
+ if self.range:
+ if self.id == len(self.p.info.chunks) - 1: # see above
+ range = "%i-" % self.range[0]
+ else:
+ range = "%i-%i" % (self.range[0], min(self.range[1] + 1, self.p.size - 1))
+
+ self.log.debug("Chunked with range %s" % range)
+ self.c.setopt(pycurl.RANGE, range)
+
+ self.fp = open(fs_name, "wb")
+
+ return self.c
+
+ def writeHeader(self, buf):
+ self.header += buf
+ #@TODO forward headers?, this is possibly unneeded, when we just parse valid 200 headers
+ # as first chunk, we will parse the headers
+ if not self.range and self.header.endswith("\r\n\r\n"):
+ self.parseHeader()
+ elif not self.range and buf.startswith("150") and "data connection" in buf: #ftp file size parsing
+ size = search(r"(\d+) bytes", buf)
+ if size:
+ self.p._size = int(size.group(1))
+ self.p.chunkSupport = True
+
+ self.headerParsed = True
+
+ def writeBody(self, buf):
+ #ignore BOM, it confuses unrar
+ if not self.BOMChecked:
+ if [ord(b) for b in buf[:3]] == [239, 187, 191]:
+ buf = buf[3:]
+ self.BOMChecked = True
+
+ size = len(buf)
+ self.nLastSize = self.lastSize
+ self.lastSize = size
+
+ self.arrived += size
+
+ self.fp.write(buf)
+
+ if self.p.bucket:
+ sleep(self.p.bucket.consumed(size))
+
+ # if the buffer sizes are stable no sleep will be made
+ elif size != self.lastSize or size != self.nLastSize:
+ # Avoid small buffers, increasing sleep time slowly if buffer size gets smaller
+ # otherwise reduce sleep time percentile (values are based on tests)
+ # So in general cpu time is saved without reducing bandwidth too much
+
+ if size < self.lastSize:
+ self.sleep += 0.002
+ else:
+ self.sleep *= 0.7
+
+ sleep(self.sleep)
+
+ if self.range and self.arrived > self.size:
+ return 0 #close if we have enough data
+
+
+ def parseHeader(self):
+ """parse data from received header"""
+ for orgline in self.decodeResponse(self.header).splitlines():
+ line = orgline.strip().lower()
+ if line.startswith("accept-ranges") and "bytes" in line:
+ self.p.chunkSupport = True
+
+ if "content-disposition" in line:
+
+ m = search("filename(?P<type>=|\*=(?P<enc>.+)'')(?P<name>.*)", line)
+ if m:
+ name = remove_chars(m.groupdict()['name'], "\"';/").strip()
+ self.p._name = name
+ self.log.debug("Content-Disposition: %s" % name)
+
+ if not self.resume and line.startswith("content-length"):
+ self.p._size = int(line.split(":")[1])
+
+ self.headerParsed = True
+
+ def stop(self):
+ """The download will not proceed after next call of writeBody"""
+ self.range = [0,0]
+ self.size = 0
+
+ def resetRange(self):
+ """ Reset the range, so the download will load all data available """
+ self.range = None
+
+ def setRange(self, range):
+ self.range = range
+ self.size = range[1] - range[0]
+
+ def flushFile(self):
+ """ flush and close file """
+ self.fp.flush()
+ fsync(self.fp.fileno()) #make sure everything was written to disk
+ self.fp.close() #needs to be closed, or merging chunks will fail
+
+ def close(self):
+ """ closes everything, unusable after this """
+ if self.fp: self.fp.close()
+ self.c.close()
+ if hasattr(self, "p"): del self.p
diff --git a/pyload/plugins/network/CurlDownload.py b/pyload/plugins/network/CurlDownload.py
new file mode 100644
index 000000000..985513691
--- /dev/null
+++ b/pyload/plugins/network/CurlDownload.py
@@ -0,0 +1,325 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+###############################################################################
+# Copyright(c) 2008-2012 pyLoad Team
+# http://www.pyload.org
+#
+# This file is part of pyLoad.
+# pyLoad is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# Subjected to the terms and conditions in LICENSE
+#
+# @author: RaNaN
+###############################################################################
+
+from os import remove
+from os.path import dirname
+from time import time
+from shutil import move
+
+import pycurl
+
+from pyload.plugins.Base import Abort
+from pyload.network.CookieJar import CookieJar
+from pyload.utils.fs import save_join, fs_encode
+
+from ..Download import Download
+from CurlChunk import ChunkInfo, CurlChunk
+from CurlRequest import ResponseException
+
+# TODO: save content-disposition for resuming
+
+class CurlDownload(Download):
+ """ loads an url, http + ftp supported """
+
+ # def __init__(self, url, filename, get={}, post={}, referer=None, cj=None, bucket=None,
+ # options={}, disposition=False):
+
+ CONTEXT_CLASS = CookieJar
+
+ def __init__(self, *args, **kwargs):
+ Download.__init__(self, *args, **kwargs)
+
+ self.path = None
+ self.disposition = False
+
+ self.chunks = []
+ self.chunkSupport = None
+
+ self.m = pycurl.CurlMulti()
+
+ #needed for speed calculation
+ self.lastArrived = []
+ self.speeds = []
+ self.lastSpeeds = [0, 0]
+
+ @property
+ def speed(self):
+ last = [sum(x) for x in self.lastSpeeds if x]
+ return (sum(self.speeds) + sum(last)) / (1 + len(last))
+
+ @property
+ def arrived(self):
+ return sum(c.arrived for c in self.chunks) if self.chunks else self._size
+
+ @property
+ def name(self):
+ return self._name if self.disposition else None
+
+ def _copyChunks(self):
+ init = fs_encode(self.info.getChunkName(0)) #initial chunk name
+
+ if self.info.getCount() > 1:
+ fo = open(init, "rb+") #first chunkfile
+ for i in range(1, self.info.getCount()):
+ #input file
+ fo.seek(
+ self.info.getChunkRange(i - 1)[1] + 1) #seek to beginning of chunk, to get rid of overlapping chunks
+ fname = fs_encode("%s.chunk%d" % (self.path, i))
+ fi = open(fname, "rb")
+ buf = 32 * 1024
+ while True: #copy in chunks, consumes less memory
+ data = fi.read(buf)
+ if not data:
+ break
+ fo.write(data)
+ fi.close()
+ if fo.tell() < self.info.getChunkRange(i)[1]:
+ fo.close()
+ remove(init)
+ self.info.remove() #there are probably invalid chunks
+ raise Exception("Downloaded content was smaller than expected. Try to reduce download connections.")
+ remove(fname) #remove chunk
+ fo.close()
+
+ if self.name:
+ self.filename = save_join(dirname(self.path), self.name)
+
+ move(init, fs_encode(self.path))
+ self.info.remove() #remove info file
+
+ def checkResume(self):
+ try:
+ self.info = ChunkInfo.load(self.path)
+ self.info.resume = True #resume is only possible with valid info file
+ self._size = self.info.size
+ self.infoSaved = True
+ except IOError:
+ self.info = ChunkInfo(self.path)
+
+ def download(self, uri, path, get={}, post={}, referer=True, disposition=False, chunks=1, resume=False, cookies=True):
+ """ returns new filename or None """
+ self.url = uri
+ self.path = path
+ self.disposition = disposition
+ self.get = get
+ self.post = post
+ self.referer = referer
+ self.cookies = cookies
+
+ self.checkResume()
+ chunks = max(1, chunks)
+ resume = self.info.resume and resume
+
+ try:
+ self._download(chunks, resume)
+ except pycurl.error, e:
+ #code 33 - no resume
+ code = e.args[0]
+ if code == 33:
+ # try again without resume
+ self.log.debug("Errno 33 -> Restart without resume")
+
+ #remove old handles
+ for chunk in self.chunks:
+ self.closeChunk(chunk)
+
+ return self._download(chunks, False)
+ else:
+ raise
+ finally:
+ self.close()
+
+ return self.name
+
+ def _download(self, chunks, resume):
+ if not resume:
+ self.info.clear()
+ self.info.addChunk("%s.chunk0" % self.path, (0, 0)) #create an initial entry
+
+ self.chunks = []
+
+ init = CurlChunk(0, self, None, resume) #initial chunk that will load complete file (if needed)
+
+ self.chunks.append(init)
+ self.m.add_handle(init.getHandle())
+
+ lastFinishCheck = 0
+ lastTimeCheck = 0
+ chunksDone = set() # list of curl handles that are finished
+ chunksCreated = False
+ done = False
+ if self.info.getCount() > 1: # This is a resume, if we were chunked originally assume still can
+ self.chunkSupport = True
+
+ while 1:
+ #need to create chunks
+ if not chunksCreated and self.chunkSupport and self.size: #will be set later by first chunk
+
+ if not resume:
+ self.info.setSize(self.size)
+ self.info.createChunks(chunks)
+ self.info.save()
+
+ chunks = self.info.getCount()
+
+ init.setRange(self.info.getChunkRange(0))
+
+ for i in range(1, chunks):
+ c = CurlChunk(i, self, self.info.getChunkRange(i), resume)
+
+ handle = c.getHandle()
+ if handle:
+ self.chunks.append(c)
+ self.m.add_handle(handle)
+ else:
+ #close immediately
+ self.log.debug("Invalid curl handle -> closed")
+ c.close()
+
+ chunksCreated = True
+
+ while 1:
+ ret, num_handles = self.m.perform()
+ if ret != pycurl.E_CALL_MULTI_PERFORM:
+ break
+
+ t = time()
+
+ # reduce these calls
+ # when num_q is 0, the loop is exited
+ while lastFinishCheck + 0.5 < t:
+ # list of failed curl handles
+ failed = []
+ ex = None # save only last exception, we can only raise one anyway
+
+ num_q, ok_list, err_list = self.m.info_read()
+ for c in ok_list:
+ chunk = self.findChunk(c)
+ try: # check if the header implies success, else add it to failed list
+ chunk.verifyHeader()
+ except ResponseException, e:
+ self.log.debug("Chunk %d failed: %s" % (chunk.id + 1, str(e)))
+ failed.append(chunk)
+ ex = e
+ else:
+ chunksDone.add(c)
+
+ for c in err_list:
+ curl, errno, msg = c
+ chunk = self.findChunk(curl)
+ #test if chunk was finished
+ if errno != 23 or "0 !=" not in msg:
+ failed.append(chunk)
+ ex = pycurl.error(errno, msg)
+ self.log.debug("Chunk %d failed: %s" % (chunk.id + 1, str(ex)))
+ continue
+
+ try: # check if the header implies success, else add it to failed list
+ chunk.verifyHeader()
+ except ResponseException, e:
+ self.log.debug("Chunk %d failed: %s" % (chunk.id + 1, str(e)))
+ failed.append(chunk)
+ ex = e
+ else:
+ chunksDone.add(curl)
+ if not num_q: # no more info to get
+
+ # check if init is not finished so we reset download connections
+ # note that other chunks are closed and everything downloaded with initial connection
+ if failed and init not in failed and init.c not in chunksDone:
+ self.log.error(_("Download chunks failed, fallback to single connection | %s" % (str(ex))))
+
+ #list of chunks to clean and remove
+ to_clean = filter(lambda x: x is not init, self.chunks)
+ for chunk in to_clean:
+ self.closeChunk(chunk)
+ self.chunks.remove(chunk)
+ remove(fs_encode(self.info.getChunkName(chunk.id)))
+
+ #let first chunk load the rest and update the info file
+ init.resetRange()
+ self.info.clear()
+ self.info.addChunk("%s.chunk0" % self.filename, (0, self.size))
+ self.info.save()
+ elif failed:
+ raise ex
+
+ lastFinishCheck = t
+
+ if len(chunksDone) >= len(self.chunks):
+ if len(chunksDone) > len(self.chunks):
+ self.log.warning("Finished download chunks size incorrect, please report bug.")
+ done = True #all chunks loaded
+
+ break
+
+ if done:
+ break #all chunks loaded
+
+ # calc speed once per second, averaging over 3 seconds
+ if lastTimeCheck + 1 < t:
+ diff = [c.arrived - (self.lastArrived[i] if len(self.lastArrived) > i else 0) for i, c in
+ enumerate(self.chunks)]
+
+ self.lastSpeeds[1] = self.lastSpeeds[0]
+ self.lastSpeeds[0] = self.speeds
+ self.speeds = [float(a) / (t - lastTimeCheck) for a in diff]
+ self.lastArrived = [c.arrived for c in self.chunks]
+ lastTimeCheck = t
+
+ if self.doAbort:
+ raise Abort()
+
+ self.m.select(1)
+
+ for chunk in self.chunks:
+ chunk.flushFile() #make sure downloads are written to disk
+
+ self._copyChunks()
+
+ def findChunk(self, handle):
+ """ linear search to find a chunk (should be ok since chunk size is usually low) """
+ for chunk in self.chunks:
+ if chunk.c == handle: return chunk
+
+ def closeChunk(self, chunk):
+ try:
+ self.m.remove_handle(chunk.c)
+ except pycurl.error, e:
+ self.log.debug("Error removing chunk: %s" % str(e))
+ finally:
+ chunk.close()
+
+ def close(self):
+ """ cleanup """
+ for chunk in self.chunks:
+ self.closeChunk(chunk)
+ else:
+ #Workaround: pycurl segfaults when closing multi, that never had any curl handles
+ if hasattr(self, "m"):
+ c = pycurl.Curl()
+ self.m.add_handle(c)
+ self.m.remove_handle(c)
+ c.close()
+
+ self.chunks = []
+ if hasattr(self, "m"):
+ self.m.close()
+ del self.m
+ if hasattr(self, "info"):
+ del self.info \ No newline at end of file
diff --git a/pyload/plugins/network/CurlRequest.py b/pyload/plugins/network/CurlRequest.py
new file mode 100644
index 000000000..717590ac5
--- /dev/null
+++ b/pyload/plugins/network/CurlRequest.py
@@ -0,0 +1,320 @@
+# -*- coding: utf-8 -*-
+
+###############################################################################
+# Copyright(c) 2008-2012 pyLoad Team
+# http://www.pyload.org
+#
+# This file is part of pyLoad.
+# pyLoad is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# Subjected to the terms and conditions in LICENSE
+#
+# @author: RaNaN
+###############################################################################
+
+import pycurl
+
+from codecs import getincrementaldecoder, lookup, BOM_UTF8
+from urllib import quote, urlencode
+from httplib import responses
+from cStringIO import StringIO
+
+from pyload.plugins.Base import Abort
+from pyload.network.CookieJar import CookieJar
+
+from ..Request import Request, ResponseException
+
+
+def myquote(url):
+ return quote(url.encode('utf8') if isinstance(url, unicode) else url, safe="%/:=&?~#+!$,;'@()*[]")
+
+
+def myurlencode(data):
+ data = dict(data)
+ return urlencode(dict((x.encode('utf8') if isinstance(x, unicode) else x, \
+ y.encode('utf8') if isinstance(y, unicode) else y ) for x, y in data.iteritems()))
+
+
+bad_headers = range(400, 418) + range(500, 506)
+
+pycurl.global_init(pycurl.GLOBAL_DEFAULT)
+
+class CurlRequest(Request):
+ """ Request class based on libcurl """
+
+ __version__ = "0.1"
+
+ CONTEXT_CLASS = CookieJar
+
+ def __init__(self, *args, **kwargs):
+ self.c = pycurl.Curl()
+ Request.__init__(self, *args, **kwargs)
+
+ self.rep = StringIO()
+ self.lastURL = None
+ self.lastEffectiveURL = None
+
+ # cookiejar defines the context
+ self.cj = self.context
+
+ self.c.setopt(pycurl.WRITEFUNCTION, self.write)
+ self.c.setopt(pycurl.HEADERFUNCTION, self.writeHeader)
+
+ # TODO: addAuth, addHeader
+
+ @property
+ def http(self):
+ print "Deprecated usage of req.http, just use req instead"
+ return self
+
+ def initContext(self):
+ self.initHandle()
+
+ if self.config:
+ self.setInterface(self.config)
+ self.initOptions(self.config)
+
+ def initHandle(self):
+ """ sets common options to curl handle """
+
+ self.c.setopt(pycurl.FOLLOWLOCATION, 1)
+ self.c.setopt(pycurl.MAXREDIRS, 5)
+ self.c.setopt(pycurl.CONNECTTIMEOUT, 30)
+ self.c.setopt(pycurl.NOSIGNAL, 1)
+ self.c.setopt(pycurl.NOPROGRESS, 1)
+ if hasattr(pycurl, "AUTOREFERER"):
+ self.c.setopt(pycurl.AUTOREFERER, 1)
+ self.c.setopt(pycurl.SSL_VERIFYPEER, 0)
+ # Interval for low speed, detects connection loss, but can abort dl if hoster stalls the download
+ self.c.setopt(pycurl.LOW_SPEED_TIME, 45)
+ self.c.setopt(pycurl.LOW_SPEED_LIMIT, 5)
+
+ # don't save the cookies
+ self.c.setopt(pycurl.COOKIEFILE, "")
+ self.c.setopt(pycurl.COOKIEJAR, "")
+
+ #self.c.setopt(pycurl.VERBOSE, 1)
+
+ self.c.setopt(pycurl.USERAGENT,
+ "Mozilla/5.0 (Windows NT 6.1; Win64; x64;en; rv:5.0) Gecko/20110619 Firefox/5.0")
+ if pycurl.version_info()[7]:
+ self.c.setopt(pycurl.ENCODING, "gzip, deflate")
+ self.c.setopt(pycurl.HTTPHEADER, ["Accept: */*",
+ "Accept-Language: en-US,en",
+ "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7",
+ "Connection: keep-alive",
+ "Keep-Alive: 300",
+ "Expect:"])
+
+ def setInterface(self, options):
+
+ interface, proxy, ipv6 = options["interface"], options["proxies"], options["ipv6"]
+
+ if interface and interface.lower() != "none":
+ self.c.setopt(pycurl.INTERFACE, str(interface))
+
+ if proxy:
+ if proxy["type"] == "socks4":
+ self.c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_SOCKS4)
+ elif proxy["type"] == "socks5":
+ self.c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_SOCKS5)
+ else:
+ self.c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_HTTP)
+
+ self.c.setopt(pycurl.PROXY, str(proxy["address"]))
+ self.c.setopt(pycurl.PROXYPORT, proxy["port"])
+
+ if proxy["username"]:
+ self.c.setopt(pycurl.PROXYUSERPWD, str("%s:%s" % (proxy["username"], proxy["password"])))
+
+ if ipv6:
+ self.c.setopt(pycurl.IPRESOLVE, pycurl.IPRESOLVE_WHATEVER)
+ else:
+ self.c.setopt(pycurl.IPRESOLVE, pycurl.IPRESOLVE_V4)
+
+ if "timeout" in options:
+ self.c.setopt(pycurl.LOW_SPEED_TIME, options["timeout"])
+
+ def initOptions(self, options):
+ """ Sets same options as available in pycurl """
+ for k, v in options.iteritems():
+ if hasattr(pycurl, k):
+ self.c.setopt(getattr(pycurl, k), v)
+
+ def setRequestContext(self, url, get, post, referer, cookies, multipart=False):
+ """ sets everything needed for the request """
+ url = myquote(url)
+
+ if get:
+ get = urlencode(get)
+ url = "%s?%s" % (url, get)
+
+ self.c.setopt(pycurl.URL, url)
+
+ if post:
+ self.c.setopt(pycurl.POST, 1)
+ if not multipart:
+ if type(post) == unicode:
+ post = str(post) #unicode not allowed
+ elif type(post) == str:
+ pass
+ else:
+ post = myurlencode(post)
+
+ self.c.setopt(pycurl.POSTFIELDS, post)
+ else:
+ post = [(x, y.encode('utf8') if type(y) == unicode else y ) for x, y in post.iteritems()]
+ self.c.setopt(pycurl.HTTPPOST, post)
+ else:
+ self.c.setopt(pycurl.POST, 0)
+
+ if referer and self.lastURL:
+ self.c.setopt(pycurl.REFERER, str(self.lastURL))
+ else:
+ self.c.setopt(pycurl.HTTPHEADER, ["Referer:"])
+
+ if cookies:
+ for c in self.cj.output().splitlines():
+ self.c.setopt(pycurl.COOKIELIST, c)
+ else:
+ # Magic string that erases all cookies
+ self.c.setopt(pycurl.COOKIELIST, "ALL")
+
+ # TODO: remove auth again
+ if "auth" in self.options:
+ self.c.setopt(pycurl.USERPWD, str(self.options["auth"]))
+
+ def load(self, url, get={}, post={}, referer=True, cookies=True, just_header=False, multipart=False, decode=False):
+ """ load and returns a given page """
+
+ self.setRequestContext(url, get, post, referer, cookies, multipart)
+
+ # TODO: use http/rfc message instead
+ self.header = ""
+
+ if "header" in self.options:
+ self.c.setopt(pycurl.HTTPHEADER, self.options["header"])
+
+ if just_header:
+ self.c.setopt(pycurl.FOLLOWLOCATION, 0)
+ self.c.setopt(pycurl.NOBODY, 1) #TODO: nobody= no post?
+
+ # overwrite HEAD request, we want a common request type
+ if post:
+ self.c.setopt(pycurl.CUSTOMREQUEST, "POST")
+ else:
+ self.c.setopt(pycurl.CUSTOMREQUEST, "GET")
+
+ try:
+ self.c.perform()
+ rep = self.header
+ finally:
+ self.c.setopt(pycurl.FOLLOWLOCATION, 1)
+ self.c.setopt(pycurl.NOBODY, 0)
+ self.c.unsetopt(pycurl.CUSTOMREQUEST)
+
+ else:
+ self.c.perform()
+ rep = self.getResponse()
+
+ self.c.setopt(pycurl.POSTFIELDS, "")
+ self.lastURL = myquote(url)
+ self.lastEffectiveURL = self.c.getinfo(pycurl.EFFECTIVE_URL)
+ self.code = self.verifyHeader()
+
+ if cookies:
+ self.parseCookies()
+
+ if decode:
+ rep = self.decodeResponse(rep)
+
+ return rep
+
+ def parseCookies(self):
+ for c in self.c.getinfo(pycurl.INFO_COOKIELIST):
+ #http://xiix.wordpress.com/2006/03/23/mozillafirefox-cookie-format
+ domain, flag, path, secure, expires, name, value = c.split("\t")
+ # http only was added in py 2.6
+ domain = domain.replace("#HttpOnly_", "")
+ self.cj.setCookie(domain, name, value, path, expires, secure)
+
+ def verifyHeader(self):
+ """ raise an exceptions on bad headers """
+ code = int(self.c.getinfo(pycurl.RESPONSE_CODE))
+ if code in bad_headers:
+ raise ResponseException(code, responses.get(code, "Unknown statuscode"))
+ return code
+
+ def getResponse(self):
+ """ retrieve response from string io """
+ if self.rep is None: return ""
+ value = self.rep.getvalue()
+ self.rep.close()
+ self.rep = StringIO()
+ return value
+
+ def decodeResponse(self, rep):
+ """ decode with correct encoding, relies on header """
+ header = self.header.splitlines()
+ encoding = "utf8" # default encoding
+
+ for line in header:
+ line = line.lower().replace(" ", "")
+ if not line.startswith("content-type:") or \
+ ("text" not in line and "application" not in line):
+ continue
+
+ none, delemiter, charset = line.rpartition("charset=")
+ if delemiter:
+ charset = charset.split(";")
+ if charset:
+ encoding = charset[0]
+
+ try:
+ #self.log.debug("Decoded %s" % encoding )
+ if lookup(encoding).name == 'utf-8' and rep.startswith(BOM_UTF8):
+ encoding = 'utf-8-sig'
+
+ decoder = getincrementaldecoder(encoding)("replace")
+ rep = decoder.decode(rep, True)
+
+ #TODO: html_unescape as default
+
+ except LookupError:
+ self.log.debug("No Decoder found for %s" % encoding)
+ except Exception:
+ self.log.debug("Error when decoding string from %s." % encoding)
+
+ return rep
+
+ def write(self, buf):
+ """ writes response """
+ if self.rep.tell() > 1000000 or self.doAbort:
+ rep = self.getResponse()
+ if self.doAbort: raise Abort()
+ f = open("response.dump", "wb")
+ f.write(rep)
+ f.close()
+ raise Exception("Loaded Url exceeded limit")
+
+ self.rep.write(buf)
+
+ def writeHeader(self, buf):
+ """ writes header """
+ self.header += buf
+
+ def reset(self):
+ self.cj.clear()
+ self.options.clear()
+
+ def close(self):
+ """ cleanup, unusable after this """
+ self.rep.close()
+ if hasattr(self, "cj"):
+ del self.cj
+ if hasattr(self, "c"):
+ self.c.close()
+ del self.c \ No newline at end of file
diff --git a/pyload/plugins/network/DefaultRequest.py b/pyload/plugins/network/DefaultRequest.py
new file mode 100644
index 000000000..dce486ea5
--- /dev/null
+++ b/pyload/plugins/network/DefaultRequest.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+
+from CurlRequest import CurlRequest
+from CurlDownload import CurlDownload
+
+__version__ = "0.1"
+
+DefaultRequest = CurlRequest
+DefaultDownload = CurlDownload \ No newline at end of file
diff --git a/pyload/plugins/network/XDCCRequest.py b/pyload/plugins/network/XDCCRequest.py
new file mode 100644
index 000000000..6b692ab38
--- /dev/null
+++ b/pyload/plugins/network/XDCCRequest.py
@@ -0,0 +1,162 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: jeix
+"""
+
+import socket
+import re
+
+from os import remove
+from os.path import exists
+
+from time import time
+
+import struct
+from select import select
+
+from pyload.plugins.Plugin import Abort
+
+# TODO: This must be adapted to the new request interfaces
+class XDCCRequest():
+ def __init__(self, timeout=30, proxies={}):
+
+ self.proxies = proxies
+ self.timeout = timeout
+
+ self.filesize = 0
+ self.recv = 0
+ self.speed = 0
+
+ self.abort = False
+
+
+ def createSocket(self):
+ # proxytype = None
+ # proxy = None
+ # if self.proxies.has_key("socks5"):
+ # proxytype = socks.PROXY_TYPE_SOCKS5
+ # proxy = self.proxies["socks5"]
+ # elif self.proxies.has_key("socks4"):
+ # proxytype = socks.PROXY_TYPE_SOCKS4
+ # proxy = self.proxies["socks4"]
+ # if proxytype:
+ # sock = socks.socksocket()
+ # t = _parse_proxy(proxy)
+ # sock.setproxy(proxytype, addr=t[3].split(":")[0], port=int(t[3].split(":")[1]), username=t[1], password=t[2])
+ # else:
+ # sock = socket.socket()
+ # return sock
+
+ return socket.socket()
+
+ def download(self, ip, port, filename, irc, progressNotify=None):
+
+ ircbuffer = ""
+ lastUpdate = time()
+ cumRecvLen = 0
+
+ dccsock = self.createSocket()
+
+ dccsock.settimeout(self.timeout)
+ dccsock.connect((ip, port))
+
+ if exists(filename):
+ i = 0
+ nameParts = filename.rpartition(".")
+ while True:
+ newfilename = "%s-%d%s%s" % (nameParts[0], i, nameParts[1], nameParts[2])
+ i += 1
+
+ if not exists(newfilename):
+ filename = newfilename
+ break
+
+ fh = open(filename, "wb")
+
+ # recv loop for dcc socket
+ while True:
+ if self.abort:
+ dccsock.close()
+ fh.close()
+ remove(filename)
+ raise Abort()
+
+ self._keepAlive(irc, ircbuffer)
+
+ data = dccsock.recv(4096)
+ dataLen = len(data)
+ self.recv += dataLen
+
+ cumRecvLen += dataLen
+
+ now = time()
+ timespan = now - lastUpdate
+ if timespan > 1:
+ self.speed = cumRecvLen / timespan
+ cumRecvLen = 0
+ lastUpdate = now
+
+ if progressNotify:
+ progressNotify(self.percent)
+
+
+ if not data:
+ break
+
+ fh.write(data)
+
+ # acknowledge data by sending number of received bytes
+ dccsock.send(struct.pack('!I', self.recv))
+
+ dccsock.close()
+ fh.close()
+
+ return filename
+
+ def _keepAlive(self, sock, readbuffer):
+ fdset = select([sock], [], [], 0)
+ if sock not in fdset[0]:
+ return
+
+ readbuffer += sock.recv(1024)
+ temp = readbuffer.split("\n")
+ readbuffer = temp.pop()
+
+ for line in temp:
+ line = line.rstrip()
+ first = line.split()
+ if first[0] == "PING":
+ sock.send("PONG %s\r\n" % first[1])
+
+ def abortDownloads(self):
+ self.abort = True
+
+ @property
+ def size(self):
+ return self.filesize
+
+ @property
+ def arrived(self):
+ return self.recv
+
+ @property
+ def percent(self):
+ if not self.filesize: return 0
+ return (self.recv * 100) / self.filesize
+
+ def close(self):
+ pass
diff --git a/pyload/plugins/network/__init__.py b/pyload/plugins/network/__init__.py
new file mode 100644
index 000000000..4b31e848b
--- /dev/null
+++ b/pyload/plugins/network/__init__.py
@@ -0,0 +1 @@
+__author__ = 'christian'