1. 用Python批量爬取全站小说
爬取这个网站小说:http://www.shuquge.com/txt/89644/index.html
2. 爬取一本书
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 8 20:31:43 2020
@author: douzi
"""
import requests
from parsel import Selector
import re
import time
def main():
index_url = 'http://www.shuquge.com/txt/89644/index.html' # 想要爬取的小说
tpl = 'http://www.shuquge.com/txt/89644/'
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"}
# 获取小说目录页
urllist = requests.get(index_url, headers=headers)
index_sel = Selector(urllist.text)
# <div class="listmain"> <dl><dt>《九星毒奶》最新章节</dt><dd><a href="29287710.html">1040 养龙皮?</a&