YQL AND YAHOO! APISSaurabh SahniYDN Developer, Hacker, EvangelistTwitter: @saurabhsahni
Hacking togethersystems in 24 hours islot of fun
Data manipulationHacks =           +          Data visualization
The web has lot of data around
ProgrammableWeb.Com – 3517 APIs
Yahoo! has openedup its data
http://developer.yahoo.com/everything.html
THE TROUBLE WITH DATA •  You need to find data API •  Get Access – Signup for key •  Find data endpoint •  Read docs to le...
To make data accesseasy on the web,Yahoo! created YQL
YQL turns webservices and data onthe web intodatabases.
select {what} from {where}    where {conditions}
You can select, filter,sort and limit
You can even insert,update and deletefrom it.
FINDING VIDEOS ABOUT BANGALORE SELECT * FROM youtube.search where query=bangalore
SELECTING PHOTOS OF HACKDAYSELECT * FROM flickr.photos.search wheretext="hackday"
INSERTING DATAINSERT INTO bitly.shorten (login, apiKey, longUrl)VALUES (ME, API_KEY, http://yahoo.com)
UPDATING DATA UPDATE social.profile.status SET status="Using YQL UPDATE” WHERE guid="NJFIDHVPVVISDX7UKED2WHU"
RETRIEVING MY CONTACTSSELECT * FROM social.contacts WHEREguid=me
ACCESSING PRIVATE DATA        http://query.yahooapis.com/v1/yqlUses OAuth 1.0 for authorizationOAuth is complicated – use ...
The easiest way to startwith YQL is to use theconsolehttp://developer.yahoo.com/yql/console
YQL: http://developer.yahoo.com/yql/console
URL STRUCTUREhttp://query.yahooapis.com/v1/yql?[params]http://query.yahooapis.com/v1/public/yql?[params]    Params    •  q...
LET’S SEE IT
QUERY EXAMPLESFind hackday tweets:SELECT * FROM twitter.search where q=hackday’Search Yahoo! Answers for resolved question...
QUERY EXAMPLESFind distance between Bangalore and Mumbai:select * from geo.distance where place1="bangalore" andplace2="mu...
QUERY EXAMPLESScrape news from Yahoo! Finance:select * from html where url="http://finance.yahoo.com/q?s=yhoo" and xpath=/...
Let’s findopenhackindiaphotos on flickr
MAKING REQUESTS: FLICKR URLS <photo farm="3"        id="5708163920"        isfamily="0"        isfriend="0"        ispubli...
MAKING REQUESTS: FLICKR URLS Photo URL	   http://farm{$farm}.static.flickr.com/{$server}/ {$id}_{$secret}.jpg Photo Page U...
https://github.com/saurabhsahni/Hacks/
Finding Recent Photos from flickr
Some YQL Hacks
ChromYQLip is achrome extension forpage scraping via YQLOpen	  Hack	  Bangalore	  2010	  Winner	  
http://bit.ly/chromeYQL
VIDEO CLIP
http://www.webmeme.in
WEBMEME.INFetch multiple feeds in different formats like atom, RSS andtransform them into consistent RSS formatSelect * fr...
YQL is open – youcan get your datatables in our system
All you need to do iswrite an XMLschema and put iton Github.
http://github.com/yql/yql-tables
Here is the craigslistsearch tablehttps://github.com/yql/yql-tables/tree/master/craigslist/craigslist.search.xml
USE INSTANTLY BY UPLOADING ON YOUR SITE   USE http://www.mysite.com/my_table.xml   AS mytable;   SELECT * FROM mytable   W...
You can even writeserver side javascriptto build a webserviceor augment one.h#p://developer.yahoo.com/yql/guide/yql-­‐exec...
There are lot ofthings you can dowith YQL.
Play yourselfhttp://developer.yahoo.com/yql/
RESOURCESAll Yahoo! APIs and Serviceshttp://developer.yahoo.com/everything.htmlYQL Documentationhttp://developer.yahoo.com...
ANY QUESTIONS?http://www.slideshare.net/saurabhsahni  Saurabh Sahni  Twitter: @saurabhsahni  Github: http://github.com/sau...
YQL & Yahoo! APIs - Open Hack India 2011
YQL & Yahoo! APIs - Open Hack India 2011
YQL & Yahoo! APIs - Open Hack India 2011
YQL & Yahoo! APIs - Open Hack India 2011
YQL & Yahoo! APIs - Open Hack India 2011
YQL & Yahoo! APIs - Open Hack India 2011
YQL & Yahoo! APIs - Open Hack India 2011
YQL & Yahoo! APIs - Open Hack India 2011
YQL & Yahoo! APIs - Open Hack India 2011
YQL & Yahoo! APIs - Open Hack India 2011
YQL & Yahoo! APIs - Open Hack India 2011
YQL & Yahoo! APIs - Open Hack India 2011
YQL & Yahoo! APIs - Open Hack India 2011
Upcoming SlideShare
Loading in...5
×

YQL & Yahoo! APIs - Open Hack India 2011

4,357

Published on

Introduction to YQL & Yahoo! APIs

Published in: Technology, Design
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,357
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
127
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide

YQL & Yahoo! APIs - Open Hack India 2011

  1. 1. YQL AND YAHOO! APISSaurabh SahniYDN Developer, Hacker, EvangelistTwitter: @saurabhsahni
  2. 2. Hacking togethersystems in 24 hours islot of fun
  3. 3. Data manipulationHacks = + Data visualization
  4. 4. The web has lot of data around
  5. 5. ProgrammableWeb.Com – 3517 APIs
  6. 6. Yahoo! has openedup its data
  7. 7. http://developer.yahoo.com/everything.html
  8. 8. THE TROUBLE WITH DATA •  You need to find data API •  Get Access – Signup for key •  Find data endpoint •  Read docs to learn what parameters you have •  Get data in obscure format •  Use data after converting and filtering •  More APIs you use, more is your annoyance
  9. 9. To make data accesseasy on the web,Yahoo! created YQL
  10. 10. YQL turns webservices and data onthe web intodatabases.
  11. 11. select {what} from {where} where {conditions}
  12. 12. You can select, filter,sort and limit
  13. 13. You can even insert,update and deletefrom it.
  14. 14. FINDING VIDEOS ABOUT BANGALORE SELECT * FROM youtube.search where query=bangalore
  15. 15. SELECTING PHOTOS OF HACKDAYSELECT * FROM flickr.photos.search wheretext="hackday"
  16. 16. INSERTING DATAINSERT INTO bitly.shorten (login, apiKey, longUrl)VALUES (ME, API_KEY, http://yahoo.com)
  17. 17. UPDATING DATA UPDATE social.profile.status SET status="Using YQL UPDATE” WHERE guid="NJFIDHVPVVISDX7UKED2WHU"
  18. 18. RETRIEVING MY CONTACTSSELECT * FROM social.contacts WHEREguid=me
  19. 19. ACCESSING PRIVATE DATA http://query.yahooapis.com/v1/yqlUses OAuth 1.0 for authorizationOAuth is complicated – use one of our SDKs athttps://github.com/yahoo
  20. 20. The easiest way to startwith YQL is to use theconsolehttp://developer.yahoo.com/yql/console
  21. 21. YQL: http://developer.yahoo.com/yql/console
  22. 22. URL STRUCTUREhttp://query.yahooapis.com/v1/yql?[params]http://query.yahooapis.com/v1/public/yql?[params] Params •  q = [ YQL QUERY ] •  format = [ XML / JSON ] •  diagnostics = [ true / false ] •  debug = [ true / false ] •  callback = [ function name ]
  23. 23. LET’S SEE IT
  24. 24. QUERY EXAMPLESFind hackday tweets:SELECT * FROM twitter.search where q=hackday’Search Yahoo! Answers for resolved questions about cars:select * from answers.search where query="cars" and type="resolved”Translate tweets into Hindi:select * from google.translate where q in (select text fromtwitter.search where q="hackday") and target=hi;Extract important terms from top stories on Yahoo! news:select * from search.termextract where context in (select descriptionfrom rss where url=http://rss.news.yahoo.com/rss/topstories)
  25. 25. QUERY EXAMPLESFind distance between Bangalore and Mumbai:select * from geo.distance where place1="bangalore" andplace2="mumbai”Get stock quotes for Yahoo!, Apple, Google & Microsoft in one query:select * from yahoo.finance.quotes where symbol in("YHOO","AAPL","GOOG","MSFT")Shorten a URL:insert into yahoo.y.ahoo.it (url, keysize) values (http://www.javarants.com, 5)Search apartments in criagslist:select * from craigslist.search where location="bangalore" andtype="apa" and query="indiranagar”
  26. 26. QUERY EXAMPLESScrape news from Yahoo! Finance:select * from html where url="http://finance.yahoo.com/q?s=yhoo" and xpath=//div[@id="yfi_headlines"]/div[2]/ul/li/a’Select, filter data from google spreadsheets:select * from csv where url="https://spreadsheets.google.com/pub?key=0ArYndzim-lbrdF8wc3A5QWl1ZGRpdkxRZk80SU9zUXc&output=csv"and col5 like Bangalore%’ ;
  27. 27. Let’s findopenhackindiaphotos on flickr
  28. 28. MAKING REQUESTS: FLICKR URLS <photo farm="3" id="5708163920" isfamily="0" isfriend="0" ispublic="1" owner="31832337@N04" secret="0075137487" server="2496" title="San Francisco"/>
  29. 29. MAKING REQUESTS: FLICKR URLS Photo URL   http://farm{$farm}.static.flickr.com/{$server}/ {$id}_{$secret}.jpg Photo Page URL   http://www.flickr.com/photos/{$owner}/{$id} Photo Owner Profile URL   http://www.flickr.com/photos/{$owner}
  30. 30. https://github.com/saurabhsahni/Hacks/
  31. 31. Finding Recent Photos from flickr
  32. 32. Some YQL Hacks
  33. 33. ChromYQLip is achrome extension forpage scraping via YQLOpen  Hack  Bangalore  2010  Winner  
  34. 34. http://bit.ly/chromeYQL
  35. 35. VIDEO CLIP
  36. 36. http://www.webmeme.in
  37. 37. WEBMEME.INFetch multiple feeds in different formats like atom, RSS andtransform them into consistent RSS formatSelect * from rss where url in (‘http://feeds.feedburner.com/pluggd’, ‘http://quatrainman.blogspot.com/atom.xml’, ‘…’)Filter news containing “india” from multiple feeds:select * from rss where url in (http://feeds.feedburner.com/TechCrunch, http://www.readwriteweb.com/rss.xml,http://gigaom.com/feed/) and description like %india%’
  38. 38. YQL is open – youcan get your datatables in our system
  39. 39. All you need to do iswrite an XMLschema and put iton Github.
  40. 40. http://github.com/yql/yql-tables
  41. 41. Here is the craigslistsearch tablehttps://github.com/yql/yql-tables/tree/master/craigslist/craigslist.search.xml
  42. 42. USE INSTANTLY BY UPLOADING ON YOUR SITE USE http://www.mysite.com/my_table.xml AS mytable; SELECT * FROM mytable WHERE user=saurabh
  43. 43. You can even writeserver side javascriptto build a webserviceor augment one.h#p://developer.yahoo.com/yql/guide/yql-­‐execute-­‐chapter.html  
  44. 44. There are lot ofthings you can dowith YQL.
  45. 45. Play yourselfhttp://developer.yahoo.com/yql/
  46. 46. RESOURCESAll Yahoo! APIs and Serviceshttp://developer.yahoo.com/everything.htmlYQL Documentationhttp://developer.yahoo.com/yqlYQL Consolehttp://developer.yahoo.com/yql/consoleYQL Github Account (Contribute Tables)http://github.com/yql/yql-tables
  47. 47. ANY QUESTIONS?http://www.slideshare.net/saurabhsahni Saurabh Sahni Twitter: @saurabhsahni Github: http://github.com/saurabhsahni Web: http://www.saurabhsahni.com
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×