Browse Source

Log the video and title

main
fluffy 5 months ago
parent
commit
42aa13cbd4
2 changed files with 5 additions and 3 deletions
  1. +4
    -2
      beatbot.py
  2. +1
    -1
      youtube.py

+ 4
- 2
beatbot.py View File

@@ -56,14 +56,16 @@ def bot():
random.shuffle(video_ids)

# try to find a random video we haven't used before
for vid in video_ids:
for (vid, title) in video_ids:
if vid not in seen_vids:
yt_id = vid
LOGGER.info("Using [https://youtube.com/watch?v=%s] - %s", yt_id, title)
break

if not yt_id and video_ids:
# nothing new, so just select a random one (list is already shuffled)
yt_id = video_ids[0]
(yt_id, title) = video_ids[0]
LOGGER.info("Reusing [https://youtube.com/watch?v=%s] - %s", yt_id, title)

if yt_id:
text += f'\n\nhttps://youtube.com/watch?v={yt_id}'


+ 1
- 1
youtube.py View File

@@ -27,7 +27,7 @@ def get_videos(query):
return []

wfilter = wordfilter.Wordfilter()
return [item["id"]["videoId"]
return [(item["id"]["videoId"], item['snippet'].get('title'))
for item in response['items']
if 'id' in item
and 'videoId' in item['id']


Loading…
Cancel
Save