Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
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
|
|
@@ -120,7 +120,7 @@ async def genres(request: Request, id: str):
|
|
| 120 |
for canal in list_canais:
|
| 121 |
canal.pop('streams')
|
| 122 |
if id in canal['genres']:
|
| 123 |
-
canais_.append(canal)
|
| 124 |
|
| 125 |
return JSONResponse(content={"metas": canais_})
|
| 126 |
|
|
@@ -136,7 +136,7 @@ async def catalog_route(request: Request, type: str, id: str):
|
|
| 136 |
for canal in list_canais:
|
| 137 |
canal.pop('streams')
|
| 138 |
canais_.append(canal)
|
| 139 |
-
return JSONResponse(content={"metas": canais_})
|
| 140 |
else:
|
| 141 |
return JSONResponse(content={"metas": []})
|
| 142 |
|
|
@@ -170,8 +170,9 @@ async def stream(request: Request, type: str, id: str):
|
|
| 170 |
host = request.client.host
|
| 171 |
server = f'https://{host}/logo?url=' if not ('localhost' in host or '127.0.0.1' in host) else f'http://{host}/logo?url='
|
| 172 |
|
|
|
|
|
|
|
| 173 |
if type == 'tv':
|
| 174 |
-
scrape_ = []
|
| 175 |
list_canais = canais.canais_list(server)
|
| 176 |
for canal in list_canais:
|
| 177 |
if canal['id'] == id:
|
|
@@ -195,7 +196,7 @@ async def stream(request: Request, type: str, id: str):
|
|
| 195 |
}
|
| 196 |
}
|
| 197 |
}]
|
| 198 |
-
except:
|
| 199 |
scrape_ = []
|
| 200 |
|
| 201 |
return JSONResponse(content={"streams": scrape_})
|
|
|
|
| 1 |
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
|
|
|
|
| 120 |
for canal in list_canais:
|
| 121 |
canal.pop('streams')
|
| 122 |
if id in canal['genres']:
|
| 123 |
+
canais_.append(canal)
|
| 124 |
|
| 125 |
return JSONResponse(content={"metas": canais_})
|
| 126 |
|
|
|
|
| 136 |
for canal in list_canais:
|
| 137 |
canal.pop('streams')
|
| 138 |
canais_.append(canal)
|
| 139 |
+
return JSONResponse(content={"metas": canais_})
|
| 140 |
else:
|
| 141 |
return JSONResponse(content={"metas": []})
|
| 142 |
|
|
|
|
| 170 |
host = request.client.host
|
| 171 |
server = f'https://{host}/logo?url=' if not ('localhost' in host or '127.0.0.1' in host) else f'http://{host}/logo?url='
|
| 172 |
|
| 173 |
+
scrape_ = []
|
| 174 |
+
|
| 175 |
if type == 'tv':
|
|
|
|
| 176 |
list_canais = canais.canais_list(server)
|
| 177 |
for canal in list_canais:
|
| 178 |
if canal['id'] == id:
|
|
|
|
| 196 |
}
|
| 197 |
}
|
| 198 |
}]
|
| 199 |
+
except Exception as e:
|
| 200 |
scrape_ = []
|
| 201 |
|
| 202 |
return JSONResponse(content={"streams": scrape_})
|