Select * from internet

Post on 20-Jan-2015

252 views 0 download

Tags:

description

 

Transcript of Select * from internet

Select * from Internet

Markandey Singh

http://bit.ly/yqlagency

$ Hello!

$ whoami@markandey

I work @

Yahoo!

I am a {JavaScript}

Hacker

Advertising on web is not same as on paper.

On web, Ads Have power of HTML5.

To make great (html5 app)

Ads

shift your point of view

From Ad to data

From Ad to data

Ad is not start

Ad comes at the end and need most of

the work

What you start

with is information

and a goal

What you start

with is 1nf0rmat10nand a goal

On Webinformation is not always structured

YQL makes easy to access

unstructured data

YQLis

Yahoo! Query Language

YQLis

Yahoo! Query Languageand its not a language

of its own.

YQLis a

web service which works on SQL like syntax

YQL lets you access data from Yahoo!

YQL lets you access data from Yahoo!

& rest of web

Select {What} from {service} where {condition};

For example

select * from flickr.photos.search where

text=”Delhi" and api_key='2149834c0fb3e9e84de9c3

1d50c7a97d'

Lets start with YQL console

SELECT A TABLE

SEE QUERY HERE

OUTPUT

TAKE AWAY QUERY URL

URL Output

http://query.yahooapis.com/{query}

<xml>

</xml

{ ‘json’:’json’ }

Lets see with example

select * from flickr.photos.interestingness

Here is the code

JSON

{ “photo”: “xyzphr”, “user”: “phfhfb”}

JSON with callback

foo ({ “photo”: “xyzphr”, “user”: “phfhfb”});

This is what you get

http://bit.ly/yqlflickr

$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

Page Scraping

select * from html where url=“------" and

xpath=“--------”;

Delhi FM Radio

select * from html where url=“http://www.radiomirchi.com/delhi" and xpath=“…”;

URL

select * from html where url=“http://www.radiomirchi.com/delhi" and xpath=“//marquee[@id="ticker_nowplaying"]”;

XPATH

You can search currently playing song

on youtube

select * from youtube.search where query="currently playing song”

Can you think of a hack???

+

This is what You get

http://bit.ly/yqlmirchi

ChromYQLipchromy-clip

bit.ly/yqlhtml

Content Analysis with YQL

bit.ly/yqlcap

One catch with CAP

One catch with CAP

URL length is limited , so you have to switch back to POST, method on YQL.

Lets see some more hacks

Picture me

bit.ly/pikme

What else YQL can do????

You can create your own table

Read more bit.ly/yqlODT

My random hello!! table

You can store secrets on YQL

60

Twitter oauthSELECT * FROM twitter.STATUS.timeline.friendsWHERE oauth_consumer_key = '9DiJt6Faw0Dyr61tVOATA'AND oauth_consumer_secret = 'XBF9j0B2SZAOWg44QTu6fCwYy5JtivoNNpvJMs6cA'AND oauth_token = '18342542-NkgUoRinvdJVILEwCUQJ3sL2CIm2ZwzS5jjj2Lg7y'AND oauth_token_secret = 'D6ewAzsueTzQmrAJGFH0phV5zgWT88FOtcMeqW4YeI';

YQL

Local storage

oauth_token

oauth_token

oauth_consumer_key

oauth_consumer_secret

Read more here

http://bit.ly/yqloauth

Placemaker: geo this

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=’….'

Google Spreadsheetswrite-protected can have specific access.

More Hacks here

http://bit.ly/markhack

Siri vs fake

http://bit.ly/sirichrome

Reach me

twitter@markandey

http://bit.ly/yqlflickrhttp://bit.ly/yqlmirchihttp://bit.ly/yqlhtmlhttp://bit.ly/yqlcaphttp://bit.ly/pikmehttp://bit.ly/yqlODThttp://bit.ly/yqloauthhttp://bit.ly/markhackhttp://bit.ly/sirichrome