YouTube Data API v3 to check whether video id is a short
Asked Answered
T

2

8

It seems the YouTube Data API v3 is missing the functionality to check whether a video id is a short. Another way to check whether it is a short is by checking the response code of the following public url: https://www.youtube.com/shorts/:videoId (303 = regular video, 200 = short), but this could easily result in ratelimits and if used on a worker node like Cloudflare workers, Google will flag the request as suspicious.

Is there another way to check whether a video is a short?

Traceetracer answered 28/4, 2022 at 22:23 Comment(5)
Check this answer - video samples: k4Tgwk0H9q0, ouf0ozwnU84Latisha
@MarcoAurelioFernandezReyes Thanks for the reply! I did stumble upon that post, and looked at the code of their workaround, which is unfortunately the same as checking the URL I listed aboveTraceetracer
In that case, I suggest you to post a ticket on Issue TrackerLatisha
I went and added an issue to request official API support for this BTW.Toner
YT marked it "Won't fix (Infeasible)" - which I don't believe for a second.Shamanism
C
1

I was also looking for answers to this question and stumbled upon this post. Another workaround for the lack of direct API functionality would be to use duration from 'contentDetails.duration.' As of this comment, shorts are limited to 60 seconds and, if they are in the right format, they'll be converted to shorts automatically. Not pretty, but it should get the job done since the likelihood of someone uploading a video in the wrong format at that duration is pretty low.

EDIT Although it wasn't asked, you can also figure out if a video was live or not by calling the liveStreamingDetails part of the video's api.

Coptic answered 27/12, 2022 at 23:24 Comment(0)
B
1

youtube will sometimes add 1~2 seconds to the videos when calculating the length of the videos, so the 60 seconds + aspect ratio rule is not accurate to tell if the video is shorts. There are many 60 seconds videos are excluded by youtube as shorts, even if the creators intend them to be shorts.

Bigname answered 10/2, 2023 at 2:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.