jojo的奇妙冒险

爬取漫画DB上的JoJo的奇妙冒险 第七部 飙马野郎

笑着哭i 提交于 2019-12-03 00:06:47
SBR是JOJO系列我最喜欢的一部,所以今天把漫画爬取到本地,日后慢慢看。 import os import re import time import requests from bs4 import BeautifulSoup from requests import RequestException def get_page(url): try: headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36' + '(KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36'} response = requests.get(url, headers=headers) if response.status_code == 200: return response.text else: return None return None except RequestException: return None def get_pagesNumber(text): soup = BeautifulSoup(text, 'lxml') pagesNumber = soup.find(name='div', class_="d