|
@@ -126,6 +126,17 @@ class Source(SourceBase):
|
126
|
126
|
desc = desc + " [%s]" % item[3]
|
127
|
127
|
title = title + " - " + desc
|
128
|
128
|
content.append((title,self.name+"::"+data2,img,desc))
|
|
129
|
+
|
|
130
|
+ url = "https://ltv.lsm.lv/lv/tieshraide/"
|
|
131
|
+ r = self._http_request(url)
|
|
132
|
+ result = re.findall('<article class="entry highlight"><figure><a href="/lv/([^"]+)"><img src="([^"]+)".+?>([^<]+)</a>', r, re.IGNORECASE | re.DOTALL | re.MULTILINE)
|
|
133
|
+ for item in result:
|
|
134
|
+ data2 = item[0]
|
|
135
|
+ ch = data2.split("/")[1]
|
|
136
|
+ title = item[2] + " (ltv.lsm.lv)"
|
|
137
|
+ img = "https://ltv.lsm.lv/" + item[1]
|
|
138
|
+ desc = title
|
|
139
|
+ content.append((title,self.name+"::"+data2,img,desc))
|
129
|
140
|
return content
|
130
|
141
|
|
131
|
142
|
### Meklēsana ###
|
|
@@ -214,48 +225,57 @@ class Source(SourceBase):
|
214
|
225
|
nfo = {}
|
215
|
226
|
|
216
|
227
|
### Kanāla tiesraide
|
217
|
|
- if clist == "tiesraide" and "/" in data:
|
218
|
|
- r = self.call(data, lang=lang)
|
|
228
|
+ if clist == "tiesraide" and "/" in data or clist == "tieshraide":
|
|
229
|
+ if clist == "tiesraide":
|
|
230
|
+ url = "https://replay.lsm.lv/lv/" + data
|
|
231
|
+ #r = self.call(data, lang=lang)
|
|
232
|
+ else:
|
|
233
|
+ url = "https://ltv.lsm.lv/lv/" + data
|
|
234
|
+ r = self._http_request(url)
|
219
|
235
|
ch = data.split('/')[1]
|
220
|
|
-
|
221
|
236
|
veids = "audio" if "lr" in ch else "video"
|
222
|
|
- url = "https://replay.lsm.lv/lv/tiesraide/%s/"%ch
|
223
|
|
- r = self._http_request(url)
|
|
237
|
+ img = ch + ".png"
|
224
|
238
|
|
225
|
239
|
m = re.search('span class="badge badge-primary">Tagad</span>([^<]+)<.+?<time>([^<]+)</time>', r, re.DOTALL)
|
226
|
|
- tagad = m.group(1).strip() if m else ""
|
227
|
|
- laiks = m.group(2).strip() if m else ""
|
228
|
|
- laiks = h.unescape(laiks).encode("utf8")
|
229
|
|
- title = m.group(1).strip() if m else path.split("/")[1].upper()
|
230
|
|
- dd = datetime.datetime.now().strftime("%d.%m.%Y")
|
231
|
|
- title = "%s - %s (%s) [%s]"%(ch.upper(), title, dd, laiks)
|
232
|
|
- desc = title
|
|
240
|
+ if clist == "tieshraide":
|
|
241
|
+ m = re.search("<h1>([^<]+)</h1>", r)
|
|
242
|
+ title = m.group(1).strip() if m else ch.upper()
|
|
243
|
+ desc = title
|
|
244
|
+ else:
|
|
245
|
+ tagad = m.group(1).strip() if m else ""
|
|
246
|
+ laiks = m.group(2).strip() if m else ""
|
|
247
|
+ laiks = h.unescape(laiks).encode("utf8")
|
|
248
|
+ title = m.group(1).strip() if m else path.split("/")[1].upper()
|
|
249
|
+ dd = datetime.datetime.now().strftime("%d.%m.%Y")
|
|
250
|
+ title = "%s - %s (%s) [%s]"%(ch.upper(), title, dd, laiks)
|
|
251
|
+ desc = title
|
233
|
252
|
|
234
|
253
|
if veids == "video":
|
235
|
254
|
m = re.search('<iframe.+?src="([^"]+)"', r)
|
236
|
255
|
if not m:
|
237
|
256
|
raise Exception("No stream found")
|
238
|
|
- url = m.group(1)
|
239
|
257
|
headers = headers2dict("""
|
240
|
|
- User-Agent: Mozilla/5.0 (Linux; U; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30
|
241
|
|
- Referer: https://replay.lsm.lv/lv/ieraksts/ltv/70398/tiesa-runa.-lielbritanija-gatavojas-referendumam-par-tu/
|
242
|
|
- """)
|
|
258
|
+ User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0
|
|
259
|
+ Referer: %s
|
|
260
|
+ """% url)
|
|
261
|
+ url = m.group(1)
|
243
|
262
|
r = self._http_request(url,headers=headers)
|
244
|
263
|
|
245
|
264
|
#m = re.search('<div class="video-player"><iframe.+src="([^"]+)"', r)
|
246
|
265
|
m = re.search(r'iframe src=\\"([^"]+)\\', r)
|
247
|
|
- if not m:
|
248
|
|
- raise Exception("No stream found")
|
249
|
|
- url2 = m.group(1).replace('\\/', "/")
|
250
|
|
- m = re.search('poster":"([^"]+)"', r, re.DOTALL)
|
251
|
|
- img = "https://ltv.lsm.lv" + m.group(1).replace("\\","") if m else ch + '.png'
|
252
|
|
-
|
253
|
|
- r = self._http_request(url2,headers=headers)
|
|
266
|
+ if m:
|
|
267
|
+ #raise Exception("No stream found")
|
|
268
|
+ headers["Referer"] = url
|
|
269
|
+ url2 = m.group(1).replace('\\/', "/")
|
|
270
|
+ m = re.search('poster":"([^"]+)"', r, re.DOTALL)
|
|
271
|
+ img = "https://ltv.lsm.lv" + m.group(1).replace("\\","") if m else ch + '.png'
|
|
272
|
+ r = self._http_request(url2,headers=headers)
|
|
273
|
+ url = url2
|
254
|
274
|
m = re.search('"([^"]+m3u8[^"]+)"', r)
|
255
|
275
|
if not m:
|
256
|
276
|
raise Exception("No stream found")
|
257
|
277
|
data2 = m.group(1).replace("\\","")
|
258
|
|
- headers2["Referer"] = url2
|
|
278
|
+ headers2["Referer"] = url
|
259
|
279
|
headers2["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36"
|
260
|
280
|
headers2["Origin"] = "https://embed.lsm.lv"
|
261
|
281
|
headers2["Host"] = data2.split("/")[2]
|
|
@@ -373,6 +393,8 @@ Referer: https://replay.lsm.lv/%s/%s
|
373
|
393
|
return True
|
374
|
394
|
elif cmd[0]=="tiesraide" and len(cmd)>1:
|
375
|
395
|
return True
|
|
396
|
+ elif cmd[0] == "tieshraide":
|
|
397
|
+ return True
|
376
|
398
|
else:
|
377
|
399
|
return False
|
378
|
400
|
|