Cap video list to 15

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

@ -40,9 +40,9 @@ async def get_video_list(session, channel_id):
if resp.status != 200:
logging.error('Invidious instance %s returned %s', i, str(resp.status))
continue
return list(map(lambda i: i['videoId'], await resp.json()))
return list(map(lambda i: i['videoId'], await resp.json()))[:15]
except BaseException:
logging.exception('Invidious instance %s raised exception', i)
async with session.get(f'https://www.youtube.com/feeds/videos.xml?channel_id={channel_id}&a={time.time()}', headers={'Cache-Control': 'no-store, max-age=0'}) as resp:
d = feedparser.parse(await resp.text())
return list(map(lambda i: i['yt_videoid'], d['entries']))
return list(map(lambda i: i['yt_videoid'], d['entries']))[:15]

Loading…
Cancel
Save