Python 获取Facebook instance

CODE:

#!/usr/bin/python 
# -*- coding: utf-8 -*-

'''
Created on 2014-8-8
@author: guaguastd
@name: helper.py
'''
    
# A helper function to pretty-print Python objects as JSON
def pp(o):
    
    import json
    print json.dumps(o, indent=1)
    

#!/usr/bin/python 
# -*- coding: utf-8 -*-

'''
Created on 2014-8-8
@author: guaguastd
@name: facebook_instance_get.py
'''

# impot login; refer to http://blog.csdn.net/guaguastd/article/details/38433667
from login import facebook_login

# import helper
from helper import pp

# access to facebook
facebook_api = facebook_login()

# Execute a few sample queries
mtsw_id = '146803958708175'

print '---------------'
print 'Query for Mining the Social Web'
print '---------------'
pp(facebook_api.get_object(mtsw_id))
print

RESULT:

---------------
Query for Mining the Social Web
---------------
{
 "website": "http://miningthesocialweb.com", 
 "can_post": true, 
 "company_overview": "Like It here on Facebook!\n\nFollow @SocialWebMining on Twitter: http://twitter.com/SocialWebMining\n\nGet the source code for the revised and expanded second edition on GitHub: http://bit.ly/MiningTheSocialWeb2E\n\nGet the (now legacy) source code for the first edition on GitHub: http://bit.ly/SocialWebMining", 
 "mission": "Teaches you how to navigate the most popular social web APIs to access, collect, analyze, and visualize social web data with IPython Notebook and other easy to use Python packages and visualization tools.", 
 "founded": "January 2011", 
 "likes": 1708, 
 "parking": {
  "street": 0, 
  "lot": 0, 
  "valet": 0
 }, 
 "general_info": "Analyzing Data from Facebook, Twitter, LinkedIn, and Other Social Media Sites - Get it at http://bit.ly/135dHfs", 
 "id": "146803958708175", 
 "category": "Book", 
 "has_added_app": false, 
 "talking_about_count": 12, 
 "is_community_page": false, 
 "username": "MiningTheSocialWeb", 
 "description": "Facebook, Twitter, LinkedIn, Google+, and other social web properties generate a wealth of valuable social data, but how can you tap into this data and discover who\u2019s connecting with whom, which insights are lurking just beneath the surface, and what people are talking about? This book shows you how to answer these questions and many more. Each chapter combines popular and useful social web data with analysis techniques and visualization to help you find the needles in the social haystack that you've been looking for\u2014as well as many you probably didn't even know existed.\n\nIn this expanded and thoroughly revised second edition you\u2019ll learn how to:\n\n* Navigate the most popular social web APIs to access, collect, analyze, and visualize social web data\n* Employ IPython Notebook and other easy to use Python packages such as the Natural Language Toolkit, NetworkX, and Matplotlib to efficiently sift through social web data as part of an experimentally-driven approach to discovering insights in social web data\n* Apply advanced text-mining techniques such as TF-IDF, cosine similarity, collocation analysis, document summarization, and clique detection to human language data that you'll encounter all over the web\n* Bootstrap interest graphs by discovering latent affinities between people, programming languages, and coding projects from GitHub data\n* Visualize social web data with D3, a state-of-the-art HTML5 and JavaScript toolkit\n\nThe book's source code is maintained in a GitHub repository maintained by the author and can be deployed as turn-key virtual machine with each chapter's source code presented in an interactive and easy to use IPython Notebook format. No complex third-party installations or advanced Python knowledge is required to get the most out of this book.", 
 "awards": "Jolt Productivity Award (1st Ed.) -  http://drdobbs.com/joltawards/231500080?pgno=6", 
 "genre": "Data Mining", 
 "checkins": 0, 
 "about": "Analyzing Data from Facebook, Twitter, LinkedIn, and Other Social Media Sites. Twitter: @SocialWebMining", 
 "name": "Mining the Social Web", 
 "release_date": "January 2011", 
 "cover": {
  "source": "https://scontent-a.xx.fbcdn.net/hphotos-frc3/t31.0-8/p180x540/1073953_522831997772034_741301400_o.jpg", 
  "cover_id": 522831997772034, 
  "offset_x": 0, 
  "offset_y": 56
 }, 
 "were_here_count": 0, 
 "link": "https://www.facebook.com/MiningTheSocialWeb", 
 "is_published": true
}


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值