import requests import re import threading import time headers = { "User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36"} # 详情页图片地址 URL detail_urls = [] mutex = threading.Lock() # 循环获取URL def get_detail_urls(url): res = requests.get(url=url, headers=headers) res.encoding = 'gb2312' if res is not None: html = res.text # 读取页面源码 # 对目标源码页数据进行裁剪 # 获取 ul class = "g-gxlist-imgbox" 的数据 # 该数据在标签