Shuffle invidious instances

This commit is contained in:
blank X 2021-04-17 22:18:17 +07:00
parent 21e9cb2a0c
commit 46d841fa85
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 3 additions and 1 deletions

View File

@ -125,7 +125,9 @@ async def handle_video(video_id, video_title):
tmp_handled_videos.discard(video_id) tmp_handled_videos.discard(video_id)
async def get_video_list(session, channel_id): async def get_video_list(session, channel_id):
for i in invidious_instances: shuffled_instances = invidious_instances.copy()
random.shuffle(shuffled_instances)
for i in shuffled_instances:
try: try:
async with session.get(f'{i}/api/v1/channels/{channel_id}/latest?fields=title,videoId&a={time.time()}', headers={'Cache-Control': 'no-store, max-age=0'}) as resp: async with session.get(f'{i}/api/v1/channels/{channel_id}/latest?fields=title,videoId&a={time.time()}', headers={'Cache-Control': 'no-store, max-age=0'}) as resp:
if resp.status != 200: if resp.status != 200: