Parcourir la source

ltv.lsm.lv strīmi

salaboti title ltc,filmix
Ivars il y a 6 ans
Parent
révision
e64552cf6d
4 fichiers modifiés avec 544 ajouts et 407 suppressions
  1. 481
    375
      project.wpr
  2. 1
    1
      sources/filmix.py
  3. 16
    7
      sources/ltc.py
  4. 46
    24
      sources/replay.py

+ 481
- 375
project.wpr
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 1
- 1
sources/filmix.py Voir le fichier

@@ -202,7 +202,7 @@ Cookie: FILMIXNET=%s;
202 202
             title = re.search('itemprop="name" content="([^"]+)"', r2, re.DOTALL).group(1)
203 203
             m = re.search('itemprop="alternativeHeadline" content="([^"]+)"', r2, re.DOTALL)
204 204
             if m:
205
-                title = title + "/"+m.group(1)
205
+                title = title + " ~ "+m.group(1)
206 206
             m = re.search(r'img src="(https://filmix\.co/uploads/posters/thumbs/[^"]+)"', r2)
207 207
             img = m.group(1) if m else self.img
208 208
 

+ 16
- 7
sources/ltc.py Voir le fichier

@@ -117,7 +117,8 @@ X-Requested-With: XMLHttpRequest
117 117
             for item in result:
118 118
                 title1 = item[4]
119 119
                 title2 = item[5]
120
-                title = "%s ~ %s" % (title1, title2)
120
+                if title1 <> title2:
121
+                    title = "%s ~ %s" % (title1, title2)
121 122
                 if item[1]:
122 123
                     title = title + "[J]" if item[2] == "Jaunums" else title + "[P]"
123 124
                 data2 = item[0]
@@ -434,7 +435,10 @@ X-Requested-With: XMLHttpRequest
434 435
             for it in result:
435 436
                 title1 = re.search('<div class="categorie-one-title">(.+?)<', it, re.DOTALL).group(1)
436 437
                 title2 = re.search('<div class="categorie-one-subtitle">(.+?)<', it, re.DOTALL).group(1)
437
-                title = "%s ~ %s" % (title1, title2)
438
+                if title1 <> title2:
439
+                    title = "%s ~ %s" % (title1, title2)
440
+                else:
441
+                    title = title1
438 442
                 img = self.api_url2 + re.search('img src="(.+?)"', it).group(1)
439 443
                 data2 = re.search('href="/(.+?)/"', it).group(1)
440 444
                 if "?series" in data or re.search("e\d+$", data2):
@@ -476,7 +480,10 @@ X-Requested-With: XMLHttpRequest
476 480
                 set2 = title2.replace("\xe2\x80\x93", "-")
477 481
                 if " - " in set2:
478 482
                     set2 = set2.split(" - ")[0]
479
-                raidijums = "%s ~ %s" % (set1, set2)
483
+                if set1 <> set2:
484
+                    raidijums = "%s ~ %s" % (set1, set2)
485
+                else:
486
+                    raidijums = set1
480 487
             else:
481 488
                 m = re.search('<div class="movie_titles"><div class="en">([^<]+)</div>', r)
482 489
                 raidijums = m.group(1) if m else "Series"
@@ -935,9 +942,10 @@ Host: manstv.lattelecom.tv
935 942
             m = re.search('<meta name="dr:say:title" content="([^"]+)">', r, re.IGNORECASE)
936 943
             title1 = title2 = unescape(m.group(1)) if m else "Video"
937 944
         nfo["title"] = title1
938
-        nfo["originaltitle"] = title2
939
-        if nfo["originaltitle"] and not nfo["title"]:
940
-            nfo["title"] = nfo["originaltitle"]
945
+        if not title1 == title2:
946
+            nfo["originaltitle"] = title2
947
+            if nfo["originaltitle"] and not nfo["title"]:
948
+                nfo["title"] = nfo["originaltitle"]
941 949
         if 'episode_switcher_title' in r:
942 950
             set1 = title1.replace("\xe2\x80\x93", "-")
943 951
             if " - " in set1:
@@ -945,7 +953,8 @@ Host: manstv.lattelecom.tv
945 953
             set2 = title2.replace("\xe2\x80\x93", "-")
946 954
             if " - " in set2:
947 955
                 set2 = set2.split(" - ")[0]
948
-            nfo["set"] = "%s ~ %s" % (set1, set2)
956
+            if set1 <> set2:
957
+                nfo["set"] = "%s ~ %s" % (set1, set2)
949 958
             m = re.search(r"<br>(S(\d+)E(\d+))<", r, re.IGNORECASE | re.DOTALL)
950 959
             if m:
951 960
                 #nfo["title"] = nfo["title"] + " (%s)" % m.group(1)

+ 46
- 24
sources/replay.py Voir le fichier

@@ -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