python爬取起点小说
完整代码:
# _*_ coding:utf-8 _*_
import os
import sys
import re
import urllib.request
from bs4 import BeautifulSoup
os.chdir('/Users/baby/Desktop/qidian') ##设置路径
class downloader(object):
def __init__(self):
self.server = 'https://book.qidian.com/info/1013406185' ##小说网站首页
self.target = 'https://book.qidian.com/info/1013406185#Catalog' ##小说目录页面
self.nums = 0
self.names = []
self.urls = []
def get_downloader_url(self):
html = urllib