From bbc503bfd8cbe8b7a0832a11165651787b496875 Mon Sep 17 00:00:00 2001 From: Evil0ctal Date: Wed, 6 Apr 2022 09:42:24 -0700 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A0=B9=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- API/web_api.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/API/web_api.py b/API/web_api.py index 06958e0..c4fb1f9 100644 --- a/API/web_api.py +++ b/API/web_api.py @@ -2,7 +2,7 @@ # -*- encoding: utf-8 -*- # @Author: https://github.com/Evil0ctal/ # @Time: 2021/11/06 -# @Update: 2022/04/05 +# @Update: 2022/04/06 # @Function: # 创建一个接受提交参数的Flask应用程序。 # 将scraper.py返回的内容以JSON格式返回。 @@ -39,6 +39,19 @@ def clean_filename(string, author_name): return filename +@app.route("/", methods=["POST", "GET"]) +def index(): + # 显示基础信息 + index_info = {'API status': 'Running', + 'GitHub': 'https://github.com/Evil0ctal/Douyin_TikTok_Download_API', + 'Introduction': 'Free and open source Douyin/TikTok watermark-free video download tool, supports API calls.', + 'Web interface': 'https://douyin.wtf/', + 'Parsing Douyin/TikTok videos': 'https://api.douyin.wtf/api?url=[Douyin/TikTok url]', + 'Return Video MP4 File Download': 'https://api.douyin.wtf/video?url=[Douyin/TikTok url]', + 'Return Video MP3 File Download': 'https://api.douyin.wtf/music?url=[Douyin/TikTok url]'} + return jsonify(index_info) + + @app.route("/api", methods=["POST", "GET"]) def webapi(): # 创建一个Flask应用获取POST参数并返回结果 @@ -75,7 +88,6 @@ def webapi(): return jsonify(status='failed', reason='url value cannot be empty') - @app.route("/video", methods=["POST", "GET"]) def download_video(): # 用于返回视频下载请求(返回MP4文件下载请求,面对大量请求时非常吃服务器内存,容易崩,慎用。) @@ -192,4 +204,4 @@ if __name__ == '__main__': else: # 默认端口 port = 2333 - app.run(host='0.0.0.0', port=port) \ No newline at end of file + app.run(host='0.0.0.0', port=port)