import pymysql import requests from lxml import etree import re def getDB(): db = pymysql.connect(host='localhost',user='root',password='123456',database='douban') return db def Agent_info(): headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36' } return headers def get_url(): headers=Agent_info() manh_url = 'https://www.qimao.com/paihang' res = requests.get(url=manh_url, headers=headers) htmldata=res.text urls=re.findall('