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

更新 soup 的选择语句 #67

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Allianzcortex
Copy link

实际上感觉这个好像更适合作为 issue 而非 PR 提出来,⊙﹏⊙b汗

原选择语句为:asks_num = int(soup.find_all("span", class_="num")[0].string)

更改后读取的是同一位置:ask_num = int(soup.find_all('a', href="/people/" +
self.user_id + "/asks").find("span").string)

但可读性更加良好~

对于下面的 get_answer_num 也可以考虑更改~,不通过相对位置来获取 string


最后一个 PR 了

好吧,通读了一早上的源码,自己写了个 fake-zhihu-python 的程序。只有说 orz……

不过 chrome 的开发工具好像对表单的读取不够好,最后在虚拟机里用 fiddler 来抓取解决~

3 个 PR 指向三个部分,看 LZ 怎么选择,希望能多多交流呀

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

Successfully merging this pull request may close these issues.

1 participant