Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,10 +2,8 @@ from fastapi import FastAPI
|
|
| 2 |
from fastapi.responses import JSONResponse
|
| 3 |
from fastapi import Request, Response
|
| 4 |
from fastapi.templating import Jinja2Templates
|
| 5 |
-
import json
|
| 6 |
import requests
|
| 7 |
import canais
|
| 8 |
-
import os
|
| 9 |
from dotenv import load_dotenv
|
| 10 |
|
| 11 |
load_dotenv()
|
|
@@ -69,7 +67,6 @@ MANIFEST = {
|
|
| 69 |
"idPrefixes": ["skyflix", "tt"]
|
| 70 |
}
|
| 71 |
|
| 72 |
-
|
| 73 |
@app_.get("/")
|
| 74 |
async def home(request: Request):
|
| 75 |
name = MANIFEST['name']
|
|
@@ -104,7 +101,6 @@ async def proxy_logo(request: Request):
|
|
| 104 |
except requests.exceptions.RequestException as e:
|
| 105 |
return JSONResponse(content={"error": f"Erro ao buscar a imagem: {str(e)}"}, status_code=500)
|
| 106 |
|
| 107 |
-
|
| 108 |
@app_.get("/manifest.json")
|
| 109 |
async def manifest():
|
| 110 |
return JSONResponse(content=MANIFEST)
|
|
@@ -124,7 +120,6 @@ async def genres(request: Request, id: str):
|
|
| 124 |
|
| 125 |
return JSONResponse(content={"metas": canais_})
|
| 126 |
|
| 127 |
-
|
| 128 |
@app_.get("/catalog/{type}/{id}.json")
|
| 129 |
async def catalog_route(request: Request, type: str, id: str):
|
| 130 |
host = request.client.host
|
|
@@ -140,7 +135,6 @@ async def catalog_route(request: Request, type: str, id: str):
|
|
| 140 |
else:
|
| 141 |
return JSONResponse(content={"metas": []})
|
| 142 |
|
| 143 |
-
|
| 144 |
@app_.get("/catalog/{type}/skyflix/search={query}.json")
|
| 145 |
async def search(type: str, query: str):
|
| 146 |
catalog = catalog_search(query)
|
|
@@ -164,7 +158,6 @@ async def meta(request: Request, type: str, id: str):
|
|
| 164 |
|
| 165 |
return JSONResponse(content={"meta": {}})
|
| 166 |
|
| 167 |
-
|
| 168 |
@app_.get("/stream/{type}/{id}.json")
|
| 169 |
async def stream(request: Request, type: str, id: str):
|
| 170 |
host = request.client.host
|
|
@@ -201,7 +194,6 @@ async def stream(request: Request, type: str, id: str):
|
|
| 201 |
|
| 202 |
return JSONResponse(content={"streams": scrape_})
|
| 203 |
|
| 204 |
-
|
| 205 |
@app_.options("/{path:path}")
|
| 206 |
async def options_handler(path: str):
|
| 207 |
response = Response()
|
|
|
|
| 2 |
from fastapi.responses import JSONResponse
|
| 3 |
from fastapi import Request, Response
|
| 4 |
from fastapi.templating import Jinja2Templates
|
|
|
|
| 5 |
import requests
|
| 6 |
import canais
|
|
|
|
| 7 |
from dotenv import load_dotenv
|
| 8 |
|
| 9 |
load_dotenv()
|
|
|
|
| 67 |
"idPrefixes": ["skyflix", "tt"]
|
| 68 |
}
|
| 69 |
|
|
|
|
| 70 |
@app_.get("/")
|
| 71 |
async def home(request: Request):
|
| 72 |
name = MANIFEST['name']
|
|
|
|
| 101 |
except requests.exceptions.RequestException as e:
|
| 102 |
return JSONResponse(content={"error": f"Erro ao buscar a imagem: {str(e)}"}, status_code=500)
|
| 103 |
|
|
|
|
| 104 |
@app_.get("/manifest.json")
|
| 105 |
async def manifest():
|
| 106 |
return JSONResponse(content=MANIFEST)
|
|
|
|
| 120 |
|
| 121 |
return JSONResponse(content={"metas": canais_})
|
| 122 |
|
|
|
|
| 123 |
@app_.get("/catalog/{type}/{id}.json")
|
| 124 |
async def catalog_route(request: Request, type: str, id: str):
|
| 125 |
host = request.client.host
|
|
|
|
| 135 |
else:
|
| 136 |
return JSONResponse(content={"metas": []})
|
| 137 |
|
|
|
|
| 138 |
@app_.get("/catalog/{type}/skyflix/search={query}.json")
|
| 139 |
async def search(type: str, query: str):
|
| 140 |
catalog = catalog_search(query)
|
|
|
|
| 158 |
|
| 159 |
return JSONResponse(content={"meta": {}})
|
| 160 |
|
|
|
|
| 161 |
@app_.get("/stream/{type}/{id}.json")
|
| 162 |
async def stream(request: Request, type: str, id: str):
|
| 163 |
host = request.client.host
|
|
|
|
| 194 |
|
| 195 |
return JSONResponse(content={"streams": scrape_})
|
| 196 |
|
|
|
|
| 197 |
@app_.options("/{path:path}")
|
| 198 |
async def options_handler(path: str):
|
| 199 |
response = Response()
|