Spaces:
Paused
Paused
File size: 5,838 Bytes
c97ec96 6ada024 c97ec96 51ad99b c97ec96 6ada024 974f03a 6ada024 c97ec96 6ada024 51ad99b c97ec96 51ad99b c97ec96 6ada024 974f03a 6ada024 |
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
from bs4 import BeautifulSoup
import httpx
tivu = {
"dazn-zona-a": "801",
}
"""
"rai-1": "3401",
"rai-2": "3402",
"rai-3": "3403",
"rete-4": "123",
"canale-5": "122",
"italia-1": "121",
"la7": "79",
"tv8": "7260",
"nove": "4323",
"rai-4": "3405",
"rai-movie": "3406",
"rai-premium": "8522",
"mediaset-extra": "129",
"cielo": "4120",
"rai-sport": "17714",
"rai-news": "17711",
"dmax": "15202",
"real-time": "15201",
"focus": "134",
"giallo": "4322",
"topcrime": "132",
"boing": "126",
"cartoonito": "133",
"k2": "15204",
"foodnetwork": "15203",
"hgtv": "4334",
"solocalcio": "4996" ,
"euronews": "2017",
"rai-4k": "3407",
"""
convert_bho_1 = {
"euronews": "PlutoEuronews.it",
"cartoonito": "cartoonito",
"sky-tg-24": "skytg24",
"frisbee": "frisbee",
"hgtv": "hgtv",
"k2": "k2",
"supertennis": "supertennis",
"solocalcio": "sportitaliasolocalcio",
"sportitalia": "sportitalia",
"sportitalia24": "RakutenSportItalia.it",
"rsi-la-2": "rsila2",
"baby-shark-tv": "RakutenBabySharkTv.it",
"adrenaline-movies": "RakutenFullMoon.it",
"adrenaline-movies": "RakutenBizzarroMovies.it",
"cinema-italiano": "RakutenCinemaItalianoRakutenTv.it",
"le-vite-degli-altri": "RakutenLeViteDegliAltri.it",
"dark-matter": "RakutenDarkMatterItNew.it",
"cine-western": "RakutenWesternEPeplum.it",
"serie-crime": "RakutenCrimeSeriesItRakutenTv.it",
"filmrise-sci-fi": "RakutenFuelTvNew.it",
"doctor-who": "RakutenBbcDoctorWho.it",
"bbc-drama": "RakutenBbcDrama.it",
"documentari": "RakutenDocumentaries.it",
"house-of-docs": "RakutenHouseOfDocs.it",
"the-asylum": "PlutoTheAsylum.it",
"western": "PlutoTvWestern.it",
"consulenze-illegali": "PlutoConsulenzeIllegaliItPlus.it"
}
convert_bho_2 = {
"la7": "La 7",
"rai-1": "Rai 1",
"rai-2": "Rai 2",
"rai-3": "Rai 3",
"rai-4": "Rai 4",
"rai-premium": "Rai Premium",
"rai-movie": "Rai Movie",
"rai-sport": "Rai Sport",
"rete-4": "Rete 4",
"canale-5": "Canale 5",
"italia-1": "Italia 1",
"topcrime": "Top Crime",
"mediaset-extra": "Mediaset Extra",
"focus": "Focus",
"boing": "Boing",
"history": "History",
"comedy-central": "Comedy Central",
"tv8": "TV 8",
"cielo": "Cielo",
"sky-cinema-action": "Sky Cinema Action",
"sky-arte": "Sky Arte FHD",
"sky-atlantic": "Sky Atlantic",
"sky-cinema-collection": "Sky Cinema Collection",
"sky-cinema-comedy": "Sky Cinema Comedy",
"sky-cinema-drama": "Sky Cinema Drama",
"sky-cinema-due": "Sky Cinema Due",
"sky-cinema-family": "Sky Cinema Family",
"sky-cinema-romance": "Sky Cinema Romance",
"sky-cinema-suspence": "Sky Cinema Suspence",
"sky-cinema-uno": "Sky Cinema Uno",
"sky-uno": "Sky Uno",
"sky-sport-24": "Sky Sport",
"sky-sport-uno": "Sky Sport Uno",
"sky-sport-f1": "Sky Sport F1",
"sky-sport-motogp": "Sky Sport MotoGP",
"sky-sport-arena": "Sky Sport Arena",
"sky-sport-nba": "Sky Sport NBA",
"eurosport-1": "Eurosport 1",
"eurosport-2": "Eurosport 2",
"dmax": "Dmax",
"foodnetwork": "Food Network",
"giallo": "Giallo",
"nove": "Nove",
"realtime": "Real Time",
}
async def tivu_get(id):
try:
cookies = {
'ASP.NET_SessionId': 'p2fk5silp5mjgtx0j5chjrh3',
}
ik = tivu[id]
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0',
'Accept': '*/*',
'Accept-Language': 'en-US,en;q=0.5',
# 'Accept-Encoding': 'gzip, deflate, br, zstd',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'X-Requested-With': 'XMLHttpRequest',
'Origin': 'https://www.tivu.tv',
'DNT': '1',
'Sec-GPC': '1',
'Connection': 'keep-alive',
'Referer': 'https://www.tivu.tv/schedasat-rai1.html',
# 'Cookie': 'ASP.NET_SessionId=p2fk5silp5mjgtx0j5chjrh3',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin',
'Pragma': 'no-cache',
'Cache-Control': 'no-cache',
}
data = {
'ik': ik
}
async with httpx.AsyncClient() as client:
response = await client.post('https://www.tivu.tv/getPrograms.ashx', cookies=cookies, headers=headers, data=data)
soup = BeautifulSoup(response.text,'lxml')
tr_element = soup.find('tr', class_='in_onda')
hour_range = tr_element.find_all('td')[0].text.strip()
program_name = tr_element.find_all('td')[1].text.strip()
description = hour_range + " " + program_name
print(description)
return description
except Exception as e:
print(e)
return None
async def epg_guide(id):
try:
async with httpx.AsyncClient() as client:
if id in convert_bho_1:
id = convert_bho_1[id]
response = await client.get(f"https://lorempizza-boh.hf.space/{id}/now")
elif id in convert_bho_2:
id = convert_bho_2[id]
response = await client.get(f"https://mammamia-urlo-boh2.hf.space/{id}/now")
data = response.json()
description = data['description'].replace("- EPG by epg-guide.com","").replace("No description","")
title = data['title']
print(description,title)
return description,title
except Exception as e:
print(e)
description = f'Watch {id}'
title = ""
return description,title
|