上传文件至 /

This commit is contained in:
2026-03-24 11:33:30 +08:00
parent e291b6ac0f
commit 32e380d0b6

23
260324 09林贵珍 Normal file
View File

@@ -0,0 +1,23 @@
import requests
from bs4 import BeautifulSoup
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36'
}
url = 'https://movie.douban.com/top250?start=25&filter='
response = requests.get(url,headers=headers,timeout=10)
response.encoding = 'utf-8'
# print(response.status-code)
soup = BeautifulSoup(response.text,'html.parser')
movies = []
for item in soup.find_all('div',class_='hd'):
a = item.find('a')
if a:
print(a.get_text(strip=True))