Retrieve videos from youtube playlist - ios

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"]

Related

How can i get first video thumbnail of playlist by API V3?

I am using google youtube API v3 to get playlist details by playlist id but in result it is showing second video thumbnail.
Do you have any idea How can i get first video thumbnail?
https://developers.google.com/youtube/v3/docs/playlists/list

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.

Search a video of a playlist in youtube API

I have this as a request for youtube api in displaying videos of a particular video playlist https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId='+playlist_id+'&key={My Key}
The Problem
How will I able to have a request that will search a video in that particular video playlist?
you can add the video id and have it return just that video.
videoId string
The videoId parameter specifies that the request should
return only the playlist items that contain the specified video.
If the question is how do I return only the "dog" videos in the playlist, the answer is you cant. There is no free text searching in playlistitems.list

YouTube API v3.0 recordingDetails from playlistItems

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.

Resources