Fixed torrent search URLs
This commit is contained in:
parent
d2f4ec44c3
commit
5ed4b10de3
1 changed files with 10 additions and 5 deletions
|
@ -26,7 +26,12 @@ class TorrentPlugin(Plugin):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
default_torrent_ports = [6881, 6891]
|
default_torrent_ports = [6881, 6891]
|
||||||
supported_categories = ['movies', 'tv', 'anime']
|
supported_categories = {
|
||||||
|
'movies': 'https://movies-v2.api-fetch.website/movies/1',
|
||||||
|
'tv': 'https://tv-v2.api-fetch.website/tv/1',
|
||||||
|
'anime': 'https://anime.api-fetch.website/anime/1',
|
||||||
|
}
|
||||||
|
|
||||||
torrent_state = {}
|
torrent_state = {}
|
||||||
transfers = {}
|
transfers = {}
|
||||||
|
|
||||||
|
@ -50,7 +55,7 @@ class TorrentPlugin(Plugin):
|
||||||
def _search_all(self, query, *args, **kwargs):
|
def _search_all(self, query, *args, **kwargs):
|
||||||
results = {
|
results = {
|
||||||
category: []
|
category: []
|
||||||
for category in self.supported_categories
|
for category in self.supported_categories.keys()
|
||||||
}
|
}
|
||||||
|
|
||||||
def worker(category):
|
def worker(category):
|
||||||
|
@ -58,7 +63,7 @@ class TorrentPlugin(Plugin):
|
||||||
|
|
||||||
workers = [
|
workers = [
|
||||||
threading.Thread(target=worker, kwargs={'category': category})
|
threading.Thread(target=worker, kwargs={'category': category})
|
||||||
for category in self.supported_categories
|
for category in self.supported_categories.keys()
|
||||||
]
|
]
|
||||||
|
|
||||||
for worker in workers:
|
for worker in workers:
|
||||||
|
@ -93,12 +98,12 @@ class TorrentPlugin(Plugin):
|
||||||
|
|
||||||
if category not in self.supported_categories:
|
if category not in self.supported_categories:
|
||||||
raise RuntimeError('Unsupported category {}. Supported category: {}'.
|
raise RuntimeError('Unsupported category {}. Supported category: {}'.
|
||||||
format(category, self.supported_categories))
|
format(category, self.supported_categories.keys()))
|
||||||
|
|
||||||
self.logger.info('Searching {} torrents for "{}"'.format(category, query))
|
self.logger.info('Searching {} torrents for "{}"'.format(category, query))
|
||||||
url = 'https://{category}-v2.api-fetch.website/{category}/1'.format(category=category)
|
url = 'https://{category}-v2.api-fetch.website/{category}/1'.format(category=category)
|
||||||
request = urllib.request.urlopen(urllib.request.Request(
|
request = urllib.request.urlopen(urllib.request.Request(
|
||||||
url + '?' + urllib.parse.urlencode({
|
self.supported_categories[category] + '?' + urllib.parse.urlencode({
|
||||||
'sort': 'relevance',
|
'sort': 'relevance',
|
||||||
'keywords': query,
|
'keywords': query,
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Reference in a new issue