Comments (14)
能贴一下具体的代码吗?方便我排查
from zhihu-python.
@egrcc 这不会就是你说的那个问题吧?
from zhihu-python.
@yannisxu 请问你是在 OSX 平台出现这个错误的吗?
from zhihu-python.
@yannisxu 猜测应该是 BSoup没有 find 到 elem。
最好能给上当时你抓的那个 URL.
from zhihu-python.
用的 demo 里面的代码
from zhihu import User
user_url = "http://www.zhihu.com/people/jixin"
user = User(user_url)
# 获取用户ID
user_id = user.get_user_id()
# 获取该用户的关注者人数
followers_num = user.get_followers_num()
# 获取该用户关注的人数
followees_num =user.get_followees_num()
# 获取该用户提问的个数
asks_num = user.get_asks_num()
# 获取该用户回答的个数
answers_num = user.get_answers_num()
# 获取该用户收藏夹个数
collections_num = user.get_collections_num()
# 获取该用户获得的赞同数
agree_num = user.get_agree_num()
# 获取该用户获得的感谢数
thanks_num = user.get_thanks_num()
# 获取该用户关注的人
followees = user.get_followees()
# 获取关注该用户的人
followers = user.get_followers()
# 获取该用户提的问题
asks = user.get_asks()
# 获取该用户回答的问题的答案
answers = user.get_answers()
# 获取该用户的收藏夹
collections = user.get_collections()
print user_id # 黄继新
print followers_num # 614840
print followees_num # 8408
print asks_num # 1323
print answers_num # 786
print collections_num # 44
print agree_num # 46387
print thanks_num # 11477
print followees
# follow = list(followees)
# for x in follow:
# print x
# <generator object get_followee at 0x7ffcac3af050>
# 代表所有该用户关注的人的生成器对象
print followers
next(followers)
# <generator object get_follower at 0x7ffcac3af0f0>
# 代表所有关注该用户的人的生成器对象
print asks
# <generator object get_ask at 0x7ffcab9db780>
# 代表该用户提的所有问题的生成器对象
print answers
# <generator object get_answer at 0x7ffcab9db7d0>
# 代表该用户回答的所有问题的答案的生成器对象
print collections
# <generator object get_collection at 0x7ffcab9db820>
# 代表该用户收藏夹的生成器对象
环境是 OS X 10.11 (beta) Python 2.7.6
from zhihu-python.
@yannisxu 没错,OSX 会有这个问题.
但是你的是否重复出现呢?执行第二遍/第三遍 依然出现?
from zhihu-python.
@LuoZijun 一直出现~
from zhihu-python.
@yannisxu 你下载这个 zhihu.py
的文件替换你的,看看还会不会有问题。
https://raw.githubusercontent.com/LuoZijun/zhihu-python/master/zhihu.py
from zhihu-python.
@LuoZijun 应该是登录的问题,之前的内容可以获取到是因为不需要登录也可以访问。获取关注用户的列表的时候知乎需要登录了,所以没有权限,抓到内容有问题。我再看看...
from zhihu-python.
问题查到了,不支持手机帐号登录,只支持 email 帐号, issue#17 和 issue#18 问题相同,非常感谢。
from zhihu-python.
好吧,解决就好。也感谢 @LuoZijun 的帮忙。
from zhihu-python.
@yannisxu 手机登录这个我确实没有测试,我猜测了一个 phone
的表单字段。
不知你能否抓下 手机登录的表单发送信息?以完善这个功能?
另外,`之前的内容可以获取到是因为不需要登录也可以访问` 这个也代表 /setting 路径也是可以访问?应该会 302/301 重置的吧?
from zhihu-python.
@LuoZijun /setting 应该是不行的,个人主页是可以的,但是 /followees 就要求登录了。
from zhihu-python.
@yannisxu 没有登录请求这个页面确实会被 302
的.
from zhihu-python.
Related Issues (20)
- user.get_followers_num() NoneType error HOT 7
- 验证码不正确 HOT 2
- 输入密码不正确时,显示unknow error HOT 1
- 爬取用户回答,如果遇到用户某回答被和谐,爬虫自动终止,不能自动跳过
- User的get_followers()
- auth.py 登录出错。
- question.get_top_i_answers() 和 question.get_all_answers() 获取答案失败 HOT 4
- 编码好像问题挺多的 HOT 4
- 最近忙毕业论文,issue 和 pull requests 要过段时间才会处理 HOT 1
- get_topic出现列表越界
- 网络异常 HOT 12
- auth.py登录一直返回500错误 HOT 5
- Post.get_all_posts()requests到的页面是html格式的,但是用的代码是r.json()
- Answer.get_question()失败 HOT 1
- auth.py登录返回403错误
- auth.py验证码请求失败 HOT 4
- get_all_answers始终得到的答案数是一个 HOT 3
- 是知乎的网页结构换了吗?出现大量的NONETYPE错误 HOT 1
- 验证码问题 HOT 3
- 能用吗 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zhihu-python.