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)