Compare commits

...

2 Commits

Author SHA1 Message Date
localhost_frssoft 200deac9a6 tab 2024-07-25 23:23:32 +03:00
localhost_frssoft bc2b7efdd9 compressed request for speed up 2024-07-25 23:12:38 +03:00

View File

@ -34,7 +34,7 @@ def create_playlist_file(track_list):
def filter_tracks(tracks): def filter_tracks(tracks):
def remove_unreach_tracks(track): def remove_unreach_tracks(track):
try: try:
r = requests.head(track['listen_url'], timeout=2) r = requests.head(track['listen_url'], timeout=2, headers={'Content-Encoding': 'gzip'})
r.raise_for_status() r.raise_for_status()
return 1 return 1
except: except:
@ -74,8 +74,9 @@ 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):
r = 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) 'ordering': 'random', 'scope': 'all'},
timeout=10, headers={'Content-Encoding': 'gzip'})
r.raise_for_status() r.raise_for_status()
tracks = r.json() tracks = r.json()