Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do I get youtube shorts from youtube api data v3

I want a way to get YouTube shorts for a specific channel from YouTube API. I looked every where and I couldn't find anything.

Currently I can get a playlist ID for all channel videos with this endpoint:

request = youtube.channels().list(
    part="contentDetails",
    id=id
)

I also tried these parameters:

request = youtube.channels().list(
    part="snippet,contentDetails,statistics,brandingSettings",
    id=id
)

So is there a way to get YouTube shorts from a specific channel from YouTube API or any other source if it's available.

like image 302
Computer Mind Avatar asked Sep 02 '25 14:09

Computer Mind


1 Answers

Looking at the playlist IDs that can be retrieved from the API's contentDetails.relatedPlaylists.uploads, we can see that the "UC" at the beginning of the channel ID is replaced with "UU".

The same format can be used by replacing "UC" at the beginning of the channel ID with "UUSH" to get a playlist of only short videos.

For example, a channel ID of "UCutJqz56653xV2wwSvut_hQ" will result in a playlist ID of "UUSHutJqz56653xV2wwSvut_hQ".

Also, other prefixes exist:

prefix contents
UULF Videos
UULP Popular videos
UULV Live streams
UUMF Members-only videos
UUMO Members-only contents (videos, short videos and live streams)
UUMS Members-only short videos
UUMV Members-only live streams
UUPS Popular short videos
UUPV Popular live streams
UUSH Short videos

However, this pattern was found by me by acquiring all playlists from "UUAA" to "UUZZ" and is not officially announced by YouTube.

This is a demo code using TypeScript to get the prefix. (Demo code)

like image 174
coco0419 Avatar answered Sep 05 '25 16:09

coco0419