-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
46 lines (34 loc) · 996 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from fastapi import FastAPI, Request
from fastapi.responses import HTMLResponse
from fastapi.templating import Jinja2Templates
from routers.youtube import links
description = """
Enter a keyword, and the three most relevant videos will be displayed.
## Index
You can **search youtube videos**.
## Youtube
You can **get youtube videos**.
"""
tags_metadata = [
{
"name": "index",
"description": "Get the index webpage.",
},
{
"name": "youtube",
"description": "Get the three most relevant videos.",
},
]
app = FastAPI(
title="Youtube Search",
description=description,
version="0.0.1",
docs_url="/documentation",
redoc_url=None,
openapi_tags=tags_metadata,
)
app.include_router(links.router)
templates = Jinja2Templates(directory="templates")
@app.get("/", response_class=HTMLResponse, tags=['index'])
async def get_index(request: Request):
return templates.TemplateResponse("index.html", {"request": request})