xulh commited on
Commit
fe2e75b
·
1 Parent(s): 04d24cf

代码初始化

Browse files
Files changed (1) hide show
  1. video/iqiyi.py +0 -47
video/iqiyi.py CHANGED
@@ -71,50 +71,3 @@ async def video_search(
71
  except requests.exceptions.RequestException as e:
72
  # 处理请求错误
73
  raise HTTPException(status_code=500, detail=f"请求第三方API出错: {str(e)}")
74
-
75
-
76
- # 定义请求体模型
77
- class SearchVideoRequest(BaseModel):
78
- date: int # 时间
79
- videoName: str # 视频名称
80
- sign: str
81
-
82
-
83
- @routerVideo.post("/video/search")
84
- def search_videos(request: SearchVideoRequest):
85
- """
86
- 搜索视频接口
87
- :param date: 时间
88
- :param videoName: 视频名称
89
- :return: 符合条件的视频列表
90
- """
91
- api_url = "https://api.q168.vip/api/search"
92
- params = {
93
- "date": request.date,
94
- "videoName": request.videoName
95
- }
96
- # 签名
97
- # data_str = json.dumps(params)
98
- # sign = hmac.new("OArmXWpMeX8n".encode('utf-8'), data_str.encode('utf-8'), hashlib.sha256).hexdigest()
99
- # sign = generate_signature(params)
100
-
101
- # 设置请求头
102
- headers = {
103
- "Sign": request.sign,
104
- "Accept": "application/json, text/plain, */*",
105
- "Accept-Encoding": "gzip, deflate, br", # 加入 br
106
- "origin": "https://wantwatch.me",
107
- "Content-Type": "application/json; charset=utf-8",
108
- }
109
-
110
- try:
111
- # 发送请求到第三方API
112
- response = requests.post(api_url, data=params, headers=headers)
113
- response.raise_for_status() # 确保HTTP请求成功
114
-
115
- # 返回第三方API的结果
116
- return response.json()
117
-
118
- except requests.exceptions.RequestException as e:
119
- # 处理请求错误
120
- raise HTTPException(status_code=500, detail=f"请求第三方API出错: {str(e)}")
 
71
  except requests.exceptions.RequestException as e:
72
  # 处理请求错误
73
  raise HTTPException(status_code=500, detail=f"请求第三方API出错: {str(e)}")