YouTube API v3.0 recordingDetails from playlistItems - youtube-api

I am looking to get recordingDetails from items in a playlist or from the videos in a channel. So far I have only found the /videos method to respond with recordingDetails.

From channels->list method, you should get uploads playlist
Then from playlists->list, you will get video Ids.
With that video ids, you can do videos->list to get recordingDetails.

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 Retrieve the Video ID from private videos within a public Playlist- YouTube API v3?

I need some help getting the video ID number and the video title ( the title would be "Private video") for all private videos within a public playlist. Specifically I'd need help editing my script below. This script used to be able to do that, but I fear something has changed with Youtube's API. I want to know if there is any way to get this information and fix my script.
My script is located here
Just a month ago my script (see above) was able to retrieve video ID numbers and video names of private videos when fetching playlistItems from a playlistid (of course the video titles were renamed "Private video" - but that is the info I wanted). Unfortunately now when I fetch the same playlistid from youtube it hides all this info. It acts as if there are no videos in the playlist when a playlist contains private videos. Here is a question asked last year, it shows you can pull the video ID numbers and names from a playlist that contained private videos. Retrieve Video IDs contained in a Playlist - YouTube API v3
Here is an example of a playlist I would want to fetch the video ID and video name from.
https://www.youtube.com/playlist?list=PLAg_-NsALZoOLfXbX7eGIzFsbG21XAvct
I haven't tried it but you can try PlaylistItems: list and Advanced Google Services
Returns a collection of playlist items that match the API request parameters. You can retrieve all of the playlist items in a specified playlist or retrieve one or more playlist items by their unique IDs.
AFAIK if you own the private/unlisted videos, you can get the videos using Youtube API v3. You can read these related SO questions - Using the YouTube API v3 to list all private videos, Google Youtube Data API: Private videos with API key and Google YouTube API (v3): how to access my unlisted/private videos from my server? that all discuss retrieving the ID as the owner of the videos.
This issue has been fixed. You now get the behavior you were used to.

Retrieve videos from youtube playlist

I am fetching all the videos from the youtube playlist. I am following the procedure given in this answer
Retrieve all videos from youtube playlist using youtube v3 API
I am able to fetched 50 videos of the playlist and to get the remaning result I am passing the url like that
#"https://www.googleapis.com/youtube/v3/playlistItems?pageToken=%# &part=snippet&playlistId=PL_aEw_4hMkBfAWoYqB6I0G1Oe0qtqcqwF&key={MY_API_KEY}",[jsonDict valueForKey:#"nextPageToken"]];
But I am getting url nil and doesn't getting any result.
How can I fetch other videos from youtube playlist??
You are doing right just replace this url with this
#"https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&pageToken=%#&playlistId=PL_aEw_4hMkBfAWoYqB6I0G1Oe0qtqcqwF&key={your_api_key}",[jsonDict valueForKey:#"nextPageToken"]

Get recommendation videos from youtube api

I need to get some recommended videos for loggined user from youtube api. I am using this request
GET GET https://www.googleapis.com/youtube/v3/activities?part=snippet&home=true&maxResults=50&key={YOUR_API_KEY}
But in response i receive only 4 videos and all the same in every request. So how do i get all recommended videos i want?
You should be able to get the videos from your subscribed channels with that request. You can also try chart=mostpopular for most popular videos.
More info:
http://apiblog.youtube.com/2013/09/what-to-watch-our-apis-can-help.html

Get videos from youtube api from channel

How can i get videos from the youtube channel with duration and views count?
I tried this request:
https://www.googleapis.com/youtube/v3/search?part=snippet%2Cid&channelId=UC4H3KiOO86uiw2fAoZy6NRA&key=YOUR_API_KEY
but response doesn't contains duration/views count. Any ideas? Thx.
That data is not available in the snippet field. Instead, make a second API call to the channels.list() with the video IDs and request the contentDetails and statistics fields in your response. You can find documentation on the video resource here.

Resources