docker_fastapi / main.py
lanbogao's picture
Update main.py
465b2b5
raw
history blame
No virus
430 Bytes
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/")
def get_subtitle(vid: str):
subtitle = fetchYoutubeSubtitle(vid)
return JSONResponse(content=subtitle)