爱看小说的程序猿必备!
首先我们需要安装以下库:
python3.5
requests
pymysql
lxml
queue
threading
import requests
from lxml import etree
import pymysql
def insertdb():
url = "http://www.xbiquge.la/xiaoshuodaquan/"
# 获取响应
req = requests.get(url)
html = etree.HTML(req.content.decode("utf8", "ignore"))
lists = html.xpath("//div[@class='novellist']/ul/li")
#链接数据库
db = pymysql.connect(host='localhost', port=3306, user='root', password='123456', db='biquge&

本文介绍了一种使用Python爬取笔趣阁小说网站数据的方法,包括小说信息抓取和多线程下载功能,利用requests、lxml和pymysql等库实现数据抓取与存储。

最低0.47元/天 解锁文章
5385

被折叠的 条评论
为什么被折叠?



