+ All Categories
Home > Technology > HackU: IIT Madras: Hacking Yahoo! Social

HackU: IIT Madras: Hacking Yahoo! Social

Date post: 22-Nov-2014
Category:
Upload: saurabh-sahni
View: 2,598 times
Download: 0 times
Share this document with a friend
Description:
Introduction to Yahoo! social APIs and open applications
80
` Hacking Yahoo! Social Saurabh Sahni Developer, Hacker, Evangelist
Transcript
Page 1: HackU: IIT Madras: Hacking Yahoo! Social

Hacking Yahoo! Social

Saurabh Sahni Developer, Hacker, Evangelist

Page 2: HackU: IIT Madras: Hacking Yahoo! Social

Yahoo! Audience is the Platform

Page 3: HackU: IIT Madras: Hacking Yahoo! Social

1) Open Applications

Run your applications across Yahoo!

Reach large Yahoo! audience

Two ways to hack Yahoo! Social

2) Social APIs

Syndicate UGC

Get referral traffic back to your site

HOME PAGE 

MY YAHOO! 

…more coming soon 

Y! TOOLBAR 

PULSE 

CONTACTS 

SOCIAL DIRECTORY  UPDATES 

STATUS 

Page 4: HackU: IIT Madras: Hacking Yahoo! Social

Open Applications

HOME PAGE 

MY YAHOO! 

…more coming soon 

Y! TOOLBAR 

PULSE 

Page 5: HackU: IIT Madras: Hacking Yahoo! Social
Page 6: HackU: IIT Madras: Hacking Yahoo! Social
Page 7: HackU: IIT Madras: Hacking Yahoo! Social
Page 8: HackU: IIT Madras: Hacking Yahoo! Social
Page 9: HackU: IIT Madras: Hacking Yahoo! Social
Page 10: HackU: IIT Madras: Hacking Yahoo! Social

Why hack open apps?

MY APP 

SOCIAL ‐ Access user Profile & ConnecBon data ‐ InteracBve, personalized 

DISTRIBUTABLE ‐ Discovery ‐ PromoBon 

‐ Media buy enhanced 

ENGAGING ‐ Permanently parked in high‐traffic starBng points ‐ Viral in nature 

EASY TO BUILD ‐ Quickly prototype idea within 24 hours 

‐ Launch directly in producBon. No blockers! 

Page 11: HackU: IIT Madras: Hacking Yahoo! Social

YAP: Programming Model

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

Page 12: HackU: IIT Madras: Hacking Yahoo! Social

YAP : Small View

•  Small size •  Cached, needs to be

fast •  Supports only: Html,

Inline css, YML

Page 13: HackU: IIT Madras: Hacking Yahoo! Social

YAP: Canvas View

•  Loads external URL from your server

•  Support for: •  Open social

•  YML, CSS, HTML, JS

•  Runs in an iFrame with Caja

•  Yahoo! SDK

Page 14: HackU: IIT Madras: Hacking Yahoo! Social

YAP - Accessing User Data

•  Guid – Unique identifier for a user

– Public info, can be stored on your servers

•  Consumer Key / Secret – Specifies “API Scopes” – Enables to query Yahoo! WS

– Necessary for OAuth 1.1 authentication

– Automatically created for you in devTool

Page 15: HackU: IIT Madras: Hacking Yahoo! Social

‐  ‐ 

Social Platforms: Available APIs

•  Social Directory: One Social Graph – Contacts, connections & profile data

•  Updates – Syndicate user content & activity

•  Presence – Read, write presence

•  SDK simplifies access •  Make it easy: YQL

Page 16: HackU: IIT Madras: Hacking Yahoo! Social

‐  ‐ 

YML: Yummy Language To Get You Started

•  Enables you to get cool features fast – <yml:a view=”Full” params=”prefs.php”/> •  Enables ajaxy behaviors in SmallView

– <yml:profile-pic uid=”XXX”>

– <yml:name uid=”viewer” linked="true"/> –   <yml:friend-selector uid="viewer"/>  

–  <yml:user-badge uid="viewer" linked="true” />   

More: hXp://developer.yahoo.com/yap/guide/yapdev‐yml.html  

Page 17: HackU: IIT Madras: Hacking Yahoo! Social

YAP Cautions

•  Your gadget URL needs to be a prod host •  Not all HTML/JS will run for security

•  JS/HTML will be cajoled

•  YML and OpenSocial are whitelisted

•  Small view: •  No Javascript •  NO CSS

•  No <a> Links except via YML

Page 18: HackU: IIT Madras: Hacking Yahoo! Social

2. Y! Social APIs

hXp://developer.yahoo.com/social/ 

Page 19: HackU: IIT Madras: Hacking Yahoo! Social

User Data 

Updates 

ConnecBons 

Status 

hXp://pulse.yahoo.com/sahni_saurabh 

Page 20: HackU: IIT Madras: Hacking Yahoo! Social
Page 21: HackU: IIT Madras: Hacking Yahoo! Social
Page 22: HackU: IIT Madras: Hacking Yahoo! Social
Page 23: HackU: IIT Madras: Hacking Yahoo! Social

YAHOO! MESSENGER 

Page 24: HackU: IIT Madras: Hacking Yahoo! Social

Y! Social APIs

hXp://developer.yahoo.com/social/ 

    SOCIAL     DIRECTORY  

 YAHOO!  CONTACTS 

STATUS 

UPDATES 

Page 25: HackU: IIT Madras: Hacking Yahoo! Social

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

applications with Yahoo!’s Social APIs.

Page 26: HackU: IIT Madras: Hacking Yahoo! Social

 Open applicaBons are applicaBons that run on the Yahoo! network or other open social containers 

 OAuth applicaBons are standalone applicaBons that run off the Yahoo! network. 

Two ways use Social APIs

Page 27: HackU: IIT Madras: Hacking Yahoo! Social

Easiest way to use Social APIs is via

YQL

Page 28: HackU: IIT Madras: Hacking Yahoo! Social

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

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

Page 29: HackU: IIT Madras: Hacking Yahoo! Social

select * from social.profile where guid=me;

Fetching your profile data

Page 30: HackU: IIT Madras: Hacking Yahoo! Social

Profile Data 

Page 31: HackU: IIT Madras: Hacking Yahoo! Social

select * from social.contacts where guid=me;

Finding your contacts

Page 32: HackU: IIT Madras: Hacking Yahoo! Social

Contacts 

Page 33: HackU: IIT Madras: Hacking Yahoo! Social

select * from social.profile where guid=

‘7VABDKK365VEHCUDYFO6HUSKQM’;

Fetching any user’s profile data

Page 34: HackU: IIT Madras: Hacking Yahoo! Social

select * from social.updates where guid=me;

Fetching your updates

Page 35: HackU: IIT Madras: Hacking Yahoo! Social

Updates 

Page 36: HackU: IIT Madras: Hacking Yahoo! Social

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

Updates from your contacts

Page 37: HackU: IIT Madras: Hacking Yahoo! Social

Access all Yahoo! Updates in real time via YQL

Updates Firehose

hXp://www.flickr.com/photos/thomashawk/250792779/ 

Page 38: HackU: IIT Madras: Hacking Yahoo! Social

Update Sources: 75+

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

Page 39: HackU: IIT Madras: Hacking Yahoo! Social

Updates Firehose 

Page 40: HackU: IIT Madras: Hacking Yahoo! Social

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

Finding updates about iPad

Page 41: HackU: IIT Madras: Hacking Yahoo! Social

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

Updates associated with nytimes.com

Page 42: HackU: IIT Madras: Hacking Yahoo! Social

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

Tweets in Yahoo! Updates

Page 43: HackU: IIT Madras: Hacking Yahoo! Social

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

Updates from your application

Page 44: HackU: IIT Madras: Hacking Yahoo! Social

44 

 Y! Social SDK  What can you do? 

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

Page 45: HackU: IIT Madras: Hacking Yahoo! Social

•  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

Yahoo! Social SDK – Features 

Page 46: HackU: IIT Madras: Hacking Yahoo! Social

hIp://developer.yahoo.com/social/sdk/ 

SDK Languages 

Page 47: HackU: IIT Madras: Hacking Yahoo! Social

Scalable Hosting

hXp://signup.joyent.com/yahoo_signup  

Page 48: HackU: IIT Madras: Hacking Yahoo! Social

Example Apps

Page 49: HackU: IIT Madras: Hacking Yahoo! Social

Flixter on Yahoo!

USER DATA 

DATA  

LOCATION 

    UPDATES   

CONTACTS 

AUTHENTICATION 

Page 50: HackU: IIT Madras: Hacking Yahoo! Social

Updatesville

Page 51: HackU: IIT Madras: Hacking Yahoo! Social

Updatesville

Page 52: HackU: IIT Madras: Hacking Yahoo! Social

Social Search

Social Search

Page 53: HackU: IIT Madras: Hacking Yahoo! Social

Social Search

Page 54: HackU: IIT Madras: Hacking Yahoo! Social

•  Materialize Social Graph data for engaging experiences

•  Build apps for Yahoo! network and reach 600M+ audience

•  Use updates API to make your hacks viral

•  Improve social search experience •  Think social games!

•  Personalize your hacks with Yahoo! Profile data. Use Yahoo! Login.

What can you do?

Page 55: HackU: IIT Madras: Hacking Yahoo! Social

Hack: Updates in your language

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

Page 56: HackU: IIT Madras: Hacking Yahoo! Social
Page 57: HackU: IIT Madras: Hacking Yahoo! Social

DEMO

Page 58: HackU: IIT Madras: Hacking Yahoo! Social
Page 59: HackU: IIT Madras: Hacking Yahoo! Social
Page 60: HackU: IIT Madras: Hacking Yahoo! Social

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

Page 61: HackU: IIT Madras: Hacking Yahoo! Social

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

Page 62: HackU: IIT Madras: Hacking Yahoo! Social
Page 63: HackU: IIT Madras: Hacking Yahoo! Social

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

Page 64: HackU: IIT Madras: Hacking Yahoo! Social
Page 65: HackU: IIT Madras: Hacking Yahoo! Social
Page 66: HackU: IIT Madras: Hacking Yahoo! Social
Page 67: HackU: IIT Madras: Hacking Yahoo! Social

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

Page 68: HackU: IIT Madras: Hacking Yahoo! Social
Page 69: HackU: IIT Madras: Hacking Yahoo! Social
Page 70: HackU: IIT Madras: Hacking Yahoo! Social

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

$user = $session->getSessionedUser();

var_dump($user);

PHP Example: OAuth Dance 

Page 71: HackU: IIT Madras: Hacking Yahoo! Social

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

Social Data with YQL ‐ Recap  

Page 72: HackU: IIT Madras: Hacking Yahoo! Social

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

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

var_dump($results);

PHP Example: ExecuUng YQL 

Page 73: HackU: IIT Madras: Hacking Yahoo! Social

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

$user = $session->getSessionedUser();

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

var_dump($update);

PHP Example: InserUng Updates 

Page 74: HackU: IIT Madras: Hacking Yahoo! Social

•  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

GeVng Started ‐ DocumentaUon

Page 75: HackU: IIT Madras: Hacking Yahoo! Social

THANK YOU! 

Saurabh Sahni hXp://www.saurabhsahni.com  hXp://twiXer.com/saurabhsahni hXp://pulse.yahoo.com/sahni_saurabh  hXp://slideshare.net/saurabhsahni 

Page 76: HackU: IIT Madras: Hacking Yahoo! Social

Appendix

Page 77: HackU: IIT Madras: Hacking Yahoo! Social

•  OpenSocial API •  For developing applicaUons on social networks •  Accessing social data (profiles, connecUons) •  Fetching and inserUng acUviUes 

•  Implemented by many containers •  Develop once, distribute broadly 

What is OpenSocial? 

Page 78: HackU: IIT Madras: Hacking Yahoo! Social

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

Page 79: HackU: IIT Madras: Hacking Yahoo! Social

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

profile = oauthapp.getProfile()

print profile

Python Example: Fetching Profile Data

Page 80: HackU: IIT Madras: Hacking Yahoo! Social

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

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

print results

Python Example: ExecuUng YQL 


Recommended