Posted: . At: 2:32 PM. This was 2 weeks ago. Post ID: 19579
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.



Sponsored.



How to web scrape YouTube and get information about a video easily.


YouTube is pretty friendly in terms of getting information about YouTube videos using the API, but you do not need to use the API if you just want to web-scrape information about a YouTube video from the YouTube channel`s RSS feed. This example below will return the most recent video on the YouTube channel and get information about this video easily.

(jcartwright@2403-4800-25af-b00--2) 192.168.1.5 ~  $ yt-dlp --skip-download --dump-single-json --no-check-certificate --restrict-filenames --ignore-no-formats-error --no-warnings https://www.youtube.com/feeds/videos.xml?channel_id=UCrB8o1tlLKRnPHlpSy3GBFg | jq -r '.fulltitle,.description,.format_note,.id,.resolution'
BAN South Park.
Regular Donations: https://streamelements.com/bhdonos/tip
Printer Donations: https://streamelements.com/bhdonos_special/tip
Website: https://www.BuddhismHotline.org/
Discord: https://discord.com/invite/vs44Yc3FZ8
1080p60+medium
Zh35id8k6h0
1920x1080

This should be very useful to someone who wants to use this in a script. So it is possible to scrape YouTube easily.

This version will get even more information.

(jcartwright@2403-4800-25af-b00--2) 192.168.1.5 ~  $ yt-dlp --skip-download --dump-single-json --no-check-certificate --restrict-filenames --ignore-no-formats-error --no-warnings https://www.youtube.com/feeds/videos.xml?channel_id=UCrB8o1tlLKRnPHlpSy3GBFg | jq -r '.fulltitle,.description,.format_note,.id,.resolution,.aspect_ratio,.original_url,.fps,.format'
BAN South Park.
Regular Donations: https://streamelements.com/bhdonos/tip
Printer Donations: https://streamelements.com/bhdonos_special/tip
Website: https://www.BuddhismHotline.org/
Discord: https://discord.com/invite/vs44Yc3FZ8
1080p60+medium
Zh35id8k6h0
1920x1080
1.78
https://www.youtube.com/feeds/videos.xml?channel_id=UCrB8o1tlLKRnPHlpSy3GBFg
60
299 - 1920x1080 (1080p60)+251 - audio only (medium)

The YouTube RSS feed is a most useful feature and I hope they do not get rid of it. They did have the new YouTube layout they rolled back that I never got to see, they keep trying new stuff and not just maintaining a good service. There were also the AdBlock pop-ups telling users to switch off the adblockers on YouTube, but they have given up on this for sure, all you had to do was update the uBlock filters and you were fine.

Here are some uBlock Origin filters to clean up the YouTube watch page and make it focus on the video.

1
2
3
4
5
6
7
8
9
10
11
! 2024-03-26 https://www.youtube.com
www.youtube.com##.yt-spec-button-shape-next--size-m.yt-spec-button-shape-next--mono.yt-spec-button-shape-next--filled.yt-spec-button-shape-next > yt-touch-feedback-shape > .yt-spec-touch-feedback-shape--touch-response-inverse.yt-spec-touch-feedback-shape > .yt-spec-touch-feedback-shape__fill
www.youtube.com##ytd-button-renderer.ytd-masthead.style-scope > yt-button-shape > .yt-spec-button-shape-next--icon-leading.yt-spec-button-shape-next--size-m.yt-spec-button-shape-next--call-to-action.yt-spec-button-shape-next--outline.yt-spec-button-shape-next > yt-touch-feedback-shape > .yt-spec-touch-feedback-shape--touch-response.yt-spec-touch-feedback-shape > .yt-spec-touch-feedback-shape__fill
 
! 2024-05-04 https://www.youtube.com
www.youtube.com###end > .ytd-masthead.style-scope
www.youtube.com###owner
www.youtube.com###menu > .ytd-watch-metadata.style-scope
www.youtube.com###bottom-row > .ytd-watch-metadata.style-scope.item
www.youtube.com##.ytd-metadata-row-container-renderer.style-scope > .ytd-rich-metadata-row-renderer.style-scope
www.youtube.com###header > .ytd-item-section-renderer.style-scope

This should be very nice for YouTube video watching.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.