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

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

相关推荐
hcnaisd214 小时前
使用Python进行PDF文件的处理与操作
jvm·数据库·python
不会代码的小测试14 小时前
UI自动化-针对验证码登录的系统,通过首次手动登录存储cookie的方式后续访问免登录方法
开发语言·python·selenium
开发者小天14 小时前
python中calss的用法
开发语言·python
weixin_4624462314 小时前
使用 Python 批量在 HTML 文件中插入自定义 div 元素
python·beautifulsoup·自动化脚本·html 批量处理
SeatuneWrite15 小时前
**AI漫剧软件2025推荐,解锁沉浸式二次元内容创作新体验
大数据·人工智能·python
Pyeako15 小时前
opencv计算机视觉--Harris角点检测&SIFT特征提取&图片抠图
人工智能·python·opencv·计算机视觉·harris角点检测·sift特征提取·图片抠图
艾莉丝努力练剑15 小时前
【AI时代的赋能与重构】当AI成为创作环境的一部分:机遇、挑战与应对路径
linux·c++·人工智能·python·ai·脉脉·ama
果粒蹬i15 小时前
从割裂到融合:MATLAB与Python混合编程实战指南
开发语言·汇编·python·matlab
木头左15 小时前
指数期权备兑策略的历史表现与Backtrader回测验证
python
yufuu9815 小时前
Python数据库操作:SQLAlchemy ORM指南
jvm·数据库·python