on master help sign in
Merge pull request #2654 from return42/acgsou

[drop] Acgsou engine - www.acgsou.com no longer exists

commit0b71d61dfc45559cc647a622388cf0bcca998322 authorAlexandre Flament <alex@al-f.net> dateMon 15 Mar 2021, 08:27 (6 years ago) parent92925713703ebb
2 files changed−80
searx/engines/acgsou.py−74 searx/settings.yml−6
searx/engines/acgsou.pydeleted−74
@@ -1,74 +0,0 @@
1−# SPDX-License-Identifier: AGPL-3.0-or-later
2−"""
3− Acgsou (Japanese Animation/Music/Comics Bittorrent tracker)
4−"""
5−
6−from urllib.parse import urlencode
7−from lxml import html
8−from searx.utils import extract_text, get_torrent_size, eval_xpath_list, eval_xpath_getindex
9−
10−# about
11−about = {
12− "website": 'https://www.acgsou.com/',
13− "wikidata_id": None,
14− "official_api_documentation": None,
15− "use_official_api": False,
16− "require_api_key": False,
17− "results": 'HTML',
18−}
19−
20−# engine dependent config
21−categories = ['files', 'images', 'videos', 'music']
22−paging = True
23−
24−# search-url
25−base_url = 'https://www.acgsou.com/'
26−search_url = base_url + 'search.php?{query}&page={offset}'
27−# xpath queries
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()'
33−
34−
35−def request(query, params):
36− query = urlencode({'keyword': query})
37− params['url'] = search_url.format(query=query, offset=params['pageno'])
38− return params
39−
40−
41−def response(resp):
42− results = []
43− dom = html.fromstring(resp.text)
44− for result in eval_xpath_list(dom, xpath_results):
45− # defaults
46− filesize = 0
47− magnet_link = "magnet:?xt=urn:btih:{}&tr=https://tracker.acgsou.com:2710/announce"
48−
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')
53−
54− magnet_link = magnet_link.format(page_a.attrib.get('href')[5:-5])
55−
56− filesize_info = eval_xpath_getindex(result, xpath_filesize, 0, default=None)
57− if filesize_info:
58− try:
59− filesize = filesize_info[:-2]
60− filesize_multiplier = filesize_info[-2:]
61− filesize = get_torrent_size(filesize, filesize_multiplier)
62− except:
63− pass
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)
67−
68− results.append({'url': href,
69− 'title': title,
70− 'content': content,
71− 'filesize': filesize,
72− 'magnetlink': magnet_link,
73− 'template': 'torrent.html'})
74− return results
searx/settings.yml−6
@@ -737,12 +737,6 @@ engines:
737737 shortcut : nt
738738 disabled : True
739739
740− - name : acgsou
741− engine : acgsou
742− shortcut : acg
743− disabled : True
744− timeout: 5.0
745−
746740 - name : openairedatasets
747741 engine : json_engine
748742 paging : True