Ivars 7 anos atrás
pai
commit
f7bf08fc23
47 arquivos alterados com 390 adições e 263 exclusões
  1. BIN
      release/enigma2-plugin-extensions-playstream_0.6v.ipk
  2. BIN
      release/enigma2-plugin-extensions-playstream_0.6w.ipk
  3. BIN
      release/enigma2-plugin-extensions-playstream_0.7a.ipk
  4. BIN
      release/enigma2-plugin-extensions-playstream_0.7b.ipk
  5. BIN
      release/enigma2-plugin-extensions-playstream_0.7c.ipk
  6. BIN
      release/enigma2-plugin-extensions-playstream_0.7d.ipk
  7. BIN
      release/enigma2-plugin-extensions-playstream_0.7e.ipk
  8. BIN
      resolvers/aadecode.pyc
  9. BIN
      resolvers/hdgo.pyc
  10. BIN
      resolvers/hqqresolver.pyc
  11. BIN
      resolvers/kapnob.pyc
  12. BIN
      resolvers/kodik.pyc
  13. BIN
      resolvers/openload3.pyc
  14. BIN
      resolvers/youtuberesolver.pyc
  15. 9
    4
      sources/SourceBase.py
  16. BIN
      sources/SourceBase.pyc
  17. BIN
      sources/YouTubeVideoUrl.pyc
  18. BIN
      sources/__init__.pyc
  19. 1
    0
      sources/cinemalive.py
  20. BIN
      sources/cinemalive.pyc
  21. BIN
      sources/config.pyc
  22. 29
    16
      sources/euronews.py
  23. BIN
      sources/euronews.pyc
  24. 55
    16
      sources/filmix.py
  25. BIN
      sources/filmix.pyc
  26. 1
    0
      sources/filmon.py
  27. BIN
      sources/filmon.pyc
  28. 5
    1
      sources/iplayer.py
  29. BIN
      sources/iplayer.pyc
  30. BIN
      sources/jsinterp.pyc
  31. 110
    118
      sources/ltc.py
  32. BIN
      sources/ltc.pyc
  33. 1
    0
      sources/movieplace.py
  34. BIN
      sources/movieplace.pyc
  35. BIN
      sources/mtgplay.pyc
  36. BIN
      sources/play24.pyc
  37. BIN
      sources/replay.pyc
  38. 1
    0
      sources/serialguru.py
  39. BIN
      sources/serialguru.pyc
  40. BIN
      sources/swfinterp.pyc
  41. 2
    0
      sources/tvdom.cfg
  42. 166
    107
      sources/tvdom.py
  43. BIN
      sources/tvdom.pyc
  44. 9
    1
      sources/ustvnow.py
  45. BIN
      sources/ustvnow.pyc
  46. 1
    0
      sources/viaplay.py
  47. BIN
      sources/viaplay.pyc

BIN
release/enigma2-plugin-extensions-playstream_0.6v.ipk Ver arquivo


BIN
release/enigma2-plugin-extensions-playstream_0.6w.ipk Ver arquivo


BIN
release/enigma2-plugin-extensions-playstream_0.7a.ipk Ver arquivo


BIN
release/enigma2-plugin-extensions-playstream_0.7b.ipk Ver arquivo


BIN
release/enigma2-plugin-extensions-playstream_0.7c.ipk Ver arquivo


BIN
release/enigma2-plugin-extensions-playstream_0.7d.ipk Ver arquivo


BIN
release/enigma2-plugin-extensions-playstream_0.7e.ipk Ver arquivo


BIN
resolvers/aadecode.pyc Ver arquivo


BIN
resolvers/hdgo.pyc Ver arquivo


BIN
resolvers/hqqresolver.pyc Ver arquivo


BIN
resolvers/kapnob.pyc Ver arquivo


BIN
resolvers/kodik.pyc Ver arquivo


BIN
resolvers/openload3.pyc Ver arquivo


BIN
resolvers/youtuberesolver.pyc Ver arquivo


+ 9
- 4
sources/SourceBase.py Ver arquivo

@@ -8,7 +8,7 @@
8 8
 
9 9
 import urllib2, urllib
10 10
 import datetime, re, sys,os
11
-import requests
11
+import requests, json
12 12
 import ssl
13 13
 if "_create_unverified_context" in dir(ssl):
14 14
     ssl._create_default_https_context = ssl._create_unverified_context
