From 50e4de8f7354c7021c75173bd0cc3d508bcee428 Mon Sep 17 00:00:00 2001 From: pg78ac9nr <2401677463@qq.com> Date: Wed, 18 Sep 2024 23:55:29 +0800 Subject: [PATCH] =?UTF-8?q?Update=20102201214=20=E8=AE=B8=E8=8E=8E?= =?UTF-8?q?=E8=8E=8E.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 102201214 许莎莎.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/102201214 许莎莎.py b/102201214 许莎莎.py index e345a1c..fdeddac 100644 --- a/102201214 许莎莎.py +++ b/102201214 许莎莎.py @@ -47,12 +47,10 @@ def seek_api_urls(html_data): def get_api_urls(url): response = requests.get(url, headers=headers) if response.status_code == 200: - # 若请求成功则查找api链接 html_data=response.text api_urls=seek_api_urls(html_data) return api_urls else: - # 返回一个空列表作为默认值 return [] # 获取视频接口函数 @@ -109,21 +107,15 @@ def vedio_transform_port(url): port_urls.add(port_url.replace("bilibili.com", "ibilibili.com")) for page in range(1,8): - # 获取视频链接 vedio_urls=get_urls(page) - # 创建接口链接列表 port_urls=set() for vedio_url in vedio_urls: - # 将视频链接转换成接口链接 port_url = vedio_transform_port(vedio_url) - # 循环访问接口 + for url in port_urls: - #获取弹幕链接 api_urls=get_api_urls(url) - # 检查列表是否为空 if api_urls: - #不为空,则将获取弹幕链接 api_url = api_urls[0] html_data = get_html(api_url) soup = BeautifulSoup(html_data, 'html.parser')