马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
上代码:import requests
import json
def get():
url = "http://book.zongheng.com/api/chapter/chapterinfo?bookId=963124&chapterId=60681352&_=1590030263307"
headers = {
'Referer':'http://book.zongheng.com/totaltome/963124/60681352.html',
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36'
}
res = requests.get(url,headers=headers).text
target = json.loads(res)
p = target['data']['content']
p = p.replace("<p>",' ')
p = p.replace("</p>",' ')
f = open("xiaoshuo.txt",'w')
f.write(p)
f.close()
def main():
get()
if __name__ == "__main__":
main()
|