当前位置:网站首页>百度知道爬虫,根据问题id,线索id,评论id获取评论下面的对话
百度知道爬虫,根据问题id,线索id,评论id获取评论下面的对话
2022-06-28 23:21:00 【supramolecular】
import requests
import time
import math
import demjson
comment_request = [{'thread_id': '11817919873', 'qid': '96177926', 'rid': '2954479968'}, {'thread_id': '1260090477', 'qid': '96177926', 'rid': '315022619'}, {'thread_id': '1260687497', 'qid': '96177926', 'rid': '315171874'}, {'thread_id': '11734823241', 'qid': '96177926', 'rid': '2933705810'}, {'thread_id': '1260108277', 'qid': '96177926', 'rid': '315027069'}]
def get_new_comment(param):
t = str(math.floor(time.time()))
# url = "https://zhidao.baidu.com/api/comment?method=get_new_comment&app=qb&thread_id=1260090477&qid=96177926&rid=2954479968"
url = "https://zhidao.baidu.com/api/comment?method=get_new_comment&app=qb&thread_id=" + param['thread_id'] + "&qid=" + param['qid'] + "&rid=" + param['rid'] + "&pn=0&rn=10&r=" + t
print(url)
# url = "https://zhidao.baidu.com/api/comment?method=get_new_comment&app=qb&thread_id=11817919873&qid=96177926&rid=2954479968&pn=0&rn=10&r=" + t
resp = requests.post(url)
comment = resp.json()
if comment['data']['comment_count'] != None:
for item in comment['data']['comment_list']:
str_create_time = item['str_create_time']
content = item['content']
from_uname = item['from_uname']
from_uid = item['from_uid']
to_uid = item['to_uid']
id = param['rid']
print(str_create_time, content, from_uname, from_uid, to_uid, id)
for req in comment_request:
get_new_comment(req)
边栏推荐
- I can't sleep
- 【状态机设计】Moore、Mealy状态机、三段式、二段式、一段式状态机书写规范
- [数学建模]Matlab非线性规划之fmincon()函数
- LINQ linked table query
- Design e-commerce seckill system
- [stm32 Hal library] RTC and BKP drives
- 【狀態機設計】Moore、Mealy狀態機、三段式、二段式、一段式狀態機書寫規範
- The picture display on the left of the two column layout is determined by the content height on the right
- Undefined symbol main (referred from entry9a.o).
- Tanghongbin, Yaya live CTO: to truly localize, the product should not have the attribute of "origin"
猜你喜欢

MATLAB 学习笔记(6)MATLAB 的 upsample 函数和 downsample 函数

再次上榜!知道创宇入选2022中国网安产业竞争力50强

在线SQL转HTMLTable工具
![[数学建模]Matlab非线性规划之fmincon()函数](/img/fc/46949679859b1369fcc83d0d8b637c.png)
[数学建模]Matlab非线性规划之fmincon()函数

关联线探究,如何连接流程图的两个节点

Use conditional breakpoints in vscode (based on GDB)

Online sql to htmltable tool
![LeetCode 324 擺動排序 II[排序 雙指針] HERODING的LeetCode之路](/img/41/b8ba8d771b7224eac1cc8c54fe9d29.png)
LeetCode 324 擺動排序 II[排序 雙指針] HERODING的LeetCode之路

老家出资,俞敏洪设立两支基金

C interview questions_ 20220627 record
随机推荐
大三,不简单啊!
Prometeus 2.36.0 new features
Do you know all the wonderful functions of the vlookup function?
Langage C - analyse des mots
复杂嵌套的对象池(4)——管理多类实例和多阶段实例的对象池
[Chapter 2 of word tutorial series] how to set the table on each page to have a header in word
融云通信解决方案 破解企业沟通痛点
第五章 虚拟存储器 练习
[sword finger offer] 50 First character that appears only once
WEB API学习笔记1
Counting sorting and stability of sorting
没找到实习,他总结了这些
What will be done after digital IC Verification?
10. Standard i/o redirection and pipeline
That's how he did it!
CMake教程(一)
CIN at QT (the clearest tutorial in the whole network)
Junior, it's not easy!
Fanuc robot_ Introduction to Karel programming (2)_ Usage of general IO signal
frameworks/base/core/res/res/values/symbols. Xml:3915: error: no definition for declared symbol solution