open hack day bangalore: hacking yahoo! social

Post on 16-May-2015

4.422 Views

Category:

Education

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

Introduction to Yahoo! Social APIs

TRANSCRIPT

Saurabh Sahni Developer, Hacker, Evangelist

Hacking Yahoo! Social and Meme

User Data 

Updates 

Connec/ons 

Status 

h3p://pulse.yahoo.com/sahni_saurabh 

YAHOO! MESSENGER 

Y! Social APIs

h3p://developer.yahoo.com/social/ 

    SOCIAL     DIRECTORY  

 YAHOO!  CONTACTS 

STATUS 

MEME 

UPDATES 

Leverage Yahoo!’s 600+ million users in your social

applications with Yahoo!’s Social APIs.

 Open applica/ons are applica/ons that run on the Yahoo! network or other open social containers 

 OAuth applica/ons are standalone applica/ons that run off the Yahoo! network. 

Two ways to hack Social APIs

Easiest way to use Social APIs is via

YQL

h3p://developer.yahoo.com/yql/console/ 

h3p://developer.yahoo.com/yql/console/ 

Fetching your profile data

select * from social.profile where guid=me;

Profile Data 

Finding your contacts

select * from social.contacts where guid=me;

Contacts 

Fetching any user’s profile data

select * from social.profile where guid=

‘7VABDKK365VEHCUDYFO6HUSKQM’;

Fetching your updates

select * from social.updates where guid=me;

Updates 

Updates from your contacts

select * from social.contacts.updates where guid=me;

Updates Firehose

Access all Yahoo! Updates in real time via YQL h3p://www.flickr.com/photos/thomashawk/250792779/ 

Update Sources: 75+

http://developer.yahoo.com/social/rest_api_guide/updates-update_sources.html

Updates Firehose 

Finding updates about iPad

select * from social.updates.search where query=’iPad';

Updates associated with huffingtonpost.com

select * from social.updates.search where link='huffingtonpost.com';

Tweets in Yahoo! Updates

select * from social.updates.search where source = 'twitter';

Updates from your application

select * from social.updates.search where source = '7BNRkt42';

Yahoo! Meme: meme.yahoo.com 

My Meme: h3p://meme.yahoo.com/saurabhsahni 

Yahoo! Meme Dashabord: meme.yahoo.com 

Meme API: http://developer.yahoo.com/meme/

More with meme

•  INSERT INTO meme.user.posts (type, content, caption) VALUES ("photo", "http://www.yahoo.com/myphoto.jpg", "this is the photo caption”)

•  INSERT INTO meme.user.posts (type, content, caption) VALUES ("video", "http://www.vimeo.com/12345", "this video is awesome")

•  SELECT * FROM meme.search WHERE query=”hackday”

•  SELECT * FROM meme.popular WHERE locale='in'

34 

Y! Social SDK  What can you do? 

h3p://www.flickr.com/photos/phploveme/2847931240/ 

Yahoo! Social SDK – Features 

•  Examples for OpenSocial, PHP, Python

•  Performs OAuth authorizaiton

•  REST calls to the Yahoo! Social Web Services

–  Fetching Profiles

–  Fetching and Inserting Updates

–  Fetching Connections

–  Executing YQL

SDK Languages hHp://developer.yahoo.com/social/sdk/ 

Scalable Hosting

h3p://signup.joyent.com/yahoo_signup  

Example Apps

Flixter on Yahoo!

USER DATA 

DATA  

LOCATION 

    UPDATES   

CONTACTS 

AUTHENTICATION 

Updatesville

Updatesville

Social Search

Social Search

Social Search

Slidememe

Slidememe

Slidememe

Hack: Updates in your language

h3p://www.flickr.com/photos/dimitridf/2841804136/ 

DEMO

h3ps://developer.apps.yahoo.com/projects/  

h3ps://developer.apps.yahoo.com/projects/ 

Gadget XML: h3p://github.com/saurabhsahni/Hacks  

PHP Code: h3p://github.com/saurabhsahni/Hacks 

PHP Example: OAuth Dance 

$session = YahooSession::requireSession($key, $secret, $app_id)

$user = $session->getSessionedUser();

var_dump($user);

Social Data with YQL ‐ Recap  

select * from social.profile where guid=me

select * from social.connections where owner_guid=me

select message from social.profile.status where guid=me

select * from social.updates where guid=me

PHP Example: ExecuTng YQL 

$session = YahooSession::requireSession($key, $secret, $app_id)

$results = $session->query(‘select * from social.updates where guid=me’);

var_dump($results);

PHP Example: InserTng Updates 

$session = YahooSession::requireSession ($key, $secret, $app_id)

$user = $session->getSessionedUser();

$update = $user->insertUpdate($suid, $title, $link, $description);

var_dump($update);

GeUng Started ‐ DocumentaTon

•  Yahoo! Social APIs - http://developer.yahoo.com/social/

•  Meme APIs: http://developer.yahoo.com/meme/

•  Yahoo! Query Language - http://developer.yahoo.com/yql/

•  Yahoo! Social SDKs- http://developer.yahoo.com/social/sdk/

•  Examples - http://github.com/saurabhsahni/Hacks

THANK YOU! 

Saurabh Sahni h3p://www.saurabhsahni.com  h3p://twi3er.com/saurabhsahni h3p://pulse.yahoo.com/sahni_saurabh  h3p://slideshare.net/saurabhsahni 

Appendix

What is OpenSocial? 

•  OpenSocial API •  For developing applicaTons on social networks •  Accessing social data (profiles, connecTons) •  Fetching and inserTng acTviTes 

•  Implemented by many containers •  Develop once, distribute broadly 

Python Example: OAuth Dance 

oauthapp = yahoo.application.OAuthApplication (key, secret, app_id, callback)

# fetch unauthorized request token request_token = oauthapp.get_request_token(callback)

# authorize request token authorization_url = oauthapp.get_authorization_url(request_token)

# refresh authorized request token with access token access_token = oauthapp.get_access_token(request_token)

oauthapp.token = access_token

Python Example: Fetching Profile Data

oauthapp = yahoo.application.OAuthApplication(key, secret, app_id, callback)

profile = oauthapp.getProfile()

print profile

Python Example: ExecuTng YQL 

oauthapp = yahoo.application.OAuthApplication(key, secret, app_id, callback)

results = oauthapp.yql('select * from social.profile where guid=me')

print results

top related