Open Hack London - Introduction to YQL

Christian Heilmann
Christian HeilmannSenior Program Manager Developer Experience and Evangelism at Microsoft
Remixing web data for your hacks
                   the easy way
                YQL – the can opener of the web
Hacking together systems
in 24 hours is a lot of fun.
But you want to spend that
time thinking about the
interface.
And not how you get to the
right data in the right
format.
The web is full of juicy and
long lasting data.




                     hquot;p://www.flickr.com/photos/clspeace/162336973/
And there is a lot of it
around.




                      hquot;p://www.flickr.com/photos/tudor/2981410947/
However, our attempts to
get to it can be clumsy.




                  hquot;p://www.flickr.com/photos/lumachrome/2140368742/
What we need is an easy
way to get to that data.




                   hquot;p://www.flickr.com/photos/carey@lden/115435226/
We had a way to do that
for quite a while now.
http://pipes.yahoo.com/
Pipes, however is high end
technology…




                    hquot;p://www.flickr.com/photos/axio/2346342672/
We’re developers, not
interface users.




                   hquot;p://www.flickr.com/photos/codepo8/2278641937/
So for a long time people
asked Yahoo for a
command line version of
pipes.

Can we have one?
Yes, we can!
The Yahoo Query
Language, or short YQL is a
unified interface language
to the web.
http://developer.yahoo.com/yql/
Using YQL, accessing the
web and its services
becomes as easy as SQL:

select {what} from
{service} where
{condition}
Say you want kittens in
your hack (who doesn’t?)

select * from
flickr.photos.search
where text=quot;kittenquot;
Say you want kittens in
your hack (who doesn’t?)
Say you only want 5 kittens

select * from
flickr.photos.search
where text=quot;kittenquot;
limit 5
Say you only want 5 kittens
Nice, but where can you
get this?
YQL is a REST API in itself,
and it has two endpoints.
The public endpoint does
not need any
authentication.

http://query.yahooapis.com/v1/
public/yql?q={query}
&format={format}
The private endpoint needs
oauth authentication.

http://query.yahooapis.com/v1/
yql?q={query}
&format={format}
hquot;p://developer.yahoo.com/yql/guide/
authoriza@on‐access.html
Output formats are XML or
JSON.
JSON also allows for a
callback parameter to use
the output directly as
JSON-P.
http://query.yahooapis.com/v1/public/yql?
q=select%20*%20from flickr.photos.search
%20where%20text=%22kitten%22limit
%205&format=json&callback=meow
Open Hack London - Introduction to YQL
You can mix and match
several web services using
the in() command.
Guess what this does:

select * from
flickr.photos.info where
photo_id in (select id from
flickr.photos.search where
woe_id in (select woeid from
geo.places where
text='london,uk') and
license=4)
Find London, UK, without a
doubt.
select * from
flickr.photos.info where
photo_id in (select id from
flickr.photos.search where
woe_id in (select woeid from
geo.places where
text='london,uk') and
license=4)
Find Photos of London, UK

select * from
flickr.photos.info where
photo_id in (select id from
flickr.photos.search where
woe_id in (select woeid from
geo.places where
text='london,uk') and
license=4)
Find Photos of London, UK
with a “By” CC license
select * from
flickr.photos.info where
photo_id in (select id from
flickr.photos.search where
woe_id in (select woeid from
geo.places where
text='london,uk') and
license=4)
Give me everything you
know about these photos.
select * from
flickr.photos.info where
photo_id in (select id from
flickr.photos.search where
woe_id in (select woeid from
geo.places where
text='london,uk') and
license=4)
Using a command like this
and some out-of-the-box UI
elements like Yahoo Maps
and the YUI carousel, you
can build something *very*
quickly.
http://isithackday.com/hacks/cantine/
index.php?loc=covent+garden
Instead of selecting all the
information you can also
limit the results:
select name,url from
upcoming.venue where metro_id
in (select id from
upcoming.metro where
search_text=quot;stokeyquot;)
select name,url from
upcoming.venue where metro_id in
(select id from upcoming.metro
where search_text=quot;stokeyquot;)
The diagnostics part of the returned
data shows you what happened and
how long it took
Here’s what Yahoo offers you in this
  format:
