LoremPizza commited on
Commit
974f03a
·
verified ·
1 Parent(s): 5fc20cb

Update epg.py

Browse files
Files changed (1) hide show
  1. epg.py +20 -14
epg.py CHANGED
@@ -36,7 +36,7 @@ tivu = {
36
  "rai-4k": "3407",
37
  """
38
  convert_bho_1 = {
39
- "euronews": "euronewsit",
40
  "cartoonito": "cartoonito",
41
  "sky-tg-24": "skytg24",
42
  "frisbee": "frisbee",
@@ -158,19 +158,25 @@ async def tivu_get(id):
158
 
159
 
160
 
161
- async def epg_guide(id,client):
162
- if id in convert_bho_1:
163
- id = convert_bho_1[id]
164
- response = await client.get(f"https://lorempizza-boh.hf.space/{id}/now")
165
- elif id in convert_bho_2:
166
- id = convert_bho_2[id]
167
- response = await client.get(f"https://mammamia-urlo-boh2.hf.space/{id}/now")
168
- data = response.json()
169
- description = data['description'].replace("- EPG by epg-guide.com","").replace("No description","")
170
- title = data['title']
171
- print(description,title)
172
- return description,title
173
-
 
 
 
 
 
 
174
 
175
 
176
 
 
36
  "rai-4k": "3407",
37
  """
38
  convert_bho_1 = {
39
+ "euronews": "PlutoEuronews.it",
40
  "cartoonito": "cartoonito",
41
  "sky-tg-24": "skytg24",
42
  "frisbee": "frisbee",
 
158
 
159
 
160
 
161
+ async def epg_guide(id):
162
+ try:
163
+ async with httpx.AsyncClient() as client:
164
+ if id in convert_bho_1:
165
+ id = convert_bho_1[id]
166
+ response = await client.get(f"https://lorempizza-boh.hf.space/{id}/now")
167
+ elif id in convert_bho_2:
168
+ id = convert_bho_2[id]
169
+ response = await client.get(f"https://mammamia-urlo-boh2.hf.space/{id}/now")
170
+ data = response.json()
171
+ description = data['description'].replace("- EPG by epg-guide.com","").replace("No description","")
172
+ title = data['title']
173
+ print(description,title)
174
+ return description,title
175
+ except Exception as e:
176
+ print(e)
177
+ description = f'Watch {id}'
178
+ title = ""
179
+ return description,title
180
 
181
 
182