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.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With