Web services made easy with YQL
-
date post
12-Sep-2014 -
Category
Technology
-
view
4.311 -
download
2
description
Transcript of Web services made easy with YQL
![Page 1: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/1.jpg)
Web services made easy with YQL
Chris&an Heilmann ‐ Global Radio Brown Bag ‐ London, England, June 2010
![Page 2: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/2.jpg)
I am Chris (@codepo8)
![Page 3: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/3.jpg)
I love the web as a medium.
![Page 4: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/4.jpg)
And I hate taking unnecessary steps.
![Page 5: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/5.jpg)
So if I want to get data off the web, I don’t feel like going through lots of steps.
![Page 6: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/6.jpg)
1. Find data API2. Request key 3. Receive key4. Find data endpoint5. Read docs to learn how to
authenticate6. Read docs to know what
parameters you have.7. Get massive amount of
data in some obscure format
8. Use data after converting and filtering it.
![Page 7: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/7.jpg)
Instead I want this:
![Page 8: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/8.jpg)
1. Find data2. Request, filter and
convert data.3. Use data.
![Page 9: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/9.jpg)
And for that, I can use YQL.
![Page 10: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/10.jpg)
YQL hAp://developer.yahoo.com/yql/console/
![Page 11: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/11.jpg)
YQL hAp://developer.yahoo.com/yql/console/
select {what} from {where} where {condi&ons}
![Page 12: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/12.jpg)
YQL turns the web into a massive database.
![Page 13: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/13.jpg)
You can select, filter, sort and limit data and you can even insert, update and delete from it.
![Page 14: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/14.jpg)
YQL in itself is a web service, and you don’t need any Yahoo product to use it.
![Page 15: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/15.jpg)
Using the YQL console makes it very easy to use it.
![Page 16: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/16.jpg)
1) Define your Query
2) Select your output
3) Copy the URL.
![Page 17: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/17.jpg)
Or the manly way...
https://query.yahooapis.com/v1/public/yql?q={uri-encoded-query}&format={xml|json}&diagnostics={true|false}&callback={function}&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys
![Page 18: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/18.jpg)
Using the YQL console makes it very easy to use it.
![Page 19: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/19.jpg)
You can use JSON-P and just copy and paste the URL in JavaScript:
![Page 20: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/20.jpg)
Or create nodes to do it dynamically.
![Page 21: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/21.jpg)
![Page 22: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/22.jpg)
Display with PHP:
![Page 23: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/23.jpg)
So what about some demo queries?
![Page 24: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/24.jpg)
select * from search.web where query="london heart"
![Page 25: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/25.jpg)
select abstract from search.web where query="london heart"
![Page 26: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/26.jpg)
select abstract from search.web(100) where query="london heart"
![Page 27: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/27.jpg)
select * from search.termextract where context in (select abstract from search.web(100) where query="london heart")
![Page 28: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/28.jpg)
select * from search.termextract where context in (select abstract from search.web(100) where query="london heart") | sort(field="Result") | unique(field="Result")
![Page 29: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/29.jpg)
select * from query.multi where queries=' select Title,Description,Url,DisplayUrl from microsoft.bing.web(20) where query="cat"; select title,clickurl,abstract,dispurl from search.web(20) where query="cat"; select titleNoFormatting,url,content,visibleUrl from google.search(20) where q="cat"'
![Page 30: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/30.jpg)
http://icant.co.uk/goohoobi/index.php?research
![Page 32: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/32.jpg)
select * from flickr.photos.search(50) where text="XFM" and has_geo='true'
![Page 33: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/33.jpg)
select * from geo.places where text="glastonbury"
![Page 34: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/34.jpg)
select * from flickr.photos.search(50) where woe_id in (select woeid from geo.places where text="glastonbury")
![Page 35: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/35.jpg)
select * from flickr.photos.search(50) where woe_id in (select woeid from geo.places where text="glastonbury") and min_taken_date = "2009"
![Page 36: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/36.jpg)
I love using geolocation services.
![Page 37: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/37.jpg)
http://isithackday.com/hacks/geo/yql-geo-library/
![Page 38: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/38.jpg)
http://isithackday.com/hacks/geo/around-you/
![Page 39: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/39.jpg)
hAp://isithackday.com/geoplanet‐explorer/
![Page 40: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/40.jpg)
hAp://isithackday.com/hacks/geo/addmap.html
<script src="addmap.js"></script><script>addmap.config.mapkey = 'YOUR_API_KEY';addmap.analyse('content');</script>
![Page 41: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/41.jpg)
YQL is not limited to Yahoo data - at all.
![Page 42: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/42.jpg)
Articles of the New York Times:
select * from nyt.article.search where query="football"
![Page 43: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/43.jpg)
Headlines of elpais.com:
select content from html where url="http://elpais.com" and xpath="//h2/a"
![Page 44: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/44.jpg)
Keywords extracted from elpais.com headlines.
select * from search.termextract where context in( select content from html where url="http://elpais.com" and xpath="//h2/a")
![Page 45: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/45.jpg)
elpais.com headlines in English:
select * from google.translate where q in(select content from html where url="http://elpais.com" and xpath="//h2/a") and target="en"
![Page 46: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/46.jpg)
Updating Twitter:use 'http://www.yqlblog.net/samples/twitter.status.xml';insert into twitter.status (status,username,password)values ( "In your redinnova, blowing ur mindz", "codepo8", "didyoureallythinkIshowit?")
![Page 47: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/47.jpg)
Updating Wordpress:
insert into wordpress.post (title, description, blogurl, username, password) values ("Test Title", "This is a test body", "http://ajaxian.com", "codepo8", "iedoesitright")
![Page 48: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/48.jpg)
YQL is open - if you want your data in this system, all we need is an address where to get it :)
![Page 49: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/49.jpg)
![Page 50: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/50.jpg)
![Page 51: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/51.jpg)
Join us! http://github.com/yql/yql-tables
![Page 52: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/52.jpg)
You can even write server-side JavaScript to build a webservice that way.
![Page 53: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/53.jpg)
One last thing to access through YQL is the Yahoo Firehose.
![Page 54: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/54.jpg)
http://developer.yahoo.net/blog/archives/2010/04/yahoo_updates_firehose.html
![Page 55: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/55.jpg)
Enough talk, let me show you YQL.
![Page 56: Web services made easy with YQL](https://reader034.fdocuments.in/reader034/viewer/2022051608/5412eff68d7f720c4e8b4733/html5/thumbnails/56.jpg)
Christian Heilmann http://wait-till-i.com http://developer-evangelism.com http://twitter.com/codepo8
Thanks!