mirror of
http://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-22 13:41:28 +00:00
18 lines
581 B
Python
18 lines
581 B
Python
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)
|
|
|