SlideShare a Scribd company logo
YQL & Yahoo! APIs - Open Hack India 2011
YQL AND YAHOO! APIS
Saurabh Sahni
YDN Developer, Hacker, Evangelist
Twitter: @saurabhsahni
Hacking together
systems in 24 hours is
lot of fun
Data manipulation
Hacks =           +
          Data visualization
The web has lot of data around
ProgrammableWeb.Com – 3517 APIs
Yahoo! has opened
up 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 learn what parameters you
    have
 •  Get data in obscure format
 •  Use data after converting and filtering
 •  More APIs you use, more is your
    annoyance
To make data access
easy on the web,
Yahoo! created YQL
YQL turns web
services and data on
the web into
databases.
select {what} from {where}
    where {conditions}
You can select, filter,
sort and limit
You can even insert,
update and delete
from it.
FINDING VIDEOS ABOUT BANGALORE




 SELECT * FROM youtube.search where
 query='bangalore'
SELECTING PHOTOS OF HACKDAY




SELECT * FROM flickr.photos.search where
text="hackday"
INSERTING DATA




INSERT 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 CONTACTS




SELECT * FROM social.contacts WHERE
guid=me
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
The easiest way to start
with YQL is to use the
console

http://developer.yahoo.com/yql/console
YQL: http://developer.yahoo.com/yql/console
YQL & Yahoo! APIs - Open Hack India 2011
YQL & Yahoo! APIs - Open Hack India 2011
YQL & Yahoo! APIs - Open Hack India 2011
URL STRUCTURE


http://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 ]
LET’S SEE IT
QUERY EXAMPLES

Find 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 from
twitter.search where q="hackday") and target='hi';


Extract important terms from top stories on Yahoo! news:
select * from search.termextract where context in (select description
from rss where url='http://rss.news.yahoo.com/rss/topstories')
QUERY EXAMPLES

Find distance between Bangalore and Mumbai:
select * from geo.distance where place1="bangalore" and
place2="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" and
type="apa" and query="indiranagar”
QUERY EXAMPLES


Scrape 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%’ ;
Let’s find
openhackindia
photos on flickr
YQL & Yahoo! APIs - Open Hack India 2011
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"/>
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}
YQL & Yahoo! APIs - Open Hack India 2011
https://github.com/saurabhsahni/Hacks/
Finding Recent Photos from flickr
Some YQL Hacks
ChromYQLip is a
chrome extension for
page scraping via YQL
Open	
  Hack	
  Bangalore	
  2010	
  Winner	
  
http://bit.ly/chromeYQL
VIDEO CLIP
http://www.webmeme.in
WEBMEME.IN


Fetch multiple feeds in different formats like atom, RSS and
transform them into consistent RSS format
Select * 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%’
YQL is open – you
can get your data
tables in our system
All you need to do is
write an XML
schema and put it
on Github.
http://github.com/yql/yql-tables
Here is the craigslist
search table
https://github.com/yql/yql-tables/tree/master/
craigslist/craigslist.search.xml
YQL & Yahoo! APIs - Open Hack India 2011
USE INSTANTLY BY UPLOADING ON YOUR SITE




   USE 'http://www.mysite.com/my_table.xml'
   AS mytable;
   SELECT * FROM mytable
   WHERE user='saurabh'
You can even write
server side javascript
to build a webservice
or augment one.
h#p://developer.yahoo.com/yql/guide/yql-­‐execute-­‐chapter.html	
  
There are lot of
things you can do
with YQL.
Play yourself
http://developer.yahoo.com/yql/
RESOURCES

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
ANY QUESTIONS?


http://www.slideshare.net/
saurabhsahni




  Saurabh Sahni

  Twitter: @saurabhsahni
  Github: http://github.com/saurabhsahni
  Web: http://www.saurabhsahni.com
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

More Related Content

