From 92b30f5682adfdfcf79bfdbf0ba3bfc172554895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=96=87=E7=90=B3?= <2509165042@student.example.com> Date: Tue, 31 Mar 2026 11:27:18 +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 --- XWL.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 XWL.py diff --git a/XWL.py b/XWL.py new file mode 100644 index 0000000..9a95726 --- /dev/null +++ b/XWL.py @@ -0,0 +1,39 @@ +import requests +import re +import csv +import time +headers = { + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' +} +all_movies=[] +for page in range(10): + url = 'https://movie.douban.com/top250' + response = requests.get(url, headers=headers) + html = response.text + title_pattern = r'([^<&]+)' + rating_pattern = r']*>(\d+\.?\d*)' + titles = re.findall(title_pattern, html) + ratings = re.findall(rating_pattern, html) + for i in range(min(25,len(ratings))): + title =titles[i*2]if i*2