Python 获取Twitter搜索结果
2014-06-28 07:54
447 查看
CODE:
RESULT:
#!/usr/bin/python # -*- coding: utf-8 -*- ''' Created on 2014-06-28 @author: guaguastd @name: search_for_tweet.py ''' if __name__ == '__main__': import json # import search from search import search_for_tweet # import login, see http://blog.csdn.net/guaguastd/article/details/31706155 from login import twitter_login # get the twitter access api twitter_api = twitter_login() # Show one sample search result by slicing the list... while 1: # input the query query = raw_input('\nInput the query(exit to quit): ') if query == 'exit': print 'Successfully exit!' break statuses = search_for_tweet(twitter_api, query) print json.dumps(statuses[0], indent=1)
RESULT:
Input the query(exit to quit): Hello world Length of statuses 100 Length of statuses 200 Length of statuses 200 { "contributors": null, "truncated": false, "text": "RT @harrystylds: 3 steps to make me the happiest girl in the world:\n\n1.notice and read this\n2.say hello\n3.follow me \n\n@harry_styles i love \u2026", "in_reply_to_status_id": null, "id": 485553920056385536, "favorite_count": 0, "source": "<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone</a>", "retweeted": false, "coordinates": null, "entities": { "symbols": [], "user_mentions": [ { "id": 1273625730, "indices": [ 3, 15 ], "id_str": "1273625730", "screen_name": "harrystylds", "name": "block bc harry" }, { "id": 181561712, "indices": [ 118, 131 ], "id_str": "181561712", "screen_name": "Harry_Styles", "name": "Harry Styles" } ], "hashtags": [], "urls": [] }, "in_reply_to_screen_name": null, "in_reply_to_user_id": null, "retweet_count": 1, "id_str": "485553920056385536", "favorited": false, "retweeted_status": { "contributors": null, "truncated": false, "text": "3 steps to make me the happiest girl in the world:\n\n1.notice and read this\n2.say hello\n3.follow me \n\n@harry_styles i love you :) x\nx13,723", "in_reply_to_status_id": null, "id": 485530761375006720, "favorite_count": 0, "source": "<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone</a>", "retweeted": false, "coordinates": null, "entities": { "symbols": [], "user_mentions": [ { "id": 181561712, "indices": [ 101, 114 ], "id_str": "181561712", "screen_name": "Harry_Styles", "name": "Harry Styles" } ], "hashtags": [], "urls": [] }, "in_reply_to_screen_name": null, "in_reply_to_user_id": null, "retweet_count": 1, "id_str": "485530761375006720", "favorited": false, "user": { "follow_request_sent": false, "profile_use_background_image": true, "default_profile_image": false, "id": 1273625730, "profile_background_image_url_https": "https://pbs.twimg.com/profile_background_images/378800000058925647/75a82de53c7b8bffd0135b66bdfd6414.png", "verified": false, "profile_text_color": "333333", "profile_image_url_https": "https://pbs.twimg.com/profile_images/485518231499988992/59Z4ScZA_normal.jpeg", "profile_sidebar_fill_color": "DDEEF6", "entities": { "description": { "urls": [] } }, "followers_count": 21073, "profile_sidebar_border_color": "FFFFFF", "id_str": "1273625730", "profile_background_color": "FFFFFF", "listed_count": 51, "is_translation_enabled": false, "utc_offset": -10800, "statuses_count": 53222, "description": "110514", "friends_count": 7582, "location": "brasil", "profile_link_color": "75B1CB", "profile_image_url": "http://pbs.twimg.com/profile_images/485518231499988992/59Z4ScZA_normal.jpeg", "following": false, "geo_enabled": false, "profile_banner_url": "https://pbs.twimg.com/profile_banners/1273625730/1404443951", "profile_background_image_url": "http://pbs.twimg.com/profile_background_images/378800000058925647/75a82de53c7b8bffd0135b66bdfd6414.png", "screen_name": "harrystylds", "lang": "pt", "profile_background_tile": false, "favourites_count": 4360, "name": "block bc harry", "notifications": false, "url": null, "created_at": "Sun Mar 17 00:27:41 +0000 2013", "contributors_enabled": false, "time_zone": "Atlantic Time (Canada)", "protected": false, "default_profile": false, "is_translator": false }, "geo": null, "in_reply_to_user_id_str": null, "lang": "en", "created_at": "Sat Jul 05 21:08:48 +0000 2014", "in_reply_to_status_id_str": null, "place": null, "metadata": { "iso_language_code": "en", "result_type": "recent" } }, "user": { "follow_request_sent": false, "profile_use_background_image": true, "default_profile_image": false, "id": 2537411935, "profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png", "verified": false, "profile_text_color": "333333", "profile_image_url_https": "https://pbs.twimg.com/profile_images/472720352250822656/ij-fsPk5_normal.jpeg", "profile_sidebar_fill_color": "DDEEF6", "entities": { "description": { "urls": [] } }, "followers_count": 3258, "profile_sidebar_border_color": "C0DEED", "id_str": "2537411935", "profile_background_color": "C0DEED", "listed_count": 3, "is_translation_enabled": false, "utc_offset": null, "statuses_count": 14015, "description": "", "friends_count": 1810, "location": "", "profile_link_color": "0084B4", "profile_image_url": "http://pbs.twimg.com/profile_images/472720352250822656/ij-fsPk5_normal.jpeg", "following": false, "geo_enabled": false, "profile_banner_url": "https://pbs.twimg.com/profile_banners/2537411935/1402070046", "profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png", "screen_name": "AkkiKhan07", "lang": "en", "profile_background_tile": false, "favourites_count": 1481, "name": "Aka$h ##", "notifications": false, "url": null, "created_at": "Sat May 31 12:42:38 +0000 2014", "contributors_enabled": false, "time_zone": null, "protected": false, "default_profile": true, "is_translator": false }, "geo": null, "in_reply_to_user_id_str": null, "lang": "en", "created_at": "Sat Jul 05 22:40:50 +0000 2014", "in_reply_to_status_id_str": null, "place": null, "metadata": { "iso_language_code": "en", "result_type": "recent" } } Input the query(exit to quit):
相关文章推荐
- 编写Python脚本来获取Google搜索结果的示例
- 编写Python脚本来获取Google搜索结果的示例
- 编写Python脚本来获取Google搜索结果的示例
- python如何获取百度搜索结果的真实URL
- python爬虫(11)身边的搜索专家——获取百度搜索结果
- C++和python如何获取百度搜索结果页面下信息对应的真实链接(百度搜索爬虫,可指定页数)
- Python 获取Twitter话题 (API)
- 用python和BeautifulSoup抓取百度搜索结果10-20页面中的网站链接
- 013] 百度地图API之城市POI搜索-获取所有结果(Android)
- 获取python执行shell命令的结果
- python获取命令行输出结果
- 研究搜索引擎获取搜索结果
- 百度地图8之城市POI搜索-获取所有结果(Android)
- [013] 百度地图API之城市POI搜索-获取所有结果(Android)
- 使用BeautifulSoup爬虫程序获取百度搜索结果的标题和url示例
- python 抓百度招聘信息,将搜索结果解析下来,用来跟踪招聘趋势数据,免费数据变为有用的东东
- PHP 批量获取 百度搜索结果 网址列表
- python获取命令行输出结果
- 用python通过apache log 获取百度搜索来源关键词
- python,抓取百度搜索结果