sharatsachin / ytplaylist-len

A small web app to get the lengths of playlists on YouTube
https://ytplaylist-len.sharats.dev/
740 stars 114 forks source link

Error handling for 'Upcoming' videos in playlists #38

Closed DavidUllauri closed 4 weeks ago

DavidUllauri commented 2 months ago

When trying to find the length of a playlist that contains an 'Upcoming' video, the site returns a status 500 Internal Server Error.

This occurs because duration in contentDetails is undefined for 'Upcoming' videos.

sanketkamta commented 1 month ago

Can you provide me with a link?

sharatsachin commented 4 weeks ago

@DavidUllauri Please check if this is fixed as per the latest deployment.

DavidUllauri commented 3 weeks ago

Thank you for addressing the issue! I've tested it again, and while the error is now handled more gracefully with the error message Error: 'Video' object has no attribute 'duration', the playlist length is still not returned when it contains an 'Upcoming' video. It would be great if the playlist length could be calculated while excluding upcoming videos.

This is the link I used for testing: https://youtube.com/playlist?list=PLD_vBJjpCwJvP9F9CeDRiLs08a3ldTpW5&si=-8bwNRud1niknuxm

sharatsachin commented 2 weeks ago

I see, thanks for giving me the example link. It should be fixed now; the Upcoming video is excluded now.