Top Banner
Web services made easy with YQL Chris&an Heilmann ‐ Global Radio Brown Bag ‐ London, England, June 2010
56

Web services made easy with YQL

Sep 12, 2014

Download

Technology

 
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Web services made easy with YQL

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

I am Chris (@codepo8)

Page 3: Web services made easy with YQL

I love the web as a medium.

Page 4: Web services made easy with YQL

And I hate taking unnecessary steps.

Page 5: Web services made easy with YQL

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

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

Instead I want this:

Page 8: Web services made easy with YQL

1. Find data2. Request, filter and

convert data.3. Use data.

Page 9: Web services made easy with YQL

And for that, I can use YQL.

Page 10: Web services made easy with YQL

YQL    hAp://developer.yahoo.com/yql/console/

Page 11: Web services made easy with YQL

YQL    hAp://developer.yahoo.com/yql/console/

select {what} from {where} where {condi&ons}

Page 12: Web services made easy with YQL

YQL turns the web into a massive database.

Page 13: Web services made easy with YQL

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

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

Using the YQL console makes it very easy to use it.

Page 17: Web services made easy with YQL

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

Using the YQL console makes it very easy to use it.

Page 19: Web services made easy with YQL

You can use JSON-P and just copy and paste the URL in JavaScript:

Page 20: Web services made easy with YQL

Or create nodes to do it dynamically.

Page 21: Web services made easy with YQL
Page 22: Web services made easy with YQL

Display with PHP:

Page 23: Web services made easy with YQL

So what about some demo queries?

Page 24: Web services made easy with YQL

select * from search.web where query="london heart"

Page 25: Web services made easy with YQL

select abstract from search.web where query="london heart"

Page 26: Web services made easy with YQL

select abstract from search.web(100) where query="london heart"

Page 27: Web services made easy with YQL

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

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

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

http://icant.co.uk/goohoobi/index.php?research

Page 31: Web services made easy with YQL

http://vimeo.com/8075850

Page 32: Web services made easy with YQL

select * from flickr.photos.search(50) where text="XFM" and has_geo='true'

Page 33: Web services made easy with YQL

select * from geo.places where text="glastonbury"

Page 34: Web services made easy with YQL

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

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

I love using geolocation services.

Page 38: Web services made easy with YQL

http://isithackday.com/hacks/geo/around-you/

Page 39: Web services made easy with YQL

hAp://isithackday.com/geoplanet‐explorer/

Page 40: Web services made easy with YQL

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

YQL is not limited to Yahoo data - at all.

Page 42: Web services made easy with YQL

Articles of the New York Times:

select * from nyt.article.search where query="football"

Page 43: Web services made easy with YQL

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

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

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 47: Web services made easy with YQL

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

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
Page 50: Web services made easy with YQL
Page 51: Web services made easy with YQL

Join us! http://github.com/yql/yql-tables

Page 52: Web services made easy with YQL

You can even write server-side JavaScript to build a webservice that way.

Page 53: Web services made easy with YQL

One last thing to access through YQL is the Yahoo Firehose.

Page 55: Web services made easy with YQL

Enough talk, let me show you YQL.

Page 56: Web services made easy with YQL

Christian Heilmann http://wait-till-i.com http://developer-evangelism.com http://twitter.com/codepo8

Thanks!