raise for status in search

This commit is contained in:
localhost_frssoft 2024-07-25 14:38:57 +03:00
parent e3d523758d
commit 92a52dd2b8

View File

@ -76,9 +76,12 @@ def filter_tracks(tracks):
def search_tracks_on_instance(instance, tag='', query='', recursion=args.recursion):
tracks = requests.get(f'https://{instance}/api/v1/tracks', params={'tag': tag, 'q': query,
r = requests.get(f'https://{instance}/api/v1/tracks', params={'tag': tag, 'q': query,
'local': True, 'playable': True,
'ordering': 'random'}, timeout=10).json()
'ordering': 'random'}, timeout=10)
r.raise_for_status()
tracks = r.json()
count = tracks['count']
print(f'found {count} tracks on {instance}')
if recursion == 1: