python的中文编码实在是非常麻烦,不光如此,因为有些用户的简介里有一些特殊符号,®或者笑脸之类的,于是在这里纠结了很久,好歹最后是成功了(其实也就是过滤掉了那些特殊符号)
效率来说呢,开始的时候一个小时能采集大概1.4w条微博的用户信息,但是由于我是从每个人的关注列表里采集的,所以很快就会遇到爬到许多已经爬过的用户,所以总的来说效率不是很高,怪不得那个“中国爬盟”要发动群众的力量去爬
而且有些担心爬久了微博账号被封,我也没敢尝试太久,最后爬了5w条用户信息,8w条关系数据,我拿着数据目前也没什么用,所以就这样吧
python没看多久,代码有冗余的地方,其实主要就是三个函数save_user(),creepy_myself(),creepy_others()
具体的就看代码的注释吧,下载提示看文章末尾,和下面的一样(代码有冗余,因为要先爬出来用户的关注数目来计算有多少页)
[python] view plaincopy