thecodingtrain.com icon indicating copy to clipboard operation
thecodingtrain.com copied to clipboard

Auto update YT Descriptions using the YouTube API

Open dipamsen opened this issue 1 year ago • 4 comments

For now, this script only allows updating one video at a time, because of safety reasons, as well as the YouTube videos.update API has a high quota cost.

Obviously, this is untested code. (I have only tested the updateDescription function with a video on my channel.)

dipamsen avatar Jun 14 '24 07:06 dipamsen

Deploy Preview for codingtrain ready!

Name Link
Latest commit f733015b0df8f41f0a4f40c1364d73970ae770fa
Latest deploy log https://app.netlify.com/sites/codingtrain/deploys/674de10b29395b000932a03d
Deploy Preview https://deploy-preview-1621--codingtrain.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Jun 14 '24 07:06 netlify[bot]

Hi @dipamsen, super excited about this! How about we set up a "dummy" channel to test this out on before deploying it with the CT channel itself? We could maybe hardcode a single video ID and use that over and over again? Let me know, I can work on that!

shiffman avatar Jun 17 '24 20:06 shiffman

The current script is coded such that it only updates a single description at a time (to minimise damage), I think it can be directly tested on the actual channel on a obscure/non popular video, and in the worst case scenario where the description is lost, it can be manually restored via the generated description (yt-desc).

This way the entire workflow can be tested which involves getting the yt I'd of the video etc

dipamsen avatar Jun 17 '24 20:06 dipamsen

Apologies for the delay @dipamsen I hope to try this out soon! Thanks for your patience!

shiffman avatar Jul 03 '24 10:07 shiffman

@dipamsen Great job on this.

I had a thought earlier and wanted to share, feel free to dismiss!

The Coding Train channel has 1266 videos total (more than we have integrated in the site for sure). Since video.list() is cheap (1 quota unit) and you should be able to give it up to 50 ids per call, it would only cost up to 26 units to fetch the description of every single video.

From there, you could only offer to update the videos that have a different description than the one expected. Maybe you could even show a little diff between the two strings in the terminal before going through with the update?

See https://github.com/kpdecker/jsdiff

fturmel avatar Nov 17 '24 17:11 fturmel

I was finally able to get this to work! I updated a toxiclibs video (https://youtu.be/E67e0RX-7Ew) that had a "typo" noted in #1770. I'm going to merge PR now. It would be no small task, but what I would love is something along the lines of what @fturmel suggestions with even a local server spinning up a simple UI to see the list of videos, look at what changes, and select videos to be updated. This is not something i have a lot of time to work on now, but maybe we open an issue and tackle in the future?

shiffman avatar Dec 02 '24 17:12 shiffman