xulh commited on
Commit
4e1454c
·
1 Parent(s): e1b0151

代码初始化

Browse files
Files changed (1) hide show
  1. video/shortVedio.py +32 -2
video/shortVedio.py CHANGED
@@ -9,7 +9,7 @@ EXTERNAL_API_URL = "https://playlet.zonelian.com"
9
 
10
 
11
  @shortVideo.get("/video/category/list")
12
- async def video_search(
13
  page: int = Query(1, description="页数"),
14
  limit: int = Query(10, description="搜索内容列表数"),
15
  zlsj: str = Query("zlsj", description="跳过加解密")
@@ -37,7 +37,7 @@ async def video_search(
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="搜索内容列表数"),
@@ -64,3 +64,33 @@ async def video_search(
64
  except requests.exceptions.RequestException as e:
65
  # 处理请求错误
66
  raise HTTPException(status_code=500, detail=f"请求第三方API出错: {str(e)}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
 
11
  @shortVideo.get("/video/category/list")
12
+ async def category_search(
13
  page: int = Query(1, description="页数"),
14
  limit: int = Query(10, description="搜索内容列表数"),
15
  zlsj: str = Query("zlsj", description="跳过加解密")
 
37
 
38
 
39
  @shortVideo.get("/video/playlet/list")
40
+ async def playlet_search(
41
  name_en: str = Query(1, description="分类"),
42
  page: int = Query(1, description="页数"),
43
  limit: int = Query(10, description="搜索内容列表数"),
 
64
  except requests.exceptions.RequestException as e:
65
  # 处理请求错误
66
  raise HTTPException(status_code=500, detail=f"请求第三方API出错: {str(e)}")
67
+
68
+
69
+ @shortVideo.get("/video/playlet/episode")
70
+ async def episode_search(
71
+ vid: int = Query(1, description="短剧id"),
72
+ page: int = Query(1, description="页数"),
73
+ limit: int = Query(10, description="搜索内容列表数"),
74
+ zlsj: str = Query("zlsj", description="跳过加解密")
75
+ ):
76
+ """
77
+ 视频搜索接口 - 封装第三方 API。
78
+ """
79
+ # 参数传递给第三方API
80
+ params = {
81
+ "vid": vid,
82
+ "page": page,
83
+ "limit": limit,
84
+ "zlsj": zlsj
85
+ }
86
+ try:
87
+ # 发送请求到第三方API
88
+ response = requests.get(EXTERNAL_API_URL + "/api/playlet/episode", params=params)
89
+ response.raise_for_status() # 确保HTTP请求成功
90
+
91
+ # 返回第三方API的结果
92
+ return response.json()
93
+
94
+ except requests.exceptions.RequestException as e:
95
+ # 处理请求错误
96
+ raise HTTPException(status_code=500, detail=f"请求第三方API出错: {str(e)}")