How to get video status with id - youtube

I've been looking through the youtube API v3 all day and can't figure how to know if a video is still available querying the api with the video ID.

Try with the next endpoint: https://www.googleapis.com/youtube/v3/videos?part=status&id=saEjTy1pJHA&key={YOUR_API_KEY}

Related

YouTube API: why can't I see latest video for this channel?

The latest video for this channel shows up when viewed via the Youtube website:
https://www.youtube.com/user/stefbot/videos
(video ID a4pPLwAL_Qo)
However that video does not get returned when the channel is queried via the Youtube API. I retrieve the channel video list by making a call to channels, followed by a call to playlistItems e.g.:
https://www.googleapis.com/youtube/v3/channels?part=contentDetails&forUsername=stefbot&key=xxxxxxxxxxxxxxxxx
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=UUC3L8QaxqEGUiBC252GHy3w&key=xxxxxxxxxxxxxxxxxx
See playlist response JSON here
It has been more than 24hrs since this video was posted. Can someone explain why the API would not be returning the latest video for this channel?
Based from this support page, it can take a few days for uploaded videos to be reflected in YouTube search results, especially if you recently changed or removed your video. Also, you can use this reference and use Search: list to get the latest videos from user's uploads.
GET https://www.googleapis.com/youtube/v3/search?part=snippet&channelId={CHANNEL_ID}&maxResults=10&order=date&type=video&key={YOUR_API_KEY}

How to get list of live video broadcasts using youtube api v3

I'm having an hard time trying to figure out how I can get a list of videos that are live for a given channel. For instance for this channel:
https://www.youtube.com/channel/UC4R8DWoMoI7CAwX8_LjQHig
I can get the videos from the uploads playlist or any playlist without any issue. However, I can't figure out how to get a list of live broadcasts.
Many thanks in advance
Solved by using:
https://developers.google.com/youtube/v3/docs/search/list
There, you can filter by channelId and filter by live only if you add type=video and eventtype=live.
Thanks anyway

Youtube API -likes/views along with the time when it is liked/viewed for a video

Can we get the likes/views along with the time when it is liked/viewed of a particular youtube video using Youtube API
Data API won't give that information. You can only access number and person, not the time piece.

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.

How to get youTube broadcasted-video URL using youTube API?

Is it possible to get youTube broadcasted-video URL using youTube API?
As I realized, broadcasted video URL changes everytime broadcasting is restarted.
I want to get new URL programmatically, and show broadcast-video in iFrame in my website.
Are all these possible?
Actually the answer is very easy:
From Youtube Data API documentation I've found the method where I can fetch all videos by author:
https://gdata.youtube.com/feeds/api/videos?author=crystalspringllc
And there is a video URL I want.

Resources