xulh commited on
Commit
e1b0151
·
1 Parent(s): 9bece33

代码初始化

Browse files
Files changed (1) hide show
  1. video/shortVedio.py +30 -0
video/shortVedio.py CHANGED
@@ -34,3 +34,33 @@ async def video_search(
34
  except requests.exceptions.RequestException as e:
35
  # 处理请求错误
36
  raise HTTPException(status_code=500, detail=f"请求第三方API出错: {str(e)}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  except requests.exceptions.RequestException as e:
35
  # 处理请求错误
36
  raise HTTPException(status_code=500, detail=f"请求第三方API出错: {str(e)}")
37
+
38
+
39
+ @shortVideo.get("/video/playlet/list")
40
+ async def video_search(
41
+ name_en: str = Query(1, description="分类"),
42
+ page: int = Query(1, description="页数"),
43
+ limit: int = Query(10, description="搜索内容列表数"),
44
+ zlsj: str = Query("zlsj", description="跳过加解密")
45
+ ):
46
+ """
47
+ 视频搜索接口 - 封装第三方 API。
48
+ """
49
+ # 参数传递给第三方API
50
+ params = {
51
+ "name_en": name_en,
52
+ "page": page,
53
+ "limit": limit,
54
+ "zlsj": zlsj
55
+ }
56
+ try:
57
+ # 发送请求到第三方API
58
+ response = requests.get(EXTERNAL_API_URL + "/api/playlet/list", params=params)
59
+ response.raise_for_status() # 确保HTTP请求成功
60
+
61
+ # 返回第三方API的结果
62
+ return response.json()
63
+
64
+ except requests.exceptions.RequestException as e:
65
+ # 处理请求错误
66
+ raise HTTPException(status_code=500, detail=f"请求第三方API出错: {str(e)}")