-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathquestion_api.py
More file actions
48 lines (44 loc) · 1.64 KB
/
question_api.py
File metadata and controls
48 lines (44 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# zhihu.com update there api
from zhihu_object import ZhiHuSpider
class Question(ZhiHuSpider):
def __init__(self, url_token):
self._url = ("https://www.zhihu.com/api/v4/questions/{url_token}/answers?"
"sort=default&"
"include=data[*].is_normal,"
"is_sticky,"
"collapsed_by,"
"suggest_edit,"
"comment_count,"
"collapsed_counts,"
"reviewing_comments_count,"
"can_comment,"
"content,"
"editable_content,"
"voteup_count,"
"reshipment_settings,"
"comment_permission,"
"mark_infos,"
"created_time,"
"updated_time,"
"relationship.is_author,"
"voting,"
"is_thanked,"
"is_nothelp,"
"upvoted_followees;"
"data[*].author.is_blocking,"
"is_blocked,"
"is_followed,"
"voteup_count,"
"message_thread_token,"
"badge[?(type=best_answerer)].topics&"
"limit=20&"
"offset={offset}")
super(Question, self).__init__(self._url, url_token)
if __name__ == "__main__":
qus = Question(50258333)
import time
time.time()
for i, item in enumerate(qus.get_api_object()):
print i, item["id"]