当前位置:网站首页>百度知道爬虫,根据问题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)
边栏推荐
- [stm32 HAL库] RTC和BKP驱动
- Undefined symbol main (referred from entry9a.o).
- 融云通信解决方案 破解企业沟通痛点
- TDD and automated testing
- Online text filter less than specified length tool
- Mathematical knowledge: finding combinatorial number I - finding combinatorial number
- Leetcode 324 swing sort ii[sort double pointer] the leetcode path of heroding
- Lecun predicts AgI: big model and reinforcement learning are both ramps! My world model is the new way
- 10. Standard i/o redirection and pipeline
- Thinking about lever
猜你喜欢

Keil project, RTT cannot print after too many programs are written

IDC: Alibaba cloud ranks first in the market share of China's data governance platform in 2021

直击产业落地 | 飞桨重磅推出业界首个模型选型工具
![Leetcode 324 swing sort ii[sort double pointer] the leetcode path of heroding](/img/41/b8ba8d771b7224eac1cc8c54fe9d29.png)
Leetcode 324 swing sort ii[sort double pointer] the leetcode path of heroding

Wechat red envelope cover making tutorial and use guide with link jump

CMake教程(一)

Machine learning 6-decision tree
![[数学建模]Matlab非线性规划之fmincon()函数](/img/fc/46949679859b1369fcc83d0d8b637c.png)
[数学建模]Matlab非线性规划之fmincon()函数

lock4j--分布式锁中间件--使用/实例

在线SQL转HTMLTable工具
随机推荐
Yyds dry inventory solution sword finger offer: maximum sum of continuous subarrays (II)
CMake教程(一)
Keil project, RTT cannot print after too many programs are written
第四章 存储器管理练习
Online linear programming: Dual convergence, new algorithms, and regret bounds
IDC: Alibaba cloud ranks first in the market share of China's data governance platform in 2021
[stm32 Hal library] serial port communication
Machine learning 6-decision tree
大三,不简单啊!
[word Tutorial Series Part 1] how to remove arrows in word tables
TDD和自动化测试
At the end of June, how many people in Kangkang are ready to change jobs
Cmake tutorial (I)
[conception de la machine d'état] Moore, Mealy State Machine, Three - stage, Two - stage, one - stage State Machine Writing Specification
lock4j--分布式锁中间件--使用/实例
Leetcode 324 Swing sort II [tri double pointeur] le chemin du leetcode pour l'héroding
Non scientific class! The road of self-study!
YuMinHong set up two funds funded by his hometown
One card can sell tens of millions, and the business expansion is faster than that of players: you don't understand the Jianghu of star cards
Finally, someone explained the cloud native architecture