jeffgeerling-com icon indicating copy to clipboard operation
jeffgeerling-com copied to clipboard

Add latest YouTube video block to home page

Open geerlingguy opened this issue 3 years ago • 8 comments

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!

geerlingguy avatar Dec 22 '21 03:12 geerlingguy

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.

TechStudent10 avatar Feb 08 '22 02:02 TechStudent10

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",

minecraftchest1 avatar Feb 12 '22 19:02 minecraftchest1

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?

TechStudent10 avatar Feb 12 '22 20:02 TechStudent10

Yes.

Wyatt Jackson Matrix: @minecraftchest1:matrix.org Discord: Minecraftchest1#8670 Telegram: https://t.me/minecraftchest1 Mastodon: @@.*** Github: https://github.com/minecraftchest1 Gitlab: https://gitlab.com/minecraftchest1 Email: @.***

Sent from my T-Mobile 4G LTE Device

-------- Original message -------- From: TechStudent10 @.> Date: 2/12/22 2:25 PM (GMT-06:00) To: geerlingguy/jeffgeerling-com @.> Cc: Minecraftchest1 @.>, Comment @.> Subject: Re: [geerlingguy/jeffgeerling-com] Add latest YouTube video block to home page (Issue #137)

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?

— Reply to this email directly, view it on GitHubhttps://github.com/geerlingguy/jeffgeerling-com/issues/137#issuecomment-1037453034, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKIAII5BWKY3Z7I2FV5TRF3U226ZVANCNFSM5KRSFQPA. You are receiving this because you commented.Message ID: @.***>

minecraftchest1 avatar Feb 12 '22 20:02 minecraftchest1

Yes.

And this is a website

TechStudent10 avatar Feb 12 '22 20:02 TechStudent10

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.

minecraftchest1 avatar Feb 12 '22 21:02 minecraftchest1

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 avatar Feb 12 '22 21:02 TechStudent10

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 avatar Feb 12 '22 21:02 TechStudent10