Commit 9704dd73 authored by prx's avatar prx

upgrade alphareign

parent d8e6c23b
......@@ -85,7 +85,7 @@ def search2html(keywords, extrawords=' ', searchengine='alphareign', page=0, iss
html += '</tr>'
html += '</tbody>'
html += '</table>'
if searchengine in [ 'alphareign', 'btdb', 'digbt', 'p2psearch' ]:
if searchengine in [ 'btdb', 'digbt', 'p2psearch' ]:
html += '<a href="/moreresults/{}/{}/{}/{}/{}">{}</a>'.format(
keywords, int(page) + 1, searchengine, extrawords, isserie, _('More results'))
else: # If there is no result
......
......@@ -51,7 +51,7 @@ progversion = 2.0
defaultconf = {'startperc': 7,
'uplimit': 20,
'downlimit': -1,
'searchengine': 'alphareign',
'searchengine': 'btdb',
'proxy_type': 'none',
'proxy_hostname': '',
'proxy_username': '',
......@@ -87,7 +87,7 @@ def htmlget(url, params=None):
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
if params != None:
p = urllib.parse.urlencode(params)
if url.endswith('?'):
if url.endswith('?') or url.endswith('&'):
url = '{}{}'.format(url,p)
response = opener.open(url, timeout=10)
else:
......
......@@ -388,8 +388,8 @@ class TorrentSearch:
seed : number of seeds
"""
page = int(page) + 1
url = 'https://alphareign.se/?'
keys = {'query': sch, 'page': page}
url = 'https://alphareign.se/api?apikey=58a2b5106a5d3&'
keys = {'q': sch}
s = do_req_get(url, "text", keys)
soup = bs4.BeautifulSoup(s, "html.parser")
......@@ -400,14 +400,18 @@ class TorrentSearch:
leechs = str()
res = {}
results = soup.find('div', id='results')
for r in soup.find_all("div", class_="result"):
name = r['data-name']
size = convb(int(r['data-size']))
seeds = r['data-seeders']
leechs = r['data-leechers']
link = r.find('a', alt='download torrent')
magnet = link['href']
for item in soup.find_all('item'):
title = item.find('title')
name = title.text
magnet = item.find('magneturl').text
size = item.find('size').text
size = convb(int(size))
attr = item.find_all('torznab:attr')
for a in attr:
if a['name'] == 'seeders':
seeds = a['value']
elif a['name'] == 'peers':
leechs = a['value']
if name and magnet and size and seeds and leechs :
res = {'name': name, 'magnet': magnet, 'size': size, 'seeds': seeds, "leechs": leechs}
......@@ -589,7 +593,7 @@ def isohunt_parse_results(z):
if __name__ == '__main__':
with TorrentSearch('p2psearch') as ts:
with TorrentSearch('alphareign') as ts:
s = ts.search('vikings vostfr', 0)
print(s)
......
  • Tu ne serais pas en vacances @Thuban ? :D

  • Maintainer

    Si ! :D Voilà ce qui arrive quand un prof n'a pas envie de corriger et procrastine... ^^

    Et ce moteur de recherche est extra, mais il a changé son fonctionnement et propose maintenant une API. J'attends quelques jours avant de voir si ça reste comme ça. En attendant, j'ai une surprise : un dontpanic-cli :)

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