Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

获取点赞人数的问题 #40

Open
distone opened this issue Jan 5, 2016 · 0 comments
Open

获取点赞人数的问题 #40

distone opened this issue Jan 5, 2016 · 0 comments

Comments

@distone
Copy link

distone commented Jan 5, 2016

似乎是一个bug,请您再确认一下。获取点赞人数失败,或者数字不对。

运行test.py

1。 如果某问题下只有一个回答,则
upvote = answer.get_upvote() 运行失败,报错。

比如说 answer_url = "https://www.zhihu.com/question/38214680/answer/79481584" ,
报错信息:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
File "test.py", line 79, in answer_test
upvote = answer.get_upvote()
File "~/zhihu-python-master/zhihu.py", line 757, in get_upvote
count = soup.find("span", class_="count").string
AttributeError: 'NoneType' object has no attribute 'string'
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

2。 如果该问题下有多个回答,则获得的赞数不是这个回答的,而是紧挨着它的下一个回答的。

比如,answer_url = "https://www.zhihu.com/question/33567660/answer/79138286"

结果输出:
++++++++++++++++++++++++++++++++++++++++++++
中国为什么不拍一部《伟大的抗日战争》呢?--石头布的回答.txt
中国为什么不拍一部《伟大的抗日战争》呢?--石头布的回答.md
<zhihu.Question instance at 0x17fc950>
中国为什么不拍一部《伟大的抗日战争》呢?
<zhihu.User instance at 0xbdfc68>
<generator object get_voters at 0xbde0f0>
石头布
529 <---- 是下一个回答的赞数。
14537
++++++++++++++++++++++++++++++++++++++++++++
其中 529 是下一个回答的赞数。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant