今天爬一下董宇辉的博客,说到董宇辉我总感觉这个人事白鸡汤火的,火完之后居然又走起来偶像路线。想起前年去北京凤凰岭爬山,一路盘旋向上,中途有不少人下山,有到顶下去的有跑到一半下去的。在好友的坚持下最终登顶看了看飞外来石。
- 话不多说,网站地址
2. 这个接口这次就先不搞了也不搞cookies了先来抓数据之后有机会再更一篇取cookies全自动的,直接进去。到博主首页
2.1 这里抓一下基础信息
2.2 明显这里就是个人信息的数据接口了,然后接着向下走,找一下发布的动态数据接口
2.3 mymblog接口中可见动态的数据,参数明了没有什么加密这个有翻页参数,那就可以写代码了
- 没有处理cookies就是用session()做一个会话保持,然后求请info接口获取数据
params = {
'uid': '3939528563',
}
response = sess.get('https://weibo.com/ajax/profile/info', params=params).json()['data']['user']
print(response)
item = {
'id' : response['id'],
'screen_name' : response['screen_name'],
'verified_reason' : response['verified_reason'],
'description' : response['description'],
'location' : response['location'],
'followers_count' : response['followers_count'],
'friends_count' : response['friends_count'],
}
print('====================')
print(item)
3.1 由此可见微博的用户都有一个用户id作为用户的唯一标识,然后再请求mymblog接口获取发布的动态数据
params = {
'uid': '3939528563',
'page': '1',
'feature': '0',
}
response = sess.get('https://weibo.com/ajax/statuses/mymblog', params=params).json()['data']['list']
for res in response:
print(res)
item['attitudes_count'] = res['attitudes_count']
item['comments_count'] = res['comments_count']
item['created_at'] = res['created_at']
item['text'] = res['text']
print('===============================================================')
print(item)
sys.exit()
可见信息还是挺全的,发布时间点攒,转发,评论量。发布手机,发布地点,动态信息等等,这里还有一个文章id,盲猜这个文章id和评论的数据接口因该是关联,可以自己向下面接评论的就扣,之后有时间会做一个cookies的生成过程,就完整了。