', item, re.DOTALL)
if not m:
continue
title = m.group(3).strip()
desc = title
data2 = m.group(2)
lang = m.group(1)
m = re.search(r'style="background-image: url\(([^\)]+)\)"', item, re.DOTALL)
img = m.group(1) if m else ""
m = re.search('datePublished" datetime="([^"]+)"', item, re.DOTALL)
if m:
published = m.group(1)
try:
published = util.datetime_from_zulu_to_utc(published)
published = util.datetime_from_utc_to_local(published)
published_datetime = datetime.datetime.strftime(published,"%d.%m.%Y %H:%M")
published_date = datetime.datetime.strftime(published,"%d.%m.%Y")
title = title + " (%s)" % published_date
desc = desc + "\nPublished: %s" % published_datetime
except:
a = 1
pass
m = re.search('thumbnail__duration">([^<]+)<', item, re.DOTALL)
if m:
desc = desc + "\nDuration: %s" % m.group(1)
m = re.search(r'([^<]+)', item, re.DOTALL)
if m:
desc = desc + "\nProgram: %s" % m.group(1)
m = re.search('
(Vēl[^<]+)
', item, re.DOTALL)
if m:
desc = desc + "\nRemaining: %s" % m.group(1)
content.append((title,self.name+"::"+data2,img,desc))
m = re.search(r'page=(\d+)" rel="next"', r, re.DOTALL)
if m:
page = int(m.group(1))
if "page="in data:
data2 = re.sub("page=\d+","page=%s"%page,data)
else:
if "?" in data:
data2 =data+"&page=%s"%page
else:
data2 =data+"?page=%s"%page
content.append(("Next page",self.name+"::"+data2,"next.png","Next page"))
return content
#===========================================================================
def get_streams(self, data):
source, data, path, plist, clist, params, qs = self.parse_data(data)
lang = "ru" if clist == 'statja' else "lv"
headers2 = {}
nfo = {}
### Kanāla tiesraide
if clist == "tiesraide" and "/" in data or clist == "tieshraide":
if clist == "tiesraide":
url = "https://replay.lsm.lv/lv/" + data
#r = self.call(data, lang=lang)
else:
url = "https://ltv.lsm.lv/lv/" + data
r = self._http_request(url)
ch = data.split('/')[1]
veids = "audio" if "lr" in ch else "video"
img = ch + ".png"
m = re.search('span class="badge badge-primary">Tagad([^<]+)<.+?', r, re.DOTALL)
if clist == "tieshraide":
m = re.search("
([^<]+)
", r)
title = m.group(1).strip() if m else ch.upper()
desc = title
else:
tagad = m.group(1).strip() if m else ""
laiks = m.group(2).strip() if m else ""
laiks = h.unescape(laiks).encode("utf8")
title = m.group(1).strip() if m else path.split("/")[1].upper()
dd = datetime.datetime.now().strftime("%d.%m.%Y")
title = "%s - %s (%s) [%s]"%(ch.upper(), title, dd, laiks)
desc = title
if veids == "video":
m = re.search('([^<]+)', r)
m = re.search('', r)
title = m.group(1)
title = title.replace("- REplay.lv", "")
title = title.strip()
m = re.search('', r)
img = m.group(1) if m else ""
m = re.search('