資源簡介
壓縮包中含有兩個.py文件:datebase_require.py是采集所有小說名和其對應章節表的url地址,download_novel.py是GUI界面和對應下載,請自行修改兩個文件的數據庫內容即可。

代碼片段和文件信息
import?requests
from?lxml?import?etree
import?pymysql
def?spider():
????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‘?charset=‘utf8‘)
????cursor?=?db.cursor()
????data?=?“insert?into?story_list(story_namestory_url)?values(%s?%s)“
????for?list?in?lists:
????????name?=?““.join(list.xpath(“./a/text()“))
????????url?=?““.join(list.xpath(“./a/@href“))
????????try:
????????????cursor.execute(data?(name?url))
????????????print(“小說:“+name)
????????????db.commit()
????????except:
????????????db.rollback()
????db.close()
if?__name__?==?‘__main__‘:
????spider()
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????849??2019-03-09?21:04??筆趣閣小說下載器\dateba
?????文件????????5423??2019-03-10?13:11??筆趣閣小說下載器\download_novel.py
?????文件??????????46??2019-03-10?13:18??筆趣閣小說下載器\新建文本文檔.txt
?????目錄???????????0??2019-03-10?13:17??筆趣閣小說下載器\
- 上一篇:網盤鏈接.txt62268
- 下一篇:vuenode.txt
評論
共有 條評論