lanbogao commited on
Commit
c2eed51
1 Parent(s): 3dadd80

rename getSubtitle to fetchSubtitle.

Browse files
Files changed (2) hide show
  1. fetchYoutubeSubtitle.py +1 -1
  2. main.py +2 -2
fetchYoutubeSubtitle.py CHANGED
@@ -10,7 +10,7 @@ def getVttUrlFromSubtitles(item, lang='en', vttType="vtt"):
10
  return item.get("url")
11
  return None
12
 
13
- async def getSubtitle(url: str, lang: Optional[str] = 'en', vttType="vtt") -> Optional[str]:
14
  ydl_opts = {
15
  "writesubtitles": True,
16
  "allsubtitles": True,
 
10
  return item.get("url")
11
  return None
12
 
13
+ async def fetchSubtitle(url: str, lang: Optional[str] = 'en', vttType="vtt") -> Optional[str]:
14
  ydl_opts = {
15
  "writesubtitles": True,
16
  "allsubtitles": True,
main.py CHANGED
@@ -1,6 +1,6 @@
1
  from fastapi import FastAPI
2
  from fastapi.responses import JSONResponse
3
- from fetchYoutubeSubtitle import getSubtitle, fetchSubtitleUrls
4
 
5
  app = FastAPI()
6
 
@@ -16,7 +16,7 @@ def read_json():
16
 
17
  @app.get("/subtitle/")
18
  async def get_subtitle(url: str):
19
- subtitle = await fetchSubtitleUrls(url)
20
  return JSONResponse(content=subtitle)
21
 
22
 
 
1
  from fastapi import FastAPI
2
  from fastapi.responses import JSONResponse
3
+ from fetchYoutubeSubtitle import fetchSubtitle, fetchSubtitleUrls
4
 
5
  app = FastAPI()
6
 
 
16
 
17
  @app.get("/subtitle/")
18
  async def get_subtitle(url: str):
19
+ subtitle = await fetchSubtitle(url)
20
  return JSONResponse(content=subtitle)
21
 
22