From 8466b9db8eca71bdffa01ea082f56767babe3bd3 Mon Sep 17 00:00:00 2001 From: Laurent Bachelier Date: Tue, 22 Oct 2013 10:08:04 +0200 Subject: [PATCH] Isohunt definitely closed --- modules/isohunt/__init__.py | 3 - modules/isohunt/backend.py | 62 --------------- modules/isohunt/browser.py | 50 ------------ modules/isohunt/favicon.png | Bin 3188 -> 0 bytes modules/isohunt/pages/__init__.py | 0 modules/isohunt/pages/torrents.py | 128 ------------------------------ modules/isohunt/test.py | 35 -------- 7 files changed, 278 deletions(-) delete mode 100644 modules/isohunt/__init__.py delete mode 100644 modules/isohunt/backend.py delete mode 100644 modules/isohunt/browser.py delete mode 100644 modules/isohunt/favicon.png delete mode 100644 modules/isohunt/pages/__init__.py delete mode 100644 modules/isohunt/pages/torrents.py delete mode 100644 modules/isohunt/test.py diff --git a/modules/isohunt/__init__.py b/modules/isohunt/__init__.py deleted file mode 100644 index e9db6014..00000000 --- a/modules/isohunt/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from .backend import IsohuntBackend - -__all__ = ['IsohuntBackend'] diff --git a/modules/isohunt/backend.py b/modules/isohunt/backend.py deleted file mode 100644 index 221ecda7..00000000 --- a/modules/isohunt/backend.py +++ /dev/null @@ -1,62 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright(C) 2010-2011 Julien Veyssier -# -# This file is part of weboob. -# -# weboob 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. -# -# weboob 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 weboob. If not, see . - - -from weboob.capabilities.torrent import ICapTorrent, Torrent -from weboob.tools.backend import BaseBackend - -from .browser import IsohuntBrowser - - -__all__ = ['IsohuntBackend'] - - -class IsohuntBackend(BaseBackend, ICapTorrent): - NAME = 'isohunt' - MAINTAINER = u'Julien Veyssier' - EMAIL = 'julien.veyssier@aiur.fr' - VERSION = '0.h' - DESCRIPTION = 'isoHunt BitTorrent tracker' - LICENSE = 'AGPLv3+' - BROWSER = IsohuntBrowser - - def get_torrent(self, id): - return self.browser.get_torrent(id) - - def get_torrent_file(self, id): - torrent = self.browser.get_torrent(id) - if not torrent: - return None - return self.browser.openurl(torrent.url.encode('utf-8')).read() - - def iter_torrents(self, pattern): - return self.browser.iter_torrents(pattern.replace(' ', '+')) - - def fill_torrent(self, torrent, fields): - if 'description' in fields or 'files' in fields: - tor = self.get_torrent(torrent.id) - torrent.description = tor.description - torrent.magnet = tor.magnet - torrent.files = tor.files - torrent.url = tor.url - return torrent - - OBJECTS = { - Torrent: fill_torrent - } diff --git a/modules/isohunt/browser.py b/modules/isohunt/browser.py deleted file mode 100644 index 6b162534..00000000 --- a/modules/isohunt/browser.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright(C) 2010-2011 Julien Veyssier -# -# This file is part of weboob. -# -# weboob 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. -# -# weboob 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 weboob. If not, see . - - -from weboob.tools.browser import BaseBrowser, BrowserHTTPNotFound - -from .pages.torrents import TorrentsPage, TorrentPage - - -__all__ = ['IsohuntBrowser'] - - -class IsohuntBrowser(BaseBrowser): - DOMAIN = 'isohunt.com' - PROTOCOL = 'https' - ENCODING = 'utf-8' - USER_AGENT = BaseBrowser.USER_AGENTS['wget'] - PAGES = { - 'https://isohunt.com/torrents/.*iht=-1&ihp=1&ihs1=1&iho1=d': TorrentsPage, - 'https://isohunt.com/torrent_details.*tab=summary': TorrentPage, - } - - def iter_torrents(self, pattern): - self.location('https://isohunt.com/torrents/%s?iht=-1&ihp=1&ihs1=1&iho1=d' % pattern.encode('utf-8')) - assert self.is_on_page(TorrentsPage) - return self.page.iter_torrents() - - def get_torrent(self, id): - try: - self.location('https://isohunt.com/torrent_details/%s/?tab=summary' % id) - except BrowserHTTPNotFound: - return - if self.is_on_page(TorrentPage): - return self.page.get_torrent(id) diff --git a/modules/isohunt/favicon.png b/modules/isohunt/favicon.png deleted file mode 100644 index 55c30772a0aaeebe47dc95532029b6a51e8471cc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3188 zcmV-)42$!LP)00001b5ch_0Itp) z=>Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RV3mg>+1%d`KK>z>%8FWQhbVF}# zZDnqB07G(RVRU6=Aa`kWXdp*PO;A^X4i^9b3*kvbK~!ko?OJ&vHc6X=s(RKwN+hQxI!?wBz z>S&AZQW07a2`CDw4=^`C8p!kJCik&_+!!JWFG~wMw00I1fV{1N*)!P%5Nhg|* z13=Zf>LDk@Dq?3T;)<)^OjIT|+`kecR`EL z$|Mce0s!hm*&o*JRUgU*00x+;v%jExjnQuOtFZ~zKtJBk4y=U5Xg5|gl^0iU-;=v9GB}F;WLGa~FBX)q zQ6I{V2#V~n^lZ*7Vii)gu9~&}jhUNRzS;fH&&gp2Kn_@%6XE1Jr;oP6D{XxYC7fSDmP*}=bCPvxh) zG;R%;4J|DfH#VIwz_eeEyfbG`4$4Iz9?IRES>(BIbxMAsGU?d03avrAe?_UsJkp}m zV->N!&X5+J-eI`SD$U}sy3gcrAIAsU8~)O-ZvX%U6(v7+m@kx%u=&l?e`?jY0sz8A z-d_4nqB4=4XIar;nnY!yuQR9*WlIH8f+WOzG0o5{KTgU?(xiwdo)$FicJD0!kcnk- zv79xtacIEWe~TSZByKm~v6(uZ4&!i}f4^Wo8|)~Ws%SdOvR+)hU4ykS!0gI?mu1(p z|8T>hm1Qdc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(TF&G0ZEfvT52Ga|B_2tO#p1ZQIJQG~*PBu)o9U(~fZe-y zvmL!aAb91KS88f%s;a8;^76c65s$}XE21d}K&R7rWS^Rv>b+E1S*cd5Sz7{tkdTl` zwL-lqbh^UALZwnU;Xx*$ zzAK@=%k!DjtWT)#+SuNwwYx}~F*>QU275tUuV({J(aWx33H4nsUf2J(AGeXToua=P z!1G%43H4peu3oq|KiEITcn9J`u>i4-c!i|K!R{hByA#T7LPZvRwqTcQ=%W>av)a3TNNH~AYK6gbp!4?)uc~h&Qk)W*QxZPl}Tm%67yDd2V$m1tYGbP;?09YayO(uZVt-Z&4taotI zNi!~nxnXl|>-YfxrVHIxofj4mEkw1rtDvp-vdMwdjDu$CO+-OkuNHSr7ovG#0h8$i z8mm)db^7*)o1)yW2O=)#qo);xH~VhbT!l9c-rJtyBOgAk5OO&%f&Z~J-dd>5=B(m*wyP diff --git a/modules/isohunt/pages/__init__.py b/modules/isohunt/pages/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/modules/isohunt/pages/torrents.py b/modules/isohunt/pages/torrents.py deleted file mode 100644 index 2c4a4e50..00000000 --- a/modules/isohunt/pages/torrents.py +++ /dev/null @@ -1,128 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright(C) 2010-2011 Julien Veyssier -# -# This file is part of weboob. -# -# weboob 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. -# -# weboob 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 weboob. If not, see . - - -from weboob.capabilities.torrent import Torrent -from weboob.tools.browser import BasePage -from weboob.tools.misc import get_bytes_size -from weboob.capabilities.base import NotAvailable, NotLoaded - - -__all__ = ['TorrentsPage'] - - -class TorrentsPage(BasePage): - def iter_torrents(self): - for tr in self.document.getiterator('tr'): - if tr.attrib.get('class', '') == 'hlRow': - # sometimes the first tr also has the attribute hlRow - # i use that to ditinct it from the others - if 'onmouseout' in tr.attrib: - size = NotAvailable - seed = NotAvailable - leech = NotAvailable - atitle = tr.getchildren()[2].getchildren()[1] - title = unicode(atitle.text) - if not title: - title = u'' - for bold in atitle.getchildren(): - if bold.text: - title += bold.text - if bold.tail: - title += bold.tail - idt = tr.getchildren()[2].getchildren()[0].attrib.get('href', '') - idt = idt.split('/')[2] - size = tr.getchildren()[3].text - u = size[-2:] - size = float(size[:-3]) - sseed = tr.getchildren()[4].text - sleech = tr.getchildren()[5].text - if sseed is not None and sseed != "": - seed = int(sseed) - if sleech is not None and sleech != "": - leech = int(sleech) - url = u'https://isohunt.com/download/%s/mon_joli_torrent.torrent' % idt - torrent = Torrent(idt, title) - torrent.url = url - torrent.size = get_bytes_size(size, u) - torrent.seeders = seed - torrent.leechers = leech - torrent.description = NotLoaded - torrent.files = NotLoaded - yield torrent - - -class TorrentPage(BasePage): - def get_torrent(self, id): - title = NotAvailable - size = NotAvailable - url = 'https://isohunt.com/download/%s/%s.torrent' % (id, id) - title = unicode(self.parser.select( - self.document.getroot(), 'head > meta[name=title]', 1).attrib.get('content', '')) - seed = NotAvailable - leech = NotAvailable - tip_id = "none" - for span in self.document.getiterator('span'): - if span.attrib.get('style', '') == 'color:green;' and ('ShowTip' in span.attrib.get('onmouseover', '')): - seed = int(span.tail.split(' ')[1]) - tip_id = span.attrib.get('onmouseover', '').split("'")[1] - for div in self.document.getiterator('div'): - # find the corresponding super tip which appears on super mouse hover! - if div.attrib.get('class', '') == 'dirs ydsf' and tip_id in div.attrib.get('id', ''): - leech = int(div.getchildren()[0].getchildren()[1].tail.split(' ')[2]) - # the with the size in it doesn't have a distinction - # have to get it by higher - elif div.attrib.get('id', '') == 'torrent_details': - size = div.getchildren()[6].getchildren()[0].getchildren()[0].text - u = size[-2:] - size = float(size[:-3]) - size = get_bytes_size(size, u) - - # files and description (uploader's comment) - description = NotAvailable - files = [] - count_p_found = 0 - for p in self.document.getiterator('p'): - if p.attrib.get('style', '') == 'line-height:1.2em;margin-top:1.8em': - count_p_found += 1 - if count_p_found == 1: - if p.getchildren()[1].tail is not None: - description = unicode(p.getchildren()[1].tail) - if count_p_found == 2: - if p.getchildren()[0].text == 'Directory:': - files.append(p.getchildren()[0].tail.strip() + '/') - else: - files.append(p.getchildren()[0].tail.strip()) - - for td in self.document.getiterator('td'): - if td.attrib.get('class', '') == 'fileRows': - filename = td.text - for slash in td.getchildren(): - filename += '/' - filename += slash.tail - files.append(filename) - - torrent = Torrent(id, title) - torrent.url = url - torrent.size = size - torrent.seeders = seed - torrent.leechers = leech - torrent.description = description - torrent.files = files - return torrent diff --git a/modules/isohunt/test.py b/modules/isohunt/test.py deleted file mode 100644 index d054ba21..00000000 --- a/modules/isohunt/test.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright(C) 2010-2011 Julien Veyssier -# -# This file is part of weboob. -# -# weboob 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. -# -# weboob 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 weboob. If not, see . - -from weboob.tools.test import BackendTest - -from random import choice - - -class IsohuntTest(BackendTest): - BACKEND = 'isohunt' - - def test_torrent(self): - l = list(self.backend.iter_torrents('debian')) - if len(l): - torrent = choice(l) - full_torrent = self.backend.get_torrent(torrent.id) - assert torrent.name - assert full_torrent.name - assert self.backend.get_torrent_file(torrent.id)