yql: master of the mix
TRANSCRIPT
YQL: Master of Mix
Hello!!IIT Madras
Mixing is amazing!!
Mix Chemicals
Classic result of mixing
Classic result of mixing
Steel
Mix Drinks
Mix Music
DATA
DATA
I am Markandey Singh{JavaScript Hacker}
I work at Yahoo!
YQL is Fun….
YQL is Yahoo! Query Language
YQL is a
web service which works on SQL like syntax
On Webinformation is not structured
YQL makes easy to access unstructured
data
THIS IS YQL CONSOLE
SELECT A TABLE
SEE QUERY HERE
OUTPUT
TAKE AWAY QUERY URL
URL output
http://query.yahooapis.com/{query}
URL output
http://query.yahooapis.com/{query}
<xml>
</xml>
URL output
http://query.yahooapis.com/{query}
<xml>
</xml>
{ “json”:”json”}
JSON
{ “name”: “markandey”}
JSON with callback
foo ({ “name”: “markandey”});
YQL Console Demo
Lets see with example
Select * from
interestingness
select * from flickr.photos.interestingness(20) where api_key='0fbb2b721757f77a6a9d038f4649a2b'
select * from flickr.photos.interestingness(20) where api_key='0fbb2b721757f77a6a9d038f4649a2b'
<img src=“//farm{farm-id}.staticflickr.com/{server-id}/{id}_{secret}.jpg“>
select * from flickr.photos.interestingness(20) where api_key='0fbb2b721757f77a6a9d038f4649a2b'
Here is the code
This is what you get
http://bit.ly/yqlflickr
Flickr Demo
$session = curl_init($yql_query_url); curl_setopt($session, CURLOPT_RETURNTRANSFER,true); $json = curl_exec($session);
YQL With PHP
YUI().use('yql', function(Y) {
Y.YQL('select * from weather.forecast where location=90210', function(r) { //r now contains the result of the YQL Query //use the YQL Developer console to learn //what data is coming back in this object //and how that data is structured. });
});
YQL With YUI
YQL has many Yahoo! and non-yahoo tables
Page Scraping
Page Scraping URL
Page Scraping URL
XPATH
Page Scraping
select * from html where url=“------"
and xpath=“--------”;
Your site!!
select * from html where url=“http://www.iitm.ac.in/csdept"
and xpath=“……..”;
URL
select * from html where url=“http://www.iitm.ac.in/csdept"
and
xpath=“//div[@id="content"]/div/table[3]”;
XPATH
ChromYQLipchromy-clip
YQL console demoPage scraping
This is what You get
http://bit.ly/searchiitm
Search demo
Content Analysis with YQL
http://bit.ly/yqlcap
Picture me
http://bit.ly/pikme
What else YQL can do????
You can create your own table
Read more bit.ly/yqlODT
My random hello!! table
Table Demo
Store Secret on YQL
YQL hosted storage
insert into yql.storage.admin
(name, value) values (“value-name”,”value")
Store Secret on YQL
YQL hosted storage
Store Secret on YQL
YQL hosted storage
execute select update
Keys Demo
You Can Also Access Google Spreadsheet
via YQL
You need to publish spreadsheet to the web
You need to publish spreadsheet to the web
https://docs.google.com/spreadsheet/pub?key=0AgGxPO1AxEhldFZDNzAzQldLSGp2MzVGVXdlUnIxeUE&output=html
You need to publish spreadsheet to the web
https://docs.google.com/spreadsheet/pub?key=0AgGxPO1AxEhldFZDNzAzQldLSGp2MzVGVXdlUnIxeUE&output=CSV
You need to publish spreadsheet to the web
https://docs.google.com/spreadsheet/pub?key=0AgGxPO1AxEhldFZDNzAzQldLSGp2MzVGVXdlUnIxeUE&output=CSV
select * from csv where url=’….'
Siri vs fake
Siri Demo
2 More Things
Foo
http://bit.ly/foocode
Foo Demo
CodeFoo plugin for Sublime Text 2
http://bit.ly/codefoo2
Codefoo demo
Reach me
@markandey