From 40532bb68d7f62239d47b796816fb8c6c999dece Mon Sep 17 00:00:00 2001 From: Yeach <79353322+RWGLQJ@users.noreply.github.com> Date: Sun, 24 Sep 2023 13:45:50 +0800 Subject: [PATCH] =?UTF-8?q?b=E7=AB=99=E7=83=AD=E6=92=AD=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96bv=E5=8F=B7=E7=9A=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "b\347\253\231\347\203\255\346\222\255.py" | 6 +++--- "\346\200\273\345\222\214.py" | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git "a/b\347\253\231\347\203\255\346\222\255.py" "b/b\347\253\231\347\203\255\346\222\255.py" index 4c492e0..b44d261 100644 --- "a/b\347\253\231\347\203\255\346\222\255.py" +++ "b/b\347\253\231\347\203\255\346\222\255.py" @@ -4,7 +4,6 @@ app = Flask(__name__) -@app.route('/api/hot_videos', methods=['GET']) def get_hot_videos(): try: # 发送HTTP GET请求获取热播视频数据 @@ -12,12 +11,13 @@ def get_hot_videos(): response = requests.get(url) data = response.json() - # 解析响应数据,提取热播视频信息 + # 解析响应数据,提取热播视频信息(包括vb号) hot_videos = [] for video in data['data']['list']: title = video['title'] play_count = video['stat']['view'] - hot_videos.append({'title': title, 'play_count': play_count}) + vb_number = video['bvid'] + hot_videos.append({'title': title, 'play_count': play_count, 'vb_number': vb_number}) return jsonify({'hot_videos': hot_videos}) diff --git "a/\346\200\273\345\222\214.py" "b/\346\200\273\345\222\214.py" index 119d555..437f6ff 100644 --- "a/\346\200\273\345\222\214.py" +++ "b/\346\200\273\345\222\214.py" @@ -26,18 +26,20 @@ def get_hot_videos(): response = requests.get(url) data = response.json() - # 解析响应数据,提取热播视频信息 + # 解析响应数据,提取热播视频信息(包括vb号) hot_videos = [] for video in data['data']['list']: title = video['title'] play_count = video['stat']['view'] - hot_videos.append({'title': title, 'play_count': play_count}) + vb_number = video['bvid'] + hot_videos.append({'title': title, 'play_count': play_count, 'vb_number': vb_number}) return jsonify({'hot_videos': hot_videos}) except Exception as e: return jsonify({'error': str(e)}) + #邮箱发信api #email = Flask(__name__) SMTP_SERVER = 'smtp.qq.com'