Youtube get videos and playlist accounts - youtube

I'm creating a media house mock app and am wondering whether there is a way I can get video playlists from a certain account which is not mine for example if a user has a page that is http://www.youtube.com/someuser is it possible to get all the videos and playlist from that user?

You can use youtube video feeds(Youtube RSS Video Feeds)
Make following requests using GET and read the xml data returned.
http://gdata.youtube.com/feeds/api/users/{{username}}/playlists - For playlists
http://gdata.youtube.com/feeds/api/users/{{username}}/uploads - For uploads
Orderby parameter can be used to change order of videos.

Related

Get list of videos uploaded before and after certain video

Youtube use to have a feature where you could click a more videos button while watching any video, and see a snapshot of the uploads playlist with videos uploaded before and after the one you are currently watching.
I am trying to get a list like that with the v3 data API and it seems there is no way. There use to be a way to dictate an index when using the playlistItems call, but now there isn't.
If you go to a channels upload playlist and click play all, you can see a list of videos surrounding the one you are watching, so it seems this functionality is possible, but I don't know how they are doing it.
Any ideas?

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.

How to know if a video has been seen/hidden?

Using the YouTube Data API v3, is there a way to know if a video has been seen or hidden?
Reading through the docs, I didn't see anything on the Video resource that could match what I'm looking for.
Logically, “Watched” videos are just videos which have entries on your “Watch History” on Youtube.
You can get your “Watched” videos list through the API by getting your Watch History list from your channel. You can do that by using obtaining your Watch History ID which at the same time is also treated as playlistId.
Referring through the Channel API, make a GET HTTP request to
https://www.googleapis.com/youtube/v3/channels?part=contentDetails&mine=true&key={YOUR_API_KEY}
This should return a JSON which should contain an object with “watchHistory” key. The value paired with it is your playlistId which you can now use to make a request using the PlaylistItems API
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId={YOUR_WATCHED_PLAYLIST_ID}&key={YOUR_API_KEY}
This should return a list of videos that your account has already watched.
As for getting the list of “Hidden” videos on your subscription feed. I think it's not achievable through the API. Checked on different responses of subscription and video resources but to no avail. No responses containing "watched" or "hidden" related.

How to embed playlist in youtube API?

I know how to embed a youtube video with a playlist and it's all fine. Except I don't get events. I need to know when the video or playlist is over. I know how to use the youtube API to load in a video and get the stop event. I don't know how to get them both together.
Here is an example to test with https://www.youtube.com/watch?v=YlUKcNNmywk&list=PLE5FFF0C74122C403. I tried queue playlist and looking at the other commands. It appears I can create a playlist dynamically. I don't know how to get a list of videos in an already existing playlist. My goal is having someone drop in a video id + playlist id and find out when the video/playlist is over.

Youtube Data API - Search for video in a playlist

The YouTube API allows you to search for videos from a given channel by specifying the channel id - but is it possible to search for videos from a given playlist?
Currently I have set up using the API to get all videos from a chosen playlist
var request = 'https://www.googleapis.com/youtube/v3/playlistItems?key={{my_key}}&part=contentDetails,snippet&playlist_id={{playlist_id}}&maxResults=6';
But I cant seem to combine search - unless I get all items from the playlist and then do a search on my end. Which would be inefficient and use more of my daily allowance.

Resources