🗳修复Douyin部分链接因无背景音乐导致解析失败

This commit is contained in:
Evil0ctal 2022-04-06 14:23:58 -07:00 committed by GitHub
parent e68d96080f
commit 7e64e396da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,7 @@
# -*- encoding: utf-8 -*-
# @Author: https://github.com/Evil0ctal/
# @Time: 2021/11/06
# @Update: 2022/04/06
# @Update: 2022/04/05
# @Function:
# 创建一个接受提交参数的Flask应用程序。
# 将scraper.py返回的内容以JSON格式返回。
@ -147,6 +147,9 @@ def download_music():
# 用于返回视频下载请求(返回MP3文件下载请求面对大量请求时非常吃服务器内存容易崩慎用。)
api = Scraper()
content = request.args.get("url")
if content == 'No BGM found':
return jsonify(status='failed', reason='No BGM found', function='download_music()', value=content)
else:
post_content = find_url(content)[0]
try:
if 'douyin.com' in post_content: