From a6b143a6d35ebab3f89112b39bc27109283b2d76 Mon Sep 17 00:00:00 2001 From: po9eakyfz <3055861661@qq.com> Date: Mon, 6 May 2024 14:34:51 +0800 Subject: [PATCH] ADD file via upload --- 5.py | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 5.py diff --git a/5.py b/5.py new file mode 100644 index 0000000..3c3d388 --- /dev/null +++ b/5.py @@ -0,0 +1,49 @@ +import re +import requests + +url_first = 'https://www.jxxdxy.edu.cn/news-list-xiaoyuanyaowen' +url_last = '.html' +urls = [] +urls.append(url_first + url_last) +for i in range(2, 21): + urls.append(url_first + '-'+str(i) + url_last) + +# for url in urls: +# print(url) +a = { + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,like Gecko) Chrom/124.0.0.0 Safari/537.36 Edg/124.0.0.0' + +} +# res = requests.get(urls[0], headers=a) +# res.encoding = 'utf-8' + +# print(res.text) + +# for url in urls: +# response = requests.get(url, headers=a) +# print(response.status_code) +# print(response.encoding) +lists = [] +for url in urls: + response = requests.get(url, headers=a) + lists.append(response.text) +bd_re = '