@@ -83,8 +83,13 @@ User-Agent: Mozilla/5.0 (Linux; U; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWeb
83 83
             return None
84 84
         config = ConfigParser.ConfigParser()
85 85
         if os.path.exists(self.config_file):
86
+            options0 = self.options
86 87
             config.read(self.config_file)
87 88
             self.options = OrderedDict(config.items(self.name))
89
+            for k in options0:
90
+                if not k in self.options:
91
+                    self.options[k] = options0[k]
92
+                    self.options_write(self.options)
88 93
         else:
89 94
             self.options_write(self.options)
90 95
         return self.options
@@ -105,9 +110,9 @@ User-Agent: Mozilla/5.0 (Linux; U; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWeb
105 110
         return result
106 111
 
107 112
     def call_json(self, data,params=None,headers=None,lang=""):
108
-        result = self.call(url,params,headers=headers)
113
+        result = self.call(data,params,headers)
109 114
         if result:
110
-            result = json.loads(content)
115
+            result = json.loads(result)
111 116
             return result
112 117
         else:
113 118
             raise "No data returned"
@@ -143,7 +148,7 @@ User-Agent: Mozilla/5.0 (Linux; U; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWeb
143 148
         plist = path.split("/")
144 149
         clist = plist[0]
145 150
         params = data[data.find("?"):] if "?" in data else ""
146
-        qs = dict(map(lambda x:x.split("="),re.findall("\w+=\w+",params)))
151
+        qs = dict(map(lambda x:x.split("="),re.findall("\w+=[\w\-]+",params)))
147 152
         return source,data,path,plist,clist,params,qs
148 153
 
149 154
 def stream_type(data):

BIN
sources/SourceBase.pyc Ver arquivo


BIN
sources/YouTubeVideoUrl.pyc Ver arquivo


BIN
sources/__init__.pyc Ver arquivo


+ 1
- 0
sources/cinemalive.py Ver arquivo

@@ -31,6 +31,7 @@ h = HTMLParser.HTMLParser()
31 31
 class Source(SourceBase):
32 32
 
33 33
     def __init__(self,country="",cfg_path=None):
34
+        self.hidden = True # nerāda menu nestrādājošos avotus
34 35
         self.name = "cinemalive"
35 36
         self.title = "cinemalive.tv"
36 37
         self.img = "picons/cinemalive.png" #"https://cinemalive.tv/assets/img/logo.png"

BIN
sources/cinemalive.pyc Ver arquivo


BIN
sources/config.pyc Ver arquivo


+ 29
- 16
sources/euronews.py Ver arquivo

@@ -104,8 +104,8 @@ Connection: keep-alive
104 104
                 if plist[1] in ("getTimeline"):
105 105
                     article = item["article"]
106 106
                     atype = item["type"]
107
-                    #if item["type"] == "wire":
108
-                        #continue # TODO
107
+                    if item["type"] == "wire":
108
+                        continue # TODO
109 109
                 else:
110 110
                     article = item
111 111
                     atype = "article"
@@ -161,7 +161,7 @@ Connection: keep-alive
161 161
         streams = []
162 162
 
163 163
         if path == "live":
164
-            url = "http://www.euronews.com/api/watchlive.json"
164
+            url = "http://www.euronews.com/api/watchlive.json" if lang == "en" else "http://%s.euronews.com/api/watchlive.json" % lang
165 165
             r = self._http_request(url)
166 166
             try:
167 167
                 js = json.loads(r)
@@ -176,17 +176,14 @@ Connection: keep-alive
176 176
             except:
177 177
                 raise Exception("No live stream found")
178 178
 
179
-            slist = js["primary"]
180
-
181
-            for l in slist:
182
-                stream = util.item()
183
-                stream["url"]=slist[l]["hls"]
184
-                stream["lang"]=l
185
-                stream["quality"]="variant"
186
-                stream["name"]="Euronews live [%s]"%l
187
-                stream["desc"]=stream["name"]
188
-                stream["type"]="hls" #stream_type(url)
189
-                streams.append(stream)
179
+            stream = util.item()
180
+            stream["url"]=js["primary"]
181
+            stream["lang"]= lang
182
+            stream["quality"]="variant"
183
+            stream["name"]="Euronews live [%s]"%lang
184
+            stream["desc"]=stream["name"]
185
+            stream["type"]="hls" #stream_type(url)
186
+            streams.append(stream)
190 187
 
191 188
         elif clist=="content" and plist[1] == "getArticle":
192 189
             if "lang" in qs:
@@ -199,8 +196,9 @@ Connection: keep-alive
199 196
                 if not r:
200 197
                     raise Exception("No live stream found")
201 198
                 if not "articlelist" in r:
202
-                    msg = r["label"] if "label" in r else "No article finde"
203
-                    raise Exception(msg)
199
+                    msg = r["label"] if "label" in r else "No article find"
200
+                    continue
201
+                    #raise Exception(msg)
204 202
                 article = r["articlelist"]
205 203
                 stream = util.item()
206 204
                 stream["url"]=article["videoUri"] if "videoUri" in article else ""
@@ -228,7 +226,22 @@ Connection: keep-alive
228 226
             s["order"] = lv+qv
229 227
         streams = sorted(streams,key=lambda item: item["order"],reverse=True)
230 228
         return streams
229
+
231 230
     def get_languages(self):
231
+        if self.languages: return self.languages
232
+        url = "http://www.euronews.com/"
233
+        r = self._http_request(url)
234
+        result = re.findall(r'<option value="([^"]+)"\s*(selected)*\slang="([^"]+)" hreflang="([^"]+)">', r, re.DOTALL)
235
+        languages = []
236
+        for item in result:
237
+            languages.append(item[3])
238
+        if not languages:
239
+            raise Exception("Can not get languages list")
240
+        self.languages = languages
241
+        return self.languages
242
+
243
+
244
+    def get_languages0(self):
232 245
         if self.languages: return self.languages
233 246
         url = "http://www.euronews.com/api/watchlive.json"
234 247
         r = self._http_request(url)

BIN
sources/euronews.pyc Ver arquivo


+ 55
- 16
sources/filmix.py Ver arquivo

@@ -111,7 +111,7 @@ Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
111 111
             m = re.search(r"meta_key = \['(\w+)', '(\w+)', '(\w+)'\]", r, re.IGNORECASE)
112 112
             key = m.group(3) if m else ""
113 113
             js = self.get_movie_info(vid,key)
114
-            translations = js["message"]["translations"]["flash"]
114
+            translations = js["message"]["translations"]["html5"]
115 115
             for pl  in translations:
116 116
                 if translations[pl].startswith("http"):
117 117
                     continue
@@ -122,10 +122,11 @@ Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
122 122
                 raise Exception("No episodes list found!")
123 123
             #pl_link = js["message"]["translations"]["flash"].values()[0]
124 124
             #  TODO process several players, currently taking the first
125
+            #TODO - kļuda, vairs nesradā
125 126
             if not pl_link.startswith("http"):
126
-                pl_link = self.decode_uppod_text(pl_link)
127
+                pl_link = self.decode_direct_media_url(pl_link)
127 128
             js = self._http_request(pl_link)
128
-            js = self.decode_uppod_text(js)
129
+            js = self.decode_direct_media_url(js)
129 130
             js = json.loads(js)
130 131
             if "s" in qs:
131 132
                 s = int(qs["s"])
@@ -154,7 +155,10 @@ Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
154 155
             r = self.call(data)
155 156
             r = r.decode("cp1251").encode("utf8")
156 157
             for r2 in re.findall('<article class="shortstory line".+?</article>', r, re.DOTALL):
157
-                m = re.search(r'<a href="https://filmix\.me/play/(\d+)" class="watch icon-play">', r2, re.DOTALL)
158
+                #m2 = re.search(r'<a class="watch icon-play" itemprop="url" href="([^"]+)"', r2, re.DOTALL)
159
+                #<a class="watch icon-play" itemprop="url" href="https://filmix.me/dramy/110957-stolik-19-2017.html"
160
+                #m = re.search(r'<a href="https://filmix\.me/play/(\d+)" class="watch icon-play">', r2, re.DOTALL)
161
+                m = re.search(r'<a class="watch icon-play" itemprop="url" href="https://filmix.me/\w+/(\d+)-', r2, re.DOTALL)
158 162
                 if not m: continue
159 163
                 vid = m.group(1)
160 164
                 data2 = "play/%s"%vid
@@ -202,15 +206,13 @@ Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
202 206
         elif clist=="play" and not params:
203 207
             r = self.call(path)
204 208
             #r = r.decode("cp1251").encode("utf8")
205
-            m = re.search('itemprop="contentUrl" content="(.+?)"', r, re.IGNORECASE | re.DOTALL)
206
-            if not m:
207
-                raise Exception("Can not find video link")
208
-                #return False
209
-            video_link = m.group(1)
210
-            if video_link=='{video-link}':
211
-                return False
212
-            else:
209
+            #m = re.search('itemprop="contentUrl" content="(.+?)"', r, re.IGNORECASE | re.DOTALL)
210
+            #if not m:
211
+            if u"Фильм <a href=" in r.decode("cp1251"):
213 212
                 return True
213
+            else:
214
+                return False
215
+
214 216
         else:
215 217
             return False
216 218
 
@@ -235,12 +237,12 @@ Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
235 237
             raise Exception("Can not find video link")
236 238
             #return []
237 239
         video_link = m.group(1)
238
-        series = True if video_link == '{video-link}' else False
240
+        series = False if u"Фильм <a href=" in r.decode("utf8") else True
239 241
         vid = plist[1]
240 242
         m = re.search(r"meta_key = \['(\w+)', '(\w+)', '(\w+)'\]", r, re.IGNORECASE)
241 243
         key = m.group(3) if m else ""
242 244
         js = self.get_movie_info(vid,key)
243
-        translations = js["message"]["translations"]["flash"]
245
+        translations = js["message"]["translations"]["html5"]
244 246
         for pl in translations:
245 247
             if translations[pl].startswith("http"):
246 248
                 continue
@@ -250,7 +252,7 @@ Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
250 252
         else:
251 253
             raise Exception("No episodes list found!")
252 254
         if not pl_link.startswith("http"):
253
-            pl_link = self.decode_uppod_text(pl_link)
255
+            pl_link = self.decode_direct_media_url(pl_link)
254 256
 
255 257
         if not series : # Filma
256 258
             url0 = pl_link
@@ -268,7 +270,7 @@ Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
268 270
         else: # Seriāls
269 271
             #pl_link = video_link
270 272
             js = self._http_request(pl_link)
271
-            js = self.decode_uppod_text(js)
273
+            js = self.decode_direct_media_url(js)
272 274
             js = json.loads(js)
273 275
             if "e" in qs:
274 276
                 if "s" in qs:
@@ -319,6 +321,43 @@ Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
319 321
         js = json.loads(r)
320 322
         return js
321 323
 
324
+    def decode_base64(self, encoded_url):
325
+        codec_a = ("l", "u", "T", "D", "Q", "H", "0", "3", "G", "1", "f", "M", "p", "U", "a", "I", "6", "k", "d", "s", "b", "W", "5", "e", "y", "=")
326
+        codec_b = ("w", "g", "i", "Z", "c", "R", "z", "v", "x", "n", "N", "2", "8", "J", "X", "t", "9", "V", "7", "4", "B", "m", "Y", "o", "L", "h")
327
+        i = 0
328
+        for a in codec_a:
329
+            b = codec_b[i]
330
+            i += 1
331
+            encoded_url = encoded_url.replace(a, '___')
332
+            encoded_url = encoded_url.replace(b, a)
333
+            encoded_url = encoded_url.replace('___', b)
334
+        return base64.b64decode(encoded_url)
335
+
336
+    def decode_unicode(self, encoded_url):
337
+        from itertools import izip_longest
338
+        def grouper(n, iterable, fillvalue=None):
339
+            "grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
340
+            args = [iter(iterable)] * n
341
+            return izip_longest(fillvalue=fillvalue, *args)
342
+
343
+        _ = (encoded_url[1:] if encoded_url.find('#') != -1 else encoded_url)
344
+        tokens = map(lambda items: '\u0'+''.join(items), grouper(3, _))
345
+        return ''.join(tokens).decode('unicode_escape')
346
+
347
+    def decode_direct_media_url(self, encoded_url, checkhttp=False):
348
+        if(checkhttp == True and (encoded_url.find('http://') != -1 or encoded_url.find('https://') != -1)):
349
+            return False
350
+
351
+        try:
352
+            if encoded_url.find('#') != -1:
353
+                return self.decode_unicode(encoded_url)
354
+            else:
355
+                return self.decode_base64(encoded_url)
356
+        except:
357
+            return False
358
+
359
+
360
+
322 361
     def decode_uppod_text(self, text):
323 362
         Client_codec_a = ["l", "u", "T", "D", "Q", "H", "0", "3", "G", "1", "f", "M", "p", "U", "a", "I", "6", "k", "d", "s", "b", "W", "5", "e", "y", "="]
324 363
         Client_codec_b = ["w", "g", "i", "Z", "c", "R", "z", "v", "x", "n", "N", "2", "8", "J", "X", "t", "9", "V", "7", "4", "B", "m", "Y", "o", "L", "h"]

BIN
sources/filmix.pyc Ver arquivo


+ 1
- 0
sources/filmon.py Ver arquivo

@@ -33,6 +33,7 @@ h = HTMLParser.HTMLParser()
33 33
 class Source(SourceBase):
34 34
 
35 35
     def __init__(self,country="lv",cfg_path=None):
36
+        #self.hidden = True
36 37
         self.name = "filmon"
37 38
         self.title = "FilmOn"
38 39
         self.img = "http://behindthegloves.com/wp-content/uploads/2016/01/FilmOn-logo1.jpg"

BIN
sources/filmon.pyc Ver arquivo


+ 5
- 1
sources/iplayer.py Ver arquivo

@@ -278,8 +278,10 @@ Connection: Keep-Alive
278 278
                 #if not (c["supplier"].startswith("mf_") or c["supplier"].startswith("ll_")) : continue # TODO ir kaut kādas VPN problēmas ar akamaihd
279 279
                 #if c["priority"] <> "1": continue
280 280
                 url=c["href"].encode("utf8")
281
+                #print url.split("/")[2]
281 282
                 r2 = self._http_request(url)
282
-                if not r2: continue
283
+                if not r2:
284
+                    continue
283 285
                 slist = re.findall("#EXT-X-STREAM-INF:([^\n]+)\n([^\n]+)", r2, re.DOTALL)
284 286
                 if not slist:
285 287
                     stream = util.item()
@@ -293,6 +295,7 @@ Connection: Keep-Alive
293 295
                     stream["subs"]=captions
294 296
                     stream["order"]=int(s["bitrate"])
295 297
                     stream["nfo"] = nfo
298
+                    #print url.split("/")[2]
296 299
                     streams.append(stream)
297 300
                 else:
298 301
                     for cc in slist:
@@ -305,6 +308,7 @@ Connection: Keep-Alive
305 308
                             uu = url.split("/")[:-1]
306 309
                             uu.append(url2)
307 310
                             url2 = "/".join(uu)
311
+                        #print url.split("/")[2]
308 312
                         stream = util.item()
309 313
                         stream["url"]=url2
310 314
                         stream["name"]=title

BIN
sources/iplayer.pyc Ver arquivo


BIN
sources/jsinterp.pyc Ver arquivo


+ 110
- 118
sources/ltc.py Ver arquivo

@@ -83,7 +83,7 @@ Accept-Language: en-US,en;q=0.8
83 83
         if clist=="home":
84 84
             content.extend([
85 85
                 ("Search TV", "ltc::search/{0}","","Search in TV archive"),
86
-                ("Search Video", "ltc::meklet?q={0}","","Search in video"),
86
+                ("Search Video", "ltc::viss/search/?cat=movies&q={0}","","Search in video"),
87 87
                 ("Live streams", "ltc::tiesraide","","TV live streams"),
88 88
                 ("Archive", "ltc::arhivs","","TV live archive"),
89 89
                 ("Video", "ltc::videonoma","","Video on demand"),
@@ -96,54 +96,28 @@ Accept-Language: en-US,en;q=0.8
96 96
             return content
97 97
 
98 98
         ### Meklēsana video (www )###
99
-        elif clist == "meklet": #TODO vod/search/{q}
99
+        elif path == 'viss/search/': #TODO vod/search/{q}
100 100
             r = self.call2(data)
101
-
102
-            for res in re.findall('<div class="(program follow|movie forward)-link">(.+?</div></div>.*?)</div>', r, re.DOTALL):
103
-                r2 = res[1]
104
-                if "movie" in res[0]:
105
-                    #if not "permalink" in r2:
106
-                        #continue
107
-                    m = re.search('<a class="title" href="([^"]+)/">([^<]+)</a>', r2, re.DOTALL)
108
-                    if not m: continue
109
-                    title = m.group(2)
110
-                    data2 = "videonoma" + m.group(1)
111
-                    #data2 = "arhivs" + m.group(1)
112
-                    m = re.search('src="([^"]+)"', r2, re.DOTALL)
113
-                    img = "https://www.lattelecom.tv/"+m.group(1) if m else ""
114
-                    m = re.search('<div class="introduction">([^<]+)<', r2, re.DOTALL)
115
-                    desc = m.group(1) if m else ""
116
-                    m = re.search('class="genre".+?>([^<]+)<', r2, re.DOTALL)
117
-                    if m:
118
-                        desc = m.group(1)+"\n"+desc
119
-
120
-                else:
121
-                    m = re.search('<a href="/([^"]+)" class="title">([^<]+)</a>', r2, re.DOTALL)
122
-                    if not m: continue
123
-                    title = m.group(2)
124
-                    data2 = m.group(1)
125
-                    dd = data2.split("/")
126
-                    if dd[0]=="arhivs":
127
-                        ch_name = dd[1]
128
-                        ch = self.get_channel_by_name(ch_name)
129
-                        data2 = "archive/get-stream/%s?channelid=%s"%(dd[3],ch["id"]) if ch else ""
130
-                        #ltc::archive/get-stream/1464120671889?channelid=101
131
-                    else:
132
-                        continue
133
-                    m = re.search(r"url\((.+?)\)", r2, re.DOTALL)
134
-                    img = "https://www.lattelecom.tv"+m.group(1) if m else ""
135
-                    m = re.search('<span class="sub">([^<]+)</span>', r2, re.DOTALL)
136
-                    sub = m.group(1) if m else ""
137
-                    title = title + " " + sub
101
+            if "cat=movies" in data:
102
+                result = re.findall(' class="forward-link" href="/([^"]+)"><img src="([^"]+)".+?class="categorie-one-title">([^<]+)<', r)
103
+                for item in result:
104
+                    title = item[2]
105
+                    data2 = item[0][0:-1]
106
+                    img = "https://www.lattelecom.tv" + item[1]
138 107
                     desc = title
139
-                content.append((title,self.name+"::"+data2,img,desc))
140
-            return content
108
+                    content.append((title,self.name+"::"+data2,img,desc))
109
+                return content
110
+            else:
111
+                return content
141 112
 
142 113
         ### Tiešraides kanānālu saraksts ###
143 114
         elif data=="tiesraide":
144 115
             r = self.call2(data)
145
-            jsdata = re.search("site.program = ([^;]+);",r).group(1)
146
-            js=json.loads(jsdata)
116
+            m = re.search("var xprs_ides_array = (.+);", r, re.MULTILINE)
117
+            if m:
118
+                js=json.loads(m.group(1))
119
+            else:
120
+                raise Exception("Error reading channel list")
147 121
             for item in self.get_channels():
148 122
                 if item["live"]=='0':continue
149 123
                 title = item["name"]
@@ -347,44 +321,56 @@ Accept-Language: en-US,en;q=0.8
347 321
             r = self._http_request(url,headers=self.headers2)
348 322
             if not r:
349 323
                 return content
350
-            m = re.search('<div class="movie_details"><div class="movie_titles"><div class="en">([^<]+?)</div>', r, re.DOTALL | re.IGNORECASE)
351
-            raidijums = m.group(1) + " - " if m else ""
324
+            m = re.search('<div class="movie_titles"><div class="en">([^<]+)</div>', r)
325
+            raidijums = m.group(1) if m else "Series"
352 326
             img0 = re.search('<meta name="og:image" content="([^"]+)">', r).group(1) if re.search('<meta name="dr:say:img" content="([^"]+)">', r) else ""
327
+            m = re.search('season_choice', r)
353 328
 
354
-            m = re.search('<ul class="episode_choiser".+?(<li>[^<]+</li>)+</ul>', r)
355
-            if m and not "season_nr" in qs: # ir sezonas
356
-                for s,it in enumerate(re.findall('<li>([^<]+)</li>', m.group())):
357
-                    title = "%s%s" % (raidijums, it)
358
-                    se = re.search("(\d+)",it).group(1)
359
-                    data2 = path+"?season_nr=%s"%(se)
360
-                    img = img0
361
-                    desc = title
362
-                    content.append((title, self.name + "::" + data2, img, desc))
363
-                return content
364
-
365
-            m = re.search('data-bid="([^"]+)',r)
329
+            # Ir sezonas
366 330
             if m:
367
-                if not "season_nr" in qs:
368
-                    qs["season_nr"]="0"
369
-                url = "https://www.lattelecom.tv/episode-loader.json?bcast_ids=%s&season_nr=%s"%(m.group(1),qs["season_nr"])
370
-                r = self._http_request(url,headers=self.headers2)
371
-                i1 = r.find('{"total":')
372
-                i2 = r.find('}<div class=')
373
-                js = json.loads(r[i1:i2+1])
374
-                for item in js["episodes"]:
375
-                    title = "%s%s (%s)"%(raidijums,item["title"],item["episode_nr"])
376
-                    data2 = item["url"][1:]
377
-                    img = "https://www.lattelecom.tv"+item["img"]
378
-                    desc = title
379
-                    content.append((title,self.name+"::"+data2,img,desc))
331
+                result = re.findall(r"""season_choice\('[^']*','[^']*','(\d+)','epizode','([^']*)','','(\d+)',0,0\)">([^<]+)<""", r)
332
+                if not result:
333
+                    raise Exception("No seasons find!")
334
+                vid = result[0][1]
335
+
336
+                if not "season_nr" in qs:  # Sezonu saraksts
337
+                    for s,it in enumerate(result):
338
+                        title = "%s - %s" % (raidijums, it[3])
339
+                        data2 = path+"?season_nr=%s"%(it[2])
340
+                        img = img0
341
+                        desc = title
342
+                        content.append((title, self.name + "::" + data2, img, desc))
343
+                    return content
344
+
345
+                else:  # Sezonas epizožu saraksts
346
+                    if not "season_nr" in qs:
347
+                        qs["season_nr"]="0"
348
+                    # https://www.lattelecom.tv/api/episode-loader-design17/0?chunk_size=4&sorting=epizode&series_id=dora_the_explorer
349
+                    url = "https://www.lattelecom.tv/api/episode-loader-design17/%s?chunk_size=4&sorting=epizode&series_id=%s" % (qs["season_nr"], vid)
350
+                    r = self._http_request(url,headers=self.headers2)
351
+                    try:
352
+                        js = json.loads(r)
353
+                    except:
354
+                        raise Exception("Error getting episode list")
355
+                    result = re.findall(r'class="" href="([^"]+)".+?image:url\(([^ \)]+)\); "></div><div class="episode_titlez_design17">([^<]+)</div><div class="episode_number_design17">([^<]+)</div></a>', js["data"])
356
+                    for item in result:
357
+                        title = "%s - %s(%s)"%(raidijums,item[2],item[3])
358
+                        data2 = item[0][1:]
359
+                        img = "https://www.lattelecom.tv"+item[1]
360
+                        desc = title
361
+                        content.append((title,self.name+"::"+data2,img,desc))
362
+                    return content
363
+
364
+            # Nav sezonu
380 365
             else:
381
-                for item in re.findall('(?si)<a class="elementxxx forward-link[^"]*" href="([^"]+)">.*?<img src="([^"]+)" class="img"><span class="titlez">([^<]+)</span><span class="epizode_number">([^<]+)</span>', r):
382
-                    title = "%s%s (%s)"%(raidijums,item[2],item[3])
366
+                result = re.findall(r'class="" href="([^"]+)".+?image:url\(([^ \)]+)\).+?class="episode_titlez_design17">([^<]+)</div><div class="episode_number_design17">([^<]+)</div></a>', r)
367
+                for item in result:
368
+                    title = "%s - %s(%s)"%(raidijums,item[2],item[3])
383 369
                     data2 = item[0][1:]
384 370
                     img = "https://www.lattelecom.tv"+item[1]
385 371
                     desc = title
386 372
                     content.append((title,self.name+"::"+data2,img,desc))
387
-            return content
373
+                return content
388 374
 
389 375
         ### Videonomas video
390 376
         elif clist=="videonoma" and len(data.split("/"))>1:
@@ -758,58 +744,62 @@ Host: manstv.lattelecom.tv
758 744
                 hls["streams"].append(s)
759 745
         return hls
760 746
 
761
-    def get_stream_url2(self,data):
762
-        video_id=data[data.find("/")+1:]
763
-        if not self.is_logedin2():
764
-            if not self.login2():
765
-                return []
766
-            #data2 = self.get_noma_url(video_id)
767
-        r = self.call2(data)
768
-        m = re.search('<meta name="dr:say:title" content="([^"]+)">', r, re.IGNORECASE)
747
+
748
+    def get_info2(self, data):
749
+        # Get movie info (for VOD)
769 750
         nfo = {}
770 751
         tt = lambda p,r,d: re.search(p,r).group(1) if re.search(p,r) else d
771
-        tt2 = lambda p,r,d: (re.sub("<.+?>","",re.search(p,r).group(1))).split(",") if re.search(p,r) else d
772
-        r2 = r[r.find('<div class="movie_details">'):]
773
-        nfo["title"] = tt('<div class="lv">([^<]+)</div>', r2,"")
774
-        nfo["originaltitle"] = tt('<div class="en">([^<]+)</div>', r2,"")
752
+        tt2 = lambda p,r,d: (re.sub("[\.]","",re.search(p,r).group(1))).split(", ") if re.search(p,r) else d
753
+        r = self.call2(data)
754
+        m = re.search(r'"movie_titles" data-movieid=(\d+)><div class="en">([^<]+)</div><div class="lv translated">([^<]+)</div>', r)
755
+        if m:
756
+            title1 = m.group(2)
757
+            title2 = m.group(3)
758
+        else:
759
+            m = re.search('<meta name="dr:say:title" content="([^"]+)">', r, re.IGNORECASE)
760
+            title1 = title2 = m.group(1) if m else "Video"
761
+        nfo["title"] = title2
762
+        nfo["originaltitle"] = title1
775 763
         if nfo["originaltitle"] and not nfo["title"]:
776
-                nfo["title"] = nfo["originaltitle"]
777
-                #nfo["originaltitle"] = ""
778
-        if "raidijumi" in data:
779
-            nfo["set"] = nfo["title"]
780
-            m = re.search('class="movie_informatio">(.+?)<br>(.+?)<br>', r)
781
-            ep2,ep1 = m.groups()
782
-            #nfo["title"]
783
-            s_nr = tt('<span id="current_season_nr">(\d+)</span>',r,"")
784
-            for it in  re.findall(r'<span class="epizode_number">(\d+)</span>.+?<span class="titlez">(.+?)</span>', r):
785
-                if it[1] == ep1:
786
-                    ep_nr = it[0]
787
-                    break
764
+            nfo["title"] = nfo["originaltitle"]
765
+        if 'episode_switcher_title' in r:
766
+            title2 = title2.replace("\xe2\x80\x93", "-")
767
+            if " - " in title2:
768
+                nfo["set"] = title2.split(" - ")[0]
788 769
             else:
789
-                ep_nr=""
790
-            if s_nr:
791
-                nfo["season"] = s_nr
792
-            if ep_nr:
793
-                nfo["eposode"] = ep_nr
794
-            se = "S%02i"%int(s_nr) if s_nr else ""
795
-            se += "E%02i"%int(ep_nr) if ep_nr else ""
796
-            nfo["title"] += " - %s"%ep1 if ep1 else ""
797
-            nfo["originaltitle"] += " - %s"%ep2 if ep2 else ""
798
-            nfo["title"] += "(%s)"%se if se else ""
799
-            nfo["originaltitle"] += "(%s)"%se if se else ""
800
-
770
+                nfo["set"] = tt('<div class="movie_titles"><div class="en">(.+?)<', r, title2)
771
+            m = re.search('<div class="serial_switcher_banner active".+?<div class="episode_titlez_design17">([^<]+)</div><div class="episode_number_design17">([^<]+)</div>', r)
772
+            if m:
773
+                ep1 = m.group(1)
774
+                ep2 = m.group(2)
775
+                nfo["title"] = "%s - %s(%s)"%(nfo["set"], ep1, ep2)
776
+                nfo["originaltitle"] = nfo["originaltitle"] + "(%s)" % ep2
777
+            m = re.search("S(\d+)E(\d+)", ep2)
778
+            if m:
779
+                nfo["season"] = m.group(1)
780
+                nfo["eposode"] = m.group(2)
801 781
 
802 782
         nfo["thumb"] = tt('<meta name="og:image" content="([^"]+)"', r,"")
803
-        nfo["year"] = tt("Gads: ([^<]+)<", r2, "")
804
-        nfo["runtime"] = tt("Garums: ([^<]+)<", r2, "")
805
-        nfo["quality"] = tt("Kvalitāte: ([^<]+)<", r2, "")
806
-        nfo["genre"]=tt2("Žanr.: (.+?)<br", r2, "")
807
-        nfo["director"] = tt("Režisors: ([^<]+)<", r2, "")
808
-        nfo["actor"] = tt2("Lomās: ([^<]+)<", r2, "")
809
-        nfo["language"] = tt2("Valodas: ([^<]+)<", r2, "")
810
-        nfo["subtitles"] = tt2("Subtitri: ([^<]+)<", r2, "")
811
-        nfo["plot"] = tt('"introduction">(.+?)<', r2,"")
783
+        nfo["thumb"] = nfo["thumb"].replace("http:", "https:")
784
+        nfo["year"] = tt('movie-informatio-title">Gads<.+?content">([^<]+)<', r, "")
785
+        nfo["runtime"] = tt('movie-informatio-title">Garums<.+?content">([^<]+)<', r, "")
786
+        nfo["quality"] = tt('movie-informatio-title">Kvalitāte<.+?content">([^<]+)<', r, "")
787
+        nfo["genre"]=tt('movie-informatio-title">Žanrs<.+?content">([^<]+)<', r, "")
788
+        nfo["director"] = tt('movie-informatio-title">Režisors<.+?content">([^<]+)<', r, "")
789
+        nfo["actor"] = tt2('movie-informatio-title">Aktieri<.+?content">([^<]+)<', r, "")
790
+        nfo["language"] = tt2('movie-informatio-title">Valodas*<.+?content">([^<]+)<', r, "")
791
+        nfo["subtitles"] = tt2('movie-informatio-title">Subtitri<.+?content">([^<]+)<', r, "")
792
+        nfo["plot"] = tt('movie-informatio-title">Apraksts<.+?content">([^<]+)<', r, "")
812 793
         nfo["tagline"] = nfo["plot"]
794
+        return nfo
795
+
796
+    def get_stream_url2(self,data):
797
+        video_id=data[data.find("/")+1:]
798
+        if not self.is_logedin2():
799
+            if not self.login2():
800
+                return []
801
+            #data2 = self.get_noma_url(video_id)
802
+        nfo = self.get_info2(data)
813 803
         title = util.nfo2title(nfo)
814 804
         desc = util.nfo2desc(nfo)
815 805
         img = nfo["thumb"]
@@ -1042,6 +1032,8 @@ User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like
1042 1032
 if __name__ == "__main__":
1043 1033
     c = Source()
1044 1034
     from subprocess import call
1035
+    c.get_info2(sys.argv[1])
1036
+    sys.exit()
1045 1037
 
1046 1038
     if len(sys.argv)>1 and  not "ltc::" in sys.argv[1]:
1047 1039
 

BIN
sources/ltc.pyc Ver arquivo


+ 1
- 0
sources/movieplace.py Ver arquivo

@@ -33,6 +33,7 @@ h = HTMLParser.HTMLParser()
33 33
 class Source(SourceBase):
34 34
 
35 35
     def __init__(self, country="",cfg_path=None):
36
+        self.hidden = True # nerāda menu nestrādājošos avotus
36 37
         self.name = "movieplace"
37 38
         self.title = "MoviePlace.lv"
38 39
         self.img = "http://movieplace.lv/images/logo.png"

BIN
sources/movieplace.pyc Ver arquivo


BIN
sources/mtgplay.pyc Ver arquivo


BIN
sources/play24.pyc Ver arquivo


BIN
sources/replay.pyc Ver arquivo


+ 1
- 0
sources/serialguru.py Ver arquivo

@@ -26,6 +26,7 @@ h = HTMLParser.HTMLParser()
26 26
 class Source(SourceBase):
27 27
 
28 28
     def __init__(self,country="",cfg_path=None):
29
+        self.hidden = True # nerāda menu nestrādājošos avotus
29 30
         self.name = "serialguru"
30 31
         self.title = "SerialGURU.ru"
31 32
         self.img = "http://serialguru.ru/images/xlogo_new.png.pagespeed.ic.0sre2_2OJN.png"

BIN
sources/serialguru.pyc Ver arquivo


BIN
sources/swfinterp.pyc Ver arquivo


+ 2
- 0
sources/tvdom.cfg Ver arquivo

@@ -1,4 +1,6 @@
1 1
 [tvdom]
2 2
 user = ivars777@gmail.com
3 3
 password = kaskade7
4
+region = lv
5
+lang = lv
4 6
 

+ 166
- 107
sources/tvdom.py Ver arquivo

@@ -17,12 +17,16 @@ if "_create_unverified_context" in dir(ssl):
17 17
     ssl._create_default_https_context = ssl._create_unverified_context
18 18
 
19 19
 from SourceBase import SourceBase
20
+import util
20 21
 
21
-API_URL = 'http://replay.lsm.lv/'
22 22
 headers2dict = lambda  h: dict([l.strip().split(": ") for l in h.strip().splitlines()])
23 23
 headers0 = headers2dict("""
24
-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
25
-""")
24
+User-Agent: Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.04
25
+Accept: application/json, text/javascript, */*; q=0.01
26
+Accept-Language: en-US,en;q=0.5
27
+Accept-Encoding: gzip, deflate, br
28
+Content-Type: application/x-www-form-urlencoded; charset=UTF-8
29
+X-Requested-With: XMLHttpRequest""")
26 30
 import HTMLParser
27 31
 h = HTMLParser.HTMLParser()
28 32
 
@@ -34,6 +38,7 @@ class Source(SourceBase):
34 38
         self.img = "https://tvdom.tv/front/assets/images/logo.png"
35 39
         self.desc = "TVDom.tv portāla satura skatīšanās"
36 40
         self.headers = headers0
41
+        self.url = "https://tvdom.tv/"
37 42
 
38 43
         self.country=country
39 44
         self.session = None
@@ -42,7 +47,7 @@ class Source(SourceBase):
42 47
         cur_directory = os.path.dirname(os.path.abspath(__file__))
43 48
         if not cfg_path: cfg_path = cur_directory
44 49
         self.config_file = os.path.join(cfg_path,self.name+".cfg")
45
-        self.options = OrderedDict([("user","lietotajs"),("password","parole")])
50
+        self.options = OrderedDict([("user","lietotajs"),("password","parole"), ("region", "lv"), ("lang", "lv")])
46 51
         self.options_read()
47 52
 
48 53
     def login(self,user="",password=""):
@@ -80,13 +85,16 @@ Referer: https://tvdom.tv/
80 85
     def get_content(self, data):
81 86
         print "[tvdom] get_content:", data
82 87
         source,data,path,plist,clist,params,qs = self.parse_data(data)
83
-        lang = qs["lang"] if "lang" in qs else self.country
88
+        lang = self.options["lang"]
89
+        region = self.options["region"]
84 90
         content=[]
85 91
         content.append(("..return", "back","","Return back"))
86 92
 
87 93
         if clist=="home":
88 94
             content.extend([
89 95
                 ("Live stream", "tvdom::tiesraides","","TV live streams"),
96
+                ("Archive - last", "tvdom::arhivs?filter=new&page=0&limit=30&region=%s&language=%s" % (region, lang),"","Video archive - last videos"),
97
+                ("Archive - popular", "tvdom::arhivs?filter=new&page=0&limit=30&region=%s&language=%s"% (region, lang),"","Video archive - popular video"),
90 98
                 ("Archive - categories", "tvdom::arhivs","","Video archive by categories"),
91 99
                 ("Search", "tvdom::search/?srch-term={0}","","Search archive"),
92 100
 
@@ -96,70 +104,51 @@ Referer: https://tvdom.tv/
96 104
 
97 105
         ### Tiesraides kanalu saraksts ###
98 106
         elif data=="tiesraides":
99
-            ch_name = {"49":"Дом Кино","50":"Карусель","51":"Время","52":"Музыка Первого","53":"Телекафе"}
100
-            url = "https://tvdom.tv/"
101
-            r = self._http_request(url)
102
-            #channels1 = re.findall(r'data-xprs_status="\d" data-href="/tiesraides/([^/]+)/[^"]+">.+?src="([^"]+)" alt="([^"]+)">', r, re.DOTALL)
103
-            channels2 = re.findall(r'<a class="channel-name">([^<]*)</a>\s+<div class="redirect-to-url" data-href="/tiesraides/([^/]+)/[^"]*">.+?<img style="width:100%;" src="([^"]+)".+?<h3>([^<]+)</h3>.+?<p class="unix">([^<]+)</p>', r, re.DOTALL)
104
-            channels = {}
105
-            for item in channels2:
106
-                title = item[0]
107
-                title =  h.unescape(title.decode("utf8")).encode("utf8")
108
-                img = "https://tvdom.tv"+item[2]
109
-                data2 = "tiesraides/%s/"%item[1]
110
-                desc = "%s\n%s\n%s"%(title,item[3],item[4])
111
-                channels[item[1]]={"title":title,"img":img,"desc":desc}
112
-                #content.append((title,self.name+"::"+data2,img,desc))
113
-
114
-            for r2 in re.findall(r'<div class="thumbnail-menu pull-left updater"(.+?)</div>\s+</div>', r, re.DOTALL):
115
-                ch = re.search('data-href="/tiesraides/([^/]+)/[^"]*"', r2, re.DOTALL).group(1)
116
-                data2 = "tiesraides/"+ch
117
-                m = re.search('src="(.+?)" alt="(.+?)">', r2, re.DOTALL)
118
-                title = m.group(2)
119
-                img = m.group(1)
120
-                desc = title
121
-                if ch in channels:
122
-                    img = channels[ch]["img"]
123
-                    desc = channels[ch]["desc"]
124
-                else:
125
-                    m = re.search('<img src="([^"]+)" alt="aaaaaa([^"]+)"><h3>.+<p class="unix">([^<]+)</p>', r2, re.DOTALL)
126
-                    if m:
127
-                        desc  = "%s\n%s\n%s"%(title,m.group(1),m.group(3))
128
-                        img = m.group(2)
129
-                content.append((title,self.name+"::"+data2,img,desc))
107
+            data1 = "infinity/on_front_filter_channels_list.json"
108
+            params = "hd=&language=%s&region=%s" % (self.options["lang"], self.options["region"])
109
+            r = self.call_json(data1, params)
110
+            for genre in  r["data"]:
111
+                for item in r["data"][genre]:
112
+                    ch = item["channel_name"]
113
+                    title = u"%s - %s" % (item["channel_name"], item["program_title"])
114
+                    img = "https://tvdom.tv"+item["channel_logo"]
115
+                    data2 = item["program_url"][1:]
116
+                    desc = u"%s\n%s-%s"%(title,item["time_start"],item["time_stop"])
117
+                    content.append((title,self.name+"::"+data2,img,desc))
130 118
             return content
131 119
 
132
-        elif clist == "tiesraides":
133
-            if not self.session:
134
-                self.login()
135
-            url = "https://tvdom.tv/" + data
136
-            headers = self.headers
137
-            headers["Cookie"] = "PHPSESSID=%s; neverending_story=1;"%self.session
138
-            r = self._http_request(url,headers=headers)
139
-            m = re.search("var streamConnectionUrl = '([^']+)'", r, re.DOTALL)
140
-            if m:
141
-                data2 = m.group(1)
142
-            else:
143
-                return ("No stream found %s"%data,"","","No stream found")
144
-            m = re.search('title: "([^"]+)"', r, re.DOTALL)
145
-            title = m.group(1) if m else data2
146
-            m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
147
-            desc = m.group(1) if m else title
148
-            m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
149
-            desc = m.group(1) if m else title
150
-            m = re.search('var promo_image *= "([^"]+)', r, re.DOTALL)
151
-            img = m.group(1) if m else ""
152
-            return (title,data2,img,desc)
120
+#         elif clist == "tiesraides":
121
+#             if not self.session:
122
+#                 self.login()
123
+#             url = "https://tvdom.tv/" + data
124
+#             headers = self.headers
125
+#             headers["Cookie"] = "PHPSESSID=%s; neverending_story=1;"%self.session
126
+#             r = self._http_request(url,headers=headers)
127
+#             m = re.search("var streamConnectionUrl = '([^']+)'", r, re.DOTALL)
128
+#             if m:
129
+#                 data2 = m.group(1)
130
+#             else:
131
+#                 return ("No stream found %s"%data,"","","No stream found")
132
+#             m = re.search('title: "([^"]+)"', r, re.DOTALL)
133
+#             title = m.group(1) if m else data2
134
+#             m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
135
+#             desc = m.group(1) if m else title
136
+#             m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
137
+#             desc = m.group(1) if m else title
138
+#             m = re.search('var promo_image *= "([^"]+)', r, re.DOTALL)
139
+#             img = m.group(1) if m else ""
140
+#             return (title,data2,img,desc)
153 141
 
154 142
         ### Search ###
155 143
         elif clist=="search":
156 144
             url = "https://tvdom.tv/" + data
157 145
             r = self._http_request(url)
158
-            for item in re.findall(r'<li data-xprs-search="\d+" data-href="([^"]+)".*?<img class="img-responsive" src="([^"]+)".*?<h3>([^<]+)</h3>.*?<h5>([^<]+)</h5>', r, re.DOTALL):
159
-                title = item[2] + " "+ item[3]
146
+            result = re.findall(r'<div class="film-block_img">\s*<img src="([^"]+).+?<a href="/([^"]+)">([^<]+)</a>\s*</div>\s*<ul class="film-block_descr_tag">\s*<li><a href="">([^<]+)</a>', r, re.DOTALL)
147
+            for item in result:
148
+                title = item[2] + " ("+ item[3] + ")"
160 149
                 title =  h.unescape(title.decode("utf8")).encode("utf8")
161
-                img = "https://tvdom.tv" + item[1]
162
-                data2 = item[0][1:]
150
+                img = "https://tvdom.tv" + item[0]
151
+                data2 = item[1]
163 152
                 desc = title
164 153
                 content.append((title,self.name+"::"+data2,img,desc))
165 154
             return content
@@ -167,36 +156,103 @@ Referer: https://tvdom.tv/
167 156
         ### Arhīva kategorijas ###
168 157
         elif data=="arhivs":
169 158
             url = "https://tvdom.tv/"+data
159
+            headers = self.headers
160
+            headers["Cookie"] = "neverending_story=1; user_selected_language=%s"% (self.options["lang"])
170 161
             r = self._http_request(url)
171
-            for item in re.findall('pointer" href="/([^"]+)">([^<]+)</a>', r, re.DOTALL):
172
-                title = item[1]
173
-                title =  h.unescape(title.decode("utf8")).encode("utf8")
162
+            result = re.findall(r'data-text-mobile="(.+?)" data-id="(\d+)" data-filter-type="archive_genre">', r)
163
+            for item in result:
164
+                title = item[0]
174 165
                 img = ""
175
-                data2 = item[0]
166
+                data2 = "arhivs?" + "genre1=%s&filter=new&region=%s&lang=%s&page=0&limit=30" % (item[1], region, lang)
176 167
                 desc = title
177 168
                 content.append((title,self.name+"::"+data2,img,desc))
178 169
             return content
179 170
 
180 171
         ### Arhīva kategorijas programmas ###
181 172
         elif clist=="arhivs":
182
-            url = "https://tvdom.tv/"+data
183
-            r = self._http_request(url)
184
-            for item in re.findall(r"""<li><div class="thumbnail pull-left" onclick="location\.href='([^']+)'" data-toggle="popover" title="([^"]+)" data-content="([^"]*)".+?<img class="img-responsive archive-image" src="([^"]+)""", r, re.DOTALL):
185
-            #for item in re.findall(r"""<li><div class="thumbnail pull-left" onclick="location\.href='([^']+)'" data-toggle="popover" title="([^"]+)" data-content="([^"]+)".+?<img class="img-responsive archive-image" src="([^"]+)""", r, re.DOTALL):
186
-                title = item[1].replace("&lt;br&gt;"," - ")
187
-                title =  h.unescape(title.decode("utf8")).encode("utf8")
188
-                img = "https://tvdom.tv"+item[3]
189
-                data2 = item[0][1:]
190
-                desc = item[2]
173
+            data1 = "infinity/on_front_archive_get_events2.json"
174
+            r = self.call_json(data1, params[1:])
175
+
176
+            for item in r["data"]:
177
+                title = item["title"] + "- " + item["online_time"]
178
+                img = "https://tvdom.tv"+item["image"]
179
+                data2 = item["url"][1:]
180
+                desc = u"%s\nlast: %s\npopularity: %s\n%s" % (title, item["online_time"], item["popularity"], item["channel_code"])
191 181
                 content.append((title,self.name+"::"+data2,img,desc))
182
+            if len(r["data"]) == 30:
183
+                page = int(qs["page"]) + 1
184
+                data2 = re.sub("page=\d+", "page=%s" % page, data)
185
+                content.append(("Next page",self.name+"::"+data2,"","Go to next page"))
192 186
             return content
193 187
 
194 188
         ### Arhīva programmas video saraksts ###
195 189
         elif clist=="play_arhivs" and len(data.split("/"))==3 and not re.search("_\d+",plist[2]):
196 190
             url = "https://tvdom.tv/"+data
197 191
             r = self._http_request(url)
198
-            vid=re.search(r"id:(\d+), type: type", r, re.DOTALL).group(1)
192
+            vid=re.search('materialIdentifier : "(\d+)', r, re.DOTALL).group(1)
193
+            pname = re.split("[_\.\-]", plist[-1])[0]
199 194
             data2 = data+"_"+vid
195
+            m = re.search(r'var program_title\s*= "(.+?)"', r)
196
+            title = title0 = m.group(1) if m else data2
197
+            m = re.search('<p class="content-info__descr-item">(.+?)</p>', r, re.DOTALL)
198
+            datums = m.group(1).strip() if m else ""
199
+            title = title + " " + datums
200
+            m = re.search('<p class="video-player__descr-text" style="height: 100px;">(.+?)<span', r, re.DOTALL)
201
+            desc = m.group(1).strip() if m else title
202
+            m = re.search('var share_image\s*= "([^"]+)', r, re.DOTALL)
203
+            img = m.group(1) if m else ""
204
+            content.append((title,self.name+"::"+data2,img,desc))
205
+            i2 = r.find("content  content--indent-pb")
206
+            r2 = r if i2 == -1 else r[:i2]
207
+            result = re.findall(r'<img src="([^"]+)" class="content-item__image" alt=""><a href="/([^"]+)" class="content-item__hide-info">.+?<h3 class="content-item__name">\s*<a href="#">\s*([^<]*)\s*<br>\s*([^<]*)\s*</a>\s*</h3>', r2, re.DOTALL)
208
+            for item in result:
209
+                if pname not in item[1]:
210
+                    continue
211
+                title = item[2] + " " + item[3].strip()
212
+                title =  h.unescape(title.decode("utf8")).encode("utf8")
213
+                img = "https://tvdom.tv"+item[0]
214
+                data2 = item[1]
215
+                desc = title # TODO
216
+                content.append((title,self.name+"::"+data2,img,desc))
217
+            return content
218
+
219
+        ### Arhīva video
220
+#         elif clist=="play_arhivs" and len(data.split("/"))==3 and re.search("_\d+",plist[2]):
221
+#             url = "https://tvdom.tv/" + data
222
+#             headers = self.headers
223
+#             headers["Cookie"] = "PHPSESSID=%s; neverending_story=1;"%self.session
224
+#             r = self._http_request(url,headers=headers)
225
+#             m = re.search('var streamConnectionUrl  = "([^"]+)"', r, re.DOTALL)
226
+#             if m:
227
+#                 data2 = m.group(1)
228
+#             else:
229
+#                 return ("No stream found %s"%data,"","","No stream found")
230
+#             m = re.search('program_title        = "([^"]+)"', r, re.DOTALL)
231
+#             title = m.group(1) if m else data2
232
+#             m = re.search('<a class="episode">Pārraides laiks ēterā: <span>([^<]+)</span></a>', r, re.DOTALL)
233
+#             datums = m.group(1) if m else ""
234
+#             title = title + " " + datums
235
+#             m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
236
+#             desc = m.group(1) if m else title
237
+#             m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
238
+#             desc = m.group(1) if m else title
239
+#             m = re.search('var share_image *= "([^"]+)', r, re.DOTALL)
240
+#             img = m.group(1) if m else ""
241
+#             return (title,data2,img,desc)
242
+
243
+    def get_streams(self,data):
244
+        print "[tvdom] get_streams:", data
245
+        if not self.is_video(data):
246
+            return []
247
+        source,data,path,plist,clist,params,qs = self.parse_data(data)
248
+        if not self.session:
249
+            self.login()
250
+        url = "https://tvdom.tv/" + data
251
+        headers = self.headers
252
+        headers["Cookie"] = "PHPSESSID=%s; neverending_story=1;"%self.session
253
+        r = self._http_request(url,headers=headers)
254
+
255
+        if clist == "play_arhivs":
200 256
             m = re.search('program_title        = "([^"]+)"', r, re.DOTALL)
201 257
             title = m.group(1) if m else data2
202 258
             m = re.search('<a class="episode">Pārraides laiks ēterā: <span>([^<]+)</span></a>', r, re.DOTALL)
@@ -208,41 +264,51 @@ Referer: https://tvdom.tv/
208 264
             desc = m.group(1) if m else title
209 265
             m = re.search('var share_image *= "([^"]+)', r, re.DOTALL)
210 266
             img = m.group(1) if m else ""
211
-            content.append((title,self.name+"::"+data2,img,desc))
212
-            i = r.find('<span class="slider-top-title"')
213
-            if i>0: r = r[:i]
214
-            for item in re.findall('<div class="col-md-9 redirect-to-url same-event" data-href="/([^"]+)">.+?image" src="([^"]+)".+?<h3 class="same-title">([^<]+)</h3>.*?<h5 class="same-online">([^<]+)</h5>', r, re.DOTALL):
215
-                title = item[2] + " " + item[3]
216
-                title =  h.unescape(title.decode("utf8")).encode("utf8")
217
-                img = "https://tvdom.tv"+item[1]
218
-                data2 = item[0]
219
-                desc = title # TODO
220
-                content.append((title,self.name+"::"+data2,img,desc))
221
-            return content
222 267
 
223
-        ### Arhīva video
224
-        elif clist=="play_arhivs" and len(data.split("/"))==3 and re.search("_\d+",plist[2]):
225
-            url = "https://tvdom.tv/" + data
226
-            headers = self.headers
227
-            headers["Cookie"] = "PHPSESSID=%s; neverending_story=1;"%self.session
228
-            r = self._http_request(url,headers=headers)
229
-            m = re.search('var streamConnectionUrl  = "([^"]+)"', r, re.DOTALL)
268
+            m = re.search(r"var streams\s*= ({[^;]+);", r, re.DOTALL)
269
+            if not m:
270
+                raise Exception("No stream found")
271
+            js = json.loads(m.group(1))
272
+            streams = []
273
+            for st in js:
274
+                if st == "qualities": continue
275
+                s = js[st]
276
+                data2 = s["url"]
277
+                stream = util.item()
278
+                stream["name"] = title
279
+                stream["url"] = data2
280
+                stream["img"] = img
281
+                stream["desc"] = desc
282
+                stream["resolver"] = "tvdom"
283
+                stream["quality"] = st
284
+                stream["order"] = int(st[:-1])
285
+                streams.append(stream)
286
+
287
+            streams = sorted(streams,key=lambda item: item["order"],reverse=True)
288
+            return streams
289
+
290
+        # Tiešraides video
291
+        else:
292
+            m = re.search("var streamConnectionUrl = '([^']+)'", r, re.DOTALL)
230 293
             if m:
231 294
                 data2 = m.group(1)
232 295
             else:
233
-                return ("No stream found %s"%data,"","","No stream found")
234
-            m = re.search('program_title        = "([^"]+)"', r, re.DOTALL)
296
+                raise Exception("No stream found")
297
+            m = re.search('title: "([^"]+)"', r, re.DOTALL)
235 298
             title = m.group(1) if m else data2
236
-            m = re.search('<a class="episode">Pārraides laiks ēterā: <span>([^<]+)</span></a>', r, re.DOTALL)
237
-            datums = m.group(1) if m else ""
238
-            title = title + " " + datums
239 299
             m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
240 300
             desc = m.group(1) if m else title
241 301
             m = re.search('<div id="panel">([^<]+)<', r, re.DOTALL)
242 302
             desc = m.group(1) if m else title
243
-            m = re.search('var share_image *= "([^"]+)', r, re.DOTALL)
303
+            m = re.search('var promo_image *= "([^"]+)', r, re.DOTALL)
244 304
             img = m.group(1) if m else ""
245
-            return (title,data2,img,desc)
305
+            stream = util.item()
306
+            stream["name"] = title
307
+            stream["url"] = data2
308
+            stream["img"] = img
309
+            stream["desc"] = desc
310
+            stream["resolver"] = "tvdom"
311
+            return [stream]
246 312
 
247 313
 
248 314
     def is_video(self,data):
@@ -255,13 +321,6 @@ Referer: https://tvdom.tv/
255 321
         else:
256 322
             return False
257 323
 
258
-    def call(self, data,headers=headers0,lang=""):
259
-        if not lang: lang = self.country
260
-        url = API_URL%lang + data
261
-        #print "[TVPlay Api] url: ",url
262
-        result = []
263
-        content = self._http_request(url)
264
-        return content
265 324
 
266 325
 if __name__ == "__main__":
267 326
     country= "lv"

BIN
sources/tvdom.pyc Ver arquivo


+ 9
- 1
sources/ustvnow.py Ver arquivo

@@ -33,6 +33,7 @@ h = HTMLParser.HTMLParser()
33 33
 class Source(SourceBase):
34 34
 
35 35
     def __init__(self,country="lv",cfg_path=None):
36
+        self.hidden = True
36 37
         self.name = "ustvnow"
37 38
         self.title = "USTVNow"
38 39
         self.img = "http://watch.ustvnow.com/assets/ustvnow/img/ustvnow_og_image.png"
@@ -117,7 +118,14 @@ class Source(SourceBase):
117 118
         ### Tiesraides kanāls ###
118 119
         elif path == "live/view":
119 120
             url = "http://m-api.ustvnow.com/stream/1/%s"%data
120
-            r = self._http_request(url)
121
+            #url = "http://m.ustvnow.com/stream/1/live/view?scode=whphd&token=o7oxits4dcjd8hbxusf9d9cgcyad&br_n=Chrome&br_v=60&br_d=desktop"
122
+            url =  "http://m.ustvnow.com/stream/1/live/%s"%data
123
+            headers = headers2dict("""
124
+Accept: application/json, text/javascript, */*; q=0.01
125
+User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36
126
+Referer: http://watch.ustvnow.com/guide
127
+                """)
128
+            r = self._http_request(url, headers=headers )
121 129
             if not r:
122 130
                 return ("No stream found %s"%data,"","","No stream found")
123 131
             r = json.loads(r)

BIN
sources/ustvnow.pyc Ver arquivo


+ 1
- 0
sources/viaplay.py Ver arquivo

@@ -37,6 +37,7 @@ headers2dict = lambda  h: dict([l.strip().split(": ") for l in h.strip().splitli
37 37
 class Source(SourceBase):
38 38
 
39 39
     def __init__(self,language="en",cfg_path=None):
40
+        self.hidden = True # nerāda menu nestrādājošos avotus
40 41
         self.name = "viaplay"
41 42
         self.title = "viaplay.lv"
42 43
         self.img = "https://yt3.ggpht.com/-noVdjbNR-V8/AAAAAAAAAAI/AAAAAAAAAAA/yZ9XNP5urLY/s900-c-k-no-mo-rj-c0xffffff/photo.jpg"

BIN
sources/viaplay.pyc Ver arquivo