python爬取起点中文网小说
完整代码:
import requests
from lxml import etree
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 getbookurls():
url = 'https://book.qidian.com/info/1017125042#Catalog'
#获取页面源代码
charptes = requests.get(url,headers = header).text
#print(charptes)
objects = etree.H