Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add latest YouTube video block to home page #137

Open
geerlingguy opened this issue Dec 22, 2021 · 8 comments
Open

Add latest YouTube video block to home page #137

geerlingguy opened this issue Dec 22, 2021 · 8 comments
Labels
enhancement New feature or request planned

Comments

@geerlingguy
Copy link
Owner

I'd like to have a custom block which displays a video thumbnail, then title, then date, for the three most recent YouTube videos on my channel. There's gotta be some simple API I could use to get this to automatically pull in. Set a cache on the block so it generates once every hour or so, and bob's your uncle!

@TechStudent10
Copy link

Not sure if this is too late but I found this on Stack Overflow; https://stackoverflow.com/a/23253789

All that's left is getting the latest video ID.

@minecraftchest1
Copy link

minecraftchest1 commented Feb 12, 2022

This script gets the video ID and name using yt-dlp if you are intersted. That would allow you to link directly to the video if you want. yt-dlp spits out other information that could be useful. Then the only thing would be figuring how to update the homepage with that info.

yt-dlp --playlist-items 1 --skip-download --dump-json  'https://www.youtube.com/c/JeffGeerling' | jq '.id, .title'

Some other fields that might be useful

"webpage_url",
"upload_date",
"view_count".
"categories[]",
"categories[]",
"like_count",
"fulltitle",
"width",
"height",
"resolution",
"thumbnail",
"description",

@TechStudent10
Copy link

This script gets the video ID and name using yt-dlp if you are intersted. That would allow you to link directly to the video if you want. yt-dlp spits out other information that could be useful. Then the only thing would be figuring how to update the homepage with that info.

yt-dlp --playlist-items 1 --skip-download --dump-json  'https://www.youtube.com/c/JeffGeerling' | jq '.id, .title'

Some other fields that might be useful

"webpage_url",
"upload_date",
"view_count".
"categories[]",
"categories[]",
"like_count",
"fulltitle",
"width",
"height",
"resolution",
"thumbnail",
"description",

Isn't that a CLI tool?

@minecraftchest1
Copy link

minecraftchest1 commented Feb 12, 2022 via email

@TechStudent10
Copy link

Yes.

And this is a website

@minecraftchest1
Copy link

Yes it is a command line tool. Yes, we are talking about content on a website. However, this website we are talking about has a way to update content through some sort of API. I imagine it would not be hard to have a script run the command out of a cron job and update the page using curl. If not, a plugin could likely also be written to run the command on the server. There is also the possibility of using an iframe or something similar to embed a page that shows the video or other info using a page rendered using CGI, go webapp, python webapp, nodejs webapp, etc. The Json output could also be saved to a file accessable to the public updated by a cron job and accessed by a plugin or via client side javascript.

@TechStudent10
Copy link

TechStudent10 commented Feb 12, 2022

Yes it is a command line tool. Yes, we are talking about content on a website. However, this website we are talking about has a way to update content through some sort of API. I imagine it would not be hard to have a script run the command out of a cron job and update the page using curl. If not, a plugin could likely also be written to run the command on the server. There is also the possibility of using an iframe or something similar to embed a page that shows the video or other info using a page rendered using CGI, go webapp, python webapp, nodejs webapp, etc. The Json output could also be saved to a file accessable to the public updated by a cron job and accessed by a plugin or via client side javascript.

Yeah, I guess that works

@TechStudent10

This comment was marked as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request planned
Projects
None yet
Development

No branches or pull requests

3 participants