.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.engines.solidtorrents Namespace Reference

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
list categories = ['files']
 
bool paging = True
 
str base_url = 'https://solidtorrents.to'
 

Detailed Description

SolidTorrents

Function Documentation

◆ request()

searx.engines.solidtorrents.request ( query,
params )

Definition at line 35 of file solidtorrents.py.

35def request(query, params):
36 if isinstance(base_url, list):
37 params['base_url'] = random.choice(base_url)
38 else:
39 params['base_url'] = base_url
40 search_url = params['base_url'] + '/search?{query}'
41 query = urlencode({'q': query, 'page': params['pageno']})
42 params['url'] = search_url.format(query=query)
43 return params
44
45

◆ response()

searx.engines.solidtorrents.response ( resp)

Definition at line 46 of file solidtorrents.py.

46def response(resp):
47 results = []
48 dom = html.fromstring(resp.text)
49
50 for result in eval_xpath(dom, '//li[contains(@class, "search-result")]'):
51 torrentfile = eval_xpath_getindex(result, './/a[contains(@class, "dl-torrent")]/@href', 0, None)
52 magnet = eval_xpath_getindex(result, './/a[contains(@class, "dl-magnet")]/@href', 0, None)
53 if torrentfile is None or magnet is None:
54 continue # ignore anime results that which aren't actually torrents
55 title = eval_xpath_getindex(result, './/h5[contains(@class, "title")]', 0, None)
56 url = eval_xpath_getindex(result, './/h5[contains(@class, "title")]/a/@href', 0, None)
57 categ = eval_xpath(result, './/a[contains(@class, "category")]')
58 stats = eval_xpath_list(result, './/div[contains(@class, "stats")]/div', min_len=5)
59
60 params = {
61 'seed': extract_text(stats[3]),
62 'leech': extract_text(stats[2]),
63 'title': extract_text(title),
64 'url': resp.search_params['base_url'] + url,
65 'filesize': extract_text(stats[1]),
66 'magnetlink': magnet,
67 'torrentfile': torrentfile,
68 'metadata': extract_text(categ),
69 'template': "torrent.html",
70 }
71
72 try:
73 params['publishedDate'] = datetime.strptime(extract_text(stats[4]), '%b %d, %Y')
74 except ValueError:
75 pass
76
77 results.append(params)
78
79 return results

Variable Documentation

◆ about

dict searx.engines.solidtorrents.about
Initial value:
1= {
2 "website": 'https://www.solidtorrents.to/',
3 "wikidata_id": None,
4 "official_api_documentation": None,
5 "use_official_api": False,
6 "require_api_key": False,
7 "results": 'HTML',
8}

Definition at line 19 of file solidtorrents.py.

◆ base_url

str searx.engines.solidtorrents.base_url = 'https://solidtorrents.to'

Definition at line 32 of file solidtorrents.py.

◆ categories

list searx.engines.solidtorrents.categories = ['files']

Definition at line 28 of file solidtorrents.py.

◆ paging

bool searx.engines.solidtorrents.paging = True

Definition at line 29 of file solidtorrents.py.