Posts Tagged ‘XML


YQL Guide

This guide describes the Yahoo! Query Language (YQL) Web Service, which enables you to access Internet data with SQL-like commands. This guide is for software developers who are familiar with Web applications that call Web services to retrieve data in XML or JSON format. Experience with SQL, MySQL, or Yahoo! Pipes is helpful, but not required.


The web is your CMS

Source : http://24ways.org/2009/the-web-is-your-cms

Making it easier to access APIs

What we need is a way to abstract the pains of different data formats and authentication formats away from the developer — and this is the purpose of the Yahoo Query Language, or YQL for short.

Libraries like jQuery and YUI make it easy and reliable to use JavaScript in browsers (yes, even IE6) and YQL allows us to access web services and even the data embedded in web documents in a simple fashion – SQL style.

Select * from the web and filter it the way I want

YQL is a web service that takes a few inputs itself:

  • A query that tells it what to get, update or access
  • An output format – XML, JSON, JSON-P or JSON-P-X
  • A callback function (if you defined JSON-P or JSON-P-X)

You can try it out yourself – check out this link to get back Flickr photos for the search term ‘santa’ in XML format. The YQL query for this is

select * from flickr.photos.search where text="santa"

The easiest way to take your first steps with YQL is to look at the console. There you get sample queries, access to all the data sources available to you and you can easily put together complex queries. In this article, however, let’s use PHP to put together a web page that pulls in Flickr photos, blog posts, Videos from YouTube and latest bookmarks from Delicious.

Check out the demo and get the source code on GitHub.

Source : http://24ways.org/2009/the-web-is-your-cms

/* YouTube RSS */
$query = 'select description from rss(5) where   url="http://gdata.youtube.com/feeds/base/users/chrisheilmann/uploads?alt=rss&v=2&orderby=published&client=ytapi-youtube-profile";';
 
/* Flickr search by user id */
$query .= 'select farm,id,owner,secret,server,title from flickr.photos.search where user_id="11414938@N00";';
 
/* Delicious RSS */
$query .= 'select title,link from rss where url="http://feeds.delicious.com/v2/rss/codepo8?count=10";';
 
/* Blog RSS */
$query .= 'select title,link from rss where url="http://feeds.feedburner.com/wait-till-i/gwZf"';
 
/* The YQL web service root with JSON as the output */
$root = 'http://query.yahooapis.com/v1/public/yql?format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys';
 
/* Assemble the query */
$query = "select * from query.multi where queries='".$query."'";
$url = $root . '&q=' . urlencode($query);
1 pages

Home made artworks

MyBookReadR | The RSS Wall | Carousel slider | Fast web start | Try it :)
My latest sources and sheets :
Github sources | Personnal wiki | jsFiddle example | WebDev bookmark

RSS Code tooltips updates

  • An error has occurred; the feed is probably down. Try again later.

RSS Molokoloco's JS fiddles

Recent Comments