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\×tamp=1722511408')
res.encoding='utf-8'
print(res.text)