Python 获取Facebook instance

来源:互联网 发布:上海淘宝运营培训班 编辑:程序博客网 时间:2024/05/16 07:16

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 JSONdef 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/38433667from login import facebook_login# import helperfrom helper import pp# access to facebookfacebook_api = facebook_login()# Execute a few sample queriesmtsw_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 0