mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-18 21:23:01 +00:00
raise for status in search
This commit is contained in:
parent
e3d523758d
commit
92a52dd2b8
@ -76,9 +76,12 @@ def filter_tracks(tracks):
|
|||||||
|
|
||||||
|
|
||||||
def search_tracks_on_instance(instance, tag='', query='', recursion=args.recursion):
|
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,
|
'local': True, 'playable': True,
|
||||||
'ordering': 'random'}, timeout=10).json()
|
'ordering': 'random'}, timeout=10)
|
||||||
|
r.raise_for_status()
|
||||||
|
tracks = r.json()
|
||||||
|
|
||||||
count = tracks['count']
|
count = tracks['count']
|
||||||
print(f'found {count} tracks on {instance}')
|
print(f'found {count} tracks on {instance}')
|
||||||
if recursion == 1:
|
if recursion == 1:
|
||||||
|
Loading…
Reference in New Issue
Block a user