diff options
author | flubshi <flubshi@web.de> | 2015-01-13 23:20:26 +0100 |
---|---|---|
committer | flubshi <flubshi@web.de> | 2015-01-13 23:20:26 +0100 |
commit | b18abd1a3b61bdffc159e87312d527bc71216087 (patch) | |
tree | aa3db54ae89f14b9272074fbf00d14eb76f6b1e8 /module/plugins/hoster/FreeWayMe.py | |
parent | [FileSharkPl] Fix https://github.com/pyload/pyload/issues/1040 (diff) | |
download | pyload-b18abd1a3b61bdffc159e87312d527bc71216087.tar.xz |
Host FreeWayMe: Improve error handling, try five times
This update allows 4 additional attempts if download fails.
Diffstat (limited to 'module/plugins/hoster/FreeWayMe.py')
-rw-r--r-- | module/plugins/hoster/FreeWayMe.py | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/module/plugins/hoster/FreeWayMe.py b/module/plugins/hoster/FreeWayMe.py index ffc8115d3..6d08e1f8d 100644 --- a/module/plugins/hoster/FreeWayMe.py +++ b/module/plugins/hoster/FreeWayMe.py @@ -6,7 +6,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class FreeWayMe(MultiHoster): __name__ = "FreeWayMe" __type__ = "hoster" - __version__ = "0.15" + __version__ = "0.16" __pattern__ = r'https://(?:www\.)?free-way\.me/.+' @@ -24,13 +24,30 @@ class FreeWayMe(MultiHoster): def handlePremium(self, pyfile): user, data = self.account.selectAccount() - self.download("https://www.free-way.me/load.php", + for _i in xrange(5): + # try it five times + header = self.load("https://www.free-way.me/load.php", get={'multiget': 7, 'url' : pyfile.url, 'user' : user, 'pw' : self.account.getAccountData(user)['password'], - 'json' : ""}, - disposition=True) + 'json' : ""}, just_header=True) + if "location" in header: + #download + self.logInfo("Download: " + header['location']) + headers = self.load(header['location'],just_header=True) + if headers['code'] == 500: + #error on 2nd stage + self.logInfo("Free-Way Error [stage2]") + # todo: handle errors + else: + # seems to work.. + self.download(header['location']) + break + else: + #error page first stage + self.logInfo("Free-Way Error [stage1]") + # todo: handle errors getInfo = create_getInfo(FreeWayMe) |