def get_hush_search():
count = len('64hb58763ce1e6f8fd3c4d39b876f0e6')
random_list = ['1','2','3','4','5','6','7','8','9','0','a','b','c','d','e','f']
b = ''
for i in range(0,count):
a = random.choice(random_list)
b = b + str(a)
return b
def get_json_data (url):
return json.loads(requests.get(url=url,headers=headers).text)
for i in range(0,1000):
url = 'https://www.zhihu.com/api/v4/search_v3?t=general&q=BAT&correction=1&search_hash_id='+get_hush_search()+'&offset='+str(i)+'&limit=10'
data_list = get_json_data(url=url)['data']
print(url)
for i in data_list:
print(len(data_list))
try:
print(i['object']['question']['name'])
ID = i['object']['question']['id']
comment_count = int(i['object']['comment_count'])
for j in range(0,comment_count,10):
new_url = 'https://www.zhihu.com/api/v4/questions/' + str(ID) + '/answers?include=data[*].is_normal,admin_closed_comment,reward_info,is_collapsed,annotation_action,annotation_detail,collapse_reason,is_sticky,collapsed_by,suggest_edit,comment_count,can_comment,content,editable_content,voteup_count,reshipment_settings,comment_permission,created_time,updated_time,review_info,relevant_info,question,excerpt,relationship.is_authorized,is_author,voting,is_thanked,is_nothelp,upvoted_followees;data[*].mark_infos[*].url;data[*].author.follower_count,badge[?(type=best_answerer)].topics&offset='+str(j)+'&limit=10&sort_by=default'
data_li = get_json_data(new_url)['data']
for answer in data_li:
print(answer['author']['name']+'的回答:\n')
print(answer['content'])
except:
print('None content')
print('---------------'*10)
ZH
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...