SlideShare une entreprise Scribd logo
1  sur  22
Télécharger pour lire hors ligne
Facebook FQL And Tweepy



             charsyam@naver.com
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"
 }
FQL = Facebook Query Language
http://developers.facebook.com/docs/reference/fql/
FQL = Facebook Query Language
         SQL like
         Easy to Use Graph API
SELECT status_id,message,TIME,SOURCE FROM
`status` WHERE uid = me()


                                Login User Unique ID
                                112345667889
Expression
SELECT [Field] FROM [Table] WHERE [conditions]
Expression
SELECT [Field] FROM [Table] WHERE [conditions]
SELECT [Field] FROM [Table]  Error

Limitation
Alawys Need Condtions Field
Expression
SELECT link_id, owner, owner_comment, created_time, title,
summary, url, image_urls FROM link WHERE link_id =
114961875194024
.fbconsole.py
https://raw.github.com/gist/1194123/fbconsole.py


Python Facebook Library
.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
.fbconsole.py Result(JSON)

[{u'post_id': u'100001220342847_269268529764053', u'message': u'uc81cuac00
uc911ud559uc0dd ub54c uac10ub3d9 ubc1buc73cuba74uc11c ud588ub358
uac8cuc784..nuc9c0uae08ub3c4 uac8cuc784 uad00ub828 uc77c
ud558uba74uc11c ub2f9uc2e0uc774 uac00uc7a5 uac10uba85uae4auac8c ud55c
uac8cuc784uc774 ubb34uc5c7uc785ub2c8uae4c?nub77cuace0
ubb3cuc5b4ubcfc ub54c uc8fcuc800 uc5c6uc774 ub300ub2f5ud558ub294
uac8cuc784..nnhttp://itunes.apple.com/us/app/another-world-20th-
anniversary/id460076328?mt=8nnuc5b4ub098ub354uc6d4ub4dcuac00 20uc8fcub144
uae30ub150ud310uc774 ub098uc654ub124uc694, uceacud558ud558 ^^', u'target_id':
None, u'actor_id': 100001220342847, u'comments': {u'count': 1, u'comment_list': [{u'text':
u'uc774uac74 uadf8ub798ud53d uc5ecubd80ub97c ub5a0ub098uc11c uaf2d
uc5d4ub529uc744 ubd10uc57c 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}}]
But, Facebook supports partial
     Can’t get Recent Activity
tweepy
http://code.google.com/p/tweepy/


Python Twitter Library
tweepy Sample
import tweepy

public_tweets = tweepy.api.public_timeline()
for tweet in public_tweets:
   print tweet.text
Need Twitter Access Token
    For OAuth
Go https://dev.twitter.com/apps
Create Twitter Access Token
Create Twitter Access Token
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
DEMO
Q&A
Thank you!

Contenu connexe

Similaire à Facebook fql and tweepy

Facebook's Apps II part
Facebook's Apps II partFacebook's Apps II part
Facebook's Apps II part
Felix Rivas
 
YQL: Master Of the Mix
YQL: Master Of the MixYQL: Master Of the Mix
YQL: Master Of the Mix
markandey
 
Version1.0 StartHTML000000227 EndHTML000034516 StartFragment0000.docx
Version1.0 StartHTML000000227 EndHTML000034516 StartFragment0000.docxVersion1.0 StartHTML000000227 EndHTML000034516 StartFragment0000.docx
Version1.0 StartHTML000000227 EndHTML000034516 StartFragment0000.docx
washingtonrosy
 
External Data Access with jQuery
External Data Access with jQueryExternal Data Access with jQuery
External Data Access with jQuery
Doncho Minkov
 

Similaire à Facebook fql and tweepy (20)

Facebook's Apps II part
Facebook's Apps II partFacebook's Apps II part
Facebook's Apps II part
 
Facebook and its development
Facebook and its developmentFacebook and its development
Facebook and its development
 
YQL: Master Of the Mix
YQL: Master Of the MixYQL: Master Of the Mix
YQL: Master Of the Mix
 
FOWA 09 - Open Strategy Applied
FOWA 09 - Open Strategy AppliedFOWA 09 - Open Strategy Applied
FOWA 09 - Open Strategy Applied
 
Yahoo - Open Applied
Yahoo - Open AppliedYahoo - Open Applied
Yahoo - Open Applied
 
Seti 09
Seti 09Seti 09
Seti 09
 
The State of JavaScript (2015)
The State of JavaScript (2015)The State of JavaScript (2015)
The State of JavaScript (2015)
 
Send.php
Send.phpSend.php
Send.php
 
Version1.0 StartHTML000000227 EndHTML000034516 StartFragment0000.docx
Version1.0 StartHTML000000227 EndHTML000034516 StartFragment0000.docxVersion1.0 StartHTML000000227 EndHTML000034516 StartFragment0000.docx
Version1.0 StartHTML000000227 EndHTML000034516 StartFragment0000.docx
 
Test upload
Test uploadTest upload
Test upload
 
ANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJ
ANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJ
ANDROID USING SQLITE DATABASE ADMINISTRATORS ~HMFTJ
 
FQL Overview
FQL OverviewFQL Overview
FQL Overview
 
H3 경쟁력있는 웹앱 개발을 위한 모바일 js 프레임웍
H3 경쟁력있는 웹앱 개발을 위한 모바일 js 프레임웍H3 경쟁력있는 웹앱 개발을 위한 모바일 js 프레임웍
H3 경쟁력있는 웹앱 개발을 위한 모바일 js 프레임웍
 
Web services and JavaScript
Web services and JavaScriptWeb services and JavaScript
Web services and JavaScript
 
Facebook Platform
Facebook PlatformFacebook Platform
Facebook Platform
 
External Data Access with jQuery
External Data Access with jQueryExternal Data Access with jQuery
External Data Access with jQuery
 
StirTrek 2018 - Rapid API Development with Sails
StirTrek 2018 - Rapid API Development with SailsStirTrek 2018 - Rapid API Development with Sails
StirTrek 2018 - Rapid API Development with Sails
 
YQL: Hacking on steroids - Yahoo! Open Hack Day 2012
YQL: Hacking on steroids - Yahoo! Open Hack Day 2012YQL: Hacking on steroids - Yahoo! Open Hack Day 2012
YQL: Hacking on steroids - Yahoo! Open Hack Day 2012
 
Playing With The Web
Playing With The WebPlaying With The Web
Playing With The Web
 
DEF CON 27 - workshop - JOSH REYNOLDS - from ek to dek slides
DEF CON 27 - workshop - JOSH REYNOLDS - from ek to dek slidesDEF CON 27 - workshop - JOSH REYNOLDS - from ek to dek slides
DEF CON 27 - workshop - JOSH REYNOLDS - from ek to dek slides
 

Plus de DaeMyung Kang

Plus de DaeMyung Kang (20)

Count min sketch
Count min sketchCount min sketch
Count min sketch
 
Redis
RedisRedis
Redis
 
Ansible
AnsibleAnsible
Ansible
 
Why GUID is needed
Why GUID is neededWhy GUID is needed
Why GUID is needed
 
How to use redis well
How to use redis wellHow to use redis well
How to use redis well
 
The easiest consistent hashing
The easiest consistent hashingThe easiest consistent hashing
The easiest consistent hashing
 
How to name a cache key
How to name a cache keyHow to name a cache key
How to name a cache key
 
Integration between Filebeat and logstash
Integration between Filebeat and logstash Integration between Filebeat and logstash
Integration between Filebeat and logstash
 
How to build massive service for advance
How to build massive service for advanceHow to build massive service for advance
How to build massive service for advance
 
Massive service basic
Massive service basicMassive service basic
Massive service basic
 
Data Engineering 101
Data Engineering 101Data Engineering 101
Data Engineering 101
 
How To Become Better Engineer
How To Become Better EngineerHow To Become Better Engineer
How To Become Better Engineer
 
Kafka timestamp offset_final
Kafka timestamp offset_finalKafka timestamp offset_final
Kafka timestamp offset_final
 
Kafka timestamp offset
Kafka timestamp offsetKafka timestamp offset
Kafka timestamp offset
 
Data pipeline and data lake
Data pipeline and data lakeData pipeline and data lake
Data pipeline and data lake
 
Redis acl
Redis aclRedis acl
Redis acl
 
Coffee store
Coffee storeCoffee store
Coffee store
 
Scalable webservice
Scalable webserviceScalable webservice
Scalable webservice
 
Number system
Number systemNumber system
Number system
 
webservice scaling for newbie
webservice scaling for newbiewebservice scaling for newbie
webservice scaling for newbie
 

Dernier

Dernier (20)

On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 

Facebook fql and tweepy

  • 1. Facebook FQL And Tweepy charsyam@naver.com
  • 2. 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" }
  • 3. FQL = Facebook Query Language http://developers.facebook.com/docs/reference/fql/
  • 4. FQL = Facebook Query Language SQL like Easy to Use Graph API
  • 5. SELECT status_id,message,TIME,SOURCE FROM `status` WHERE uid = me() Login User Unique ID 112345667889
  • 6. Expression SELECT [Field] FROM [Table] WHERE [conditions]
  • 7. Expression SELECT [Field] FROM [Table] WHERE [conditions] SELECT [Field] FROM [Table]  Error Limitation Alawys Need Condtions Field
  • 8. Expression SELECT link_id, owner, owner_comment, created_time, title, summary, url, image_urls FROM link WHERE link_id = 114961875194024
  • 10. .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
  • 11. .fbconsole.py Result(JSON) [{u'post_id': u'100001220342847_269268529764053', u'message': u'uc81cuac00 uc911ud559uc0dd ub54c uac10ub3d9 ubc1buc73cuba74uc11c ud588ub358 uac8cuc784..nuc9c0uae08ub3c4 uac8cuc784 uad00ub828 uc77c ud558uba74uc11c ub2f9uc2e0uc774 uac00uc7a5 uac10uba85uae4auac8c ud55c uac8cuc784uc774 ubb34uc5c7uc785ub2c8uae4c?nub77cuace0 ubb3cuc5b4ubcfc ub54c uc8fcuc800 uc5c6uc774 ub300ub2f5ud558ub294 uac8cuc784..nnhttp://itunes.apple.com/us/app/another-world-20th- anniversary/id460076328?mt=8nnuc5b4ub098ub354uc6d4ub4dcuac00 20uc8fcub144 uae30ub150ud310uc774 ub098uc654ub124uc694, uceacud558ud558 ^^', u'target_id': None, u'actor_id': 100001220342847, u'comments': {u'count': 1, u'comment_list': [{u'text': u'uc774uac74 uadf8ub798ud53d uc5ecubd80ub97c ub5a0ub098uc11c uaf2d uc5d4ub529uc744 ubd10uc57c 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}}]
  • 12. But, Facebook supports partial Can’t get Recent Activity
  • 14. tweepy Sample import tweepy public_tweets = tweepy.api.public_timeline() for tweet in public_tweets: print tweet.text
  • 15. Need Twitter Access Token For OAuth
  • 19. 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
  • 20. DEMO
  • 21. Q&A