14 lines
418 B
Python
14 lines
418 B
Python
import requests
|
|
from bs4 import BeautifulSoup
|
|
|
|
headers = {
|
|
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36'
|
|
}
|
|
|
|
url = 'https://www.douban.com/doulist/3936288/'
|
|
response = requests.get(url, headers=headers)
|
|
soup = BeautifulSoup(response.text, 'html.parser')
|
|
|
|
titles = soup.select('.title a')
|
|
for t in titles:
|
|
print(t.text.strip()) |