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

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

相关推荐
蓝天星空14 分钟前
Python调用open ai接口
人工智能·python
jasmine s23 分钟前
Pandas
开发语言·python
郭wes代码23 分钟前
Cmd命令大全(万字详细版)
python·算法·小程序
leaf_leaves_leaf41 分钟前
win11用一条命令给anaconda环境安装GPU版本pytorch,并检查是否为GPU版本
人工智能·pytorch·python
夜雨飘零11 小时前
基于Pytorch实现的说话人日志(说话人分离)
人工智能·pytorch·python·声纹识别·说话人分离·说话人日志
404NooFound1 小时前
Python轻量级NoSQL数据库TinyDB
开发语言·python·nosql
天天要nx1 小时前
D102【python 接口自动化学习】- pytest进阶之fixture用法
python·pytest
minstbe1 小时前
AI开发:使用支持向量机(SVM)进行文本情感分析训练 - Python
人工智能·python·支持向量机
落魄实习生1 小时前
AI应用-本地模型实现AI生成PPT(简易版)
python·ai·vue·ppt
苏言の狗1 小时前
Pytorch中关于Tensor的操作
人工智能·pytorch·python·深度学习·机器学习