Facebook fql and tweepy

22
Facebook FQL And Tweepy [email protected]

description

 

Transcript of Facebook fql and tweepy

Page 1: Facebook fql and tweepy

Facebook FQL And Tweepy

[email protected]

Page 2: Facebook fql and tweepy

Facebook Graph API(Json) http://developers.facebook.com/docs/reference/api/

{ "name": "Facebook Platform", "type": "page", "website": "http://developers.facebook.com", "username": "platform", "founded": "May 2007", "company_overview": "Facebook Platform enables anyone to build...", "mission": "To make the web more open and social.", "products": "Facebook Application Programming Interface (API)...", "likes": 449921, "id": 19292868552, "category": "Technology" }

Page 3: Facebook fql and tweepy

FQL = Facebook Query Language http://developers.facebook.com/docs/reference/fql/

Page 4: Facebook fql and tweepy

FQL = Facebook Query Language

SQL like Easy to Use Graph API

Page 5: Facebook fql and tweepy

SELECT status_id,message,TIME,SOURCE FROM `status` WHERE uid = me()

Login User Unique ID 112345667889

Page 6: Facebook fql and tweepy

SELECT [Field] FROM [Table] WHERE [conditions]

Expression

Page 7: Facebook fql and tweepy

SELECT [Field] FROM [Table] WHERE [conditions]

Expression

Limitation Alawys Need Condtions Field

SELECT [Field] FROM [Table] Error

Page 8: Facebook fql and tweepy

SELECT link_id, owner, owner_comment, created_time, title, summary, url, image_urls FROM link WHERE link_id = 114961875194024

Expression

Page 9: Facebook fql and tweepy

.fbconsole.py https://raw.github.com/gist/1194123/fbconsole.py

Python Facebook Library

Page 10: Facebook fql and tweepy

.fbconsole.py Sample

from urllib import urlretrieve import imp urlretrieve('https://raw.github.com/gist/1194123/fbconsole.py', '.fbconsole.py') fb = imp.load_source('fb', '.fbconsole.py') fb.AUTH_SCOPE = ['read_stream'] fb.authenticate() comments = fb.fql( "SELECT post_id, actor_id, target_id, message, comments FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid=me() AND type='newsfeed') AND is_hidden = 0 LIMIT 1“ ) print comments

Page 11: Facebook fql and tweepy

.fbconsole.py Result(JSON)

[{u'post_id': u'100001220342847_269268529764053', u'message': u'\uc81c\uac00 \uc911\ud559\uc0dd \ub54c \uac10\ub3d9 \ubc1b\uc73c\uba74\uc11c \ud588\ub358 \uac8c\uc784..\n\uc9c0\uae08\ub3c4 \uac8c\uc784 \uad00\ub828 \uc77c \ud558\uba74\uc11c \ub2f9\uc2e0\uc774 \uac00\uc7a5 \uac10\uba85\uae4a\uac8c \ud55c \uac8c\uc784\uc774 \ubb34\uc5c7\uc785\ub2c8\uae4c?\n\ub77c\uace0 \ubb3c\uc5b4\ubcfc \ub54c \uc8fc\uc800 \uc5c6\uc774 \ub300\ub2f5\ud558\ub294 \uac8c\uc784..\n\nhttp://itunes.apple.com/us/app/another-world-20th-anniversary/id460076328?mt=8\n\n\uc5b4\ub098\ub354\uc6d4\ub4dc\uac00 20\uc8fc\ub144 \uae30\ub150\ud310\uc774 \ub098\uc654\ub124\uc694, \uceac\ud558\ud558 ^^', u'target_id': None, u'actor_id': 100001220342847, u'comments': {u'count': 1, u'comment_list': [{u'text': u'\uc774\uac74 \uadf8\ub798\ud53d \uc5ec\ubd80\ub97c \ub5a0\ub098\uc11c \uaf2d \uc5d4\ub529\uc744 \ubd10\uc57c \ub428..', u'likes': 0, u'time': 1316830670, u'fromid': 100001220342847, u'id': u'100001220342847_269268529764053_3910464', u'user_likes': False}], u'can_remove': False, u'can_post': True}}]

Page 12: Facebook fql and tweepy

But, Facebook supports partial

Can’t get Recent Activity

Page 13: Facebook fql and tweepy

tweepy http://code.google.com/p/tweepy/

Python Twitter Library

Page 14: Facebook fql and tweepy

tweepy Sample

import tweepy public_tweets = tweepy.api.public_timeline() for tweet in public_tweets: print tweet.text

Page 15: Facebook fql and tweepy

Need Twitter Access Token

For OAuth

Page 16: Facebook fql and tweepy

Go https://dev.twitter.com/apps

Page 17: Facebook fql and tweepy

Create Twitter Access Token

Page 18: Facebook fql and tweepy

Create Twitter Access Token

Page 19: Facebook fql and tweepy

Support API List For Timeline http://code.google.com/p/tweepy/wiki/APIReference

Timeline

Public_timeline Returns the 20 most recent public statuses

Home_timeline Returns the statuses of user and friends with retweets

Friends_timeline Returns the statuses of user and friends

User_timeline Returns the statuses of the user

Mentions Returns the mentions of the user

Retweeted_by_me Returns the retweets posted by the user

Retweeted_to_me Returns the retweets posted by the user's friends

Retweets_of_me Returns the tweets of the authenticated user that have been retweeted by others

Page 20: Facebook fql and tweepy

DEMO

Page 21: Facebook fql and tweepy

Q&A

Page 22: Facebook fql and tweepy

Thank you!