Is it possible to get the ID of the last uploaded video to the specific YouTube channel, based on channel name, eventually channel ID?
I need get a thumbnail from last video:
http://img.youtube.com/vi/<VIDEO-ID>/maxresdefault.jpg
In order to get this video id you can use the YouTube Data API
You can make a curl request to: https://www.googleapis.com/youtube/v3/search?key={your_key_here}&channelId={channel_id_here}&part=snippet,id&order=date&maxResults=1
This would return a JSON with a video id for the latest youtube video.
Related
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
I am trying to use youtube api to fetch the latest video uploaded in a channel and the query is as below
https://www.googleapis.com/youtube/v3/search?key={KEY}&channelId={CHANNEL-ID}&part=snippet&maxResults=1&order=date&type=video
But it is not returning the latest video uploaded in that channel. Adding or removing order attribute doesn't seem to work as it keeps returning the same video.
You have do to this by fetching playlist items. Get your channel id. It should look like this: UC######################. Now you have to replace the 'C' to 'U'. Like this: UU######################. You can call the youtube api with this id now.
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=UU######################&maxResults=5&key=[YOUR_API_KEY]
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}
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.
I am working in an android app which shows videos from a YouTube Channel.
I have the channel id and all other stuffs. But I need the video id to show the video in YouTube Player.
***eg. player.cueVideo("nCgQDjiotG0");***
When I go through the developer site again and again, I got this one -https://www.googleapis.com/youtube/v3/videos?part=id&chart=mostPopular&key={YOUR_API_KEY}
It is working perfectly returning the correct Video id to play. But I can't done it with my Channel id (There is no option for passing channel ID as parameter).
The only one url which accept the channel ID and returns snippet is this one -
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCxUtHtpGzd0bA5rYRY7h4VQ&q=PIVideoLibrary&type=channel&key={YOUR_API_KEY}
But the id it returning is not compatible with the above method. When I run it in the device it shows "Invalid Request" Here is screen shot which is the response of the above search request.
So this is my question.
How can we get video id of a video from a YouTube channel to show that
vedio in a youtube player integrated in the android app using YouTube
api v3
Thank You.
Ya I found it.
Go to youtube developer, https://developers.google.com/youtube/v3/docs/activities/list .
You can find a "TRY IT" field at middle of the page, fill the fields, you have to enter "contentDetails in the 'part' field to obtain video id. Then enter your channel id in the respective field. Execute the query, you can find the video id in the XML result.