diff options
author | Walter Purcaro <vuolter@gmail.com> | 2015-02-16 21:59:10 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2015-02-16 21:59:10 +0100 |
commit | 8e7d14bae4d3c836f029a1235eb227380acc3f75 (patch) | |
tree | ebd0679642cccb994e70a89a106b394189cb28bc /module/plugins/hoster/NarodRu.py | |
parent | Merge branch 'stable' into 0.4.10 (diff) | |
download | pyload-8e7d14bae4d3c836f029a1235eb227380acc3f75.tar.xz |
Fix plugins to work on 0.4.10
Diffstat (limited to 'module/plugins/hoster/NarodRu.py')
-rw-r--r-- | module/plugins/hoster/NarodRu.py | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/module/plugins/hoster/NarodRu.py b/module/plugins/hoster/NarodRu.py deleted file mode 100644 index 1738d9724..000000000 --- a/module/plugins/hoster/NarodRu.py +++ /dev/null @@ -1,66 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from random import random - -from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo - - -class NarodRu(SimpleHoster): - __name__ = "NarodRu" - __type__ = "hoster" - __version__ = "0.12" - - __pattern__ = r'http://(?:www\.)?narod(\.yandex)?\.ru/(disk|start/\d+\.\w+-narod\.yandex\.ru)/(?P<ID>\d+)/.+' - - __description__ = """Narod.ru hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - NAME_PATTERN = r'<dt class="name">(?:<[^<]*>)*(?P<N>[^<]+)</dt>' - SIZE_PATTERN = r'<dd class="size">(?P<S>\d[^<]*)</dd>' - OFFLINE_PATTERN = r'<title>404</title>|Файл удален с сервиса|Закончился срок хранения файла\.' - - SIZE_REPLACEMENTS = [(u'КБ', 'KB'), (u'МБ', 'MB'), (u'ГБ', 'GB')] - URL_REPLACEMENTS = [("narod.yandex.ru/", "narod.ru/"), - (r"/start/\d+\.\w+-narod\.yandex\.ru/(\d{6,15})/\w+/(\w+)", r"/disk/\1/\2")] - - CAPTCHA_PATTERN = r'<number url="(.*?)">(\w+)</number>' - LINK_FREE_PATTERN = r'<a class="h-link" rel="yandex_bar" href="(.+?)">' - - - def handleFree(self, pyfile): - for _i in xrange(5): - self.html = self.load('http://narod.ru/disk/getcapchaxml/?rnd=%d' % int(random() * 777)) - - m = re.search(self.CAPTCHA_PATTERN, self.html) - if m is None: - self.error(_("Captcha")) - - post_data = {"action": "sendcapcha"} - captcha_url, post_data['key'] = m.groups() - post_data['rep'] = self.decryptCaptcha(captcha_url) - - self.html = self.load(pyfile.url, post=post_data, decode=True) - - m = re.search(self.LINK_FREE_PATTERN, self.html) - if m: - url = 'http://narod.ru' + m.group(1) - self.correctCaptcha() - break - - elif u'<b class="error-msg"><strong>Ошиблись?</strong>' in self.html: - self.invalidCaptcha() - - else: - self.error(_("Download link")) - - else: - self.fail(_("No valid captcha code entered")) - - self.download(url) - - -getInfo = create_getInfo(NarodRu) |