import requests from bs4 import BeautifulSoup from selenium import webdriver import time import os from datetime import datetime import csv from selenium.webdriver.common.keys import Keys import random from selenium.webdriver import ActionChains import json import hashlib import base64 import hmac from urllib.parse import quote_plus import socket import sys from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.desired_capabilities import DesiredCapabilities from selenium.webdriver.common.proxy import Proxy, ProxyType # 设置代理服务器 from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC headers = { "User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.81 Safari/537.36", } price_url = "https://search.kongfz.com/item_result/?status=0&key=" #店铺最低售价 mix_price = 5 #书籍最低售价 book_mix_price = 15 #采集最近几个月数据 month_num = 3 #几个月内最低销量 mix_number = 8 #最低数量 #限制采集标志 xianzhi_flag = 0 #isbn搜索数量 isbn_num = 0 #最大isbn搜素数量 max_isbn_num = 150 #第一次打开网页的标志 first_flag = 0 #默认快递费 kuaidi_price = 8 #同行店铺数据表格 shop_path = 'shop_id.csv' name = '19974722014' passwd = 'hyk@123+-' shop_book_num = 2000 shop_sale_num = 0.2 #搜索一定数量之后重启浏览器,更换ip和账号 sousuo_num = 80 #name_msg = [['19039408895','cpp4655025'],['16541154686','www9909283'],['17136641868','sssk2019'],['16563084507','aaaa2201'],['16584360824','aaaapppp102'],] name_msg = [['19039408895','cpp4655025'],] name_index = 0 sousuo_end_time = "07:58"