Cap video list to 15
This commit is contained in:
parent
de500788ca
commit
b34f14a431
|
@ -40,9 +40,9 @@ async def get_video_list(session, channel_id):
|
||||||
if resp.status != 200:
|
if resp.status != 200:
|
||||||
logging.error('Invidious instance %s returned %s', i, str(resp.status))
|
logging.error('Invidious instance %s returned %s', i, str(resp.status))
|
||||||
continue
|
continue
|
||||||
return list(map(lambda i: i['videoId'], await resp.json()))
|
return list(map(lambda i: i['videoId'], await resp.json()))[:15]
|
||||||
except BaseException:
|
except BaseException:
|
||||||
logging.exception('Invidious instance %s raised exception', i)
|
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:
|
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())
|
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…
Reference in New Issue