Add entertainment category and fix incorrect variable name.

Signed-off-by: Abdulkadir Furkan Şanlı <me@abdulocra.cy>
This commit is contained in:
Abdulkadir Furkan Şanlı 2024-01-23 18:53:53 +01:00
parent 734362014c
commit ad13e5d69f
Signed by: afk
SSH Key Fingerprint: SHA256:s1hULLl4YWdqU501MUfGe1CAG/m1pf9Cs6vFsqeTNHk

View File

@ -177,7 +177,10 @@ def is_music(youtube, video_id):
video_details = youtube.videos().list(id=video_id, part="snippet").execute() video_details = youtube.videos().list(id=video_id, part="snippet").execute()
# Check if the video category is Music (typically category ID 10) # Check if the video category is Music (typically category ID 10)
return video_details["items"][0]["snippet"]["categoryId"] == "10" return video_details["items"][0]["snippet"]["categoryId"] in (
"10",
"24",
) # music, entertainment
async def message_callback(client, room, event): async def message_callback(client, room, event):
@ -227,8 +230,7 @@ async def message_callback(client, room, event):
}, },
) )
else: else:
print(f"Failed to upload image. Failure response: {resp}") print(f"Failed to upload image. Failure response: {response}")
if body == "!pow" and current_time - timestamp_sec < datetime.timedelta( if body == "!pow" and current_time - timestamp_sec < datetime.timedelta(
seconds=30 seconds=30