flickr.photos.exif             local.search            mybloglog.community.find
flickr.photos.info             music.ar0st.id          mybloglog.member
flickr.photos.interes0ngness   music.ar0st.popular     mybloglog.member.contacts
flickr.photos.recent           music.ar0st.search      mybloglog.member.newwithcontacts
flickr.photos.search           music.ar0st.similar     mybloglog.member.newwithme
flickr.photos.sizes            music.release.ar0st     mybloglog.members.find
flickr.places                  music.release.id        mybloglog.stats.find
flickr.places.info             music.release.popular   upcoming.category
geo.places                    music.release.search    upcoming.country
geo.places.ancestors          music.track.id          upcoming.events
geo.places.belongtos          music.track.popular     upcoming.events.bes0nplace
geo.places.children           music.track.search      upcoming.groups
geo.places.neighbors          music.video.category    upcoming.metro
geo.places.parent             music.video.id          upcoming.state
geo.places.siblings           music.video.popular     upcoming.user
geo.placetypes                music.video.search      upcoming.venue
gnip.ac0vity                  music.video.similar
Here’s what Yahoo offers you in this
  format:
search.images                 search.images                 search.images
search.news                   search.news                   search.news
search.siteexplorer.inlinks   search.siteexplorer.inlinks   search.siteexplorer.inlinks
search.siteexplorer.pages     search.siteexplorer.pages     search.siteexplorer.pages
search.spelling               search.spelling               search.spelling
search.suggest                search.suggest                search.suggest
search.termextract            search.termextract            search.termextract
search.web                    search.web                    search.web
social.connec0ons             social.connec0ons             social.connec0ons
social.contacts               social.contacts               social.contacts
social.presence               social.presence               social.presence
social.profile                 social.profile                 social.profile
social.updates                social.updates                social.updates
weather.forecast              weather.forecast              weather.forecast
yahoo.iden0ty                 yahoo.iden0ty                 yahoo.iden0ty
yap.setsmallview              yap.setsmallview              yap.setsmallview
You want even more?




             http://www.flickr.com/photos/verylastexcitingmoment/3123597774/
Alright, how about this?


              json
atom
              microformats
csv
              rss
feed
              xml
html
Telegraph’s headlines
anyone?
select * from html where
url='http://www.telegraph.co.uk/'
and xpath='//h3/a'
Telegraph’s headlines
anyone?
You can dynamically create
YQL queries to collate
several sources…
Then use cURL to pull them
off the web with one single
http request!
YQL caches and
compresses the results for
you.

Pretty easy, isn’t it?
Here’s another fun part:
Anyone can be part of the
YQL interface.
All we need the data
provider to do is to create a
schema that explains their
data structure.

http://developer.yahoo.com/yql/guide/
yql-opentables-chapter.html
And people do…
amazon              nmm
bitly               nyt
delicious           opensocial
dopplr              search
etsy                shopping
friendfeed          social
github              twi?er
Greader             update.groovy
guardian            weather
imdb                wesabe
iploca0on           whitepages
las>m               yahoo
nestoria            yelp
ne>lix              zillow

http://github.com/spullara/yql-tables/tree/master
For example the national
maritime museum:
select * from
nmm.archive.search where
searchterm=‘horatio nelson'
select * from
nmm.archive.search where
searchterm=‘horatio nelson'
That’s pretty cool –
allowing anyone to be part
of this interface.
The only shame is that you
can’t do all the things in
YQL that you can do in
Pipes – for example string
manipulation.
We wondered how to make
this possible.

One thing we didn’t want
to sacrifice is the simplicity
of the language itself.
So instead of inventing an
own language, we decided
to piggy-back on one you
already know.
YQL execute allows you to
embed JavaScript in the
open table schema that
runs on the YQL server and
converts the data for you.
http://developer.yahoo.com/yql/guide/yql-
execute-chapter.html
For example you can
augment an existing service
to do something different.
The following example
adds a rank to search
results.
http://www.yqlblog.net/samples/searchrank.xml
Open Hack London - Introduction to YQL
Open Hack London - Introduction to YQL
Stored as XML this can be
used in a YQL query:
use 'http://yqlblog.net/
samples/searchrank.xml' as
searchrank;
select * from searchrank where
query='pizza' and dispurl like
'%pizzahut%'
Open Hack London - Introduction to YQL
Anyways, the *easiest* way
to start with YQL is to use
the console.
http://developer.yahoo.com/yql/console/
Open Hack London - Introduction to YQL
Open Hack London - Introduction to YQL
Open Hack London - Introduction to YQL
Open Hack London - Introduction to YQL
Open Hack London - Introduction to YQL
Open Hack London - Introduction to YQL
Open Hack London - Introduction to YQL
Open Hack London - Introduction to YQL
Open Hack London - Introduction to YQL
Of course, you can also
spend half the hack day
reading API docs 
Check out some code
examples on.

