def livefootballol(): url = 'http://www.livefootballol.com/live-football-streaming.html' html = get_page_source(url) soup = bs(html) tag = soup.find('div', {'id': 'maininner'}) table = tag.find('div', {'class': 'content clearfix'}) divs = table.findAll('div') for item in divs: if 'GMT+1' in item.getText(): date = item.findAll('span', {'class': 'RED'})[0].find('strong').getText() index = date.index(',') + 2 date = date[index:] dates = date.split('/') day, month, year = dates[0], dates[1], dates[2] else: time = item.findAll('span', {'class': 'RED'})[0].getText() time = time.split(':') hour, minute = time[0], time[1] link = item.find('a')['href'] import datetime from utils import pytzimp d = pytzimp.timezone(str( pytzimp.timezone('Europe/Berlin'))).localize( datetime.datetime(2000 + int(year), int(month), int(day), hour=int(hour), minute=int(minute))) timezona = addon.get_setting('timezone_new') my_location = pytzimp.timezone( pytzimp.all_timezones[int(timezona)]) convertido = d.astimezone(my_location) fmt = "%d-%m-%y [COLOR green]%H:%M[/COLOR]" time = convertido.strftime(fmt) full = item.getText() indx = full.index(']') indxy = full.index('[') competition = full[indxy:indx + 1] match = full[indx + 1:] title = '([COLOR blue][B]%s[/B][/COLOR]) [B][COLOR orange]%s[/COLOR][/B] %s' % ( time, match, competition) if 'streaming/' in link: url = build_url({ 'mode': 'open_livefoot', 'url': link, 'name': match }) li = xbmcgui.ListItem(title, iconImage='') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) xbmcplugin.endOfDirectory(addon_handle)
def lfootballws_events(): try: source = mechanize_browser(base_url) except: source = ""; xbmcgui.Dialog().ok(translate(40000),translate(40128)); return; items = re.findall('<li class="fl">[^<]*<[^>]+class="link"[^>]+href="([^"]+)".+?"(?:liveCon clear|date)"><span[^>]*>(.+?)</span>', source, re.DOTALL) number_of_items= len(items) liveStreams = [] nextStreams = [] for url, dateEnc in items: date = dateEnc.decode("windows-1251").encode('utf8') dateRE = re.search('(\d+) ([^\s]+) (\d+):(\d+)', date) teams = re.search("\d+-(.+).html", url).group(1) if dateRE: import datetime from utils import pytzimp parsedTime = datetime.datetime(2015, 7, day=int(dateRE.group(1)), hour=int(dateRE.group(3)), minute=int(dateRE.group(4))) d = pytzimp.timezone('Europe/Moscow').localize(parsedTime) myTimeZone=pytzimp.timezone(pytzimp.all_timezones[int(settings.getSetting('timezone_new'))]) convertedTime=d.astimezone(myTimeZone) timeStr=myTimeZone.normalize(convertedTime).strftime("%d %H:%M") nextStreams.append((url, teams, timeStr)) elif date == "Live": liveStreams.append((url, teams)) for stream in liveStreams: addDir("[B][COLOR green](Live)[/COLOR][/B] {0}".format(stream[1]), stream[0],401,os.path.join(current_dir,'icon.png'),number_of_items,False,parser="lfootballws",parserfunction="streams") for stream in reversed(nextStreams): addDir("[B][COLOR orange]({0} {1})[/COLOR][/B] {2}".format(translate(600012), stream[2], stream[1]), stream[0],401,os.path.join(current_dir,'icon.png'),number_of_items,False,parser="lfootballws",parserfunction="streams")
def wiziwig_events(url): conteudo=clean(abrir_url(url)) eventos=re.compile('<div class="date" [^>]+>([^<]+)</div>\s*<span class="time" rel=[^>]+>([^<]+)</span> -\s*<span class="time" rel=[^>]+>([^<]+)</span>\s*</td>\s*<td class="home".+?<img[^>]* src="([^"]*)"[^>]*>([^<]+)<img [^>]+></td>(.*?)<td class="broadcast"><a class="broadcast" href="([^"]+)">Live</a></td>').findall(conteudo) for date,time1,time2,icon,team1,palha,url in eventos: if re.search('<td class="away">',palha): try:team2=' - ' + re.compile('<td class="away"><img.+?>(.+?)<img class="flag"').findall(palha)[0] except:team2='' else: team2='' datefinal=date.split(', ') print datefinal,time1 try: month_day = re.compile('(.+?) (.*)').findall(datefinal[1]) monthname = translate_months(month_day[0][0]) dayname = int(month_day[0][1]) hourname = int(time1.split(':')[0]) minutesname = int(time1.split(':')[1]) import datetime from utils import pytzimp d = pytzimp.timezone(str(pytzimp.timezone('Europe/Madrid'))).localize(datetime.datetime(2014, monthname, dayname, hour=hourname, minute=minutesname)) timezona= settings.getSetting('timezone_new') lisboa=pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido=d.astimezone(lisboa) fmt = "%m-%d %H:%M" time=convertido.strftime(fmt) addDir('[B](' + str(time) + ')[/B] ' + team1 + team2,WiziwigURL + url,401,WiziwigURL + icon,len(eventos),True,parser='wiziwig',parserfunction='servers') except: addDir('[B](' + datefinal[1] + ' ' + time1 + ')[/B] ' + team1 + team2,WiziwigURL + url,401,WiziwigURL + icon,len(eventos),True,parser='wiziwig',parserfunction='servers') xbmc.executebuiltin("Container.SetViewMode(51)")
def livefootballws_events(): try: source = mechanize_browser(base_url) except: source = ""; mensagemok(traducao(40000),traducao(40128)) if source: items = re.findall('<div class="base custom" align="center"(.*?)</center></div><br></div>', source, re.DOTALL) number_of_items= len(items) for item in reversed(items): data = re.compile('<div style="text-align: center;">(.+?)</div>').findall(item) try: check = re.compile(" (.+?):(.+?)").findall(data[-1].replace("color:","")) if not check and "Online" not in data[-1]:pass else: data_item = data[-1].replace("<strong>","").replace("</strong>","").replace('<span style="color: #008000;">','').replace("</span>","") url = re.compile('<a href="(.+?)">').findall(item) teams = re.compile('/.+?-(.+?).html').findall(url[0]) try: match = re.compile('(.+?) (.+?) (.+?):(.*)').findall(data_item) import datetime from utils import pytzimp timezona= settings.getSetting('timezone_new') d = pytzimp.timezone(str(pytzimp.timezone('Europe/Moscow'))).localize(datetime.datetime(2014, 6, int(match[0][0]), hour=int(match[0][2]), minute=int(match[0][3]))) lisboa=pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido=d.astimezone(lisboa) fmt = "%d %H:%M" time=convertido.strftime(fmt) addDir("[B][COLOR orange]("+traducao(600012)+time+")[/COLOR][/B] "+teams[0],url[0],39,os.path.join(current_dir,'icon.png'),number_of_items,True,parser="livefootballws",parserfunction="streams") except: if '<span style="color: #000000;">' not in data_item: addDir("[B][COLOR green]("+data_item+")[/COLOR][/B] "+teams[0],url[0],401,os.path.join(current_dir,'icon.png'),number_of_items,True,parser="livefootballws",parserfunction="streams") else: pass except: pass
def livefootballvideo_events(): try: source = abrir_url(base_url) except: source ="";mensagemok(traducao(40000),traducao(40128)) if source: match = re.compile('"([^"]+)" alt="[^"]*"/>.*?.*?>([^<]+)</a>\s*</div>\s*<div class="date_time column"><span class="starttime time" rel="[^"]*">([^<]+)</span>.*?<span class="startdate date" rel="[^"]*">([^"]+).*?<span>([^<]+)</span></div>.*?team away column"><span>([^&<]+).*?href="([^"]+)">([^<]+)<').findall(source) for icon,comp,timetmp,datetmp,home,away,url,live in match: mes_dia = re.compile(', (.+?) (.+?)<').findall(datetmp) for mes,dia in mes_dia: dia = re.findall('\d+', dia) month = translate_months(mes) hora_minuto = re.compile('(\d+):(\d+)').findall(timetmp) try: import datetime from utils import pytzimp d = pytzimp.timezone(str(pytzimp.timezone('Atlantic/Azores'))).localize(datetime.datetime(2014, int(month), int(dia[0]), hour=int(hora_minuto[0][0]), minute=int(hora_minuto[0][1]))) timezona= settings.getSetting('timezone_new') lisboa=pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido=d.astimezone(lisboa) fmt = "%d/%m %H:%M" time=convertido.strftime(fmt) if "Online" in live: time = '[B][COLOR green](Online)[/B][/COLOR]' else: time = '[B][COLOR orange]' + time + '[/B][/COLOR]' addDir(time + ' - [B]('+comp+')[/B] ' + home + ' vs ' + away,url,401,os.path.join(addonpath,'resources','art','football.png'),len(match),True,parser='livefootballvideo',parserfunction='sources') except: addDir('[B][COLOR orange]' + timetmp + ' ' + datetmp + '[/B][/COLOR] - [B]('+comp+')[/B] ' + home + ' vs ' + away,url,401,os.path.join(addonpath,'resources','art','football.png'),len(match),True,parser='livefootballvideo',parserfunction='sources')
def schedule247(): import datetime import time i = datetime.datetime.now() day,month,year=i.day, i.month, i.year s="%s/%s/%s"%(day,month,year) time=time.mktime(datetime.datetime.strptime(s, "%d/%m/%Y").timetuple()) time=str(time).replace('.0','')+'000' url='https://tockify.com/api/readEventView?calname=pilkalive&max=30&start-inclusive=true&startms='+time txt=json.loads(read_url(url)) events=txt['events'] for i in range (len(events)): time=events[i]['when']['start']['millis'] time=str(time)[:-3] event=events[i]['content']['summary']['text'] link=events[i]['content']['description']['text'] ts = datetime.datetime.fromtimestamp(float(time)) year,month,day,hour,minute=ts.strftime('%Y'),ts.strftime('%m'),ts.strftime('%d'),ts.strftime('%H'),ts.strftime('%M') from utils import pytzimp d = pytzimp.timezone(str(pytzimp.timezone('Europe/Madrid'))).localize(datetime.datetime(2000 + int(year), int(month), int(day), hour=int(hour), minute=int(minute))) timezona= addon.get_setting('timezone_new') my_location=pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido=d.astimezone(my_location) fmt = "%d-%m-%y [COLOR green]%H:%M[/COLOR]" time=convertido.strftime(fmt) event=event[5:] title='([COLOR blue][B]%s[/B][/COLOR]) [B][COLOR orange]%s[/COLOR][/B]'%(time,event) url = build_url({'mode': 'open_247_event','url':link}) li = xbmcgui.ListItem(title,iconImage='') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) xbmcplugin.endOfDirectory(addon_handle)
def livefootballvideo_events(): try: html = get_page_source(base_url) except: html ="";xbmcgui.Dialog().ok(translate(40000),translate(40128)) soup=bs(html) table=soup.find('div',{'class':'listmatch'}) lis=table.findAll('li') for item in lis: league=item.find('div',{'class':'leaguelogo column'}).find('img')['alt'] time=item.find('span',{'class':'starttime time'})['rel'] import datetime ts = datetime.datetime.fromtimestamp(float(time)) year,month,day,hour,minute=ts.strftime('%Y'),ts.strftime('%m'),ts.strftime('%d'),ts.strftime('%H'),ts.strftime('%M') from utils import pytzimp d = pytzimp.timezone(str(pytzimp.timezone('Europe/Madrid'))).localize(datetime.datetime(2000 + int(year), int(month), int(day), hour=int(hour), minute=int(minute))) timezona= settings.getSetting('timezone_new') my_location=pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido=d.astimezone(my_location) fmt = "%d-%m-%y [COLOR white]%H:%M[/COLOR]" time=convertido.strftime(fmt) try: team1=item.find('div',{'class':'team column'}).find('img')['alt'] team2=item.find('div',{'class':'team away column'}).find('img')['alt'] except: team1=item.find('div',{'class':'program column'}).getText() team2='' url=item.find('div',{'class':'live_btn column'}).find('a')['href'] name='%s - %s'%(team1,team2) if team2=='': name=team1 name=clean(cleanex(name)) title='([COLOR blue][B]%s[/B][/COLOR]) [B][COLOR %s]%s[/COLOR][/B] [%s]'%(time,"green" if item.find('a',{'class':'online'}) else "orange",name,league) addDir(title,url,401,os.path.join(addonpath,'resources','art','football.png'),len(lis),False,parser='livefootballvideo',parserfunction='sources')
def livefootballvideo_events(): try: source = abrir_url(base_url) except: source = "" mensagemok(traducao(40000), traducao(40128)) if source: match = re.compile( '"([^"]+)" alt="[^"]*"/>.*?.*?>([^<]+)</a>\s*</div>\s*<div class="date_time column"><span class="starttime time" rel="[^"]*">([^<]+)</span>.*?<span class="startdate date" rel="[^"]*">([^"]+).*?<span>([^<]+)</span></div>.*?team away column"><span>([^&<]+).*?href="([^"]+)">([^<]+)<' ).findall(source) for icon, comp, timetmp, datetmp, home, away, url, live in match: mes_dia = re.compile(', (.+?) (.+?)<').findall(datetmp) for mes, dia in mes_dia: dia = re.findall('\d+', dia) month = translate_months(mes) hora_minuto = re.compile('(\d+):(\d+)').findall(timetmp) try: import datetime from utils import pytzimp d = pytzimp.timezone( str(pytzimp.timezone('Atlantic/Azores'))).localize( datetime.datetime(2014, int(month), int(dia[0]), hour=int(hora_minuto[0][0]), minute=int(hora_minuto[0][1]))) timezona = settings.getSetting('timezone_new') lisboa = pytzimp.timezone( pytzimp.all_timezones[int(timezona)]) convertido = d.astimezone(lisboa) fmt = "%d/%m %H:%M" time = convertido.strftime(fmt) if "Online" in live: time = '[B][COLOR green](Online)[/B][/COLOR]' else: time = '[B][COLOR orange]' + time + '[/B][/COLOR]' addDir(time + ' - [B](' + comp + ')[/B] ' + home + ' vs ' + away, url, 401, os.path.join(addonpath, 'resources', 'art', 'football.png'), len(match), True, parser='livefootballvideo', parserfunction='sources') except: addDir('[B][COLOR orange]' + timetmp + ' ' + datetmp + '[/B][/COLOR] - [B](' + comp + ')[/B] ' + home + ' vs ' + away, url, 401, os.path.join(addonpath, 'resources', 'art', 'football.png'), len(match), True, parser='livefootballvideo', parserfunction='sources')
def livefootballvideo_events(): try: html = get_page_source(base_url) except: html = "" xbmcgui.Dialog().ok(translate(40000), translate(40128)) soup = bs(html) table = soup.find('div', {'class': 'listmatch'}) lis = table.findAll('li') for item in lis: league = item.find('div', { 'class': 'leaguelogo column' }).find('img')['alt'] time = item.find('span', {'class': 'starttime time'})['rel'] import datetime ts = datetime.datetime.fromtimestamp(float(time)) year, month, day, hour, minute = ts.strftime('%Y'), ts.strftime( '%m'), ts.strftime('%d'), ts.strftime('%H'), ts.strftime('%M') from utils import pytzimp d = pytzimp.timezone(str(pytzimp.timezone('Europe/Madrid'))).localize( datetime.datetime(2000 + int(year), int(month), int(day), hour=int(hour), minute=int(minute))) timezona = settings.getSetting('timezone_new') my_location = pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido = d.astimezone(my_location) fmt = "%d-%m-%y [COLOR white]%H:%M[/COLOR]" time = convertido.strftime(fmt) try: team1 = item.find('div', { 'class': 'team column' }).find('img')['alt'] team2 = item.find('div', { 'class': 'team away column' }).find('img')['alt'] except: team1 = item.find('div', {'class': 'program column'}).getText() team2 = '' url = item.find('div', {'class': 'live_btn column'}).find('a')['href'] name = '%s - %s' % (team1, team2) if team2 == '': name = team1 name = clean(cleanex(name)) title = '([COLOR blue][B]%s[/B][/COLOR]) [B][COLOR %s]%s[/COLOR][/B] [%s]' % ( time, "green" if item.find('a', {'class': 'online'}) else "orange", name, league) addDir(title, url, 401, os.path.join(addonpath, 'resources', 'art', 'football.png'), len(lis), False, parser='livefootballvideo', parserfunction='sources')
def rojap2p0(params): plugintools.log("[%s %s] Roja Directa P2P " % (addonName, addonVersion)) thumbnail = params.get("thumbnail") fanart = params.get("fanart") url = params.get("url") headers={"Referer": 'http://www.tarjetarojaonline.me/'} r=requests.get(url, headers=headers);data=r.content;print data plugintools.add_item(action="", title='[B][COLOR orange]RojaDirecta [I]P2P[/I][/B][/COLOR] [COLOR lightyellow] - En exclusiva en [B]TV Ultra 7K[/B][/COLOR]', url=url, thumbnail=thumbnail, fanart=fanart, folder=False, isPlayable=False) if data: match = re.findall('<span class="(\d+)".*?<div class="menutitle".*?<span class="t">([^<]+)</span>(.*?)</div>',data,re.DOTALL) for id,time,eventtmp in match: try: import datetime from utils import pytzimp d = pytzimp.timezone(str(pytzimp.timezone('Europe/Madrid'))).localize(datetime.datetime(2014, 6, 7, hour=int(time.split(':')[0]), minute=int(time.split(':')[-1]))) timezona= addon.get_setting('timezone_new') my_location=pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido=d.astimezone(my_location) fmt = "%H:%M" time=convertido.strftime(fmt) except: pass eventnospanish = plugintools.find_multiple_matches(eventtmp, '<span class="es">(.+?)</span>') if eventnospanish: for spanishtitle in eventnospanish: eventtmp = eventtmp.replace('<span class="es">' + spanishtitle + '</span>','') eventclean=eventtmp.replace('<span class="en">','').replace('</span>','').replace(' ()','').replace('</time>','').replace('<span itemprop="name">','') matchdois = plugintools.find_multiple_matches(eventclean, '(.*)<b>\s*(.*?)\s*</b>') for sport,event in matchdois: express = '<span class="submenu" id="sub' + id+ '">.*?</span>\s*</span>' streams = plugintools.find_multiple_matches(data, express) for streamdata in streams: p2pstream = re.compile('<td>P2P</td>\n.+?<td>([^<]*)</td>\n.+?<td>([^<]*)</td>\n.+?<td>([^<]*)</td>\n.+?<td>([^<]*)</td>\n.+?<td><b><a.+?href="(.+?)"').findall(streamdata) already = False for canal,language,tipo,qualidade,urltmp in p2pstream: if "Sopcast" in tipo or "Acestream" in tipo: if already == False: title="[B][COLOR gold]"+time+ " - " + sport + " - " + event + "[/B][/COLOR]" plugintools.add_item(action="", title=title, url="", thumbnail="", fanart="", extra= urllib.quote_plus(event), folder=False, isPlayable=False) already = True print qualidade tipo=tipo.replace("(web)", "").strip() qualidade.replace("<","").replace(">","")+" Kbs)";qualidade='[COLOR lightgreen][I]'+qualidade+' kbps[/I][/COLOR]' canal=canal.replace("<","").replace(">","");canal='[COLOR lightyellow][B]'+canal+'[/B][/COLOR]' tipo='[COLOR lightgreen]['+tipo.replace("<","").replace(">","")+'][/COLOR] ' language='[COLOR white]('+language.replace("<","").replace(">","")+')[/COLOR]' title=tipo+canal+" - "+language+" - "+qualidade url='http://rojadirecta.tn.my/'+urltmp plugintools.log("URL= "+url) plugintools.add_item(action="rojap2p1", title=title, url=url, thumbnail=thumbnail, fanart=fanart, folder=False, isPlayable=False) p2pdirect = re.compile('<td>P2P</td><td></td><td></td><td>(.+?)</td><td></td><td>.+?href="(.+?)"').findall(streamdata) for tipo,link in p2pdirect: if tipo == "SopCast" and "sop://" in link: url='plugin://program.plexus/?mode=2&url=%s&name=%s'%(link,urllib.quote_plus(event)) plugintools.add_item(action="play", title=title, url=url, thumbnail=thumbnail, fanart=fanart, folder=False, isPlayable=False)
def wiziwig_events(url): conteudo = clean(abrir_url(url)) eventos = re.compile( '<div class="date" [^>]+>([^<]+)</div>\s*<span class="time" rel=[^>]+>([^<]+)</span> -\s*<span class="time" rel=[^>]+>([^<]+)</span>\s*</td>\s*<td class="home".+?<img[^>]* src="([^"]*)"[^>]*>([^<]+)<img [^>]+></td>(.*?)<td class="broadcast"><a class="broadcast" href="([^"]+)">Live</a></td>' ).findall(conteudo) for date, time1, time2, icon, team1, palha, url in eventos: if re.search('<td class="away">', palha): try: team2 = ' - ' + re.compile( '<td class="away"><img.+?>(.+?)<img class="flag"').findall( palha)[0] except: team2 = '' else: team2 = '' datefinal = date.split(', ') print datefinal, time1 try: month_day = re.compile('(.+?) (.*)').findall(datefinal[1]) monthname = translate_months(month_day[0][0]) dayname = int(month_day[0][1]) hourname = int(time1.split(':')[0]) minutesname = int(time1.split(':')[1]) import datetime from utils import pytzimp d = pytzimp.timezone(str( pytzimp.timezone('Europe/Madrid'))).localize( datetime.datetime(2014, monthname, dayname, hour=hourname, minute=minutesname)) timezona = settings.getSetting('timezone_new') lisboa = pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido = d.astimezone(lisboa) fmt = "%m-%d %H:%M" time = convertido.strftime(fmt) addDir('[B](' + str(time) + ')[/B] ' + team1 + team2, WiziwigURL + url, 401, WiziwigURL + icon, len(eventos), True, parser='wiziwig', parserfunction='servers') except: addDir('[B](' + datefinal[1] + ' ' + time1 + ')[/B] ' + team1 + team2, WiziwigURL + url, 401, WiziwigURL + icon, len(eventos), True, parser='wiziwig', parserfunction='servers') xbmc.executebuiltin("Container.SetViewMode(51)")
def livefootballol(): url = 'http://www.livefootballol.com/live-football-streaming.html' html = get_page_source(url) soup = bs(html) #items=re.compile('<li>\s*<div><img src=".+?" alt=".+?"/> (.+?) [(.+?)] <a href="(.+?)">(.+?)</a></div>\s*</li>') #time,league,link,name daty = soup.findAll('h3') lists = soup.findAll('list') for i in range(6): itel = daty[i] if 'CET' in itel.getText(): date = itel.getText() index = date.index(',') + 2 date = date[index:] dates = date.split('/') day, month, year = dates[0], dates[1], dates[2].replace( 'CET', '').strip() items = re.compile( '<li>\s*<div><img src=".+?" alt=".+?"\s*\/>\s*(.+?)\s*\[(.+?)\]\s*<a\s*href="(.+?)"\s*(?:target="_blank"|)\s*>\s*(.+?)<\/a>' ).findall(str(lists[i])) for tem in items: time, league, link, name = tem[0], tem[1], tem[2], tem[3] time = time.split(':') hour, minute = time[0], time[1] import datetime from utils import pytzimp d = pytzimp.timezone(str( pytzimp.timezone('Europe/Berlin'))).localize( datetime.datetime(2000 + int(year), int(month), int(day), hour=int(hour), minute=int(minute))) timezona = addon.get_setting('timezone_new') my_location = pytzimp.timezone( pytzimp.all_timezones[int(timezona)]) convertido = d.astimezone(my_location) fmt = "%d-%m-%y [COLOR green]%H:%M[/COLOR]" time = convertido.strftime(fmt) competition = league match = name title = '([COLOR blue][B]%s[/B][/COLOR]) [B][COLOR orange]%s[/COLOR][/B] %s' % ( time, match, competition) if 'streaming/' in link: url = build_url({ 'mode': 'open_livefoot', 'url': link, 'name': match }) li = xbmcgui.ListItem(title, iconImage='') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) xbmcplugin.endOfDirectory(addon_handle)
def arenavision_schedule(): url = 'http://arenavision.in/agenda' headers = {"Cookie": "beget=begetok; has_js=1;"} try: source = requests.get(url, headers=headers).text except: source = "" if source: match = re.findall('Bruselas(.*?)</footer>', source, re.DOTALL) for event in match: eventmatch = re.compile( '(\d+)/(\d+)/(\d+) (.+?):(.+?) CET (.+?)<').findall(event) for dia, mes, year, hour, minute, evento in eventmatch: import datetime from utils import pytzimp d = pytzimp.timezone(str( pytzimp.timezone('Europe/Madrid'))).localize( datetime.datetime(2000 + int(year), int(mes), int(dia), hour=int(hour), minute=int(minute))) timezona = addon.get_setting('timezone_new') my_location = pytzimp.timezone( pytzimp.all_timezones[int(timezona)]) convertido = d.astimezone(my_location) fmt = "%d-%m-%y %H:%M" time = convertido.strftime(fmt) time = '[COLOR orange](' + str(time) + ')[/COLOR] ' try: index = evento.index(')') event_name = clean(cleanex(evento[:index + 1])) evento = evento.replace(event_name, '') channels = re.compile('AV(\d+)').findall(evento) except: index = evento.index('/AV') channels = re.compile('AV(\d+)').findall(evento) event_name = clean(cleanex(evento[:index])) evento = evento.replace(event_name, '') url = build_url({ 'mode': 'av_open', 'channels': channels, 'name': event_name }) li = xbmcgui.ListItem( time + event_name, iconImage= 'http://kodi.altervista.org/wp-content/uploads/2015/07/arenavision.jpg' ) xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) xbmcplugin.endOfDirectory(addon_handle)
def livefoot_com(): url = 'http://livefootballvideo.com/streaming' html = read_url(url) soup = bs(html) table = soup.find('div', {'class': 'listmatch'}) lis = table.findAll('li') for item in lis: league = item.find('div', { 'class': 'leaguelogo column' }).find('img')['alt'] time = item.find('span', {'class': 'starttime time'})['rel'] import datetime ts = datetime.datetime.fromtimestamp(float(time)) year, month, day, hour, minute = ts.strftime('%Y'), ts.strftime( '%m'), ts.strftime('%d'), ts.strftime('%H'), ts.strftime('%M') from utils import pytzimp d = pytzimp.timezone(str(pytzimp.timezone('Europe/Madrid'))).localize( datetime.datetime(2000 + int(year), int(month), int(day), hour=int(hour), minute=int(minute))) timezona = addon.get_setting('timezone_new') my_location = pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido = d.astimezone(my_location) fmt = "%d-%m-%y [COLOR green]%H:%M[/COLOR]" time = convertido.strftime(fmt) try: team1 = item.find('div', { 'class': 'team column' }).find('img')['alt'] team2 = item.find('div', { 'class': 'team away column' }).find('img')['alt'] except: team1 = item.find('div', {'class': 'program column'}).getText() team2 = '' link = item.find('div', {'class': 'live_btn column'}).find('a')['href'] name = '%s - %s' % (team1, team2) if team2 == '': name = team1 name = clean(cleanex(name)) title = '([COLOR blue][B]%s[/B][/COLOR]) [B][COLOR orange]%s[/COLOR][/B] [%s]' % ( time, name, league) url = build_url({ 'mode': 'open_livefoot.com_stream', 'name': name, 'url': link }) li = xbmcgui.ListItem(title, iconImage='') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) xbmcplugin.endOfDirectory(addon_handle)
def sopcast_ucoz(): conteudo = clean(abrir_url('http://sopcast.ucoz.com')) listagem = re.compile( '<div class="eTitle" style="text-align:left;"><a href="(.+?)">(.+?)</a>' ).findall(conteudo) for urllist, titulo in listagem: try: match = re.compile('\((.*?)\.(.*?)\.(.*?)\. (.*?):(.*?) UTC\) (.*)' ).findall(titulo) if match: for dia, mes, ano, hora, minuto, evento in match: import datetime from utils import pytzimp d = pytzimp.timezone(str( pytzimp.timezone('Europe/London'))).localize( datetime.datetime(int(ano), int(mes), int(dia), hour=int(hora), minute=int(minuto))) timezona = settings.getSetting('timezone_new') lisboa = pytzimp.timezone( pytzimp.all_timezones[int(timezona)]) convertido = d.astimezone(lisboa) fmt = "%y-%m-%d %H:%M" time = convertido.strftime(fmt) addDir('[B][COLOR orange]' + time + '[/B][/COLOR]-' + evento, urllist, 54, '', len(listagem), False, parser="sopcastucoz", parserfunction="play") else: addDir(titulo, urllist, 401, '', len(listagem), False, parser="sopcastucoz", parserfunction="play") except: addDir(titulo, urllist, 401, '', len(listagem), False, parser="sopcastucoz", parserfunction="play")
def open_streamhub_cat(url): base='http://www.streamhub.hk/' html=read_url(url) soup=bs(html) table=soup.find('table',{'class':'table table-striped table-bordered'}) rows=table.findAll('tr') rows.pop(0) for row in rows: infos=row.findAll('td') icon=infos[0].find('img')['src'] time_start=infos[1].getText().strip() ind=time_start.index('-') time_start=time_start[:ind] timee=time_start.split(':') hour,minute=int(timee[0]),int(timee[1]) try: live=infos[1].find('img')['src'] if 'live'in live: live=True else: live=False except: live=False link=base+ infos[2].find('a')['href'] title=infos[2].getText().strip() import datetime i = datetime.datetime.now() day,month,year=i.day, i.month, i.year from utils import pytzimp d = pytzimp.timezone(str(pytzimp.timezone('America/New_York'))).localize(datetime.datetime(2000 + int(year), int(month), int(day), hour=int(hour), minute=int(minute))) timezona= addon.get_setting('timezone_new') my_location=pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido=d.astimezone(my_location) fmt = "%d-%m-%y [COLOR green]%H:%M[/COLOR]" time=convertido.strftime(fmt) if live ==True: title='%s %s [COLOR red]( LIVE ! )[/COLOR]'%(time,title) else: title='%s %s'%(time,title) url = build_url({'mode': 'open_streamhub_event','url':link}) li = xbmcgui.ListItem(title,iconImage=icon) xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) xbmcplugin.endOfDirectory(addon_handle)
def livefootballol(): url='http://www.livefootballol.com/live-football-streaming.html' html=get_page_source(url) soup=bs(html) tag=soup.find('div',{'id':'maininner'}) table=tag.find('div',{'class':'content clearfix'}) divs=table.findAll('div') for item in divs: if 'GMT+1' in item.getText(): date=item.findAll('span',{'class':'RED'})[0].find('strong').getText() index=date.index(',')+2 date=date[index:] dates=date.split('/') day,month,year=dates[0],dates[1],dates[2] else: time=item.findAll('span',{'class':'RED'})[0].getText() time=time.split(':') hour,minute=time[0],time[1] link=item.find('a')['href'] import datetime from utils import pytzimp d = pytzimp.timezone(str(pytzimp.timezone('Europe/Berlin'))).localize(datetime.datetime(2000 + int(year), int(month), int(day), hour=int(hour), minute=int(minute))) timezona= addon.get_setting('timezone_new') my_location=pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido=d.astimezone(my_location) fmt = "%d-%m-%y [COLOR green]%H:%M[/COLOR]" time=convertido.strftime(fmt) full=item.getText() indx=full.index(']') indxy=full.index('[') competition=full[indxy:indx+1] match=full[indx+1:] title='([COLOR blue][B]%s[/B][/COLOR]) [B][COLOR orange]%s[/COLOR][/B] %s'%(time,match,competition) if 'streaming/' in link: url = build_url({'mode': 'open_livefoot','url':link,'name':match}) li = xbmcgui.ListItem(title,iconImage='') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) xbmcplugin.endOfDirectory(addon_handle)
def rojadirecta_events(): try: source = abrir_url(base_url) except: source = "";mensagemok(traducao(40000),traducao(40128)) if source: match = re.findall('<span class="(\d+)">.*?<div class="menutitle".*?<span class="t">([^<]+)</span>(.*?)</div>',source,re.DOTALL) for id,time,eventtmp in match: try: import datetime from utils import pytzimp d = pytzimp.timezone(str(pytzimp.timezone('Europe/Madrid'))).localize(datetime.datetime(2014, 6, 7, hour=int(time.split(':')[0]), minute=int(time.split(':')[-1]))) timezona= settings.getSetting('timezone_new') lisboa=pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido=d.astimezone(lisboa) fmt = "%H:%M" time=convertido.strftime(fmt) except:pass eventnospanish = re.compile('<span class="es">(.+?)</span>').findall(eventtmp) print eventnospanish if eventnospanish: for spanishtitle in eventnospanish: eventtmp = eventtmp.replace('<span class="es">' + spanishtitle + '</span>','') eventclean=eventtmp.replace('<span class="en">','').replace('</span>','').replace(' ()','') matchdois = re.compile('(.*)<b>\s*(.*?)\s*</b>').findall(eventclean) for sport,event in matchdois: express = '<span class="' + id+ '">.*?</span>\s*</span>' streams = re.findall(express,source,re.DOTALL) for streamdata in streams: p2pstream = re.compile('<td>P2P</td>\n.+?<td>([^<]*)</td>\n.+?<td>([^<]*)</td>\n.+?<td>([^<]*)</td>\n.+?<td>([^<]*)</td>\n.+?<td><b><a.+?href="(.+?)"').findall(streamdata) already = False for canal,language,tipo,qualidade,urltmp in p2pstream: if "Sopcast" in tipo or "Acestream" in tipo: if already == False: addLink("[B][COLOR orange]"+time+ " - " + sport + " - " + event + "[/B][/COLOR]",'',os.path.join(current_dir,'icon.png')) already = True if "ArenaVision" in canal: thumbnail = os.path.join(current_dir,'media','arenavisionlogo.png') else: thumbnail = os.path.join(current_dir,'icon.png') addDir("[B]["+tipo.replace("<","").replace(">","")+"][/B]-"+canal.replace("<","").replace(">","")+" - ("+language.replace("<","").replace(">","")+") - ("+qualidade.replace("<","").replace(">","")+" Kbs)",urltmp.replace("goto/",""),401,thumbnail,43,False,parser='rojadirecta',parserfunction='resolve_and_play') p2pdirect = re.compile('<td>P2P</td><td></td><td></td><td>(.+?)</td><td></td><td>.+?href="(.+?)"').findall(streamdata) for tipo,link in p2pdirect: if tipo == "SopCast" and "sop://" in link: addDir("[B][SopCast][/B]- (no info)",link,401,os.path.join(current_dir,'icon.png'),43,False,parser='rojadirecta',parserfunction='resolve_and_play') xbmc.executebuiltin("Container.SetViewMode(51)")
def arenavision_schedule(): url='http://arenavision.in/agenda' headers = { "Cookie" : "beget=begetok; has_js=1;" } try: source = requests.get(url,headers=headers).text except: source="" if source: match = re.findall('Bruselas(.*?)</footer>', source, re.DOTALL) for event in match: eventmatch = re.compile('(\d+)/(\d+)/(\d+) (.+?):(.+?) CET (.+?)<').findall(event) for dia,mes,year,hour,minute,evento in eventmatch: import datetime from utils import pytzimp d = pytzimp.timezone(str(pytzimp.timezone('Europe/Madrid'))).localize(datetime.datetime(2000 + int(year), int(mes), int(dia), hour=int(hour), minute=int(minute))) timezona= addon.get_setting('timezone_new') my_location=pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido=d.astimezone(my_location) fmt = "%d-%m-%y %H:%M" time=convertido.strftime(fmt) time='[COLOR orange]('+str(time)+')[/COLOR] ' try: index=evento.index(')') event_name = clean(cleanex(evento[:index+1])) evento=evento.replace(event_name,'') channels=re.compile('AV(\d+)').findall(evento) except: index=evento.index('/AV') channels=re.compile('AV(\d+)').findall(evento) event_name = clean(cleanex(evento[:index])) evento=evento.replace(event_name,'') url = build_url({'mode': 'av_open','channels': channels, 'name':event_name}) li = xbmcgui.ListItem(time + event_name,iconImage='http://kodi.altervista.org/wp-content/uploads/2015/07/arenavision.jpg') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) xbmcplugin.endOfDirectory(addon_handle)
def livefootballws_events(): url='http://livefootball.ws' source = read_url(url) #except: source = ""; xbmcgui.Dialog().ok('No stream','No stream available!') if source: items = re.findall('<div class="base custom" align="center"(.*?)</div><br></div>', source, re.DOTALL) number_of_items= len(items) for item in reversed(items): data = re.compile('<div style="text-align: center;">(.+?)</div>').findall(item) try: check = re.compile(">.+? (.+?):(.+?)").findall(data[-1].replace("color:","")) if not check and "Online" not in data[-1]:pass else: data_item = data[-1].replace("<strong>","").replace("</strong>","").replace('<span style="color: #008000;">','').replace("</span>","") url = re.compile('<a href="(.+?)">').findall(item) teams = re.compile('/.+?-(.+?).html').findall(url[0]) try: match = re.compile('(.+?) (.+?) (.+?):(.*)').findall(data_item) import datetime from utils import pytzimp timezona= addon.get_setting('timezone_new') d = pytzimp.timezone(str(pytzimp.timezone('Europe/Athens'))).localize(datetime.datetime(2014, 6, int(match[0][0]), hour=int(match[0][2]), minute=int(match[0][3]))) my_place=pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido=d.astimezone(my_place) fmt = "%d %H:%M" time=convertido.strftime(fmt) title="[B][COLOR orange]("+'Day'+time+")[/COLOR][/B] "+teams[0] url = build_url({'mode': 'open_ws_stream','name':teams[0],'url':url[0]}) li = xbmcgui.ListItem(title,iconImage='') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) except: if '<span style="color: #000000;">' not in data_item: data_item=data_item.replace('<strong style="font-size: 10.6666669845581px; text-align: center;">','') title="[B][COLOR green]("+data_item+")[/COLOR][/B] "+teams[0] url = build_url({'mode': 'open_ws_stream','name':teams[0],'url':url[0]}) li = xbmcgui.ListItem(title,iconImage='') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) else: pass except: pass xbmcplugin.endOfDirectory(addon_handle)
def livefootballol(): url='http://www.livefootballol.me/live-football-streaming.html' html=get_page_source(url) soup=bs(html) # #items=re.compile('<li>\s*<div><img src=".+?" alt=".+?"/> (.+?) [(.+?)] <a href="(.+?)">(.+?)</a></div>\s*</li>') #time,league,link,name daty=soup.findAll('h3') lists=soup.findAll('list') for i in range(6): itel=daty[i] if 'CEST' in itel.getText(): date=itel.getText() index=date.index(',')+2 date=date[index:] dates=date.split('/') day,month,year=dates[0],dates[1],dates[2].replace('CEST','').strip() items=re.compile('<li>(\d{2}:\d{2}) <a href="([^"]+)">([^<]+)</a></li>').findall(str(lists[i])) for tem in items: time,link,name = tem[0],tem[1],tem[2] league="" time=time.split(':') hour,minute=time[0],time[1] import datetime from utils import pytzimp d = pytzimp.timezone(str(pytzimp.timezone('Europe/Berlin'))).localize(datetime.datetime(2000 + int(year), int(month), int(day), hour=int(hour), minute=int(minute))) timezona= addon.get_setting('timezone_new') my_location=pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido=d.astimezone(my_location) fmt = "%d-%m-%y [COLOR green]%H:%M[/COLOR]" time=convertido.strftime(fmt) competition=league match=name title='([COLOR blue][B]%s[/B][/COLOR]) [B][COLOR orange]%s[/COLOR][/B] %s'%(time,match,competition) if 'streaming/' in link: url = build_url({'mode': 'open_livefoot','url':link,'name':match}) li = xbmcgui.ListItem(title,iconImage='') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) xbmcplugin.endOfDirectory(addon_handle)
def schedule247(): import datetime import time i = datetime.datetime.now() day, month, year = i.day, i.month, i.year s = "%s/%s/%s" % (day, month, year) time = time.mktime(datetime.datetime.strptime(s, "%d/%m/%Y").timetuple()) time = str(time).replace('.0', '') + '000' url = 'https://tockify.com/api/readEventView?calname=pilkalive&max=30&start-inclusive=true&startms=' + time txt = json.loads(read_url(url)) events = txt['events'] for i in range(len(events)): time = events[i]['when']['start']['millis'] time = str(time)[:-3] event = events[i]['content']['summary']['text'] link = events[i]['content']['description']['text'] ts = datetime.datetime.fromtimestamp(float(time)) year, month, day, hour, minute = ts.strftime('%Y'), ts.strftime( '%m'), ts.strftime('%d'), ts.strftime('%H'), ts.strftime('%M') from utils import pytzimp d = pytzimp.timezone(str(pytzimp.timezone('Europe/Madrid'))).localize( datetime.datetime(2000 + int(year), int(month), int(day), hour=int(hour), minute=int(minute))) timezona = addon.get_setting('timezone_new') my_location = pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido = d.astimezone(my_location) fmt = "%d-%m-%y [COLOR green]%H:%M[/COLOR]" time = convertido.strftime(fmt) event = event[5:] title = '([COLOR blue][B]%s[/B][/COLOR]) [B][COLOR orange]%s[/COLOR][/B]' % ( time, event) url = build_url({'mode': 'open_247_event', 'url': link}) li = xbmcgui.ListItem(title, iconImage='') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) xbmcplugin.endOfDirectory(addon_handle)
def sopcast_ucoz(): conteudo=clean(get_page_source('http://sopcast.ucoz.com')) listagem=re.compile('<div class="eTitle" style="text-align:left;"><a href="(.+?)">(.+?)</a>').findall(conteudo) for urllist,titulo in listagem: try: match = re.compile('\((.*?)\.(.*?)\.(.*?)\. (.*?):(.*?) UTC\) (.*)').findall(titulo) if match: for dia,mes,ano,hora,minuto,evento in match: import datetime from utils import pytzimp d = pytzimp.timezone(str(pytzimp.timezone('Europe/London'))).localize(datetime.datetime(int(ano), int(mes), int(dia), hour=int(hora), minute=int(minuto))) timezona= settings.getSetting('timezone_new') my_location=pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido=d.astimezone(my_location) fmt = "%y-%m-%d %H:%M" time=convertido.strftime(fmt) addDir('[B][COLOR orange]' + time + '[/B][/COLOR]-' + evento,urllist,401,os.path.join(current_dir,'icon.png'),len(listagem),False,parser="sopcastucoz",parserfunction="play") else: addDir(titulo,urllist,401,'',len(listagem),False,parser="sopcastucoz",parserfunction="play") except: addDir(titulo,urllist,401,'',len(listagem),False,parser="sopcastucoz",parserfunction="play")
def arenavision_schedule(url): headers = { "Cookie" : "beget=begetok; has_js=1;" } try: source = requests.get(url,headers=headers).text channelsData, _ = getChannelsAndAgenda(source) DATESTR = "<td[^>]+>(\d+)/(\d+)/(\d+)</td>" HOURSTR = "<td[^>]+>(\d+):(\d+)[^<]*</td>" TEXTSTR = "<td[^>]+>(.+?)</td>" EVENTSTR = "<tr>{DATE}[^<]+{HOUR}[^<]+{SPORT}[^<]+{COMPETITION}[^<]+{EVENT}[^<]+{CHANNELS}.*?</tr>".format(DATE = DATESTR, HOUR = HOURSTR, SPORT = TEXTSTR, COMPETITION = TEXTSTR, EVENT = TEXTSTR, CHANNELS = TEXTSTR) events = re.findall(EVENTSTR, source, re.DOTALL) for day, month, year, hour, minute, sport, competition, event, channelsStr in events: if channelsStr == "": pass timeStr = "" try: import datetime from utils import pytzimp d = pytzimp.timezone(str(pytzimp.timezone('Europe/Madrid'))).localize(datetime.datetime(int(year), int(month), int(day), hour=int(hour), minute=int(minute))) timezona = settings.getSetting('timezone_new') my_location = pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido = d.astimezone(my_location) fmt = "%d-%m-%y %H:%M" timeStr=convertido.strftime(fmt) except: timeStr='N/A' channelsStr = removeNonAscii(channelsStr) channelsAndLanguages = re.findall(" *([Ss\d-]+) *\[([^\]]+)\]", channelsStr) streams = (channelsData, [(language, channels.split("-")) for channels, language in channelsAndLanguages]) addDir('[B][COLOR red]{0}[/COLOR] [COLOR white]{1}[/COLOR][/B] {3} [COLOR yellow][{2}][/COLOR]'.format(timeStr, removeNonAscii(sport), removeNonAscii(competition), removeNonAscii(event)), str(streams),401,os.path.join(current_dir,"icon.png"),1,False,parser="arenavision-in",parserfunction="arenavision_chooser") except: xbmcgui.Dialog().ok(translate(40000),translate(40128))
def arenavision_schedule(url): try: source = abrir_url(url) except: source="";mensagemok(traducao(40000),traducao(40128)) if source: match = re.findall("<br />(.*?)<div class='post-footer'>", source, re.DOTALL) for event in match: eventmatch = re.compile('(.+?)/(.+?)/(.+?) (.+?):(.+?) CET (.+?)<').findall(event) for dia,mes,year,hour,minute,evento in eventmatch: try: import datetime from utils import pytzimp d = pytzimp.timezone(str(pytzimp.timezone('Europe/Madrid'))).localize(datetime.datetime(2000 + int(year), int(mes), int(dia), hour=int(hour), minute=int(minute))) timezona= settings.getSetting('timezone_new') lisboa=pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido=d.astimezone(lisboa) fmt = "%d-%m-%y %H:%M" time=convertido.strftime(fmt) addLink('[B][COLOR orange]' + time + '[/B][/COLOR] ' + evento,'',os.path.join(current_dir,"icon.png")) except: addLink(evento.replace(" ",""),'',os.path.join(current_dir,"icon.png")) xbmc.executebuiltin("Container.SetViewMode(51)")
def livefoot_com(): url='http://livefootballvideo.com/streaming' html=read_url(url) soup=bs(html) table=soup.find('div',{'class':'listmatch'}) lis=table.findAll('li') for item in lis: league=item.find('div',{'class':'leaguelogo column'}).find('img')['alt'] time=item.find('span',{'class':'starttime time'})['rel'] import datetime ts = datetime.datetime.fromtimestamp(float(time)) year,month,day,hour,minute=ts.strftime('%Y'),ts.strftime('%m'),ts.strftime('%d'),ts.strftime('%H'),ts.strftime('%M') from utils import pytzimp d = pytzimp.timezone(str(pytzimp.timezone('Europe/Madrid'))).localize(datetime.datetime(2000 + int(year), int(month), int(day), hour=int(hour), minute=int(minute))) timezona= addon.get_setting('timezone_new') my_location=pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido=d.astimezone(my_location) fmt = "%d-%m-%y [COLOR green]%H:%M[/COLOR]" time=convertido.strftime(fmt) try: team1=item.find('div',{'class':'team column'}).find('img')['alt'] team2=item.find('div',{'class':'team away column'}).find('img')['alt'] except: team1=item.find('div',{'class':'program column'}).getText() team2='' link=item.find('div',{'class':'live_btn column'}).find('a')['href'] name='%s - %s'%(team1,team2) if team2=='': name=team1 name=clean(cleanex(name)) title='([COLOR blue][B]%s[/B][/COLOR]) [B][COLOR orange]%s[/COLOR][/B] [%s]'%(time,name,league) url = build_url({'mode': 'open_livefoot.com_stream','name':name,'url':link}) li = xbmcgui.ListItem(title,iconImage='') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) xbmcplugin.endOfDirectory(addon_handle)
def arenavision_schedule(guide): url = arenavision_url(guide) try: source = requests.get(url, headers = arenavision_headers()).text except: source="" if source: rows = re.findall('(<tr>(<td[^>]*>[^<]*<\/td>[^<]*){6}<\/tr>)', source.replace("<br />", ""), re.DOTALL) for row in rows: date, hour, sport, tournament, phase, channels = re.findall('<td[^>]*>([^<]*)</td>', row[0]) try: d, m, y, h, n = re.findall('(?:(\d{2})\/(\d{2})\/(\d{4})(\d{2})\:(\d{2}))', date + hour)[0] import datetime from utils import pytzimp dt = pytzimp.timezone(str(pytzimp.timezone('Europe/Madrid'))).localize(datetime.datetime(int(y), int(m), int(d), hour=int(h), minute=int(n))) timezona= addon.get_setting('timezone_new') my_location=pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido=dt.astimezone(my_location) fmt = "%d-%m %H:%M" time=convertido.strftime(fmt) time='[COLOR orange]('+str(time)+')[/COLOR] ' except: time=date +" "+ hour event_name = sport +": "+ tournament +" "+ phase event_name = re.sub('(\r|\n|\t|[^\w\s\d\(\)\-\:\;\&\,\.\/\+])', '', event_name.replace('&', '&')) channels = re.compile('([\dA-Z]+)', re.DOTALL).findall(channels) #xbmc.log("name: "+ event_name) url = build_url({'mode': 'av_open','channels': channels, 'name': event_name.encode('utf-8')}) li = xbmcgui.ListItem(time +" "+ event_name,iconImage='https://pbs.twimg.com/profile_images/788852870993027072/giwZj-BU.jpg') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) xbmcplugin.endOfDirectory(addon_handle)
def lfol_schedule(): try: source = requests.get(base_url+'/live-football-streaming.html').text except: source="";xbmcgui.Dialog().ok(translate(40000),translate(40128)) if source: match = re.compile('<div>\s*<h3>.+?(\d+)/(\d+)/(\d+).+<\/h3>\s*<\/div>\s*(<list (?:\s*|.)+?<\/list>)').findall(source) yday=0 date_format = xbmc.getRegion('datelong') meridiem = xbmc.getRegion('meridiem') time_format = '%H:%M' if meridiem != '/': time_format = '%I:%M%p' for day,month,year, list in match: match = re.compile('(\d+)\:(\d+) (\[.+?\])\s*(?:<span class="even">)*\s*<a.+?href="(.+?)".*?>(.+?)<\/a>').findall(list) for hour, minute, competition, link, name in match: if "/streaming/" in link.lower(): try: import datetime from utils import pytzimp d = pytzimp.timezone(str(pytzimp.timezone('Europe/Madrid'))).localize(datetime.datetime(int(year), int(month), int(day), hour=int(hour), minute=int(minute))) timezona= settings.getSetting('timezone_new') my_location=pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido=d.astimezone(my_location) time=convertido.strftime(time_format) time='[B][COLOR orange]'+time+'[/B][/COLOR]' if yday != convertido.day: yday = convertido.day date=convertido.strftime(date_format) addLink("[B][COLOR orange]"+date+"[/B][/COLOR]",'',os.path.join(current_dir,'icon.png')) except: time='[B][COLOR orange]'+hour+':'+minute+'[/B][/COLOR]' if yday != day: yday = day addLink('[B][COLOR orange]'+day+'/'+month+'/'+year+' GMT+1 [/B][/COLOR]','',os.path.join(current_dir,"icon.png")) addDir(time+' '+competition+' '+name,base_url+link,401,os.path.join(current_dir,"icon.png"),1,True,parser="livefootballol",parserfunction="lfol_streams") else: pass
def arenavision_schedule(url): try: source = abrir_url(url) except: source = "" mensagemok(traducao(40000), traducao(40128)) if source: match = re.findall("<br />(.*?)<div class='post-footer'>", source, re.DOTALL) for event in match: eventmatch = re.compile( '(.+?)/(.+?)/(.+?) (.+?):(.+?) CET (.+?)<').findall(event) for dia, mes, year, hour, minute, evento in eventmatch: try: import datetime from utils import pytzimp d = pytzimp.timezone(str( pytzimp.timezone('Europe/Madrid'))).localize( datetime.datetime(2000 + int(year), int(mes), int(dia), hour=int(hour), minute=int(minute))) timezona = settings.getSetting('timezone_new') lisboa = pytzimp.timezone( pytzimp.all_timezones[int(timezona)]) convertido = d.astimezone(lisboa) fmt = "%d-%m-%y %H:%M" time = convertido.strftime(fmt) addLink( '[B][COLOR orange]' + time + '[/B][/COLOR] ' + evento, '', os.path.join(current_dir, "icon.png")) except: addLink(evento.replace(" ", ""), '', os.path.join(current_dir, "icon.png")) xbmc.executebuiltin("Container.SetViewMode(51)")
def rojadirecta_events(): thumbnail = 'http://www.rojadirecta.me/static/roja.jpg' url = 'http://rojadirecta.tn.my' try: source = read_url(url) except: source = "" if source: match = re.findall( '<span class="(\d+)".*?<div class="menutitle".*?<span class="t">([^<]+)</span>(.*?)</div>', source, re.DOTALL) for id, time, eventtmp in match: try: import datetime from utils import pytzimp d = pytzimp.timezone(str( pytzimp.timezone('Europe/Madrid'))).localize( datetime.datetime(2014, 6, 7, hour=int(time.split(':')[0]), minute=int(time.split(':')[-1]))) timezona = addon.get_setting('timezone_new') my_location = pytzimp.timezone( pytzimp.all_timezones[int(timezona)]) convertido = d.astimezone(my_location) fmt = "%H:%M" time = convertido.strftime(fmt) except: pass eventnospanish = re.compile( '<span class="es">(.+?)</span>').findall(eventtmp) if eventnospanish: for spanishtitle in eventnospanish: eventtmp = eventtmp.replace( '<span class="es">' + spanishtitle + '</span>', '') eventclean = eventtmp.replace('<span class="en">', '').replace( '</span>', '').replace(' ()', '').replace('</time>', '').replace('<span itemprop="name">', '') matchdois = re.compile('(.*)<b>\s*(.*?)\s*</b>').findall( eventclean) for sport, event in matchdois: event = clean(cleanex(event)) express = '<span class="submenu" id="sub' + id + '">.*?</span>\s*</span>' streams = re.findall(express, source, re.DOTALL) for streamdata in streams: p2pstream = re.compile( '<td>P2P</td>\n.+?<td>([^<]*)</td>\n.+?<td>([^<]*)</td>\n.+?<td>([^<]*)</td>\n.+?<td>([^<]*)</td>\n.+?<td><b><a.+?href="(.+?)"' ).findall(streamdata) already = False for canal, language, tipo, qualidade, urltmp in p2pstream: if "Sopcast" in tipo or "Acestream" in tipo: if already == False: title = "[B][COLOR orange]" + time + " - " + sport + " - " + event + "[/B][/COLOR]" li = xbmcgui.ListItem(title, iconImage=thumbnail) li.setProperty('IsPlayable', 'false') xbmcplugin.addDirectoryItem( handle=addon_handle, url=None, listitem=li) already = True title = "[B][" + tipo.replace("<", "").replace( ">", "" ) + "][/B]-" + canal.replace("<", "").replace( ">", "") + " - (" + language.replace( "<", "").replace( ">", "") + ") - (" + qualidade.replace( "<", "").replace(">", "") + " Kbs)" try: url = build_url({ 'mode': 'open_roja_stream', 'name': event, 'url': urltmp }) except: url = build_url({ 'mode': 'open_roja_stream', 'name': event.decode('ascii', 'ignore'), 'url': urltmp }) li = xbmcgui.ListItem(title, iconImage=thumbnail) xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) p2pdirect = re.compile( '<td>P2P</td><td></td><td></td><td>(.+?)</td><td></td><td>.+?href="(.+?)"' ).findall(streamdata) for tipo, link in p2pdirect: if tipo == "SopCast" and "sop://" in link: url = 'plugin://program.plexus/?mode=2&url=%s&name=%s' % ( link, urllib.quote_plus(event)) li = xbmcgui.ListItem('Sopcast (No info)', iconImage=thumbnail) li.setProperty('IsPlayable', 'true') xbmcplugin.addDirectoryItem( handle=addon_handle, url=url, listitem=li) xbmcplugin.endOfDirectory(addon_handle)
def livefootballws_events(): url = 'http://livefootball.ws' source = read_url(url) #except: source = ""; xbmcgui.Dialog().ok('No stream','No stream available!') if source: items = re.findall( '<div class="base custom" align="center"(.*?)</div><br></div>', source, re.DOTALL) number_of_items = len(items) for item in reversed(items): data = re.compile( '<div style="text-align: center;">(.+?)</div>').findall(item) try: check = re.compile(">.+? (.+?):(.+?)").findall( data[-1].replace("color:", "")) if not check and "Online" not in data[-1]: pass else: data_item = data[-1].replace("<strong>", "").replace( "</strong>", "").replace('<span style="color: #008000;">', '').replace("</span>", "") url = re.compile('<a href="(.+?)">').findall(item) teams = re.compile('/.+?-(.+?).html').findall(url[0]) try: match = re.compile('(.+?) (.+?) (.+?):(.*)').findall( data_item) import datetime from utils import pytzimp timezona = addon.get_setting('timezone_new') d = pytzimp.timezone( str(pytzimp.timezone('Europe/Athens'))).localize( datetime.datetime(2014, 6, int(match[0][0]), hour=int(match[0][2]), minute=int(match[0][3]))) my_place = pytzimp.timezone( pytzimp.all_timezones[int(timezona)]) convertido = d.astimezone(my_place) fmt = "%d %H:%M" time = convertido.strftime(fmt) title = "[B][COLOR orange](" + 'Day' + time + ")[/COLOR][/B] " + teams[ 0] url = build_url({ 'mode': 'open_ws_stream', 'name': teams[0], 'url': url[0] }) li = xbmcgui.ListItem(title, iconImage='') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) except: if '<span style="color: #000000;">' not in data_item: data_item = data_item.replace( '<strong style="font-size: 10.6666669845581px; text-align: center;">', '') title = "[B][COLOR green](" + data_item + ")[/COLOR][/B] " + teams[ 0] url = build_url({ 'mode': 'open_ws_stream', 'name': teams[0], 'url': url[0] }) li = xbmcgui.ListItem(title, iconImage='') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) else: pass except: pass xbmcplugin.endOfDirectory(addon_handle)
def rojadirecta_events(): thumbnail='http://www.rojadirecta.me/static/roja.jpg' url='http://rojadirecta.tn.my' try: source = read_url(url) except: source = "" if source: match = re.findall('<span class="(\d+)".*?<div class="menutitle".*?<span class="t">([^<]+)</span>(.*?)</div>',source,re.DOTALL) for id,time,eventtmp in match: try: import datetime from utils import pytzimp d = pytzimp.timezone(str(pytzimp.timezone('Europe/Madrid'))).localize(datetime.datetime(2014, 6, 7, hour=int(time.split(':')[0]), minute=int(time.split(':')[-1]))) timezona= addon.get_setting('timezone_new') my_location=pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido=d.astimezone(my_location) fmt = "%H:%M" time=convertido.strftime(fmt) except: pass eventnospanish = re.compile('<span class="es">(.+?)</span>').findall(eventtmp) if eventnospanish: for spanishtitle in eventnospanish: eventtmp = eventtmp.replace('<span class="es">' + spanishtitle + '</span>','') eventclean=eventtmp.replace('<span class="en">','').replace('</span>','').replace(' ()','').replace('</time>','').replace('<span itemprop="name">','') matchdois = re.compile('(.*)<b>\s*(.*?)\s*</b>').findall(eventclean) for sport,event in matchdois: event=clean(cleanex(event)) express = '<span class="submenu" id="sub' + id+ '">.*?</span>\s*</span>' streams = re.findall(express,source,re.DOTALL) for streamdata in streams: p2pstream = re.compile('<td>P2P</td>\n.+?<td>([^<]*)</td>\n.+?<td>([^<]*)</td>\n.+?<td>([^<]*)</td>\n.+?<td>([^<]*)</td>\n.+?<td><b><a.+?href="(.+?)"').findall(streamdata) already = False for canal,language,tipo,qualidade,urltmp in p2pstream: if "Sopcast" in tipo or "Acestream" in tipo: if already == False: title="[B][COLOR orange]"+time+ " - " + sport + " - " + event + "[/B][/COLOR]" li = xbmcgui.ListItem(title,iconImage=thumbnail) li.setProperty('IsPlayable', 'false') xbmcplugin.addDirectoryItem(handle=addon_handle, url=None, listitem=li) already = True title="[B]["+tipo.replace("<","").replace(">","")+"][/B]-"+canal.replace("<","").replace(">","")+" - ("+language.replace("<","").replace(">","")+") - ("+qualidade.replace("<","").replace(">","")+" Kbs)" try: url = build_url({'mode': 'open_roja_stream','name':event,'url':urltmp}) except: url = build_url({'mode': 'open_roja_stream','name':event.encode('ascii','ignore'),'url':urltmp}) li = xbmcgui.ListItem(title,iconImage=thumbnail) xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) p2pdirect = re.compile('<td>P2P</td><td></td><td></td><td>(.+?)</td><td></td><td>.+?href="(.+?)"').findall(streamdata) for tipo,link in p2pdirect: if tipo == "SopCast" and "sop://" in link: url='plugin://program.plexus/?mode=2&url=%s&name=%s'%(link,urllib.quote_plus(event)) li = xbmcgui.ListItem('Sopcast (No info)', iconImage=thumbnail) li.setProperty('IsPlayable', 'true') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li) xbmcplugin.endOfDirectory(addon_handle)
def rojadirecta_events(): try: source = get_page_source(base_url) except Exception as e: source = "" xbmcgui.Dialog().ok(translate(40000), str(e)) if source: #print source match = re.findall( '<span class="(\d+)".*?<div class="menutitle".*?<span class="t">([^<]+)</span>(.*?)</div>', source, re.DOTALL) #print match for id, time, eventtmp in match: try: import datetime from utils import pytzimp d = pytzimp.timezone(str( pytzimp.timezone('Europe/Madrid'))).localize( datetime.datetime(2014, 6, 7, hour=int(time.split(':')[0]), minute=int(time.split(':')[-1]))) timezona = settings.getSetting('timezone_new') my_location = pytzimp.timezone( pytzimp.all_timezones[int(timezona)]) convertido = d.astimezone(my_location) fmt = "%H:%M" time = convertido.strftime(fmt) except: pass eventnospanish = re.findall('<span class="es">(.+?)</span>', eventtmp) if eventnospanish: for spanishtitle in eventnospanish: eventtmp = eventtmp.replace( '<span class="es">' + spanishtitle + '</span>', '') eventclean = eventtmp.replace('<span class="en">', '').replace( '</span>', '').replace(' ()', '').replace('</time>', '').replace('<span itemprop="name">', '') matchdois = re.findall('(.*)<b>\s*(.*?)\s*</b>', eventclean) for sport, event in matchdois: express = '<span class="submenu" id="sub' + id + '">.*?</span>\s*</span>' streams = re.findall(express, source, re.DOTALL) for streamdata in streams: p2pstream = re.findall( '<td>P2P</td>[^<]+<td>([^<]*)</td>[^<]+<td>([^<]*)</td>[^<]+<td>([^<]*)</td>[^<]+<td>([^<]*)</td>[^<]+<td><b><a.+?href="(.+?)"', streamdata, re.DOTALL) already = False for canal, language, tipo, qualidade, urltmp in p2pstream: if "Sopcast" in tipo or "Acestream" in tipo: if not already: addLink( "[B][COLOR orange]" + time + " - " + sport + " - " + event + "[/B][/COLOR]", '', os.path.join(current_dir, 'icon.png')) already = True if "ArenaVision" in canal: thumbnail = os.path.join( current_dir, 'media', 'arenavisionlogo.png') elif "Vertigo" in canal: thumbnail = os.path.join( current_dir, 'media', 'vertigologo.png') elif "Vikingo" in canal: thumbnail = os.path.join( current_dir, 'media', 'vikingologo.png') elif "futbolsinlimites" in canal: thumbnail = os.path.join( current_dir, 'media', 'futbolsinlimiteslogo.png') elif "La Catedral" in canal: thumbnail = os.path.join( current_dir, 'media', 'lacatedrallogo.png') else: thumbnail = os.path.join( current_dir, 'icon.png') addDir( "[B][" + tipo.replace("<", "").replace(">", "") + "][/B]-" + canal.replace("<", "").replace(">", "") + " - (" + language.replace("<", "").replace(">", "") + ") - (" + qualidade.replace("<", "").replace(">", "") + " Kbs)", urltmp[urltmp.rfind("http://"):], 401, thumbnail, 43, False, parser='rojadirecta', parserfunction='resolve_and_play') p2pdirect = re.findall( '<td>P2P</td><td></td><td></td><td>(.+?)</td><td></td><td>.+?href="(.+?)"', streamdata) for tipo, link in p2pdirect: if tipo == "SopCast" and "sop://" in link: addDir("[B][SopCast][/B]- (no info)", link, 401, os.path.join(current_dir, 'icon.png'), 43, False, parser='rojadirecta', parserfunction='resolve_and_play')
def rojadirecta_events(): try: source = abrir_url(base_url) except: source = "" mensagemok(traducao(40000), traducao(40128)) if source: match = re.findall( '<span class="(\d+)">.*?<div class="menutitle".*?<span class="t">([^<]+)</span>(.*?)</div>', source, re.DOTALL) for id, time, eventtmp in match: try: import datetime from utils import pytzimp d = pytzimp.timezone(str( pytzimp.timezone('Europe/Madrid'))).localize( datetime.datetime(2014, 6, 7, hour=int(time.split(':')[0]), minute=int(time.split(':')[-1]))) timezona = settings.getSetting('timezone_new') lisboa = pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido = d.astimezone(lisboa) fmt = "%H:%M" time = convertido.strftime(fmt) except: pass eventnospanish = re.compile( '<span class="es">(.+?)</span>').findall(eventtmp) print eventnospanish if eventnospanish: for spanishtitle in eventnospanish: eventtmp = eventtmp.replace( '<span class="es">' + spanishtitle + '</span>', '') eventclean = eventtmp.replace('<span class="en">', '').replace('</span>', '').replace(' ()', '') matchdois = re.compile('(.*)<b>\s*(.*?)\s*</b>').findall( eventclean) for sport, event in matchdois: express = '<span class="' + id + '">.*?</span>\s*</span>' streams = re.findall(express, source, re.DOTALL) for streamdata in streams: p2pstream = re.compile( '<td>P2P</td>\n.+?<td>([^<]*)</td>\n.+?<td>([^<]*)</td>\n.+?<td>([^<]*)</td>\n.+?<td>([^<]*)</td>\n.+?<td><b><a.+?href="(.+?)"' ).findall(streamdata) already = False for canal, language, tipo, qualidade, urltmp in p2pstream: if "Sopcast" in tipo or "Acestream" in tipo: if already == False: addLink( "[B][COLOR orange]" + time + " - " + sport + " - " + event + "[/B][/COLOR]", '', os.path.join(current_dir, 'icon.png')) already = True if "ArenaVision" in canal: thumbnail = os.path.join( current_dir, 'media', 'arenavisionlogo.png') else: thumbnail = os.path.join( current_dir, 'icon.png') addDir( "[B][" + tipo.replace("<", "").replace(">", "") + "][/B]-" + canal.replace("<", "").replace(">", "") + " - (" + language.replace("<", "").replace(">", "") + ") - (" + qualidade.replace("<", "").replace(">", "") + " Kbs)", urltmp.replace("goto/", ""), 401, thumbnail, 43, False, parser='rojadirecta', parserfunction='resolve_and_play') p2pdirect = re.compile( '<td>P2P</td><td></td><td></td><td>(.+?)</td><td></td><td>.+?href="(.+?)"' ).findall(streamdata) for tipo, link in p2pdirect: if tipo == "SopCast" and "sop://" in link: addDir("[B][SopCast][/B]- (no info)", link, 401, os.path.join(current_dir, 'icon.png'), 43, False, parser='rojadirecta', parserfunction='resolve_and_play') xbmc.executebuiltin("Container.SetViewMode(51)")
def lfol_schedule(): try: source = requests.get(base_url + '/live-football-streaming.html').text except: source = "" xbmcgui.Dialog().ok(translate(40000), translate(40128)) if source: match = re.compile( '<div>\s*<h3>.+?(\d+)/(\d+)/(\d+).+<\/h3>\s*<\/div>\s*(<list (?:\s*|.)+?<\/list>)' ).findall(source) yday = 0 date_format = xbmc.getRegion('datelong') meridiem = xbmc.getRegion('meridiem') time_format = '%H:%M' if meridiem != '/': time_format = '%I:%M%p' for day, month, year, list in match: match = re.compile( '(\d+)\:(\d+) (\[.+?\])\s*(?:<span class="even">)*\s*<a.+?href="(.+?)".*?>(.+?)<\/a>' ).findall(list) for hour, minute, competition, link, name in match: if "/streaming/" in link.lower(): try: import datetime from utils import pytzimp d = pytzimp.timezone( str(pytzimp.timezone('Europe/Madrid'))).localize( datetime.datetime(int(year), int(month), int(day), hour=int(hour), minute=int(minute))) timezona = settings.getSetting('timezone_new') my_location = pytzimp.timezone( pytzimp.all_timezones[int(timezona)]) convertido = d.astimezone(my_location) time = convertido.strftime(time_format) time = '[B][COLOR orange]' + time + '[/B][/COLOR]' if yday != convertido.day: yday = convertido.day date = convertido.strftime(date_format) addLink( "[B][COLOR orange]" + date + "[/B][/COLOR]", '', os.path.join(current_dir, 'icon.png')) except: time = '[B][COLOR orange]' + hour + ':' + minute + '[/B][/COLOR]' if yday != day: yday = day addLink( '[B][COLOR orange]' + day + '/' + month + '/' + year + ' GMT+1 [/B][/COLOR]', '', os.path.join(current_dir, "icon.png")) addDir(time + ' ' + competition + ' ' + name, base_url + link, 401, os.path.join(current_dir, "icon.png"), 1, True, parser="livefootballol", parserfunction="lfol_streams") else: pass
def arenavision_schedule(url): headers = { 'Connection': 'keep-alive', 'Pragma': 'no-cache', 'Cache-Control': 'no-cache', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'es-ES,es;q=0.9,ca;q=0.8,en;q=0.7', 'Cookie': 'beget=begetok; has_js=1;' } try: source = requests.get(url, headers=headers).text except: source = "" xbmcgui.Dialog().ok(translate(40000), translate(40128)) if source: DATESTR = "<td[^>]+>(\d+)/(\d+)/(\d+)</td>" HOURSTR = "<td[^>]+>(\d+):(\d+)[^<]*</td>" TEXTSTR = "<td[^>]+>(.+?)</td>" EVENTSTR = "<tr>{DATE}[^<]+{HOUR}[^<]+{SPORT}[^<]+{COMPETITION}[^<]+{EVENT}[^<]+{CHANNELS}.*?</tr>".format( DATE=DATESTR, HOUR=HOURSTR, SPORT=TEXTSTR, COMPETITION=TEXTSTR, EVENT=TEXTSTR, CHANNELS=TEXTSTR) events = re.findall(EVENTSTR, source, re.DOTALL) for day, month, year, hour, minute, sport, competition, event, channelsStr in events: if channelsStr == "": pass timeStr = "" try: import datetime from utils import pytzimp d = pytzimp.timezone(str( pytzimp.timezone('Europe/Madrid'))).localize( datetime.datetime(int(year), int(month), int(day), hour=int(hour), minute=int(minute))) timezona = settings.getSetting('timezone_new') my_location = pytzimp.timezone( pytzimp.all_timezones[int(timezona)]) convertido = d.astimezone(my_location) fmt = "%d-%m-%y %H:%M" timeStr = convertido.strftime(fmt) except: timeStr = 'N/A' channelsStr = removeNonAscii(channelsStr) channelsAndLanguages = re.findall(" *([Ss\d-]+) *\[([^\]]+)\]", channelsStr) streams = [(language, channels.split("-")) for channels, language in channelsAndLanguages] addDir( '[B][COLOR red]{0}[/COLOR] [COLOR white]{1}[/COLOR][/B] {3} [COLOR yellow][{2}][/COLOR]' .format(timeStr, removeNonAscii(sport), removeNonAscii(competition), removeNonAscii(event)), str(streams), 401, os.path.join(current_dir, "icon.png"), 1, False, parser="arenavision-in", parserfunction="arenavision_chooser") return None