Commit 21e4874d authored by litaolemo's avatar litaolemo

update

parent 2472974a
......@@ -3,6 +3,7 @@
# @File : xiaohongshu_to_rpc.py
# @email : litao@igengmei.com
# @author : litao
import copy
import datetime
import random
......@@ -128,12 +129,26 @@ for pid in pid_list:
video_dic["platform"] = "9"
video_dic["platform_id"] = pid
video_dic["title"] = res_json["NoteView"]["content"]["title"]
# video_dic["content"] = anwser
video_dic["user_id"] = random.choice(user_id_list)
video_dic["create_time"] = datetime.datetime.strptime(res_json["NoteView"]["content"]["time"],
'%Y-%m-%d %H:%M').timestamp()
rpc_res = post_single_data(video_dic, "cims/question/batch_create")
user_id_list_copy = copy.deepcopy(user_id_list)
qustion_id = random.choice(user_id_list_copy)
user_id_list_copy.pop(qustion_id)
video_dic["user_id"] = qustion_id
create_time = datetime.datetime.strptime(res_json["NoteView"]["content"]["time"],
'%Y-%m-%d %H:%M')
video_dic["create_time"] = create_time.timestamp()
rpc_res = post_single_data(copy.deepcopy(video_dic), "cims/question/batch_create")
print(rpc_res)
break
# rpc_res = post_single_data(video_dic, "cims/answer/batch_create")
# rpc_res = post_single_data(video_dic, "cims/reply/batch_create")
video_dic["platform_question_id"] = pid
video_dic["content"] = desc_fix
video_dic["user_id"] = random.choice(user_id_list_copy)
rpc_res = post_single_data(video_dic, "cims/answer/batch_create")
for comment in res_json["NoteView"]["commentInfo"]["comments"]:
video_dic["content"] = comment['content']
comment_id_list_copy = copy.deepcopy(majiayonghu_list)
comment_id = random.choice(comment_id_list_copy)
video_dic["user_id"] = comment_id
comment_id_list_copy.pop(comment_id)
video_dic["create_time"] = (create_time + datetime.timedelta(hours=random.randint(0,24),minutes=random.randint(0,60))).timestamp()
rpc_res = post_single_data(video_dic, "cims/reply/batch_create")
break
\ No newline at end of file
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