From bc2b7efdd97466e38a265ab80dff5bec4ad74d19 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Thu, 25 Jul 2024 23:12:38 +0300 Subject: [PATCH] compressed request for speed up --- funkwlplay.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/funkwlplay.py b/funkwlplay.py index 4dd44d9..1570165 100755 --- a/funkwlplay.py +++ b/funkwlplay.py @@ -34,7 +34,7 @@ def create_playlist_file(track_list): def filter_tracks(tracks): def remove_unreach_tracks(track): 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() return 1 except: @@ -74,8 +74,9 @@ def filter_tracks(tracks): 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, - 'local': True, 'playable': True, - 'ordering': 'random'}, timeout=10) + 'local': True, 'playable': True, + 'ordering': 'random', 'scope': 'all'}, + timeout=10, headers={'Content-Encoding': 'gzip'}) r.raise_for_status() tracks = r.json()