Giter VIP home page Giter VIP logo

Comments (14)

egrcc avatar egrcc commented on June 28, 2024

能贴一下具体的代码吗?方便我排查

from zhihu-python.

LuoZijun avatar LuoZijun commented on June 28, 2024

@egrcc 这不会就是你说的那个问题吧?

from zhihu-python.

LuoZijun avatar LuoZijun commented on June 28, 2024

@yannisxu 请问你是在 OSX 平台出现这个错误的吗?

from zhihu-python.

LuoZijun avatar LuoZijun commented on June 28, 2024

@yannisxu 猜测应该是 BSoup没有 find 到 elem。
最好能给上当时你抓的那个 URL.

from zhihu-python.

yannisxu avatar yannisxu commented on June 28, 2024

@LuoZijun @egrcc

用的 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.

LuoZijun avatar LuoZijun commented on June 28, 2024

@yannisxu 没错,OSX 会有这个问题.
但是你的是否重复出现呢?执行第二遍/第三遍 依然出现?

from zhihu-python.

yannisxu avatar yannisxu commented on June 28, 2024

@LuoZijun 一直出现~

from zhihu-python.

LuoZijun avatar LuoZijun commented on June 28, 2024

@yannisxu 你下载这个 zhihu.py 的文件替换你的,看看还会不会有问题。
https://raw.githubusercontent.com/LuoZijun/zhihu-python/master/zhihu.py

from zhihu-python.

yannisxu avatar yannisxu commented on June 28, 2024

@LuoZijun 应该是登录的问题,之前的内容可以获取到是因为不需要登录也可以访问。获取关注用户的列表的时候知乎需要登录了,所以没有权限,抓到内容有问题。我再看看...

from zhihu-python.

yannisxu avatar yannisxu commented on June 28, 2024

问题查到了,不支持手机帐号登录,只支持 email 帐号, issue#17 和 issue#18 问题相同,非常感谢。

from zhihu-python.

egrcc avatar egrcc commented on June 28, 2024

好吧,解决就好。也感谢 @LuoZijun 的帮忙。

from zhihu-python.

LuoZijun avatar LuoZijun commented on June 28, 2024

@yannisxu 手机登录这个我确实没有测试,我猜测了一个 phone 的表单字段。
不知你能否抓下 手机登录的表单发送信息?以完善这个功能?
另外,`之前的内容可以获取到是因为不需要登录也可以访问` 这个也代表 /setting 路径也是可以访问?应该会 302/301 重置的吧?

from zhihu-python.

yannisxu avatar yannisxu commented on June 28, 2024

@LuoZijun /setting 应该是不行的,个人主页是可以的,但是 /followees 就要求登录了。

from zhihu-python.

LuoZijun avatar LuoZijun commented on June 28, 2024

@yannisxu 没有登录请求这个页面确实会被 302 的.

zhihu

from zhihu-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.