xulh commited on
Commit
801db4e
·
1 Parent(s): ee70e30

代码初始化

Browse files
Files changed (2) hide show
  1. app.py +2 -0
  2. video/iqiyi.py +4 -4
app.py CHANGED
@@ -1,10 +1,12 @@
1
  from fastapi import FastAPI
2
  from inference.inference import router
3
  from picture.generalImg import routerImg
 
4
 
5
  app = FastAPI()
6
  app.include_router(router)
7
  app.include_router(routerImg)
 
8
 
9
 
10
  @app.get("/")
 
1
  from fastapi import FastAPI
2
  from inference.inference import router
3
  from picture.generalImg import routerImg
4
+ from video.iqiyi import routerVideo
5
 
6
  app = FastAPI()
7
  app.include_router(router)
8
  app.include_router(routerImg)
9
+ app.include_router(routerVideo)
10
 
11
 
12
  @app.get("/")
video/iqiyi.py CHANGED
@@ -1,13 +1,13 @@
1
- from fastapi import FastAPI, Query, HTTPException
2
  import requests
3
 
4
- app = FastAPI()
5
 
6
  # 第三方API地址
7
  EXTERNAL_API_URL = "https://api.suyanw.cn/api/Iqiyi_video_search.php"
8
 
9
 
10
- @app.get("/video-search/")
11
  async def video_search(
12
  msg: str = Query(..., description="需要搜索的视频内容"),
13
  n: int = Query(0, description="选择序号"),
@@ -37,7 +37,7 @@ async def video_search(
37
  raise HTTPException(status_code=500, detail=f"请求第三方API出错: {str(e)}")
38
 
39
 
40
- @app.get("/video-recommend/")
41
  async def video_search(
42
  source: str = Query(..., description="资源类型"),
43
  search_type: str = Query(..., description="返回格式,默认text可选json"),
 
1
+ from fastapi import APIRouter, Query, HTTPException
2
  import requests
3
 
4
+ routerVideo = APIRouter()
5
 
6
  # 第三方API地址
7
  EXTERNAL_API_URL = "https://api.suyanw.cn/api/Iqiyi_video_search.php"
8
 
9
 
10
+ @routerVideo.get("/video-search/")
11
  async def video_search(
12
  msg: str = Query(..., description="需要搜索的视频内容"),
13
  n: int = Query(0, description="选择序号"),
 
37
  raise HTTPException(status_code=500, detail=f"请求第三方API出错: {str(e)}")
38
 
39
 
40
+ @routerVideo.get("/video-recommend/")
41
  async def video_search(
42
  source: str = Query(..., description="资源类型"),
43
  search_type: str = Query(..., description="返回格式,默认text可选json"),