Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anilibria APIv3 FIX #90

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions torrt/base_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ def get_response(

url = f'{url}{delim}{query_string}'

self.pick_mirror(url)
#self.pick_mirror(url)

url = self.get_mirrored_url(url)
#url = self.get_mirrored_url(url)

result = self.client.request(
url=url,
Expand Down
12 changes: 6 additions & 6 deletions torrt/trackers/anilibria.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
REGEX_RANGE = re.compile(r'\d+-\d+')

HOST: str = 'https://www.anilibria.tv'
API_URL: str = HOST + '/public/api/index.php'
API_URL: str ='https://api.anilibria.tv/v3/title'


class AnilibriaTracker(GenericPublicTracker):
Expand Down Expand Up @@ -85,7 +85,7 @@ def find_available_qualities(self, url: str) -> Dict[str, str]:
return {}

available_qualities = {}
torrents = json['data']['torrents']
torrents = json['torrents']['list']
series2torrents = defaultdict(list)
# a release can consist of several torrents:
# 1. episode ranges (different qualities),
Expand All @@ -94,8 +94,8 @@ def find_available_qualities(self, url: str) -> Dict[str, str]:
# 4. OVAs
# we are trying to recognize `1` and `2`.
for torrent in torrents:
if REGEX_RANGE.match(torrent['series']) or torrent['series'] == json['data']['series']:
series2torrents[torrent['series']].append(torrent)
if REGEX_RANGE.match(torrent['episodes']['string']) or torrent['episodes']['string'] ==
series2torrents[torrent['episodes']['string']].append(torrent)

# some releases can be broken into several .torrent files, e.g. 1-20 and 21-41 - take the last one
sorted_series = sorted(series2torrents.keys(), key=self.to_tuple, reverse=True)
Expand All @@ -104,7 +104,7 @@ def find_available_qualities(self, url: str) -> Dict[str, str]:
return {}

for torrent in series2torrents[sorted_series[0]]:
quality = self.sanitize_quality(torrent['quality'])
quality = self.sanitize_quality(torrent['quality']['string'])
available_qualities[quality] = HOST + torrent['url']

return available_qualities
Expand Down Expand Up @@ -162,7 +162,7 @@ def api_get_release_by_code(self, code: str) -> dict:
:param code: release code

"""
response = self.get_response(API_URL, {'query': 'release', 'code': code}, as_soup=False)
response = self.get_response(API_URL + '?code=' + code, as_soup=False)

if not response:
return {}
Expand Down
Loading