Commit 9f5cefaa authored by prx's avatar prx

reactivation de plusieurs moteurs. +isohunt. + grands seeds en premier

parent 3d2975f1
......@@ -296,7 +296,7 @@ def watchlist(user):
def create_select_search_engine(selected):
#list_search_engines = ["btdigg", "kickasstorrents", "piratebay", "torrentproject", tpl_msg['tpl_all']]
list_search_engines = ["kickasstorrents", "piratebay", tpl_msg['tpl_all']]
list_search_engines = ["kickasstorrents", "piratebay", "isohunt", tpl_msg['tpl_all']]
list_html = str()
for search_engine in list_search_engines:
......
......@@ -151,6 +151,7 @@ sorttable = {
//sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
/* and comment out this one */
row_array.sort(this.sorttable_sortfunction);
row_array.reverse();
tb = this.sorttable_tbody;
for (var j=0; j<row_array.length; j++) {
......
......@@ -255,7 +255,7 @@ class TorrentSearch:
return self
def __exit__(self, exception_type, exception_value, traceback):
#print(exception_type, exception_value, traceback)
print(exception_type, exception_value, traceback)
pass
def search(self, sch, page=0):
......@@ -268,6 +268,8 @@ class TorrentSearch:
s = [res for res in self._piratebay(sch)]
elif self.searchengine == 'kickasstorrents':
s = [res for res in self._kickasstorrents(sch)]
elif self.searchengine == 'isohunt':
s = [res for res in self._isohunt(sch)]
elif self.searchengine == '*':
s = self._search_all(sch)
else:
......@@ -279,18 +281,17 @@ class TorrentSearch:
def _search_all(self, sch):
s = []
searchengine_list = [self._btdigg, self._torrentproject, self._piratebay]
searchengine_list = [self._piratebay, self._kickasstorrents, self._isohunt]
if sys.version_info >= (3, 0):
with ThreadPoolExecutor(max_workers=4) as e:
with ThreadPoolExecutor(max_workers=5) as e:
for searchengine in searchengine_list:
try :
e.map(s.append, searchengine(sch))
except:pass
else:
s += [res for res in self._btdigg(sch)]
s += [res for res in self._torrentproject(sch)]
s += [res for res in self._piratebay(sch)]
s += [res for res in self._kickasstorrents(sch)]
s += [res for res in self._isohunt(sch)]
return s
......@@ -455,20 +456,26 @@ class TorrentSearch:
size = str()
seeds = str()
leechs = str()
divs = soup.find_all('data-sc-params')
divs = soup.find_all('data-sc-params')
results = [item["data-sc-params"] for item in soup.find_all() if "data-sc-params" in item.attrs]
magnets = []
for d in results:
d = eval(d)
if 'magnet' in d.keys():
magnets.append(d['magnet'])
all_tr = soup.find_all('tr', class_="even") + soup.find_all('tr', class_="odd")
for tr in all_tr:
for tr, magnet in zip(all_tr, magnets):
td = tr.find_all("td")
name_result = td[0].find('a', class_='cellMainLink')
if name_result:
for content in name_result.contents:
name += content.string
magnet_result = td[0].find('a', title="Torrent magnet link")
if magnet_result:
href = magnet_result['href']
if href.startswith('magnet:'):
magnet = href.split('&tr=')[0] # to remove trackers
size_result = td[1]
if size_result:
for content in size_result.contents:
......@@ -485,6 +492,7 @@ class TorrentSearch:
if leechs_result:
leechs = leechs_result.string
if name != "" and magnet != "" and size != "" and seeds != "" and leechs != "":
if sys.version_info < (3, 0):
magnet = magnet.encode('utf-8')
......@@ -499,9 +507,75 @@ class TorrentSearch:
leechs = str()
yield(d)
def _isohunt(self,sch, page=0):
"""
Return:
List of dictionnaries with keys :
name : torrent name
magnet : magnet link
size : size
seed : number of seeds
"""
name = str()
magnet = str()
size = str()
seeds = str()
leechs = str()
url = 'https://isohunt.to/torrents/'
keys = {'ihq': sch}
s = do_req_get(url, "text", keys)
soup = bs4.BeautifulSoup(s, "html.parser")
row = soup.find_all("td", class_="title-row")
seeds_results = soup.find_all("td", class_="sy")
size_results = soup.find_all("td", class_="size-row")
if sys.version_info > (3, 0):
with ThreadPoolExecutor(max_workers=5) as executor:
for res in executor.map(isohunt_parse_results, zip(row, seeds_results, size_results)):
yield res
else:
for z in zip(row, seeds_results, size_results):
yield(isohunt_parse_results(z))
def isohunt_parse_results(z):
"""
parse isohunt results
return a dic of torrent description
"""
td, s, sz = z
name = str()
magnet = str()
size = str()
seeds = str()
leechs = str()
a = td.find('a')
torlink = "https://isohunt.to{}".format(a['href'])
name = a.text
seeds = s.text
size = sz.text
s = do_req_get(torlink, "text")
soup = bs4.BeautifulSoup(s, "html.parser")
magnet = soup.find("a", class_="btn-magnet")['href']
if sys.version_info < (3, 0):
magnet = magnet.encode('utf-8')
name = name.encode('utf-8')
size = size.encode('utf-8')
return {'name': name, 'magnet': magnet, 'size': size, 'seeds': seeds, "leechs": leechs}
if __name__ == '__main__':
with TorrentSearch('torrentproject') as ts:
with TorrentSearch('kickasstorrents') as ts:
s = ts.search('flash', 0)
print(s)
......
  • Maintainer

    Voilà une update qu'il était temps de faire. pleins de moteurs ont fermé, il fallait mettre à jour.

    Si vous voulez tester... Je vais faire une petite annonce bientôt.

    Allez, maintenant, 3hg-menu! \o/

  • cool le retour de kickass :P

Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment