Shuffle invidious instances

master
blank X 1 year ago
parent a6e3f7dda3
commit de500788ca
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
  1. 5
      autoytarchive/utils.py

@ -1,5 +1,6 @@
import time
import json
import random
import logging
import feedparser
from io import BytesIO
@ -31,7 +32,9 @@ async def update_seen_videos():
await client.edit_message(config['config']['storage_chat_id'], config['config']['storage_message_id'], file=file)
async def get_video_list(session, channel_id):
for i in config['config'].get('invidious_instances', []):
invidious_instances = config['config'].get('invidious_instances', [])
random.shuffle(invidious_instances)
for i in invidious_instances:
try:
async with session.get(f'{i}/api/v1/channels/{channel_id}/latest?fields=videoId&a={time.time()}', headers={'Cache-Control': 'no-store, max-age=0'}) as resp:
if resp.status != 200:

Loading…
Cancel
Save