Commit 5782ab0c authored by 段英荣's avatar 段英荣

增加搜索爬取功能

parent 6af82443
......@@ -248,19 +248,19 @@ class ZhihuAccount(object):
if "data" in raw_content_dict:
for data_item in raw_content_dict["data"]:
type = data_item["obeject"]["type"]
data_type = data_item["obeject"]["type"]
content = data_item["object"]["content"]
platform_id = data_item["object"]["id"]
user_id = random.choice(majia_user_list)
question_id = ""
if type == "article":
if data_type == "article":
title = data_item["object"]["title"]
elif type == "answer":
elif data_type == "answer":
title = data_item["object"]["question"]["name"]
question_id = data_item["object"]["question"]["id"]
else:
print("type is:%s" % type)
print("type is:%s" % data_type)
title = ""
item_dict = {
......@@ -268,7 +268,7 @@ class ZhihuAccount(object):
"platform_id": platform_id,
"title": title,
"content": content,
"type": type,
"type": data_type,
"question_id": question_id
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment