from selenium import webdriver
from lxml import etree
from time import sleep
import re
import random
import time
import requests
from selenium.webdriver.common.by import By
from get_user_agent import get_user_agent_of_pc
from selenium.webdriver.common.service import Service
def roll_down(chrome):
for x in range(1, 11,3):
time.sleep(random.random())
j = x / 10
js = "document.documentElement.scroll=document.documentElement.scrollHeight*%s" % j
chrome.execute_script(js)
def parse_html(html):
tree = etree.HTML(html)
names = tree.xpath('//div[@id="J_goodsList"]/ul/li/div/div[3]/a/em')
prices = tree.xpath('//div[@id="J_goodsList"]/ul/li/div/div[2]/strong/i/text()')
shops = tree.xpath('//div[@id="J_goodsList"]/ul/li/div/div[5]/span/a/text()')
hrefs = tree.xpath('//div[@id=&
这个爬虫为什么只能爬一页,而且为啥显示image没有被定义
最新推荐文章于 2023-03-21 14:02:51 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)