')
result = re.findall(r"""onclick="RE.tools.navigate\('/lv/(tiesraide/\w+/)'\).+?
([^<]+)
.+?
""", r[0:i2], re.DOTALL)
for item in result:
data2 = item[0]
ch = data2.split("/")[1]
title = ch.upper()
m = re.search(r'channel-logo--%s{background-image:url\("([^"]+)"\)' % ch, r2, re.DOTALL)
img = "https://replay.lsm.lv" + m.group(1)
desc = item[1]
# 00:10 – 00:45
desc = desc + " (%s)" % item[2].replace("–", "-")
title = title + " - " + desc
content.append((title,self.name+"::"+data2,img,desc))
return content
### Kanāla tiesraide
elif clist == "tiesraide" and "/" in data:
ch = data.split('/')[1]
veids = "audio" if "lr" in ch else "video"
#url = "https://replay.lsm.lv/lv/tiesraide/ltv7/"
url = "https://replay.lsm.lv/lv/tiesraide/%s/"%ch
r= self._http_request(url)
m = re.search('%s/">.+?
([^<]+)+
.*?
'%ch, r, re.DOTALL)
tagad = m.group(1).strip() if m else ""
laiks = m.group(2).strip() if m else ""
laiks = h.unescape(laiks).encode("utf8")
m = re.search("
([^<]+)
", r)
title = m.group(1).strip() if m else path.split("/")[1].upper()
title = "%s - %s (%s)"%(title,tagad,laiks)
if veids == "video":
m = re.search('
(.+?)', r2, re.DOTALL):
for item in re.findall('itemprop="image" data-image="([^"]+)".+?', r):
title = item[2]
data2 = item[1].replace("/%s/"%lang,"")+"?lang=%s"%lang
img = "https://replay.lsm.lv" + item[0]
desc = title
content.append((title,self.name+"::"+data2,img,desc))
#for item in re.findall('itemprop="image" data-image="([^"]+)".+?.*?.+?datetime="([^"]+)" class="thumbnail__date ">([^<]+)', r2):
for item in re.findall('itemprop="image" data-image="([^"]+)".+? class="icon-(ltv|lr).+?.*?.+?datetime="([^"]+)" class="thumbnail__date ">([^<]+)', r):
if item[1]=="lr":continue
title = "%s - %s (%s)"%(item[3],item[5],item[7])
data2 = item[4].replace("/%s/"%lang,"")+"?lang=%s"%lang
img = item[0] #.replace("https:","http:")
img = img.replace("lv//", "lv/") # TODO eksperiments
desc = title
content.append((title,self.name+"::"+data2,img,desc))
### Raidijumi (programmas) ###
elif clist in ( "raidijumi","peredachi"):
for item in re.findall('([^<]+)', r):
#for item in re.findall('([^<]+)', r):
title = item[1].strip()
data2 = item[0].replace("/%s/"%lang,"")+"?lang=%s"%lang
img = ""
desc = ""
content.append((title,self.name+"::"+data2,img,desc))
### Raidijuma ieraksti speciālie###
elif clist in ( "visi","vse",):
for item in re.findall('(?i).+>([^<]+).*.+>([^<]+)', r):
title = item[3].strip()
data2 = item[0].replace("/%s/"%lang,"")+"?lang=%s"%lang
img = item[1] #.replace("https:","http:")
img = img.replace("lv//", "lv/") # TODO eksperiments
desc = "%s - %s\n%s"%(item[5],item[2],item[4])
content.append((title,self.name+"::"+data2,img,desc))
### Raidijuma ieraksti (videos)
elif clist in ("raidijums","peredacha","kategorija"):
for item in re.findall('([^<]+).+">([^<]+).+class="thumbnail__date ">([^"]+)', r):
title = item[3].strip()
data2 = item[0].replace("/%s/"%lang,"")+"?lang=%s"%lang
img = item[1] #.replace("https:","http:")
img = img.replace("lv//", "lv/") # TODO eksperiments
desc = "%s - %s"%(item[4],item[2])
desc = desc.strip()
content.append((title,self.name+"::"+data2,img,desc))
### Ieraksts (video) ###
elif clist in ("ieraksts","statja"):
m = re.search('src="([^"]+)">', r)
if m:
url2 = m.group(1)
m = re.search('(.+)