From 86246ac68e1131710bb59a8c6c9b2926ebee1831 Mon Sep 17 00:00:00 2001 From: 2509165020 <2509165020@student.edu.cn> Date: Tue, 24 Mar 2026 10:41:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E7=BB=9C=E6=95=B0=E6=8D=AE=E9=87=87?= =?UTF-8?q?=E9=9B=86=EF=BC=88=E7=88=AC=E8=99=AB=E5=9F=BA=E7=A1=80=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 爬虫3.24/douban.py.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 爬虫3.24/douban.py.py diff --git a/爬虫3.24/douban.py.py b/爬虫3.24/douban.py.py new file mode 100644 index 0000000..c699b82 --- /dev/null +++ b/爬虫3.24/douban.py.py @@ -0,0 +1,14 @@ +import requests +from bs4 import BeautifulSoup + +headers = { + 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36' +} + +url = 'https://www.douban.com/doulist/3936288/' +response = requests.get(url, headers=headers) +soup = BeautifulSoup(response.text, 'html.parser') + +titles = soup.select('.title a') +for t in titles: + print(t.text.strip()) \ No newline at end of file