Perhaps I am missing something but how does one go about retrieving the xml feed of videos from a single YouTube playlist. I have tried all the ways listed on google and so on but they keep returning an invalid playlist if error even though the id is exactly the one in the youtube url that works on youtube.
Thanks
You can get listing of user's public playlists at:
http://gdata.youtube.com/feeds/api/users/username/playlists?alt=rss&v=2
And you can get xml data for an individual playlist by at:
http://gdata.youtube.com/feeds/api/playlists/AA8A0579E8329C7A?alt=rss&v=2
replace AA8A0579E8329C7A with the playlist-id you want.
Related
I could see that in the past, we could retrieve for example the most viewed Youtube videos using this link (http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed)
But I think that link no longer works.
So I don't know how to retrieve the most viewed, most liked Youtube videos, search for a video using keywords...
I tried to watch directly on "https://developers.google.com/youtube/v3/docs/videos" but without any success
So I found this link which allows to retrieve the info of the videos thanks to a Youtube api key and one or more search keywords
https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=10&order=relevance&q=KEYWORD&key=APIKEY
I've been searching for this a lot but have not found exactly what I'm looking for.
So, I have a page (index.php) which displays my YouTube channel's uploaded videos as thumbnails, and either displays them inline above the thumbnails, or as links that redirect to Youtube. What I'd like to do, is to get the video's ID (which is in the a href link) and post it to another page (video.php) that shows the full embedded video (of the ID in question), with title & description. Is this possible to do?
My site is loosely based on this: http://www.yvoschaap.com/youtube.html and I've tried Youmax, but like said, they only play videos inline. I want to pass the ID of a clicked video as a parameter to the video.php page.
Sorry if this is confusing, but I'm still quite new to programming :)
You can look into Youtube Data API.
The main link you will need to retreive a list of all Videos for a channel will be somewhat like:
https://www.googleapis.com/youtube/v3/search?key={your_key_here}&channelId={channel_id_here}&part=snippet,id&order=date&maxResults={number_of_videos_you_want}
It will recieve it's response in JSON Format containing information like your Video ID which you can pass as Parameter to your video.php page
I am using the Zend GData library to manage YouTube videos from within my application. The application gives the user the ability to choose to add the uploaded video to one of their pre-existing YouTube playlists if they desire. One problem is that if the video is subsequently deleted from within our application, it seems to leave an "orphaned" deleted video object within the playlist to which it was added.
I've been trying to figure out a way to have our application remove the video from any playlists before deleting it from YouTube but I am having difficulty figuring out how to determine if a particular YouTube video is contained within playlists.
I've written a function which loops through each entry in each playlist relevant to the logged in user and attempts to compare the video Id of the video in the playlist with a video Id that has been passed as an argument. However, I can't seem to get a value for the video Id for any of the videos in the playlists.
Here's the function:
function remove_video_from_playlists($yt,$hash){
$playlistListFeed = $yt->getPlaylistListFeed("default");
foreach ($playlistListFeed as $playlistListEntry) {
$playlistVideoFeed = $yt->getPlaylistVideoFeed($playlistListEntry->getPlaylistVideoFeedUrl());
foreach ($playlistVideoFeed as $playlistVideoEntry) {
//check to see if each video in the playlist matches the video we are trying to delete
if($playlistVideoEntry->getMediaGroup()->videoId == $hash){
$playlistVideoEntry->delete();
}
}
}
}
Any help would be appreciated. How do I get the underlying videoId of each video entry in the playlists?
I found the issue.
I needed to set the GData library version to version 2 on the $yt object
Used this:
$yt->setMajorProtocolVersion(2);
This made all the strange behavior disappear and the usage of $playlistVideoEntry->getMediaGroup()->getVideoId() worked as expected.
Have you tried doing
$playlistVideoEntry->getMediaGroup()->getVideoId();
Because from looking in the API, there seems to be such a function that should return exactly what you would need.
I've been working with a couple of API's before like Vimeo, Dribbble and Twitter. Now I am trying out YouTube's API. But the complexity of the API gets me lost.
I've been going through parts of it and reading up on a couple of tutorials but can't seem to find what I want.
They say something about zend_gdata but I don't understand what that has to do with YouTube's API and can't seem to get it work either.
This is what I want to accomplish:
Get video data for each video from [playlist] by [user]:
Video poster (big thumbnail)
Title
Description
Embed code (iframe probably)
I am using PHP and prefer an output in JSON.
Can you guys point me out where to start (tutorial, which API, ...) to accomplish this rather simple task?
EDIT
Example for Vimeo: http://vimeo.com/api/v2/channel/52750/videos.json
Which URL can I CURL for YouTube to get al videos in a specified playlist?
From Data API Protocol site:
As noted in the previous section, each entry in a user's playlists feed contains a tag that specifies the URL for retrieving the list of videos in the playlist. The following example shows the URL for retrieving a playlist as that URL appears in a playlists feed entry:
<content type='application/atom+xml' src='http://gdata.youtube.com/feeds/api/playlists/8BCDD04DE8F771B2?v=2'/>
So the url is something like this:
http://gdata.youtube.com/feeds/api/playlists/PLAYLISTID?v=2
Update
For JSON format, add &alt=json GET parameter at the end of the url:
http://gdata.youtube.com/feeds/api/playlists/PLAYLISTID?v=2&alt=json
I am using a bespoke JQuery/PHP script which parses a Flickr feed using SimpliePie and outputs an image gallery.
I have instructed my client to upload there images into their flickr account.
The images are showing but the feed seems to be limiting to 20 images, however, there are 40 images in the stream.
I have checked the API and there doesn't seem to be any paramaters to change this.
Has anyone come across this before, can anyone help me tweak the feed so that it pulls all the images in the photostream?
Here is the Flickr Stream and feed...
http://www.flickr.com/photos/44280289#N04/
http://api.flickr.com/services/feeds/photos_public.gne?id=44280289#N04&lang=en-us&format=rss_200
It appears that they do limit it to the initial 20 photos on flickr
http://www.flickr.com/help/website/
Why do I only see 20 items in RSS
feeds?
Flickr only shows the latest 20 items
in a feed. Because of this, the first
time you connect to a feed you will
only see the most recent items. But if
your RSS reader saves items (as most
do) you will see more than 20 as the
items build up over time.
But you could potentially use the flickr api, particularly http://www.flickr.com/services/api/flickr.photosets.getPhotos.html
Which allows you to get more (You will need to get an API key however)
Edit:
Though I have not personally used it I have read/heard good things about http://phpflickr.com/ which is a flickr api wrapper for php 4 and 5
Edit 2:
Unfortunately I can not comment on your comment but if you take a look at this link from the flickr code blog
http://code.flickr.com/blog/2008/08/25/api-responses-as-feeds/
Some API responses can been provided as feeds so you could try using "&format=feed-rss_200" not sure if it includes getPhotos yet though.
It seems like you want to use the photosets.getPhotos api call. It will give you a maximum of 500 photos.
Here is an example which gives you the url of the photo in url_o
http://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&extras=url_o&photoset_id=72157622766901612&api_key=[YOUR APIKEY HERE]
You need an api key to make it work.
You can also get the output as JSON directly by adding &format=json to the url.