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

The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptx
heathfieldcps1
 
Liberal & Redical Feminism presentation.pptx
Liberal & Redical Feminism presentation.pptxLiberal & Redical Feminism presentation.pptx
Liberal & Redical Feminism presentation.pptx
Rizwan Abbas
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
中 央社
 
ppt your views.ppt your views of your college in your eyes
ppt your views.ppt your views of your college in your eyesppt your views.ppt your views of your college in your eyes
ppt your views.ppt your views of your college in your eyes
ashishpaul799
 

Dernier (20)

2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptx
 
Keeping Your Information Safe with Centralized Security Services
Keeping Your Information Safe with Centralized Security ServicesKeeping Your Information Safe with Centralized Security Services
Keeping Your Information Safe with Centralized Security Services
 
MichaelStarkes_UncutGemsProjectSummary.pdf
MichaelStarkes_UncutGemsProjectSummary.pdfMichaelStarkes_UncutGemsProjectSummary.pdf
MichaelStarkes_UncutGemsProjectSummary.pdf
 
Mbaye_Astou.Education Civica_Human Rights.pptx
Mbaye_Astou.Education Civica_Human Rights.pptxMbaye_Astou.Education Civica_Human Rights.pptx
Mbaye_Astou.Education Civica_Human Rights.pptx
 
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
Removal Strategy _ FEFO _ Working with Perishable Products in Odoo 17
 
The Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational ResourcesThe Benefits and Challenges of Open Educational Resources
The Benefits and Challenges of Open Educational Resources
 
....................Muslim-Law notes.pdf
....................Muslim-Law notes.pdf....................Muslim-Law notes.pdf
....................Muslim-Law notes.pdf
 
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
Operations Management - Book1.p  - Dr. Abdulfatah A. SalemOperations Management - Book1.p  - Dr. Abdulfatah A. Salem
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
 
Liberal & Redical Feminism presentation.pptx
Liberal & Redical Feminism presentation.pptxLiberal & Redical Feminism presentation.pptx
Liberal & Redical Feminism presentation.pptx
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matrices
 
An Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptxAn Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptx
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
 
Morse OER Some Benefits and Challenges.pptx
Morse OER Some Benefits and Challenges.pptxMorse OER Some Benefits and Challenges.pptx
Morse OER Some Benefits and Challenges.pptx
 
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdfPost Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17
 
Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024
 
The Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryThe Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. Henry
 
ppt your views.ppt your views of your college in your eyes
ppt your views.ppt your views of your college in your eyesppt your views.ppt your views of your college in your eyes
ppt your views.ppt your views of your college in your eyes
 

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