Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Suggestions for a simple program to calculate the number of numbers and seconds in a

Curious as to the best way to grab the number of minutes and seconds in a Playlist on YouTube and add them all together and then print the output? Suggestions welcome .
honestly i always just did it in the browser console after loading the page with the playlist and making sure all video thumbnails loaded (no lazy loading)

then get the class name of the timer on each thumbnail, for each isntance of a timer thing, get the data (string) and split it into minutes and seconds
add all minutes together, add all seconds together
minutes += seconds / 60
seconds %= 60
then you get a minutes:seconds representation, or further simplify to hours if needed.

but there's probably a browser plugin somewhere out there that calculates total runtime of a youtube playlist.

as for python specifically, probably safer to just use their api instead of making arbitrary requests to the playlist page itself
(Jun 13, 2022 01:59 PM)Faith Connors Wrote:  honestly i always just did it in the browser console after loading the page with the playlist and making sure all video thumbnails loaded (no lazy loading)

then get the class name of the timer on each thumbnail, for each isntance of a timer thing, get the data (string) and split it into minutes and seconds
add all minutes together, add all seconds together
minutes += seconds / 60
seconds %= 60
then you get a minutes:seconds representation, or further simplify to hours if needed.

but there's probably a browser plugin somewhere out there that calculates total runtime of a youtube playlist.

as for python specifically, probably safer to just use their api instead of making arbitrary requests to the playlist page itself

Wound up doing it manually to get the answer now learning how to do it programmatically.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Java] by Nemo2478Aug 25, 2019 05:12 PM 8 483 Aug 25, 2019 05:12 PM
Last Post: Nemo2478
[C#] by sdhp442May 6, 2019 04:17 AM 2 155 May 6, 2019 04:17 AM
Last Post: sdhp442
[Java] by cryptobassboostFeb 7, 2019 05:28 PM 4 219 Feb 7, 2019 05:28 PM
Last Post: Caliban