Python 获取新浪微博的最新公共微博实例分享

2018-10-15 17:15

阅读:436

API:

statuses/public_timeline 返回最新的200条公共微博,返回结果非完全实时

CODE:

#!/usr/bin/python # -*- coding: utf-8 -*- Created on 2014-7-3 @author: guaguastd @name: statuses_public_timeline.py def public_timeline(weibo_api, count): #public_timeline = weibo_api.statuses.public_timeline.get(count=count) public_timeline = weibo_api.statuses__public_timeline(count=count) statuses = public_timeline[statuses] return statuses if __name__ == __main__: # import json import json # import login, from login import weibo_login # get the twitter access api weibo_api = weibo_login() # get the new 200 weibo content = public_timeline(weibo_api, 200) print json.dumps(content, indent=1)


RESULT:

[cc7c9d31fc797802960c84822c3654f3] [ { reposts_count: 0, truncated: false, text: \u5982\u679c\u4f60\u4e5f\u6709\u75d8\u75d8 \u75d8\u5370 \u6bdb\u5b54\u7c97\u5927 \u6697\u6c89\u6591\u70b9 \u5e72\u71e5 \u7ea2\u8840\u4e1d \u51fa\u6cb9\u9ed1\u5934 \u9ed1\u773c\u5708 \u773c\u888b \u62a4\u7406 \u51cf\u80a5 \u7b49\u7b49\u53ef\u4ee5\u52a0\u8001\u5e08QQ:1817712253\u4e00\u8d77\u5b66\u4e60, visible: { type: 0, list_id: 0 }, in_reply_to_status_id: , bmiddle_pic:

原文地址:


评论


亲,登录后才可以留言!