Date post: | 22-Nov-2014 |
Category: |
Technology |
Upload: | saurabh-sahni |
View: | 2,598 times |
Download: | 0 times |
`
Hacking Yahoo! Social
Saurabh Sahni Developer, Hacker, Evangelist
Yahoo! Audience is the Platform
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
Open Applications
HOME PAGE
MY YAHOO!
…more coming soon
Y! TOOLBAR
PULSE
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!
YAP: Programming Model
hXp://www.flickr.com/photos/dimitridf/2841804136/
YAP : Small View
• Small size • Cached, needs to be
fast • Supports only: Html,
Inline css, YML
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
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
‐ ‐
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
‐ ‐
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
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
2. Y! Social APIs
hXp://developer.yahoo.com/social/
User Data
Updates
ConnecBons
Status
hXp://pulse.yahoo.com/sahni_saurabh
YAHOO! MESSENGER
Y! Social APIs
hXp://developer.yahoo.com/social/
SOCIAL DIRECTORY
YAHOO! CONTACTS
STATUS
UPDATES
Leverage Yahoo!’s 600+ million users in your social
applications with Yahoo!’s Social APIs.
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
Easiest way to use Social APIs is via
YQL
hXp://developer.yahoo.com/yql/console/
hXp://developer.yahoo.com/yql/console/
select * from social.profile where guid=me;
Fetching your profile data
Profile Data
select * from social.contacts where guid=me;
Finding your contacts
Contacts
select * from social.profile where guid=
‘7VABDKK365VEHCUDYFO6HUSKQM’;
Fetching any user’s profile data
select * from social.updates where guid=me;
Fetching your updates
Updates
select * from social.contacts.updates where guid=me;
Updates from your contacts
Access all Yahoo! Updates in real time via YQL
Updates Firehose
hXp://www.flickr.com/photos/thomashawk/250792779/
Update Sources: 75+
http://developer.yahoo.com/social/rest_api_guide/updates-update_sources.html
Updates Firehose
select * from social.updates.search where query=’iPad';
Finding updates about iPad
select * from social.updates.search where link='huffingtonpost.com';
Updates associated with nytimes.com
select * from social.updates.search where source = 'twitter';
Tweets in Yahoo! Updates
select * from social.updates.search where source = '7BNRkt42';
Updates from your application
44
Y! Social SDK What can you do?
hXp://www.flickr.com/photos/phploveme/2847931240/
• 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
hIp://developer.yahoo.com/social/sdk/
SDK Languages
Scalable Hosting
hXp://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
• 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?
Hack: Updates in your language
hXp://www.flickr.com/photos/dimitridf/2841804136/
DEMO
hXps://developer.apps.yahoo.com/projects/
hXps://developer.apps.yahoo.com/projects/
Gadget XML: hXp://github.com/saurabhsahni/Hacks
PHP Code: hXp://github.com/saurabhsahni/Hacks
$session = YahooSession::requireSession($key, $secret, $app_id)
$user = $session->getSessionedUser();
var_dump($user);
PHP Example: OAuth Dance
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
$session = YahooSession::requireSession($key, $secret, $app_id)
$results = $session->query(‘select * from social.updates where guid=me’);
var_dump($results);
PHP Example: ExecuUng YQL
$session = YahooSession::requireSession ($key, $secret, $app_id)
$user = $session->getSessionedUser();
$update = $user->insertUpdate($suid, $title, $link, $description);
var_dump($update);
PHP Example: InserUng Updates
• 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
THANK YOU!
Saurabh Sahni hXp://www.saurabhsahni.com hXp://twiXer.com/saurabhsahni hXp://pulse.yahoo.com/sahni_saurabh hXp://slideshare.net/saurabhsahni
Appendix
• 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?
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
oauthapp = yahoo.application.OAuthApplication(key, secret, app_id, callback)
profile = oauthapp.getProfile()
print profile
Python Example: Fetching Profile Data
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