Python gets the latest public microblog instance share for sina weibo
- 2020-04-02 13:49:11
- OfStack
API:
Statuses/the public_timeline Returns the latest 200 public tweets, and the results are not fully real-time
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)
The RESULT:
['cc7c9d31fc797802960c84822c3654f3']
[
{
"reposts_count": 0,
"truncated": false,
"text": "u5982u679cu4f60u4e5fu6709u75d8u75d8 u75d8u5370 u6bdbu5b54u7c97u5927 u6697u6c89u6591u70b9 u5e72u71e5 u7ea2u8840u4e1d u51fau6cb9u9ed1u5934 u9ed1u773cu5708 u773cu888b u62a4u7406 u51cfu80a5 u7b49u7b49u53efu4ee5u52a0u8001u5e08QQ:1817712253u4e00u8d77u5b66u4e60",
"visible": {
"type": 0,
"list_id": 0
},
"in_reply_to_status_id": "",
"bmiddle_pic": "http://ww3.sinaimg.cn/bmiddle/d1a02cb3jw1ehz8g6t1m6j20c90cdq3n.jpg",
"id": 3728143255299328,
"thumbnail_pic": "http://ww3.sinaimg.cn/thumbnail/d1a02cb3jw1ehz8g6t1m6j20c90cdq3n.jpg",
"mid": "3728143255299328",
"source": "<a href="http://app.weibo.com/t/feed/3auC5p" rel="nofollow">u76aeu76aeu65f6u5149u673a</a>",
"attitudes_count": 0,
"in_reply_to_screen_name": "",
"pic_urls": [
{
"thumbnail_pic": "http://ww3.sinaimg.cn/thumbnail/d1a02cb3jw1ehz8g6t1m6j20c90cdq3n.jpg"
}
],
"in_reply_to_user_id": "",
"darwin_tags": [],
"favorited": false,
"original_pic": "http://ww3.sinaimg.cn/large/d1a02cb3jw1ehz8g6t1m6j20c90cdq3n.jpg",
"idstr": "3728143255299328",
"user": {
"bi_followers_count": 252,
"domain": "",
"avatar_large": "http://tp4.sinaimg.cn/3516935347/180/40057950890/0",
"verified_source": "",
"ptype": 0,
"statuses_count": 419,
"allow_all_comment": true,
"id": 3516935347,
"verified_reason_url": "",
"city": "1",
"province": "43",
"block_app": 0,
"follow_me": false,
"verified_reason": "",
"followers_count": 420,
"location": "u6e56u5357 u957fu6c99",
"verified_trade": "",
"mbtype": 0,
"verified_source_url": "",
"profile_url": "u/3516935347",
"block_word": 0,
"avatar_hd": "http://ww3.sinaimg.cn/crop.54.22.120.120.1024/d1a02cb3gw1ehkk32gwyfj205k05k3yq.jpg",
"star": 0,
"description": "",
"friends_count": 1085,
"online_status": 0,
"mbrank": 0,
"allow_all_act_msg": false,
"profile_image_url": "http://tp4.sinaimg.cn/3516935347/50/40057950890/0",
"idstr": "3516935347",
"verified": false,
"geo_enabled": true,
"class": 1,
"screen_name": "u8425u517bu7f8eu5bb9u8bb2u5e08u5c0fu8fea",
"lang": "zh-cn",
"weihao": "",
"remark": "",
"favourites_count": 0,
"name": "u8425u517bu7f8eu5bb9u8bb2u5e08u5c0fu8fea",
"url": "",
"gender": "f",
"created_at": "Fri Jun 07 10:40:15 +0800 2013",
"worldcup_guess": 0,
"verified_type": -1,
"following": false
},
"geo": null,
"created_at": "Thu Jul 03 07:01:20 +0800 2014",
"mlevel": 0,
"comments_count": 1
},
{
"reposts_count": 0,
"truncated": false,
"text": "u301012u661fu5ea7u8001u516cu7684u4f18u70b9u3011u767du7f8auff1au4fddu62a4u4f60u7684u52c7u58ebuff1bu91d1u725buff1au4e0du6d6au8d39u3001u4e13u4e00uff1bu53ccu5b50uff1au806au660eu5e7du9ed8uff1bu5de8u87f9uff1au6e29u67d4u4f53u8d34uff1bu72eeu5b50uff1au80fdu4f9du9760u7684u5927u6811uff1bu5904u5973uff1au7231u505au5bb6u52a1uff1bu5929u79e4uff1au813eu6c14u6e29u548cuff1bu5929u874euff1au5584u89e3u4ebau610fuff1bu5c04u624buff1au70edu60c5u5927u5ea6uff1bu6469u7fafuff1au8d23u4efbu611fuff0cu6301u5bb6uff1bu6c34u74f6uff1au5236u9020u6d6au6f2buff1bu53ccu9c7cuff1au542cu8bdd",
"visible": {
"type": 0,
"list_id": 0
},
"in_reply_to_status_id": "",
"bmiddle_pic": "http://ww3.sinaimg.cn/bmiddle/005z8hcejw1ehz8g6u4jfj30f20m8mzr.jpg",
"id": 3728143254878451,
"thumbnail_pic": "http://ww3.sinaimg.cn/thumbnail/005z8hcejw1ehz8g6u4jfj30f20m8mzr.jpg",
"mid": "3728143254878451",
"source": "<a href="http://app.weibo.com/t/feed/3auC5p" rel="nofollow">u76aeu76aeu65f6u5149u673a</a>",
"attitudes_count": 0,
"in_reply_to_screen_name": "",
"pic_urls": [
{
"thumbnail_pic": "http://ww3.sinaimg.cn/thumbnail/005z8hcejw1ehz8g6u4jfj30f20m8mzr.jpg"
}
],
"in_reply_to_user_id": "",
"darwin_tags": [],
"favorited": false,
"original_pic": "http://ww3.sinaimg.cn/large/005z8hcejw1ehz8g6u4jfj30f20m8mzr.jpg",
"idstr": "3728143254878451",
"user": {
"bi_followers_count": 6,
"domain": "",
"avatar_large": "http://tp3.sinaimg.cn/5099808650/180/5693729982/0",
"verified_source": "",
"ptype": 0,
"statuses_count": 838,
"allow_all_comment": true,
"id": 5099808650,
"verified_reason_url": "",
"city": "5",
"province": "11",
"block_app": 0,
"follow_me": false,
"verified_reason": "",
"followers_count": 170,
"location": "u5317u4eac u671du9633u533a",
"verified_trade": "",
"mbtype": 0,
"verified_source_url": "",
"profile_url": "u/5099808650",
"block_word": 0,
"avatar_hd": "http://ww3.sinaimg.cn/crop.0.0.170.170.1024/005z8hcejw1efwksyxddwj304q04qa9x.jpg",
"star": 0,
"description": "",
"friends_count": 561,
"online_status": 0,
"mbrank": 0,
"allow_all_act_msg": false,
"profile_image_url": "http://tp3.sinaimg.cn/5099808650/50/5693729982/0",
"idstr": "5099808650",
"verified": false,
"geo_enabled": true,
"class": 1,
"screen_name": "u7231u5c31u4e0du6015u5371u9669",
"lang": "zh-cn",
"weihao": "",
"remark": "",
"favourites_count": 0,
"name": "u7231u5c31u4e0du6015u5371u9669",
"url": "",
"gender": "f",
"created_at": "Tue Apr 29 17:10:14 +0800 2014",
"worldcup_guess": 0,
"verified_type": -1,
"following": false
},
"geo": null,
"created_at": "Thu Jul 03 07:01:20 +0800 2014",
"mlevel": 0,
"comments_count": 0
},
{
"darwin_tags": [],
"favorited": false,
"mid": "3728143254878339",
"in_reply_to_user_id": "",
"truncated": false,
"text": "u90edu5fb7u7eb2 u4e8eu8c26 2012u6211u8981u5e78u798f http://t.cn/z0kupX1",
"created_at": "Thu Jul 03 07:01:20 +0800 2014",
"mlevel": 0,
"reposts_count": 0,
"idstr": "3728143254878339",
"visible": {
"type": 0,
"list_id": 0
},
"attitudes_count": 0,
"pic_urls": [],
"in_reply_to_screen_name": "",
"user": {
"bi_followers_count": 14,
"domain": "",
"avatar_large": "http://tp4.sinaimg.cn/5119417731/180/5696057764/1",
"verified_source": "",
"ptype": 0,
"statuses_count": 144,
"allow_all_comment": true,
"id": 5119417731,
"verified_reason_url": "",
"city": "1000",
"province": "100",
"block_app": 0,
"follow_me": false,
"verified_reason": "",
"followers_count": 137,
"location": "u5176u4ed6",
"verified_trade": "",
"mbtype": 0,
"verified_source_url": "",
"profile_url": "u/5119417731",
"block_word": 0,
"avatar_hd": "http://ww2.sinaimg.cn/crop.0.0.120.120.1024/005AsypJjw1egrq4a029bj303c03ct8j.jpg",
"star": 0,
"description": "u4e16u754cu4e0au90a3u4e9bu6700u5bb9u6613u7684u4e8bu60c5u4e2duff0cu62d6u5ef6u65f6u95f4u6700u4e0du8d39u529bu3002",
"friends_count": 183,
"online_status": 0,
"mbrank": 0,
"allow_all_act_msg": false,
"profile_image_url": "http://tp4.sinaimg.cn/5119417731/50/5696057764/1",
"idstr": "5119417731",
"verified": false,
"geo_enabled": true,
"class": 1,
"screen_name": "u521asiru768410000u5929u542cu5988u5988u7684u8bddu9759u599e",
"lang": "zh-cn",
"weihao": "",
"remark": "",
"favourites_count": 0,
"name": "u521asiru768410000u5929u542cu5988u5988u7684u8bddu9759u599e",
"url": "",
"gender": "m",
"created_at": "Sat May 10 17:55:53 +0800 2014",
"worldcup_guess": 0,
"verified_type": -1,
"following": false
},
"in_reply_to_status_id": "",
"comments_count": 0,
"geo": null,
"id": 3728143254878339,
"source": "<a href="http://app.weibo.com/t/feed/2o92Kh" rel="nofollow">vivo_Xplay</a>"
},
{
"reposts_count": 0,
"truncated": false,
"text": "u8fd9u4e48u591au7684u6f02u4eaeu65e5u97e9u6b27u7f8eu6742u5fd7u6b3eYY~~>>>>>>u559cu6b22u70b9u8fd9u91ccuff1ahttp://t.cn/RvESDA6",
"visible": {
"type": 0,
"list_id": 0
},
"in_reply_to_status_id": "",
"bmiddle_pic": "http://ww3.sinaimg.cn/bmiddle/e9820066jw1ehz8g71g90j20c80gjwgk.jpg",
"id": 3728143254489321,
"thumbnail_pic": "http://ww3.sinaimg.cn/thumbnail/e9820066jw1ehz8g71g90j20c80gjwgk.jpg",
"mid": "3728143254489321",
"source": "<a href="http://app.weibo.com/t/feed/5xCS0B" rel="nofollow">u5faeu535au624bu673au7248</a>",
"attitudes_count": 0,
"in_reply_to_screen_name": "",
"pic_urls": [
{
"thumbnail_pic": "http://ww3.sinaimg.cn/thumbnail/e9820066jw1ehz8g71g90j20c80gjwgk.jpg"
}
],
"in_reply_to_user_id": "",
"darwin_tags": [],
"favorited": false,
"original_pic": "http://ww3.sinaimg.cn/large/e9820066jw1ehz8g71g90j20c80gjwgk.jpg",
"idstr": "3728143254489321",
"user": {
"bi_followers_count": 44,
"domain": "",
"avatar_large": "http://tp3.sinaimg.cn/3917611110/180/5680332659/0",
"verified_source": "",
"ptype": 0,
"statuses_count": 16879,
"allow_all_comment": true,
"id": 3917611110,
"verified_reason_url": "",
"city": "1000",
"province": "71",
"block_app": 0,
"follow_me": false,
"verified_reason": "",
"followers_count": 292,
"location": "u53f0u6e7e",
"verified_trade": "",
"mbtype": 0,
"verified_source_url": "",
"profile_url": "u/3917611110",
"block_word": 0,
"avatar_hd": "http://ww3.sinaimg.cn/crop.0.2.346.346.1024/e9820066jw1eaxb6we10wj209m09rgn1.jpg",
"star": 0,
"description": "",
"friends_count": 1091,
"online_status": 1,
"mbrank": 0,
"allow_all_act_msg": false,
"profile_image_url": "http://tp3.sinaimg.cn/3917611110/50/5680332659/0",
"idstr": "3917611110",
"verified": false,
"geo_enabled": true,
"class": 1,
"screen_name": "u6d41u884cu7f8eu642du6742u5fd7",
"lang": "zh-cn",
"weihao": "",
"remark": "",
"favourites_count": 0,
"name": "u6d41u884cu7f8eu642du6742u5fd7",
"url": "",
"gender": "f",
"created_at": "Sun Nov 24 17:10:30 +0800 2013",
"worldcup_guess": 0,
"verified_type": -1,
"following": false
},
"geo": null,
"created_at": "Thu Jul 03 07:01:20 +0800 2014",
"mlevel": 0,
"comments_count": 0
},
{
"darwin_tags": [],
"favorited": false,
"mid": "3728143251104938",
"in_reply_to_user_id": "",
"truncated": false,
"text": "u708eu708eu590fu65e5uff0cu60f3u60f3u81eau5df1u90a3u4e0du582au56deu9996u7684u201cu9017u6bd4u201du4e8buff0cu7ed9u8fd9u4e2au70edu7684u60f3u5c4eu7684u5b63u8282u964du964du6e29u4e5fu4e0du5931u4e3au4e00u4e2au597du529eu6cd5~~u5c31u7b97u673au667au5982u6211u6709u7684u65f6u5019u4e5fu62b5u4e0du8fc7u60b2u50acu547du8fd0u7684u6298u78e8uff01 http://t.cn/Rvufq4y",
"created_at": "Thu Jul 03 07:01:20 +0800 2014",
"mlevel": 0,
"reposts_count": 0,
"idstr": "3728143251104938",
"visible": {
"type": 0,
"list_id": 0
},
"attitudes_count": 0,
"pic_urls": [],
"in_reply_to_screen_name": "",
"user": {
"bi_followers_count": 3,
"domain": "",
"avatar_large": "http://tp2.sinaimg.cn/2776200377/180/5686197056/1",
"verified_source": "",
"ptype": 0,
"statuses_count": 855,
"allow_all_comment": true,
"id": 2776200377,
"verified_reason_url": "",
"city": "6",
"province": "43",
"block_app": 0,
"follow_me": false,
"verified_reason": "",
"followers_count": 106,
"location": "u6e56u5357 u5cb3u9633",
"verified_trade": "",
"mbtype": 0,
"verified_source_url": "",
"profile_url": "u/2776200377",
"block_word": 0,
"avatar_hd": "http://ww2.sinaimg.cn/crop.0.0.200.200.1024/a57974b9jw1ed3s4if74zj205l05kwen.jpg",
"star": 0,
"description": "",
"friends_count": 166,
"online_status": 0,
"mbrank": 0,
"allow_all_act_msg": false,
"profile_image_url": "http://tp2.sinaimg.cn/2776200377/50/5686197056/1",
"idstr": "2776200377",
"verified": false,
"geo_enabled": true,
"class": 1,
"screen_name": "u75dbu5fc3u7684u5b88u62a4",
"lang": "zh-cn",
"weihao": "",
"remark": "",
"favourites_count": 0,
"name": "u75dbu5fc3u7684u5b88u62a4",
"url": "",
"gender": "m",
"created_at": "Tue May 22 09:36:02 +0800 2012",
"worldcup_guess": 0,
"verified_type": -1,
"following": false
},
"in_reply_to_status_id": "",
"comments_count": 0,
"geo": null,
"id": 3728143251104938,
"source": "<a href="http://app.weibo.com/t/feed/2o92Kh" rel="nofollow">vivo_Xplay</a>"
}
]
The original address: http://blog.csdn.net/guaguastd/article/details/36618701