YQL & Yahoo! Apis
-
Upload
jai-santhosh -
Category
Technology
-
view
3.000 -
download
4
description
Transcript of YQL & Yahoo! Apis
![Page 1: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/1.jpg)
Saurabh Sahni YDN Developer, Hacker, Evangelist
YQL & YAHOO! APIS
Jai SanthoshFrontend Engineer, Hacker
Yahoo!
![Page 2: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/2.jpg)
What We’re Going to Cover
• YQL Overview
• Making Queries and the Console Sandbox
• Demo
• Open Data Tables and Execute (Server-Side JavaScript)
• Final Lessons
![Page 3: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/3.jpg)
Hacks = Data manipulation
+Data visualization
![Page 4: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/4.jpg)
The web is a large pile of data!
![Page 5: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/5.jpg)
ProgrammableWeb.com – 4480 Apis
![Page 6: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/6.jpg)
Yahoo! has alsoopened up its data
![Page 7: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/7.jpg)
http://developer.yahoo.com/everything.html
![Page 8: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/8.jpg)
Trouble with Data
• 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
![Page 9: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/9.jpg)
To make data access easy on the web,
Yahoo! created YQL
![Page 10: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/10.jpg)
YQL turns web services and data on the web into
databases.
=
![Page 11: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/11.jpg)
select {what} from {where} where {conditions}
![Page 12: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/12.jpg)
You can select, filter, sort and limit data and you can
even insert, update and delete from it.
![Page 13: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/13.jpg)
YQL: http://developer.yahoo.com/yql/console
![Page 14: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/14.jpg)
Finding Videos about Bangalore
• SELECT * FROM youtube.search where query='bangalore'
![Page 15: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/15.jpg)
Selecting Photos of RHOK
• SELECT * FROM flickr.photos.search where text="rhok"
![Page 16: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/16.jpg)
Inserting data
INSERT INTO bitly.shorten (login, apiKey, longUrl)
VALUES ('ME', 'API_KEY', 'http://yahoo.com')
![Page 17: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/17.jpg)
updating data
UPDATE social.profile.status
SET status="Using YQL UPDATE”
WHERE guid="NJFIDHVPVVISDX7UKED2WHU"
![Page 18: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/18.jpg)
Accessing Private Data• http://query.yahooapis.com/v1/yql
Uses OAuth 1.0 for authorization
OAuth is complicated – use one of our SDKs at https://github.com/yahoo
![Page 19: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/19.jpg)
Retrieving my profile
• SELECT * FROM social.contacts WHERE guid=me
![Page 20: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/20.jpg)
Using the YQL Console makes it very easy to
use it.
![Page 21: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/21.jpg)
![Page 22: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/22.jpg)
![Page 23: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/23.jpg)
url structure• http://query.yahooapis.com/v1/yql?[params]• http://query.yahooapis.com/v1/public/yql?
[params] Paramsq = [ YQL QUERY ]format = [ XML / JSON ]diagnostics = [ true / false ]debug = [ true / false ]callback = [ function name ]
![Page 24: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/24.jpg)
Let’s See It
![Page 25: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/25.jpg)
Query Samples
• SELECT * FROM twitter.search where q='hackathon’ limit 5
• select * from answers.search where query="cars" and type="resolved"
• select * from google.translate where q="this is a test" and target="hi";
• select * from google.translate where q in (select text from twitter.search where q="hackday") and target='hi';
• select * from search.termextract where context in (select description from rss where url='http://rss.news.yahoo.com/rss/topstories')
![Page 26: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/26.jpg)
Query Samples• select * from yahoo.finance.quotes where symbol in
("YHOO","AAPL","GOOG","MSFT")
• insert into yahoo.shortener (url, keysize) values ('http://www.javarants.com', 5)
• select * from craigslist.search where location="bangalore" and type="apa" and query="indiranagar”
• select * from html where url="http://finance.yahoo.com/q?s=yhoo" and xpath='//div[@id="yfi_headlines"]/div[2]/ul/li/a’
![Page 27: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/27.jpg)
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"/>
![Page 28: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/28.jpg)
Making Requests: Flickr URLs
http://farm{$farm}.static.flickr.com/{$server}/{$id}_{$secret}.jpg
Photo URL
http://www.flickr.com/photos/{$owner}/{$id}
Photo Page URL
http://www.flickr.com/photos/{$owner}
Photo Owner Profile URL
![Page 29: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/29.jpg)
YQL is open – you can get your data tables in our system
![Page 30: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/30.jpg)
Craigslist data table<table> <meta> <author>Yahoo! Inc.</author> <documentationURL>http://craigslist.org/</documentationURL> <sampleQuery> select * from {table} where location="sfbay" and type="sss" and query=“bike”
</sampleQuery> </meta> <bindings> … </bindings></table>
![Page 31: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/31.jpg)
Craigslist data table<table> <meta> … </meta> <bindings> <select itemPath="" produces="XML"> <urls> <url>http://{location}.craigslist.org/search/{type}?format=rss</url> </urls> <inputs> <key id="location" type="xs:string" paramType="path" required="true"/> <key id="type" type="xs:string" paramType="path" required="true"/> <key id="query" type="xs:string" paramType="query" required="true"/> </inputs> </select> </bindings></table>
![Page 32: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/32.jpg)
Upload XML to our Githubhttp://github.com/yql/yql-tables
![Page 33: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/33.jpg)
Or to your own Site
• The USE clause
USE 'http://www.mysite.com/my_table.xml' AS mytable;
SELECT * FROM mytableWHERE user='john_doe'
![Page 34: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/34.jpg)
You can even write server side javascript to build a webservice
![Page 35: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/35.jpg)
Final Lessons
• YQL is a skeleton key for all Yahoo! APIs
• Open data tables allow you to create new data feeds out of one or many different raw sources
• There are 1200+ Tables in YQL covering all major APIs on the web
• Use SDKs when accessing private data that requires OAuth
![Page 36: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/36.jpg)
Final Lessons: Links• All Yahoo! APIs and Services• http://developer.yahoo.com/everything.html
• YQL Documentation• http://developer.yahoo.com/yql• YQL Console• http://developer.yahoo.com/yql/console
• YQL Github Account (Contribute Tables)• http://github.com/yql/yql-tables
![Page 37: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/37.jpg)
http://isithackday.com/hackday-toolbox/
![Page 38: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/38.jpg)
Questions?
Jai Santhosh
Twitter: @jaisanthGithub: http://github.com/jaisanth
http://www.slideshare.net/jaisanth
![Page 39: YQL & Yahoo! Apis](https://reader035.fdocuments.in/reader035/viewer/2022062512/5549fb97b4c905507a8b4a3a/html5/thumbnails/39.jpg)
THANK YOU!