Skip to content

Commit

Permalink
fix douyin filter
Browse files Browse the repository at this point in the history
  • Loading branch information
moyada committed Mar 19, 2024
1 parent d52e6dc commit 0cc93f2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions service/douyin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
from core import config
from core.type import Video

import logging


logger = logging.getLogger('request')

headers = {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
Expand Down Expand Up @@ -75,11 +79,19 @@ def get_info(cls, url: str) -> Result:
try:
info = handler.get_info(share_url)
except Exception as e:
logger.error(f'抖音数据获取失败: {share_url}, {e}')
return Result.error(str(e))

if info is None or info['status_code'] != 0:
logger.error(f'抖音数据获取失败: {share_url}, 分享链接不支持')
return ErrorResult.VIDEO_INFO_NOT_FOUNT

if info['filter_detail'] is not None:
msg = info['filter_detail']['notice']
logger.error(f'抖音数据获取失败: {share_url}, {msg}')
return Result.error(msg)


data = info['aweme_detail']

info = Info(platform=vtype)
Expand Down

0 comments on commit 0cc93f2

Please sign in to comment.