Filter YouTube Videos which can not be played on iphone device (yt:accessControl embed and syndicate) fields - iphone

I am using this api to fetch youtube videos
API that i am hitting is:
http://gdata.youtube.com/feeds/api/charts/movies/trending?v=2&paid-content=false&hl=en&alt=json&format=5
Can you please suggest some way so that i can send some parameters in this api that can filter the results on basis of yt:accsessControl embed and syndicate fields... so how to embed this fields in api to filter results
I have tried this :
http://gdata.youtube.com/feeds/api/charts/movies/trending?v=2&paid-content=false&hl=en&alt=json&format=5&embed='allowed'&syndicate='allowed'
This does not filter the video results.. so please suggest what should i do ?

format=5 effectively acts as a proxy to return only videos that are embeddable.
Similarly, you can use format=1 (which is one of the public RTSP streams) to return only videos that have syndication enabled, since only those videos will have that format available.
You can't combine the two to get back only videos that have both set, though. If you say format=1,5 you'll get back videos that have either set.

Related

Filter not working on SoundCloud tracks search

According to the SoundCloud API documentation I should be able to specify filter=streamable on a search against tracks and (presumably) only get replies that are streamable. It's not working.
https://api.soundcloud.com/tracks.json?q=diddy&filter=streamable&client_id=<CLIENT_ID>
That returns some results that aren't streamable. Filtering the results myself is not desirable because I'm trying to fetch pages of a certain size.

Live stream thumbnails from API v2 not valid half the time

Overall: I cannot get valid thumbnails for youtube live streams (about 40% to 50% of streams ' thumbnails I get back are invalid/404 - gray "no screenshot" image) when pulling from the API v2.
Details: Here is what I am using to grab the streams:
https://gdata.youtube.com/feeds/api/charts/live/events/live_now?v=2&alt=json&inline=true&max-results=20&start-index=1&fields=entry(published,updated,title,author(name),content(entry(media:group)))
Within "media$thumbnail" I am getting data (6 thumbnail items), and on half the entries it gives me the gray "no screenshot" icon for all 6 screenshots. The other half usually gives me back half valid thumbnails and half invalid. So I may get back the default images (high def and regulars), and it won't give me the numbered images (0.jpg, 1.jpg, 2.jpg, etc.).
I have tried using the only two variations of url that I know of:
http://i.ytimg.com/vi/[VID-ID]/default.jpg
http://img.youtube.com/vi/[VID-ID]/0.jpg
From the live stream site, there are no invalid thumbnails which to me would suggest that all live streams have a valid thumbnail, or does that mean that youtube does not show streams that do not have valid thumbnails? I also noticed that they switch quite a bit between using 1.jpg and default.jpg, is there a way though the api to tell which image is preferred?
Thanks for any help on this subject!
Jake
For anyone else that is having this problem with getting correct thumbnails for YouTube live streams. By calling the json API, I was able to get the actual thumbnails returned for my live stream. These are the same thumbnails used on YouTube's site. Apparently they use a different URI pattern for live streams:
https://i.ytimg.com/vi/{{YOUTUBE_ID}}/default_live.jpg
https://i.ytimg.com/vi/{{YOUTUBE_ID}}/mqdefault_live.jpg
https://i.ytimg.com/vi/{{YOUTUBE_ID}}/hqdefault_live.jpg
https://i.ytimg.com/vi/{{YOUTUBE_ID}}/sddefault_live.jpg
So it looks like you're seeing this with video ids that correspond to "Hangouts on Air", which are Google+ Hangouts that are broadcast live via YouTube. They use a different setup than normal scheduled YouTube Live events, and you can't, for instance, create a thumbnail in advance of the broadcast (since the live event is created on the fly).

How to stream music from echonest?

Now I am using enyo.js.
I want to stream music from echonest. Now i am able to get the ids of the songs.
I want to stream the music.
More than likely you can just use an HTML 5 tag for this. You'll need to investigate their API more fully to find out if there's another request you need to make once you have the ID, or if the ID is a URL to an audio file, just make an tag and set that as the source.

How to get facebook video's original size(width & height) and how to get fql.video src_hq?

I tried to use facebook fql.video get video from my Idol's wall, then, how to get the video's original size(width & height)?
And I noticed one field named src_hq in fql table, in its description: The URL to the source file for the high quality version of the video.
but when I tried it in the browser directly. it warning:
Authorization Required
This server could not verify that you are authorized to access the
document you requested. Either you supplied the wrong credentials
(e.g., bad password), or your browser doesn't understand how to supply
the credentials required.
So my another question is how to play video with the src_hq?
Thanks and regards.
This Facebook page is the best resource. Click on "Try this query" which outputs a sample fql query (note: doesn't use fbapp.Fql(query). Take note of the &access_token=..... appended to the query. The XML output contains: <object width="400" height="224" > that you can use.
src_hq is an access problem, not a playback issue. Can the normal video be viewed on your Facebook? Usually if a high quality video is available, there is a box for [HQ], see sample video.
Use field format from FQL table video to get video width/height:
An array of various video formats available with their embed_html code and resolution

Facebook Graph API: Getting the total number of posts

I've been using the Facebook Graph API to display user posts. When I get the initial "page" of posts, the resulting data object has a paging property object with a previous and next URL property. I was hoping to generate navigation links based on this available paging information. However, sometimes these URLs point to an empty set of data, so I obviously don't want to navigate the user to an empty page.
Is there a way to find the total count of objects in a collection so that better navigation can be derived? Is there any way to get smarter paging data?
Update:
Sorry if my post isn't clear. To illustrate, look at the data at https://graph.facebook.com/7901103/posts and its paging property URLs. Then follow those URLs to see the issue: empty pages of data.
Since it pages the datas with date-time base. You can't get the knowledge of whether if there are datas or not before you actually send the request to it. But you can preload the data from previous url to determine is it suitable to dispaly a previous link in your web page.
Why be dependent of Facebook?
Why don't you preload all data for a user and save into a database. Then you fetch the posts from db and show to user. This way you have all the control on how many posts there are and how to manage next and prev.
I was going to try to post this as a comment to your question, but I can't seem to do so...
I know that the Graph API returns JSON, and while I've never come across a way to have the total number of posts returned, depending on what technology you are using to process the response, you might be able to capture the size of the JSON array containing the posts.
For example, if I were using a java application I could use the libraries available at json.org (or Google GSON, or XStream with the JSON driver) to populate an object and then simply use the JSONArray.length() method to check for the number of posts returned.
see:
http://www.json.org/javadoc/org/json/JSONArray.html
It might seem like a bit of a simplistic solution, but might be the type of work around you require if you can't find a way to have Facebook return that data.
Can you specify what technology your application is based in?