Getting videos from a playlist - php

Is there a way to get a listing of videos from a specific playlist? I tried the following call, but it doesn't seem to be giving me a list of videos in that playlist
feed://gdata.youtube.com/feeds/users/USERNAME/playlists/PLAYLIST_ID
I want get all the playlists video url and name ...
Thanks in advance,

This is available in the JavaScript API:
player.getPlaylist():Array
This function returns an array of the video IDs in the playlist as
they are currently ordered. By default, this function will return
video IDs in the order designated by the playlist owner. However, if
you have called the setShuffle function to shuffle the playlist order,
then the getPlaylist() function's return value will reflect the
shuffled order.

That's v2 of the API that was deprecated over a year ago. You need to use v3.
Start here: https://developers.google.com/youtube/v3/docs/playlistItems/list

Related

eBay API - retrieve image by specific URL

I would like to ask you. How to retrieve image by the specific URL (that I already have)? I found a lots of articles about how to retrieve images and items by some keywords etc. but I don't need that search.
I tried to make a crawler to get the image, but it's impossible until I don't use the ebay API (the url to image is hidden).
Is it possible to retrieve images even if I don't want to use ebay AppID, so just somehow crawl the page?
I am not sure what solutions I can get, but I need to use it with PHP
Without API you can just use
http://i.ebayimg.com/images/i/1234567890123-0-1/s-l250/p.jpg
http://i.ebayimg.com/images/i/[EbayId]-0-1/s-l[width]/p.jpg
Here is an example of how to get the pictures via the API, just replace your appid and the item id you want (the pictures are in Item->PictureURL):
http://open.api.ebay.com/shopping?callname=GetSingleItem&responseencoding=JSON&appid=YOURAPPID&siteid=0&version=939&ItemID=ITEMID

Concerning the post picture size of facebook page/group feed by Graph Api

I am displaying feed/posts of facebook page/group via graph api in my site by calling this Url in php code -
https://graph.facebook.com/page_id/feed?access_token=token_value
Then, Among many type of posts, for a post of picture type i get picture url as
http://photos-g.ak.fbcdn.net/hphotos-ak-frc3/t1.0-0/1972372_10152261154160659_883879121_s.jpg
Now it's the small size as the last part "_s.jpg" indicates.But i want all picture sizes be large.So to achieve this what parameters are needed to include in the graph api url - "https://graph.facebook.com/page_id/feed?access_token=token_value" so that all picture/video type of posts' picture will be in large size??, so is there will be "_b.jpg" at last as i presume.Is that possible in one graph api call?
I searched through the google but no luck, but ended up planning that i would replace the last part of the pic url above with "_b.jpg" so that url will be like -
http://photos-g.ak.fbcdn.net/hphotos-ak-frc3/t1.0-0/1972372_10152261154160659_883879121_b.jpg
But are there any drawbacks for this hack?? what are the correct ways to achieve if possible in one graph api call.
notice,
/page/feed?fields=attachments
this will give you all of the attachments in their full sizes. worked charms for me
You could use a FQL query to get the source info of the large versions of the photos use in a Page's feed:
SELECT pid, object_id, src_big, src_big_width, src_big_height FROM photo WHERE object_id in (SELECT attachment.media.photo.fbid FROM stream WHERE source_id={page_id} AND actor_id={page_id})
Not sure if that’s actually documented somewhere – but in Graph API Explorer, the “Search for a field” feature suggests a field called full_picture. A few quick tests suggest that for most feed items, it returns the original image that was used making the post, whether it was a picture uploaded with the post, a video thumbnail or whatever.
You can use it in your feed calls like this:
/{user-or-page-id}/feed?fields=full_picture,message,type,…
Only fields you will get by default when using the fields parameter are id and created_time, everything else you might be interested in (message, type, from, etc.) you will have to ask for specifically as well.
That is for any type of feed item that might have a picture attached – expect for type:photo. For those, you get an object_id as well, and when you query that explicitly in a second request, you get an images data structure, that lists the different image sizes Facebook has on their CDN.
I have not found a wya to make it spit out that additional info within the original /foo/feed request in one go though – but if you collect all object_id that call delivers, you can use them in a second call like this to get the info for multiple objects at once:
/?ids=object_id1,object_id2,…&fields=images
with every feed there is a node name object-Id, use this id like this
graph.facebook.com/object-id/picture?type=large
if it shows question mark photo then use access_token=XXXXXX in query string.

YouTube Zend library get VideoId of playlist entry

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.

Play random youtube videos based on tags

Does anybody know a quick way for a script to play YouTube videos randomly by just entering in a tag from a web form? Trying to build it using PHP and JavaScript, wouldn't know where to begin using the YouTube API.
The setShuffle function instructs YouTube to play the videos in the playlist in random order (or to play them in their designated order.
player.setShuffle(shufflePlaylist:Boolean):Void
This function indicates whether a playlist's videos should be shuffled so that they play back in an order different from the one that the playlist creator designated. If you shuffle a playlist after it has already started playing, the list will be reordered while the video that is playing continues to play. The next video that plays will then be selected based on the reordered list.
 
This setting will not persist if you load or cue a different playlist, which means that if you load a playlist, call the setShuffle function, and then load a second playlist, the second playlist will not be shuffled.
 
The required shufflePlaylist parameter indicates whether YouTube should shuffle the playlist.
 
If the parameter value is true, then YouTube will shuffle the playlist order. If you instruct the function to shuffle a playlist that has already been shuffled, YouTube will shuffle the order again.
 
If the parameter value is false, then YouTube will change the playlist order back to its original order.
click here to learn how to use YouTube JavaScript Player API Reference

youtube xml feed for single playlist

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.

Categories