import json import requests from tenacity import retry from requests.exceptions import RequestException from typing import Optional, Dict, List from applications.utils import request_retry retry_desc = request_retry(retry_times=3, min_retry_delay=2, max_retry_delay=30) @retry(**retry_desc) def fetch_piaoquan_video_list_detail(video_id_list: List[int]) -> Optional[Dict]: """ 获取票圈视频详情信息 :param: video_list: 视频id 列表 :return: Detail """ url = "https://longvideoapi.piaoquantv.com/longvideoapi/openapi/video/batchSelectVideoInfo" data = {"videoIdList": video_id_list} header = { "Content-Type": "application/json", } try: response = requests.post(url, headers=header, json=data, timeout=60) response.raise_for_status() return response.json() except RequestException as e: print(f"API请求失败: {e}") except json.JSONDecodeError as e: print(f"响应解析失败: {e}") return None