From 4a55c32041a5843eb6999a62e4dfc47155b5d0fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E7=BB=B4?= <2509165034@student.example.com> Date: Tue, 31 Mar 2026 11:30:40 +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 --- 260331-2509165034.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 260331-2509165034.py diff --git a/260331-2509165034.py b/260331-2509165034.py new file mode 100644 index 0000000..d309917 --- /dev/null +++ b/260331-2509165034.py @@ -0,0 +1,19 @@ +import requests +from bs4 import BeautifulSoup +import csv +import json +import time +headers = { + 'User-Agent':'mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/120.0.0.0 Safari/537.36' +} +movies_data = [] +for page in range(10): + url = f'https://movie.douban.com/top250?start={page * 25}' + response = requests.get(url, headers=headers) + soup = BeautifulSoup(response.text,'html.parser') + for item in soup.find_all('div',class_='item'): + title_info = item.find('div',class_='hd').find('a').get_text(strip=Ture).replace('\n','') + info = item.find('div',class_='bd').p.get_text(strip=True).split('\n')[0] + movie = { + + } \ No newline at end of file