以下是我目前的代码,应该怎么修改:
import re
from bs4 import BeautifulSoup
import requests
from lxml import etree
flink = re.compile(r'<a class="img" href="(.*?)"')
headers={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36'}
r=requests.get(f'http://tipdm.com/',headers=headers)
print(r)
s=BeautifulSoup(r.text,'html.parser')
print(s)
a=s.find_all('div',{'class':"bd"})
print(a)
for item in a:
item=str(item)
link = re.findall(flink, item)
print(link)