PDF
YQL: Hacking on steroids - Yahoo! Open Hack Day 2012
PPTX
Building Social Tools
PDF
Yql with geo
PDF
Selenium for-ops
PPTX
Building Beautiful REST APIs in ASP.NET Core
PPTX
Advanced Google Analytics
PDF
Creating HTML Pages
YQL: Hacking on steroids - Yahoo! Open Hack Day 2012
Building Social Tools
Yql with geo
Selenium for-ops
Building Beautiful REST APIs in ASP.NET Core
Advanced Google Analytics
Creating HTML Pages

What's hot (20)

PDF
Seoptimizing
PDF
Using Wordpress with Reclaim Hosting
PDF
Integrate CI/CD Pipelines with Jira Software Cloud
PDF
How to build testable UIs
PPT
Hi5 Open Social
PDF
PDF
Finding things on the web with BOSS
PDF
Discover the Possibilities of the Jira Cloud Asset API
PPT
Getting the Most Out of OpenSocial Gadgets
PDF
Supercharge Your Pages - New Ways to Extend the Confluence Editor
PPTX
Selenium tests, the Object Oriented way
PDF
Introduction to WordPress Hooks 2016
KEY
Flexible site structure with cake php
PDF
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
PPTX
d.mix: Programming by a Sample
PPTX
Make Your Own Damn SEO Tools (Using Google Docs!)
KEY
Rails Antipatterns | Open Session with Chad Pytel
KEY
You're Doing It Wrong
PDF
Simplifying Code: Monster to Elegant in 5 Steps
PPTX
Blog training
Seoptimizing
Using Wordpress with Reclaim Hosting
Integrate CI/CD Pipelines with Jira Software Cloud
How to build testable UIs
Hi5 Open Social
Finding things on the web with BOSS
Discover the Possibilities of the Jira Cloud Asset API
Getting the Most Out of OpenSocial Gadgets
Supercharge Your Pages - New Ways to Extend the Confluence Editor
Selenium tests, the Object Oriented way
Introduction to WordPress Hooks 2016
Flexible site structure with cake php
A Universal Automation Framework based on BDD Cucumber and Ruby on Rails - Ph...
d.mix: Programming by a Sample
Make Your Own Damn SEO Tools (Using Google Docs!)
Rails Antipatterns | Open Session with Chad Pytel
You're Doing It Wrong
Simplifying Code: Monster to Elegant in 5 Steps
Blog training

Viewers also liked (8)

PDF
BOSS: HackU IIT Bombay
PDF
Yahoo! Query Language - Hadoop India Summit 2011
PDF
BOSS Open Hack Day, Bangalore
PPS
Casualidad o no
PPSX
Arte con sandías
PDF
BOSS: Yahoo HackU IIIT Hyderabad
PDF
Hacking & everything you need to survice a hackday - Yahoo! Agency Hack Day N...
PDF
Hacking 101 & Yahoo Mobile Developer Suite - YMDC NYC
BOSS: HackU IIT Bombay
Yahoo! Query Language - Hadoop India Summit 2011
BOSS Open Hack Day, Bangalore
Casualidad o no
Arte con sandías
BOSS: Yahoo HackU IIIT Hyderabad
Hacking & everything you need to survice a hackday - Yahoo! Agency Hack Day N...
Hacking 101 & Yahoo Mobile Developer Suite - YMDC NYC

Similar to YQL & Yahoo! APIs - Open Hack India 2011 (20)

