- import requests
- import re
- url = 'https://www.bizhi88.com/3840x2160/'
- headers = {
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.0.0 Safari/537.36'
- }
- response = requests.get(url=url, headers=headers)
- response.encoding = 'utf8'
- html_info = re.findall('<a href="(.*?)" title="(.*?)" target="_blank" class="img" style="(.*?)"', response.text)
- num = 0
- for link, title, style in html_info:
- num = num + 1
- if num == 1:
- continue
- link_url = 'https://www.bizhi88.com' + link
- response2 = requests.get(url=link_url, headers=headers)
- response2.encoding = "utf8"
- img_url = re.findall('<img src="(.*?)" alt="(.*?)"', response2.text)[0]
- print(img_url[0], img_url[1])
-
复制代码
|