http://isithackday.com/hacks/ohd-london
THANKS!
Chris Heilmann
http://twitter.com/codepo8
1 of 76

Recommended

Using YQL Sensibly - YUIConf 2010 by
Using YQL Sensibly - YUIConf 2010Using YQL Sensibly - YUIConf 2010
Using YQL Sensibly - YUIConf 2010Christian Heilmann
2.5K views114 slides
Things you can use (by the Yahoo Developer Network and friends) by
Things you can use (by the Yahoo Developer Network and friends)Things you can use (by the Yahoo Developer Network and friends)
Things you can use (by the Yahoo Developer Network and friends)Christian Heilmann
1.6K views81 slides
Downloading the internet with Python + Scrapy by
Downloading the internet with Python + ScrapyDownloading the internet with Python + Scrapy
Downloading the internet with Python + ScrapyErin Shellman
7.2K views30 slides
How to Scrap Any Website's content using ScrapyTutorial of How to scrape (cra... by
How to Scrap Any Website's content using ScrapyTutorial of How to scrape (cra...How to Scrap Any Website's content using ScrapyTutorial of How to scrape (cra...
How to Scrap Any Website's content using ScrapyTutorial of How to scrape (cra...Anton
27.1K views20 slides
Web Scraping with Python by
Web Scraping with PythonWeb Scraping with Python
Web Scraping with PythonPaul Schreiber
11.7K views106 slides
Web Crawling Modeling with Scrapy Models #TDC2014 by
Web Crawling Modeling with Scrapy Models #TDC2014Web Crawling Modeling with Scrapy Models #TDC2014
Web Crawling Modeling with Scrapy Models #TDC2014Bruno Rocha
7.9K views17 slides

More Related Content

What's hot

Assumptions: Check yo'self before you wreck yourself by
Assumptions: Check yo'self before you wreck yourselfAssumptions: Check yo'self before you wreck yourself
Assumptions: Check yo'self before you wreck yourselfErin Shellman
1.5K views45 slides
Workers of the web - BrazilJS 2013 by
Workers of the web - BrazilJS 2013Workers of the web - BrazilJS 2013
Workers of the web - BrazilJS 2013Thibault Imbert
32.9K views105 slides
JavaScript APIs you’ve never heard of (and some you have) by
JavaScript APIs you’ve never heard of (and some you have)JavaScript APIs you’ve never heard of (and some you have)
JavaScript APIs you’ve never heard of (and some you have)Nicholas Zakas
51.4K views67 slides
JavaScript APIs - The Web is the Platform - .toster conference, Moscow by
JavaScript APIs - The Web is the Platform - .toster conference, MoscowJavaScript APIs - The Web is the Platform - .toster conference, Moscow
JavaScript APIs - The Web is the Platform - .toster conference, MoscowRobert Nyman
4.6K views73 slides
Find,Mix And Show by
Find,Mix And ShowFind,Mix And Show
Find,Mix And ShowChristian Heilmann
8.9K views112 slides
WAPWG Clark defining capturing_web-based_if by
WAPWG Clark defining capturing_web-based_ifWAPWG Clark defining capturing_web-based_if
WAPWG Clark defining capturing_web-based_ifSara Day Thomson
111 views32 slides

What's hot(20)

Assumptions: Check yo'self before you wreck yourself by Erin Shellman
Assumptions: Check yo'self before you wreck yourselfAssumptions: Check yo'self before you wreck yourself
Assumptions: Check yo'self before you wreck yourself
Erin Shellman1.5K views
Workers of the web - BrazilJS 2013 by Thibault Imbert
Workers of the web - BrazilJS 2013Workers of the web - BrazilJS 2013
Workers of the web - BrazilJS 2013
Thibault Imbert32.9K views
JavaScript APIs you’ve never heard of (and some you have) by Nicholas Zakas
JavaScript APIs you’ve never heard of (and some you have)JavaScript APIs you’ve never heard of (and some you have)
JavaScript APIs you’ve never heard of (and some you have)
Nicholas Zakas51.4K views
JavaScript APIs - The Web is the Platform - .toster conference, Moscow by Robert Nyman
JavaScript APIs - The Web is the Platform - .toster conference, MoscowJavaScript APIs - The Web is the Platform - .toster conference, Moscow
JavaScript APIs - The Web is the Platform - .toster conference, Moscow
Robert Nyman4.6K views
WAPWG Clark defining capturing_web-based_if by Sara Day Thomson
WAPWG Clark defining capturing_web-based_ifWAPWG Clark defining capturing_web-based_if
WAPWG Clark defining capturing_web-based_if
Sara Day Thomson111 views
Extending spring by Joshua Long
Extending springExtending spring
Extending spring
Joshua Long1.3K views
University of arizona mobile matters - technology, a means to an end by Thibault Imbert
University of arizona   mobile matters - technology, a means to an endUniversity of arizona   mobile matters - technology, a means to an end
University of arizona mobile matters - technology, a means to an end
Thibault Imbert29.4K views
HTML5 APIs - Where No Man Has Gone Before! - GothamJS by Robert Nyman
HTML5 APIs - Where No Man Has Gone Before! - GothamJSHTML5 APIs - Where No Man Has Gone Before! - GothamJS
HTML5 APIs - Where No Man Has Gone Before! - GothamJS
Robert Nyman7.1K views
Scraping with Python for Fun and Profit - PyCon India 2010 by Abhishek Mishra
Scraping with Python for Fun and Profit - PyCon India 2010Scraping with Python for Fun and Profit - PyCon India 2010
Scraping with Python for Fun and Profit - PyCon India 2010
Abhishek Mishra1.5K views
Working with LifeDesks by Katja Schulz
Working with LifeDesksWorking with LifeDesks
Working with LifeDesks
Katja Schulz416 views
Visdjango presentation django_boston_oct_2014 by jlbaldwin
Visdjango presentation django_boston_oct_2014Visdjango presentation django_boston_oct_2014
Visdjango presentation django_boston_oct_2014
jlbaldwin764 views
Web scraping 1 2-3 with python + scrapy (Summer BarCampHK 2012 version) by Sammy Fung
Web scraping 1 2-3 with python + scrapy (Summer BarCampHK 2012 version)Web scraping 1 2-3 with python + scrapy (Summer BarCampHK 2012 version)
Web scraping 1 2-3 with python + scrapy (Summer BarCampHK 2012 version)
Sammy Fung6.6K views
Everything is Awesome - Cutting the Corners off the Web by James Rakich
Everything is Awesome - Cutting the Corners off the WebEverything is Awesome - Cutting the Corners off the Web
Everything is Awesome - Cutting the Corners off the Web
James Rakich544 views
JavaScript and HTML5 - Brave New World (revised) by Robert Nyman
JavaScript and HTML5 - Brave New World (revised)JavaScript and HTML5 - Brave New World (revised)
JavaScript and HTML5 - Brave New World (revised)
Robert Nyman15.5K views
The Web Becomes Graceful by colorhook
The Web Becomes GracefulThe Web Becomes Graceful
The Web Becomes Graceful
colorhook248 views
Stop Worrying & Love the SQL - A Case Study by All Things Open
Stop Worrying & Love the SQL - A Case StudyStop Worrying & Love the SQL - A Case Study
Stop Worrying & Love the SQL - A Case Study
All Things Open1.5K views

Similar to Open Hack London - Introduction to YQL

YQL - Christian Heilmann Open Hack London presentation by
YQL - Christian Heilmann Open Hack London presentationYQL - Christian Heilmann Open Hack London presentation
YQL - Christian Heilmann Open Hack London presentationKorben00
1.6K views73 slides
YQL:: Select * from Internet by
YQL:: Select * from InternetYQL:: Select * from Internet
YQL:: Select * from Internetdrgath
5.1K views83 slides
Things to use, find and share by
Things to use, find and shareThings to use, find and share
Things to use, find and shareChristian Heilmann
673 views104 slides
YQL: Select * from Internet by
YQL: Select * from InternetYQL: Select * from Internet
YQL: Select * from Internetdrgath
15 views83 slides
Yql with geo by
Yql with geoYql with geo
Yql with geoPrajwal ShelvaPillai
1.1K views50 slides
Yahoo for the Masses by
Yahoo for the MassesYahoo for the Masses
Yahoo for the MassesChristian Heilmann
2.9K views95 slides

Similar to Open Hack London - Introduction to YQL(20)

YQL - Christian Heilmann Open Hack London presentation by Korben00
YQL - Christian Heilmann Open Hack London presentationYQL - Christian Heilmann Open Hack London presentation
YQL - Christian Heilmann Open Hack London presentation
Korben001.6K views
YQL:: Select * from Internet by drgath
YQL:: Select * from InternetYQL:: Select * from Internet
YQL:: Select * from Internet
drgath5.1K views
YQL: Select * from Internet by drgath
YQL: Select * from InternetYQL: Select * from Internet
YQL: Select * from Internet
drgath15 views
Dundee University HackU 2013 - YQL by smartads
Dundee University HackU 2013 - YQLDundee University HackU 2013 - YQL
Dundee University HackU 2013 - YQL
smartads572 views
Building Things Fast - and getting approval by Simon Willison
Building Things Fast - and getting approvalBuilding Things Fast - and getting approval
Building Things Fast - and getting approval
Simon Willison1.7K views
Semantic Web For Distributed Social Networks by David Peterson
Semantic Web For Distributed Social NetworksSemantic Web For Distributed Social Networks
Semantic Web For Distributed Social Networks
David Peterson21.6K views
Using Web Services with JavaScript - Fronttrends 2010 by Christian Heilmann
Using Web Services with JavaScript - Fronttrends 2010Using Web Services with JavaScript - Fronttrends 2010
Using Web Services with JavaScript - Fronttrends 2010
Christian Heilmann1.7K views
YQL: Hacking on steroids - Yahoo! Open Hack Day 2012 by Saurabh Sahni
YQL: Hacking on steroids - Yahoo! Open Hack Day 2012YQL: Hacking on steroids - Yahoo! Open Hack Day 2012
YQL: Hacking on steroids - Yahoo! Open Hack Day 2012
Saurabh Sahni4K views
With Great Nerdery Comes Great Responsibility by John Anderson
With Great Nerdery Comes Great Responsibility With Great Nerdery Comes Great Responsibility
With Great Nerdery Comes Great Responsibility
John Anderson1.4K views

More from Christian Heilmann

Develop, Debug, Learn? - Dotjs2019 by
Develop, Debug, Learn? - Dotjs2019Develop, Debug, Learn? - Dotjs2019
Develop, Debug, Learn? - Dotjs2019Christian Heilmann
1.1K views55 slides
Hinting at a better web by
Hinting at a better webHinting at a better web
Hinting at a better webChristian Heilmann
2.8K views33 slides
Taking the "vile" out of privilege by
Taking the "vile" out of privilegeTaking the "vile" out of privilege
Taking the "vile" out of privilegeChristian Heilmann
1K views64 slides
Seven ways to be a happier JavaScript developer - NDC Oslo by
Seven ways to be a happier JavaScript developer - NDC OsloSeven ways to be a happier JavaScript developer - NDC Oslo
Seven ways to be a happier JavaScript developer - NDC OsloChristian Heilmann
1.5K views52 slides
Artificial intelligence for humans… #AIDC2018 keynote by
Artificial intelligence for humans… #AIDC2018 keynoteArtificial intelligence for humans… #AIDC2018 keynote
Artificial intelligence for humans… #AIDC2018 keynoteChristian Heilmann
1.2K views56 slides
Killing the golden calf of coding - We are Developers keynote by
Killing the golden calf of coding - We are Developers keynoteKilling the golden calf of coding - We are Developers keynote
Killing the golden calf of coding - We are Developers keynoteChristian Heilmann
3.1K views35 slides

More from Christian Heilmann(20)

Seven ways to be a happier JavaScript developer - NDC Oslo by Christian Heilmann
Seven ways to be a happier JavaScript developer - NDC OsloSeven ways to be a happier JavaScript developer - NDC Oslo
Seven ways to be a happier JavaScript developer - NDC Oslo
Christian Heilmann1.5K views
Artificial intelligence for humans… #AIDC2018 keynote by Christian Heilmann
Artificial intelligence for humans… #AIDC2018 keynoteArtificial intelligence for humans… #AIDC2018 keynote
Artificial intelligence for humans… #AIDC2018 keynote
Christian Heilmann1.2K views
Killing the golden calf of coding - We are Developers keynote by Christian Heilmann
Killing the golden calf of coding - We are Developers keynoteKilling the golden calf of coding - We are Developers keynote
Killing the golden calf of coding - We are Developers keynote
Christian Heilmann3.1K views
Five ways to be a happier JavaScript developer by Christian Heilmann
Five ways to be a happier JavaScript developerFive ways to be a happier JavaScript developer
Five ways to be a happier JavaScript developer
Christian Heilmann859 views
Progressive Web Apps - Covering the best of both worlds - DevReach by Christian Heilmann
Progressive Web Apps - Covering the best of both worlds - DevReachProgressive Web Apps - Covering the best of both worlds - DevReach
Progressive Web Apps - Covering the best of both worlds - DevReach
Christian Heilmann956 views
Progressive Web Apps - Covering the best of both worlds by Christian Heilmann
Progressive Web Apps - Covering the best of both worldsProgressive Web Apps - Covering the best of both worlds
Progressive Web Apps - Covering the best of both worlds
Christian Heilmann799 views
Non-trivial pursuits: Learning machines and forgetful humans by Christian Heilmann
Non-trivial pursuits: Learning machines and forgetful humansNon-trivial pursuits: Learning machines and forgetful humans
Non-trivial pursuits: Learning machines and forgetful humans
Christian Heilmann531 views
Progressive Web Apps - Bringing the web front and center by Christian Heilmann
Progressive Web Apps - Bringing the web front and center Progressive Web Apps - Bringing the web front and center
Progressive Web Apps - Bringing the web front and center
Christian Heilmann1.2K views
The Soul in The Machine - Developing for Humans (FrankenJS edition) by Christian Heilmann
The Soul in The Machine - Developing for Humans (FrankenJS edition)The Soul in The Machine - Developing for Humans (FrankenJS edition)
The Soul in The Machine - Developing for Humans (FrankenJS edition)
Christian Heilmann916 views

Recently uploaded

ICS3211_lecture 08_2023.pdf by
ICS3211_lecture 08_2023.pdfICS3211_lecture 08_2023.pdf
ICS3211_lecture 08_2023.pdfVanessa Camilleri
231 views30 slides
Java Simplified: Understanding Programming Basics by
Java Simplified: Understanding Programming BasicsJava Simplified: Understanding Programming Basics
Java Simplified: Understanding Programming BasicsAkshaj Vadakkath Joshy
322 views155 slides
Collective Bargaining and Understanding a Teacher Contract(16793704.1).pptx by
Collective Bargaining and Understanding a Teacher Contract(16793704.1).pptxCollective Bargaining and Understanding a Teacher Contract(16793704.1).pptx
Collective Bargaining and Understanding a Teacher Contract(16793704.1).pptxCenter for Integrated Training & Education
95 views57 slides
Psychology KS4 by
Psychology KS4Psychology KS4
Psychology KS4WestHatch
98 views4 slides
How to empty an One2many field in Odoo by
How to empty an One2many field in OdooHow to empty an One2many field in Odoo
How to empty an One2many field in OdooCeline George
87 views8 slides
EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptx by
EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptxEIT-Digital_Spohrer_AI_Intro 20231128 v1.pptx
EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptxISSIP
386 views50 slides

Recently uploaded(20)

Psychology KS4 by WestHatch
Psychology KS4Psychology KS4
Psychology KS4
WestHatch98 views
How to empty an One2many field in Odoo by Celine George
How to empty an One2many field in OdooHow to empty an One2many field in Odoo
How to empty an One2many field in Odoo
Celine George87 views
EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptx by ISSIP
EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptxEIT-Digital_Spohrer_AI_Intro 20231128 v1.pptx
EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptx
ISSIP386 views
Use of Probiotics in Aquaculture.pptx by AKSHAY MANDAL
Use of Probiotics in Aquaculture.pptxUse of Probiotics in Aquaculture.pptx
Use of Probiotics in Aquaculture.pptx
AKSHAY MANDAL119 views
Education and Diversity.pptx by DrHafizKosar
Education and Diversity.pptxEducation and Diversity.pptx
Education and Diversity.pptx
DrHafizKosar193 views
Create a Structure in VBNet.pptx by Breach_P
Create a Structure in VBNet.pptxCreate a Structure in VBNet.pptx
Create a Structure in VBNet.pptx
Breach_P78 views
REPRESENTATION - GAUNTLET.pptx by iammrhaywood
REPRESENTATION - GAUNTLET.pptxREPRESENTATION - GAUNTLET.pptx
REPRESENTATION - GAUNTLET.pptx
iammrhaywood138 views
The Accursed House by Émile Gaboriau by DivyaSheta
The Accursed House  by Émile GaboriauThe Accursed House  by Émile Gaboriau
The Accursed House by Émile Gaboriau
DivyaSheta223 views
Classification of crude drugs.pptx by GayatriPatra14
Classification of crude drugs.pptxClassification of crude drugs.pptx
Classification of crude drugs.pptx
GayatriPatra14101 views
Solar System and Galaxies.pptx by DrHafizKosar
Solar System and Galaxies.pptxSolar System and Galaxies.pptx
Solar System and Galaxies.pptx
DrHafizKosar106 views
Pharmaceutical Inorganic Chemistry Unit IVMiscellaneous compounds Expectorant... by Ms. Pooja Bhandare
Pharmaceutical Inorganic Chemistry Unit IVMiscellaneous compounds Expectorant...Pharmaceutical Inorganic Chemistry Unit IVMiscellaneous compounds Expectorant...
Pharmaceutical Inorganic Chemistry Unit IVMiscellaneous compounds Expectorant...
Ms. Pooja Bhandare133 views
Narration lesson plan by TARIQ KHAN
Narration lesson planNarration lesson plan
Narration lesson plan
TARIQ KHAN61 views
Relationship of psychology with other subjects. by palswagata2003
Relationship of psychology with other subjects.Relationship of psychology with other subjects.
Relationship of psychology with other subjects.
palswagata200352 views
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx by Ms. Pooja Bhandare
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptxPharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx
Ms. Pooja Bhandare113 views

Open Hack London - Introduction to YQL

  • 1. Remixing web data for your hacks the easy way YQL – the can opener of the web
  • 2. Hacking together systems in 24 hours is a lot of fun.
  • 3. But you want to spend that time thinking about the interface.
  • 4. And not how you get to the right data in the right format.
  • 5. The web is full of juicy and long lasting data. hquot;p://www.flickr.com/photos/clspeace/162336973/
  • 6. And there is a lot of it around. hquot;p://www.flickr.com/photos/tudor/2981410947/
  • 7. However, our attempts to get to it can be clumsy. hquot;p://www.flickr.com/photos/lumachrome/2140368742/
  • 8. What we need is an easy way to get to that data. hquot;p://www.flickr.com/photos/carey@lden/115435226/
  • 9. We had a way to do that for quite a while now.
  • 11. Pipes, however is high end technology… hquot;p://www.flickr.com/photos/axio/2346342672/
  • 12. We’re developers, not interface users. hquot;p://www.flickr.com/photos/codepo8/2278641937/
  • 13. So for a long time people asked Yahoo for a command line version of pipes. Can we have one?
  • 15. The Yahoo Query Language, or short YQL is a unified interface language to the web. http://developer.yahoo.com/yql/
  • 16. Using YQL, accessing the web and its services becomes as easy as SQL: select {what} from {service} where {condition}
  • 17. Say you want kittens in your hack (who doesn’t?) select * from flickr.photos.search where text=quot;kittenquot;
  • 18. Say you want kittens in your hack (who doesn’t?)
  • 19. Say you only want 5 kittens select * from flickr.photos.search where text=quot;kittenquot; limit 5
  • 20. Say you only want 5 kittens
  • 21. Nice, but where can you get this?
  • 22. YQL is a REST API in itself, and it has two endpoints.
  • 23. The public endpoint does not need any authentication. http://query.yahooapis.com/v1/ public/yql?q={query} &format={format}
  • 24. The private endpoint needs oauth authentication. http://query.yahooapis.com/v1/ yql?q={query} &format={format} hquot;p://developer.yahoo.com/yql/guide/ authoriza@on‐access.html
  • 25. Output formats are XML or JSON. JSON also allows for a callback parameter to use the output directly as JSON-P.
  • 28. You can mix and match several web services using the in() command.
  • 29. Guess what this does: select * from flickr.photos.info where photo_id in (select id from flickr.photos.search where woe_id in (select woeid from geo.places where text='london,uk') and license=4)
  • 30. Find London, UK, without a doubt. select * from flickr.photos.info where photo_id in (select id from flickr.photos.search where woe_id in (select woeid from geo.places where text='london,uk') and license=4)
  • 31. Find Photos of London, UK select * from flickr.photos.info where photo_id in (select id from flickr.photos.search where woe_id in (select woeid from geo.places where text='london,uk') and license=4)
  • 32. Find Photos of London, UK with a “By” CC license select * from flickr.photos.info where photo_id in (select id from flickr.photos.search where woe_id in (select woeid from geo.places where text='london,uk') and license=4)
  • 33. Give me everything you know about these photos. select * from flickr.photos.info where photo_id in (select id from flickr.photos.search where woe_id in (select woeid from geo.places where text='london,uk') and license=4)
  • 34. Using a command like this and some out-of-the-box UI elements like Yahoo Maps and the YUI carousel, you can build something *very* quickly.
  • 36. Instead of selecting all the information you can also limit the results: select name,url from upcoming.venue where metro_id in (select id from upcoming.metro where search_text=quot;stokeyquot;)
  • 37. select name,url from upcoming.venue where metro_id in (select id from upcoming.metro where search_text=quot;stokeyquot;)
  • 38. The diagnostics part of the returned data shows you what happened and how long it took
  • 39. Here’s what Yahoo offers you in this format: flickr.photos.exif local.search mybloglog.community.find flickr.photos.info music.ar0st.id mybloglog.member flickr.photos.interes0ngness music.ar0st.popular mybloglog.member.contacts flickr.photos.recent music.ar0st.search mybloglog.member.newwithcontacts flickr.photos.search music.ar0st.similar mybloglog.member.newwithme flickr.photos.sizes music.release.ar0st mybloglog.members.find flickr.places music.release.id mybloglog.stats.find flickr.places.info music.release.popular upcoming.category geo.places music.release.search upcoming.country geo.places.ancestors music.track.id upcoming.events geo.places.belongtos music.track.popular upcoming.events.bes0nplace geo.places.children music.track.search upcoming.groups geo.places.neighbors music.video.category upcoming.metro geo.places.parent music.video.id upcoming.state geo.places.siblings music.video.popular upcoming.user geo.placetypes music.video.search upcoming.venue gnip.ac0vity music.video.similar
  • 40. Here’s what Yahoo offers you in this format: search.images search.images search.images search.news search.news search.news search.siteexplorer.inlinks search.siteexplorer.inlinks search.siteexplorer.inlinks search.siteexplorer.pages search.siteexplorer.pages search.siteexplorer.pages search.spelling search.spelling search.spelling search.suggest search.suggest search.suggest search.termextract search.termextract search.termextract search.web search.web search.web social.connec0ons social.connec0ons social.connec0ons social.contacts social.contacts social.contacts social.presence social.presence social.presence social.profile social.profile social.profile social.updates social.updates social.updates weather.forecast weather.forecast weather.forecast yahoo.iden0ty yahoo.iden0ty yahoo.iden0ty yap.setsmallview yap.setsmallview yap.setsmallview
  • 41. You want even more? http://www.flickr.com/photos/verylastexcitingmoment/3123597774/
  • 42. Alright, how about this? json atom microformats csv rss feed xml html
  • 43. Telegraph’s headlines anyone? select * from html where url='http://www.telegraph.co.uk/' and xpath='//h3/a'
  • 45. You can dynamically create YQL queries to collate several sources…
  • 46. Then use cURL to pull them off the web with one single http request!
  • 47. YQL caches and compresses the results for you. Pretty easy, isn’t it?
  • 48. Here’s another fun part: Anyone can be part of the YQL interface.
  • 49. All we need the data provider to do is to create a schema that explains their data structure. http://developer.yahoo.com/yql/guide/ yql-opentables-chapter.html
  • 50. And people do… amazon nmm bitly nyt delicious opensocial dopplr search etsy shopping friendfeed social github twi?er Greader update.groovy guardian weather imdb wesabe iploca0on whitepages las>m yahoo nestoria yelp ne>lix zillow http://github.com/spullara/yql-tables/tree/master
  • 51. For example the national maritime museum: select * from nmm.archive.search where searchterm=‘horatio nelson'
  • 52. select * from nmm.archive.search where searchterm=‘horatio nelson'
  • 53. That’s pretty cool – allowing anyone to be part of this interface.
  • 54. The only shame is that you can’t do all the things in YQL that you can do in Pipes – for example string manipulation.
  • 55. We wondered how to make this possible. One thing we didn’t want to sacrifice is the simplicity of the language itself.
  • 56. So instead of inventing an own language, we decided to piggy-back on one you already know.
  • 57. YQL execute allows you to embed JavaScript in the open table schema that runs on the YQL server and converts the data for you. http://developer.yahoo.com/yql/guide/yql- execute-chapter.html
  • 58. For example you can augment an existing service to do something different.
  • 59. The following example adds a rank to search results. http://www.yqlblog.net/samples/searchrank.xml
  • 62. Stored as XML this can be used in a YQL query: use 'http://yqlblog.net/ samples/searchrank.xml' as searchrank; select * from searchrank where query='pizza' and dispurl like '%pizzahut%'
  • 64. Anyways, the *easiest* way to start with YQL is to use the console. http://developer.yahoo.com/yql/console/
  • 74. Of course, you can also spend half the hack day reading API docs 
  • 75. Check out some code examples on. http://isithackday.com/hacks/ohd-london