Get Only Video and not cortos videos - youtube-api

Good morning
I am using the youtube api to get the latest videos from a channel, but I also get the short videos that are like instagram or tiktok reels, is there any way to not get these videos?
I leave the endoint I am using
https://www.googleapis.com/youtube/v3/search?channelId=${channel_id}&part=snippet,id&order=date&maxResults=${totalVideos}&key=${API_KEY_YOUTUBE}
Greetings and thank you

If you check the Search.list method you will notice that it does not have any way of limiting the data that is returned.
You will need to remove these locally.
It may be worth adding a feature request to the issue forumn

Related

Live events not showing in YouTube Data API v3

I'm sending a get request to a link like this:
https://www.googleapis.com/youtube/v3/search?part=snippet&channel_id=[MyChannelId]&type=video&eventType=live&key=[MyKey].
The purpose of it is to get the live events of a specific channel for which I provided its ID.
The problem is this does not work all the time.
When I go checking in YouTube, the channel is streaming, but I don't get any data through this link.
What are the possible mistakes that may cause this?
Or is it just a problem from their servers?
Is there an alternative reliable way?

How to pragmatically test that youtube video links is ok

Here is a link to video which does not work
https://www.youtube.com/watch?v=abEOkul6HEx
How I can programatically detect this ?
The scenario would be to monitor a list of youtube videos and detect if a single video was deleted or is no longer available
Any ideas ?
You can use following youtube v3 API GET request
https://www.googleapis.com/youtube/v3/videos?part=id&id={VIDEO_ID}&key={YOUR_API_KEY}
In the results check for pageInfo.totalResults attribute
Update
If you want to pass multiple video ids in one API, it also can. id={VIDEO_ID1},{VIDEO_ID2}. In this case you can't depend on pageInfo.totalResults you have to go through items[].id decide.

is there an alternate way to get video tags/keywords in youtube api

based on http://youtubecreator.blogspot.com/2012/08/tags-removed-from-video-watch-pages.html, youtube has made media:keywords element empty in youtube api as well.
However, it is important for my application to scan through the tags/keywords. Is there an alternate solution for me to get the tags/keywords for a video?
This blog post gives information relevant to developers: http://apiblog.youtube.com/2012/08/video-tags-just-for-uploaders.html
You can get the tags if you're authenticated as the owner of the video. Otherwise, no, it's not currently possible.

Youtube API: no way to get liked videos from user's activity feed

It's a known issue that Youtube API (v2) doesn't support liked videos - http://www.youtube.com/my_liked_videos (not http://www.youtube.com/my_favorites). The trick was to use events API for user's recent activity and filter out those with yt:rating.value = like. However, when I hit this endpoint https://gdata.youtube.com/feeds/api/users/default/events?inline=true (with proper authorization headers), I only get last 24 events and all of them are of 'X has uploded a video' type. Has anyone experienced this and figured out what is wrong?
You can get liked videos without much effort in v3 of the API. I don't think there's a workaround for this in v2.
In v3, make a channels.list(part=contentDetails) call to get the "likes" playlist id, and then do a playlistItems.list() call to get the contents of that playlist, i.e. the videos that have been liked.

Get info about a YouTube video

I'm looking to get the title and duration of a YouTube video and display it within my app. I want to do this dynamically since there will be several videos and they will change. I've looked for a URL that provides this information, but I've had no luck. Does anyone know a way to do this?
You need to use the Youtube API, details on how to do this for a single video are here:
https://developers.google.com/youtube/2.0/developers_guide_protocol_video_entries
Here's the URL to get the API data for Friday:
https://gdata.youtube.com/feeds/api/videos/kfVsfOSbJY0?v=2

Resources