From cd3db9d9702751a42a40fdab9cf91e8c04695800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E6=96=87=E6=9D=B0?= <2509165027@student.example.com> Date: Tue, 9 Jun 2026 11:28:53 +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 --- ll.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 ll.py diff --git a/ll.py b/ll.py new file mode 100644 index 0000000..8304e72 --- /dev/null +++ b/ll.py @@ -0,0 +1,27 @@ +import requests +import re + +url = 'https://www.douban.com/doulist/3936288/' +header = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36'} +response = requests.get(url, headers=header) +response.encoding = 'utf-8' +html = response.text + +title_pattern = r'
([^<]+)' +titles = re.findall(title_pattern, html) +chinese_titles = [t for t in titles if not t.startswith('/')] + +actor_pattern = r'主演:([^<]+)' +actors=re.findall(actor_pattern,html) + +quote_pattern = r'([^<]+)' +quotes = re.findall(quote_pattern, html) + +#limit=min(50,len(chinese_titles)) +for i in range(min(50,len(chinese_titles))): + title = chinese_titles[i] + actor_pattern = actors[i] + quote = quotes[i] + print(f'"rank":{i+1},"title":{titles},"actor":{actors},"quotes": {quotes}') + +