I'm using mostly the video and search list resource types. I want to filter the results for video ads. I had hoped that ads would be a video category or there would be another identifier for video ads, but I haven't been able to find a way so far. Any ideas?
With my open-source YouTube operational API you have access to whether or not a given video is a paid promotion by fetching the isPaidPromotion boolean in the JSON file at https://yt.lemnoslife.com/videos?part=isPaidPromotion&id=VIDEO_ID
Here are examples of videos ids:
having paid promotion: Q6gtj1ynstU
not having paid promotion: PEorJqo2Qaw
Then you have to discover all YouTube videos, to do so except if you look for specific keywords etc, there is this difficult method which consists in getting an initial set of YouTube channels, fetching their videos, fetching the comments on each video, fetching the YouTube channels from the comments and so on.
Unfortunately (AFAIK), some of those ads videos are unlisted videos - see these (1 and 2) ads videos examples I extracted while watching a random YouTube video - this ads video is public, though.
While querying the data of one of these videos (i.e. uuh2wkRmodI) - see the example using the try-it feature in the API documentation - , I don't see any relevant information that points me this is an advertisement video - other than being an unlisted video.
Probably, you can consider its statistics - I found odd that a video has no likes, no favorites no comments AND has views:
"statistics": {
"viewCount": "32",
"likeCount": "0",
"favoriteCount": "0",
"commentCount": "0"
}
Since those are unlisted ads videos, those cannot be searched via the API. Quote:
If a video is uploaded as an unlisted video, the property value also
specifies the date and time that the video was uploaded. In this case,
anyone who knows the video's unique video ID can retrieve the video
metadata.
Unless you somehow manages to get the VIDEO_IDs of those ads appearing before a normal video starts, you cannot really search those videos neither by YouTube or its API.
My additional guess is also those ads videos are set by YouTube itself based (aside other settings) in the region (country) of the viewer and the owner of those ads videos pays to YouTube for embed their advertisements.
If you want to try it out, then, try to search for videos that came from channels of recognized product brands and get only their public and kind of short videos (I'm not talking abuot #shorts, but, videos with a duration of a half on a minute or less).
Additionally, take into account that some ads videos might be longer, so, in resume: you have to work with what is publicly available.
youtube api responses wrong video items of this kind of playlist:
https://www.youtube.com/playlist?list=OLAK5uy_lSUrVP8K-w63I5BQyJKXdoxZNkMvU1T6w
You guys can see the actual api response by this link
This is a video returned from the api:
https://www.youtube.com/watch?v=Vdq1DWaxrJ0
But it doesn't exists in the playlist above, moreover I can't play this video because The uploader has not made this video available in your country. It looks like a "special video" of YouTube Music, lets see it thumbnail: https://i.ytimg.com/vi/Fc3Mj63xmPo/maxresdefault.jpg
Anyone know what happened?
I am developing an iPhone app with the Youtube API. I am playing the video inline. Is there a way I can exclude from the youtube search video's that give the message "this video contains content from WMG." It is restricted from playback.
How do I upload a photo slideshow to Youtube using their API?
I could not find it here:
https://developers.google.com/youtube/2.0/developers_guide_protocol_uploading_videos
Looks like there is only API for regular video uploading.
update:
Photo slideshow is the second option for manual video upload. Here: http://www.youtube.com/my_videos_upload
You can attach several photos, add music from predefined list and modify video settings like title, description, etc. It will be converted by Youtube to video internally and published.
I want to show a video on my company website, but once the video is done, it previews other videos.
How can I stop YouTube from displaying additional videos?
The link addition is only good if I link people to the video...but if they go to the video on their own, they are still subject to the additional videos.
Add:
&rel=0
to your Youtube video URL. Example:
http://youtube.googleapis.com/v/3UBbKLjOK3A?autoplay=1&rel=0