首页 > 编程语言 > 详细

简单 python 爬虫(爬取小说网)

时间:2020-05-04 19:36:51      阅读:68      评论:0      收藏:0      [点我收藏+]

#https://blog.csdn.net/Isana_Yashiro/article/details/84582946
import requests
from bs4 import BeautifulSoup
target = ‘https://www.biqukan.com/1_1094/5403177.html‘
req = requests.get(url=target)
req.encoding=‘GBK‘
html = req.text
soup = BeautifulSoup(html, ‘html.parser‘)
texts = soup.select(‘.showtxt‘)
print(texts[0].text.replace(‘ ‘, ‘\n‘).replace(‘\xa0‘*8, ‘\n‘))

简单 python 爬虫(爬取小说网)

原文:https://www.cnblogs.com/ygw1010/p/12827797.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!