From 32e380d0b63d06e96695ac18f51ab583c3fff968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E8=B4=B5=E7=8F=8D?= <2509165009@student.example.com> Date: Tue, 24 Mar 2026 11:33:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 260324 09林贵珍 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 260324 09林贵珍 diff --git a/260324 09林贵珍 b/260324 09林贵珍 new file mode 100644 index 0000000..6460ef7 --- /dev/null +++ b/260324 09林贵珍 @@ -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)) +