Strange playlist item list responded from YouTube API v3 - youtube

youtube api responses wrong video items of this kind of playlist:
https://www.youtube.com/playlist?list=OLAK5uy_lSUrVP8K-w63I5BQyJKXdoxZNkMvU1T6w
You guys can see the actual api response by this link
This is a video returned from the api:
https://www.youtube.com/watch?v=Vdq1DWaxrJ0
But it doesn't exists in the playlist above, moreover I can't play this video because The uploader has not made this video available in your country. It looks like a "special video" of YouTube Music, lets see it thumbnail: https://i.ytimg.com/vi/Fc3Mj63xmPo/maxresdefault.jpg
Anyone know what happened?

Related

YouTube API: music information

I am trying to collect music data from YouTube videos. Some videos have a box that lists "Music in this video", including the song title and artist, shown below.
From the API documentation, I cannot figure out how to extract this music information. E.g. this page shows how to extract some information related to a YouTube video, but it does not include the music information.
Does anyone know about how to get the music information?

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 OEmbed service doesn't work well for video url with playlist and index query param

Recently, I tried to use OEmbed service to get iframe code for the video url with playlist query param, but OEmbed service us the iframe code which hasn't the same video as i asked.
Here is the video url with playlist query param:
https://www.youtube.com/watch?v=B2PhzzVwRM4&index=5&list=PLXtHYVsvn_b-7onG7XS6HN7v9XlVEFvJL
Here is YouTube OEmbed service url for getting iframe code of the video:
https://www.youtube.com/oembed?url=https%3a%2f%2fwww.youtube.com%2fwatch%3fv%3dB2PhzzVwRM4%26index%3d5%26list%3dPLXtHYVsvn_b-7onG7XS6HN7v9XlVEFvJL
But OEmbed service return me the iframe code which turn out not the same video as I ask.
Here is iframe code returned:
https://www.youtube.com/embed/videoseries?list=PLXtHYVsvn_b-7onG7XS6HN7v9XlVEFvJL is not the same video as https://www.youtube.com/watch?v=B2PhzzVwRM4&index=5&list=PLXtHYVsvn_b-7onG7XS6HN7v9XlVEFvJL
Could anyone help me to take a look how can I get the right video through YouTube OEmbed sevice?
You forgot to place the index number of the actual video from the playlist that is why you always end up calling the first video of the playlist.
Upon checking the actual playlist, there are 9 videos. Since the 5th video seems to be the one you are calling, you must include "index=4" since the numbering will start at 0 from the first video. Try the link below:
https://www.youtube.com/embed/videoseries?index=4&list=PLXtHYVsvn_b-7onG7XS6HN7v9XlVEFvJL
This link should return the actual video that you need.

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.

Resources