I'm trying to determine if a video is uploaded as a "short" or a regular/long-form video via the v3 data API.
I'm checking out the video info via:
https://www.googleapis.com/youtube/v3/videos?key=[API_KEY]&id=[VIDEO_ID]&part=snippet
But nothing returned seems to indicate to me one way or the other.
By using the following appproach, you could determine whether a video is a #short video or not.
What you will need is:
The approach is as follows:
playlistItems.list
by passing the #shorts playlists1 in the playlistId
parameter.videoId
parameter the VIDEO_ID you want to test.This is an example:
CHANNEL_ID
, but after replacing the first two characters from the CHANNEL_ID - in this case, the UC
characters to UUSH
at the beginning - Notice the highlighted characters.07pPUAjEmzA
Request:
GET https://youtube.googleapis.com/youtube/v3/playlistItems?part=id,snippet,contentDetails&maxResults=10&playlistId=UUSHbqEsRhXQI5KWYVr8mSWWWw&videoId=07pPUAjEmzA&fields=items(contentDetails/videoId,id,snippet/title),kind,nextPageToken,pageInfo,prevPageToken,tokenPagination&key=[YOUR_API_KEY] HTTP/1.1
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json
Result:
{
"kind": "youtube#playlistItemListResponse",
"items": [
{
"id": "VVVTSGJxRXNSaFhRSTVLV1lWcjhtU1dXV3cuMDdwUFVBakVtekE",
"snippet": {
"title": "Batman in Blender for 1h and 30 min #blender #speedsculpt #speedsculpting #digitalart"
},
"contentDetails": {
"videoId": "07pPUAjEmzA"
}
}
],
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 10
}
}
The response confirms the said videoId 07pPUAjEmzA
is indeed a #shorts video.
You can try this request in the API explorer demo.
By changing the value of the videoId
parameter to LyvOV84kJmU
and making the request again, the response will be - empty:
{
"kind": "youtube#playlistItemListResponse",
"items": [],
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 10
}
}
In this case it means, the video, is NOT a #shorts video - despite the fact the video LyvOV84kJmU
is from the channel UCbqEsRhXQI5KWYVr8mSWWWw
.
1 all credits to the poster of the answer for his amazing discovery. I assume the Shorts
playlists is automatically created when the YouTube channel owner uploads a #short video - if you or anyone knows the real cause(s) for the generation of a playlist with only #shorts videos, please, let us know.
2 I've tested with auto-generated YouTube channels and it seems this does not work.