Using Python to Organize YouTube

in #programming2 days ago

For a while now my YouTube premium account has been my go-to for all my procrastination.

Problem is I do more bookmarking than actual watching. My bad browser tab habits transformed into bad YouTube watch later habits.

This has made my playlists really chonky, especially because I regularly hit the maximum allowed videos in watch later.

That includes listening to music, which reminds me to look again at if I need a ~$40/mo Apple subscription.

Yeah, I pay for YouTube, even though there are often ways to get an ad-free experience (as much as that is possible on YT with all the sponsorships).

I realized half the time or more I save for later just because I am not sure if a video is worth my time or just clickbait.

Enter the power of Python and so-called AI tools!

This is a several step process in actuality, but on the most simple level I ...

  1. Pull in videos for a playlist.
  2. Summarize using Open AI API.
  3. Insert into a database.
  4. Remove from the playlist.
  5. List and view the summaries to see if I want to watch the video.

That last item is done using a web UI, the rest is command line stuff.

To make the summaries I am not doing anything clever with the video itself, I rely on most videos having an English transcript ready to grab. This is then put through open ai with a request to summarize as markdown.

image.png

Here is a summary of one example video.

Right now the db is sqlite but I will likely move to MySQL just so I am not uploading and downloading a big file to git and back all the time.

The web UI is using flask and at the moment it is bare bones, but now I have this foundation I will work on showing the YouTube thumbnail and other info, with a link to watch, or a button to delete from the db.

Let me know if you are interested in any of the code!