From f701359f8c2ded3530fa161c3f28361f03834c3c Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Wed, 24 Jul 2024 09:34:06 +0300 Subject: [PATCH] prototype on python3 --- funkwlplay.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 funkwlplay.py diff --git a/funkwlplay.py b/funkwlplay.py new file mode 100644 index 0000000..75c94e4 --- /dev/null +++ b/funkwlplay.py @@ -0,0 +1,17 @@ +import requests +import concurrent.futures + +tracks_stor = [] +with open('instances') as instances: + instances = instances.read().split('\n') + + +def search_tracks_on_instance(instance, tag='', query=''): + tracks = requests.get(f'https://{instance}/api/v1/tracks', params={'tag': tag, 'q': query}).json() + return tracks + #filter_tracks(tracks) + +with concurrent.futures.ThreadPoolExecutor() as executor: # optimally defined number of threads + res = [executor.submit(search_tracks_on_instance, instance, '', '') for instance in instances] + concurrent.futures.wait(res) +