环境:python3 pycharm 模块:requests bs4 urlretrieve os time 第一步:获取网页源代码 import requests from bs4 import BeautifulSoup from urllib.request import urlretrieve import os import time def get_html(url): try: response = requests.get(url) response.encoding…
1.创建scrapy项目 dos窗口输入: scrapy startproject xiaohuar cd xiaohuar 2.编写item.py文件(相当于编写模板,需要爬取的数据在这里定义) # -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # https://doc.scrapy.org/en/latest/topics/items.html…
selenium爬取煎蛋网 直接上代码 from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as ES import requests import urllib.requ…