File size: 442 Bytes
08eee20
c26f5ec
56f750d
08eee20
 
 
 
 
c26f5ec
 
 
 
11175d2
56f750d
 
 
 
ff53fa1
 
465b2b5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from fastapi import FastAPI
from fastapi.responses import JSONResponse
from fetchYoutubeSubtitle import fetchYoutubeSubtitle

app = FastAPI()

@app.get("/")
def read_root():
    return {"Hello": "World!"}


@app.get("/json")
def read_json():
    return JSONResponse(content={"Hello": "World!"})


@app.get("/subtitle/")
async def get_subtitle(vid: str):
    subtitle = await fetchYoutubeSubtitle(vid)
    return JSONResponse(content=subtitle)