-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmain.py
More file actions
35 lines (22 loc) · 834 Bytes
/
main.py
File metadata and controls
35 lines (22 loc) · 834 Bytes
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
from fastapi import FastAPI
import scraper
from fastapi.responses import RedirectResponse
app = FastAPI()
@app.get("/")
async def root():
return RedirectResponse(url="/docs")
@app.get("/search/{query}")
async def search_anime(query: str):
return await scraper.search(query)
@app.get("/anime/{anime_id}")
async def get_anime_info(anime_id: str):
return await scraper.get_anime(anime_id)
@app.get("/new-season/{page_no}")
async def get_new_season(page_no: int):
return await scraper.new_season(page_no)
@app.get("/streaming-links/{anime_id}/{episode_no}")
async def get_streaming(anime_id: str, episode_no: int):
return await scraper.get_streaming_links(anime_id, episode_no)
@app.get("/home/{page}")
async def get_home(page: int):
return await scraper.home(page)