From f6ed82016a35e5dc1fc278865502de1955b5c37d Mon Sep 17 00:00:00 2001 From: Stefano Date: Fri, 8 Mar 2013 20:30:21 +0100 Subject: New hoster: EgoFilesCom http://forum.pyload.org/viewtopic.php?f=13&t=1959 --- module/plugins/hoster/EgoFilesCom.py | 62 ++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 module/plugins/hoster/EgoFilesCom.py (limited to 'module/plugins/hoster') diff --git a/module/plugins/hoster/EgoFilesCom.py b/module/plugins/hoster/EgoFilesCom.py new file mode 100644 index 000000000..376b1fd5b --- /dev/null +++ b/module/plugins/hoster/EgoFilesCom.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, parseFileInfo +from module.plugins.ReCaptcha import ReCaptcha +import re + +def to_seconds(m): + minutes = int(m['m']) if m['m'] else 0 + seconds = int(m['s']) if m['s'] else 0 + return minutes * 60 + seconds + +class EgoFilesCom(SimpleHoster): + __name__ = "EgoFilesCom" + __type__ = "hoster" + __pattern__ = r"https?://(www\.)?egofiles.com/(\w+)" + __version__ = "0.01" + __description__ = """Egofiles.com Download Hoster""" + __author_name__ = ("stickell") + __author_mail__ = ("l.stickell@yahoo.it") + + FILE_INFO_PATTERN = r'
\s+(?P\S+)\s+
\s+File size: (?P[\w.]+) (?P\w+) \|' + WAIT_TIME_PATTERN = r'For next free download you have to wait ((?P\d*)m)? ?((?P\d+)s)?' + RECAPTCHA_KEY = '6LeXatQSAAAAAHezcjXyWAni-4t302TeYe7_gfvX' + + def init(self): + self.file_info = {} + # Set English language + self.load("https://egofiles.com/ajax/lang.php?lang=en", just_header=True) + + def handleFree(self): + self.html = self.load(self.pyfile.url, decode=True) + + # 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) + self.setWait(to_seconds(m.groupdict()), 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(r'Download >', self.html) + if not m: + self.logError('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) + +getInfo = create_getInfo(EgoFilesCom) -- cgit v1.2.3