@@ -1,74 +0,0 @@
1−# SPDX-License-Identifier: AGPL-3.0-or-later
3− Acgsou (Japanese Animation/Music/Comics Bittorrent tracker)
6−from urllib.parse import urlencode
8−from searx.utils import extract_text, get_torrent_size, eval_xpath_list, eval_xpath_getindex
12− "website": 'https://www.acgsou.com/',
14− "official_api_documentation": None,
15− "use_official_api": False,
16− "require_api_key": False,
20−# engine dependent config
21−categories = ['files', 'images', 'videos', 'music']
25−base_url = 'https://www.acgsou.com/'
26−search_url = base_url + 'search.php?{query}&page={offset}'
28−xpath_results = '//table[contains(@class, "list_style table_fixed")]//tr[not(th)]'
29−xpath_category = './/td[2]/a[1]'
30−xpath_title = './/td[3]/a[last()]'
31−xpath_torrent_links = './/td[3]/a'
32−xpath_filesize = './/td[4]/text()'
35−def request(query, params):
36− query = urlencode({'keyword': query})
37− params['url'] = search_url.format(query=query, offset=params['pageno'])
43− dom = html.fromstring(resp.text)
44− for result in eval_xpath_list(dom, xpath_results):
47− magnet_link = "magnet:?xt=urn:btih:{}&tr=https://tracker.acgsou.com:2710/announce"
49− category = extract_text(eval_xpath_getindex(result, xpath_category, 0, default=[]))
50− page_a = eval_xpath_getindex(result, xpath_title, 0)
51− title = extract_text(page_a)
52− href = base_url + page_a.attrib.get('href')
54− magnet_link = magnet_link.format(page_a.attrib.get('href')[5:-5])
56− filesize_info = eval_xpath_getindex(result, xpath_filesize, 0, default=None)
59− filesize = filesize_info[:-2]
60− filesize_multiplier = filesize_info[-2:]
61− filesize = get_torrent_size(filesize, filesize_multiplier)
64− # I didn't add download/seed/leech count since as I figured out they are generated randomly everytime
65− content = 'Category: "{category}".'
66− content = content.format(category=category)
68− results.append({'url': href,
71− 'filesize': filesize,
72− 'magnetlink': magnet_link,
73− 'template': 'torrent.html'})