求助:小说章节标题已获取,获取内容时出现了问题

import json

import requests
import asyncio
import aiohttp\

headers = {

'Accept': '*/*',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Cache-Control': 'no-cache',
'Connection': 'keep-alive',

'Pragma': 'no-cache',

'Referer': 'https://boxnovel.baidu.com/boxnovel/detail?gid=4356714359\&data={"fromaction"%3A"dushu","fromaction_original"%3A"dushu"}',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36',
'sec-ch-ua': '"Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
}

params = {

'bookid': '4356714359',
'pageNum': '1',
'order': 'asc',
'site': '',
}

def getcha(url):

response = requests.get(url=url, params=params,headers=headers,)
context = json.loads(response.text)
for chapcount in context['data']['chapter']["chapterInfo"][1:]:
chapter_title =chapcount["chapter_title"]
chapter_id = chapcount["chapter_id"]
print(chapter_title,chapter_id)
if name == 'main':
url = 'https://boxnovel.baidu.com/boxnovel/wiseapi/chapterList'
getcha(url)

以下内容正在研究中,有高手指点吗?

res=requests.get('https://boxnovel.baidu.com/boxnovel/content?gid=4356714359\&data={"fromaction":"dushu","fromaction_original":"dushu"}\&cid=1571713073')

print(res.text)

res=requests.get('https://novel-content-new.cdn.bcebos.com/6750456234407505783?md5hash=cd8773e68d78c3b3b2ac55b52559859b\&timestamp=1722511408')
res.encoding='utf-8'
print(res.text)

https://boxnovel.baidu.com/boxnovel/wiseapi/getBookInfo?bookid=4356714359

https: // novel - content - new.cdn.bcebos.com / 6750456234407505783?md5hash = d6740ed9a68c2b4713ce0c6638182884 & timestamp = 1722510567

相关推荐
Mason Lin1 小时前
2025年1月22日(网络编程 udp)
网络·python·udp
清弦墨客2 小时前
【蓝桥杯】43697.机器人塔
python·蓝桥杯·程序算法
RZer3 小时前
Hypium+python鸿蒙原生自动化安装配置
python·自动化·harmonyos
CM莫问4 小时前
什么是门控循环单元?
人工智能·pytorch·python·rnn·深度学习·算法·gru
查理零世5 小时前
【算法】回溯算法专题① ——子集型回溯 python
python·算法
圆圆滚滚小企鹅。6 小时前
刷题记录 HOT100回溯算法-6:79. 单词搜索
笔记·python·算法·leetcode
纠结哥_Shrek6 小时前
pytorch实现文本摘要
人工智能·pytorch·python
李建军6 小时前
TensorFlow 示例摄氏度到华氏度的转换(二)
人工智能·python·tensorflow
李建军6 小时前
TensorFlow 示例摄氏度到华氏度的转换(一)
人工智能·python·tensorflow
2301_793069827 小时前
npm 和 pip 安装中常见问题总结
开发语言·python