|
发表于 2022-6-18 17:32:48
|
显示全部楼层
- import requests
- from bs4 import BeautifulSoup
- for i in range(1, 5):
- headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0'}
- page = requests.get("https://www.libvio.me/type/1-{}.html".format(i), headers=headers)
- soup = BeautifulSoup(page.content, 'html.parser', from_encoding='utf-8')
- a = soup.find_all('h4', class_='title text-overflow',)
- for j in a:
- print('https://www.libvio.me/{}'.format(j.a.attrs['href']),
- j.get_text())
复制代码 你那个我不清楚,这个你可以借鉴下
|
|