python爬取笔趣阁小说
完整代码:
import requests
from lxml import etree
import os
header = {
'User-Agent':'Mozilla/5.0(Macintosh;Inter Mac OS X 10_13_3) AppleWebkit/537.36 (KHTML,like Gecko)'
'Chrom/65.0.3325.162 Safari/537.36'
}
def gerbookurls():
print('笔趣阁的官网是: https://www.biquge.com.cn/ 去这里找想看的小说,然后把小说网址复制过来就可以了,文件存在C盘的笔趣阁小说文件夹里!')
url = input('请输入要获取的笔趣阁小说的网页地址:')
charptes = requests.get(url,headers = header).text
#print(charptes)
objects = etree.HTML(charptes)
#print(objects)