PPTX
YQL & Yahoo! Apis
PDF
Yql hacku iitd_2012
PPTX
YQL - HackU IIT Madras 2012
PDF
Boss and Cap
PDF
Yahoo! Hack India: Hyderabad 2013 | Boss and Cap
PPT
Query the web with YQL
PPT
Lessons Learned - Building YDN
PDF
ApacheCon 2005
PDF
Building Things Fast - and getting approval
PDF
YQL and Geo
PDF
YDN KR Tech Talk : Pipes 와 YQL 활용하기
PPTX
SPTechCon Boston 2015 - Utilizing jQuery in SharePoint
PPT
Hack u iitb_social
PPTX
Boss hack u-iit-madras-2012
PPT
YQL Presentation at Geek Girls Dinner Sydney
PPTX
Select * from internet
PPTX
YQL: Master Of the Mix
KEY
YQL:: Select * from Internet
PPTX
Integrating Search Driven Content in SharePoint 2013/2016/O365
PPTX
SPTechCon DevDays - SharePoint & jQuery
YQL & Yahoo! Apis
Yql hacku iitd_2012
YQL - HackU IIT Madras 2012
Boss and Cap
Yahoo! Hack India: Hyderabad 2013 | Boss and Cap
Query the web with YQL
Lessons Learned - Building YDN
ApacheCon 2005
Building Things Fast - and getting approval
YQL and Geo
YDN KR Tech Talk : Pipes 와 YQL 활용하기
SPTechCon Boston 2015 - Utilizing jQuery in SharePoint
Hack u iitb_social
Boss hack u-iit-madras-2012
YQL Presentation at Geek Girls Dinner Sydney
Select * from internet
YQL: Master Of the Mix
YQL:: Select * from Internet
Integrating Search Driven Content in SharePoint 2013/2016/O365
SPTechCon DevDays - SharePoint & jQuery

More from Saurabh Sahni (14)

PDF
Finding things on the web with Yahoo! BOSS: IIT Delhi
PDF
Hacking 101
PDF
Hacking for Innovation - WPP, New York
PDF
Innovating the Hacker Way
PDF
Finding things with BOSS
PDF
Let the hacking continue - Post Open Hack India Mixer
PDF
Hack 101 - IIT Delhi HackU 2011
PDF
Yahoo! Open Stack & YQL
PDF
Hacking for Innovation: IIT Kharagpur
PDF
HackU: IIT Madras: Hacking Yahoo! Social
PDF
Open Hack Day Bangalore: Hacking Yahoo! Social
PDF
Hackuzela: Hacking Yahoo! Social
PDF
BOSS: Yahoo HackU IIIT Bangalore
PDF
BOSS: HackU IIT Delhi
Finding things on the web with Yahoo! BOSS: IIT Delhi
Hacking 101
Hacking for Innovation - WPP, New York
Innovating the Hacker Way
Finding things with BOSS
Let the hacking continue - Post Open Hack India Mixer
Hack 101 - IIT Delhi HackU 2011
Yahoo! Open Stack & YQL
Hacking for Innovation: IIT Kharagpur
HackU: IIT Madras: Hacking Yahoo! Social
Open Hack Day Bangalore: Hacking Yahoo! Social
Hackuzela: Hacking Yahoo! Social
BOSS: Yahoo HackU IIIT Bangalore
BOSS: HackU IIT Delhi

Recently uploaded (20)

PPTX
The various Industrial Revolutions .pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
Hybrid model detection and classification of lung cancer
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
August Patch Tuesday
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Developing a website for English-speaking practice to English as a foreign la...
PPTX
observCloud-Native Containerability and monitoring.pptx
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
project resource management chapter-09.pdf
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PPTX
OMC Textile Division Presentation 2021.pptx
PPT
Module 1.ppt Iot fundamentals and Architecture
PDF
Architecture types and enterprise applications.pdf
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
The various Industrial Revolutions .pptx
Programs and apps: productivity, graphics, security and other tools
O2C Customer Invoices to Receipt V15A.pptx
A novel scalable deep ensemble learning framework for big data classification...
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
NewMind AI Weekly Chronicles – August ’25 Week III
1 - Historical Antecedents, Social Consideration.pdf
Hybrid model detection and classification of lung cancer
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
August Patch Tuesday
Assigned Numbers - 2025 - Bluetooth® Document
Developing a website for English-speaking practice to English as a foreign la...
observCloud-Native Containerability and monitoring.pptx
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
project resource management chapter-09.pdf
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
OMC Textile Division Presentation 2021.pptx
Module 1.ppt Iot fundamentals and Architecture
Architecture types and enterprise applications.pdf
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...

YQL & Yahoo! APIs - Open Hack India 2011