|
@@ -17,10 +17,13 @@ from SourceBase import SourceBase
|
17
|
17
|
import base64
|
18
|
18
|
from collections import OrderedDict
|
19
|
19
|
import sys
|
20
|
|
-
|
|
20
|
+try:
|
|
21
|
+ import util
|
|
22
|
+except:
|
|
23
|
+ sys.path.insert(0,'..')
|
|
24
|
+ import util
|
21
|
25
|
|
22
|
26
|
headers2dict = lambda h: dict([l.strip().split(": ") for l in h.strip().splitlines()])
|
23
|
|
-import util
|
24
|
27
|
|
25
|
28
|
class Source(SourceBase):
|
26
|
29
|
|
|
@@ -49,14 +52,7 @@ Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
|
49
|
52
|
|
50
|
53
|
def get_content(self, data):
|
51
|
54
|
print "[filmix] get_content:", data
|
52
|
|
- if "::" in data:
|
53
|
|
- data = data.split("::")[1]
|
54
|
|
- path = data.split("?")[0]
|
55
|
|
- clist = path.split("/")[0]
|
56
|
|
- params = data[data.find("?"):] if "?" in data else ""
|
57
|
|
- qs = dict(map(lambda x:x.split("="),re.findall("[%\w]+=\w+",params)))
|
58
|
|
- lang = qs["lang"] if "lang" in qs else self.country
|
59
|
|
-
|
|
55
|
+ source, data, path, plist, clist, params, qs = self.parse_data(data)
|
60
|
56
|
content=[]
|
61
|
57
|
content.append(("..return", "back","","Return back"))
|
62
|
58
|
|
|
@@ -107,29 +103,9 @@ Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
|
107
|
103
|
duration = "(%s)"%m.group(1) if m else ""
|
108
|
104
|
m = re.search('<p itemprop="description"[^>]+>([^<]+)<', r, re.DOTALL)
|
109
|
105
|
desc = desc0 = util.unescape(m.group(1).strip()) if m else ""
|
110
|
|
-
|
111
|
|
- m = re.search('itemprop="contentUrl" content="(.+?)"', r, re.IGNORECASE | re.DOTALL)
|
112
|
|
- if not m:
|
113
|
|
- # #raise Exception("Can not find video link")
|
114
|
|
- return []
|
115
|
|
- video_link = m.group(1)
|
116
|
|
-
|
117
|
|
- if video_link<>'{video-link}': # TODO nevar būt!
|
118
|
|
- video_link = self.decode_uppod_text(video_link)
|
119
|
|
- streams = self.get_streams2(video_link)
|
120
|
|
- data2 = streams[0][1]
|
121
|
|
- content = (title,data2,img,desc)
|
122
|
|
- return content
|
123
|
|
-
|
124
|
|
- r = util.request("https://m.filmix.me/"+data)
|
125
|
|
- i = r.find("var flashvars")
|
126
|
|
- if i == -1:
|
127
|
|
- raise Exception("Can not find series list")
|
128
|
|
- m = re.search('pl:"([^"]+)"', r[i:], re.DOTALL)
|
129
|
|
- if not m:
|
130
|
|
- #return []
|
131
|
|
- raise Exception("Can not find series list")
|
132
|
|
- pl_link = m.group(1)
|
|
106
|
+ vid = plist[-1]
|
|
107
|
+ js = self.get_movie_info(vid)
|
|
108
|
+ pl_link = js["message"]["translations"]["flash"].values()[0] # TODO process several players
|
133
|
109
|
pl_link = self.decode_uppod_text(pl_link)
|
134
|
110
|
js = self._http_request(pl_link)
|
135
|
111
|
js = self.decode_uppod_text(js)
|
|
@@ -241,28 +217,16 @@ Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
|
241
|
217
|
video_link = m.group(1)
|
242
|
218
|
series = True if video_link == '{video-link}' else False
|
243
|
219
|
vid = plist[1]
|
244
|
|
- headers = headers2dict("""
|
245
|
|
- User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0
|
246
|
|
- Accept: application/json, text/javascript, */*; q=0.01
|
247
|
|
- Accept-Language: en-US,en;q=0.5
|
248
|
|
- Content-Type: application/x-www-form-urlencoded; charset=UTF-8
|
249
|
|
- X-Requested-With: XMLHttpRequest
|
250
|
|
- Referer: https://filmix.me/play/%s
|
251
|
|
- """%vid )
|
252
|
|
- post_data = {"post_id":vid}
|
253
|
|
- r = util.post("https://filmix.me/api/movies/player_data", data=post_data, headers = headers)
|
254
|
|
- if not r:
|
255
|
|
- #raise Exception("Can not find video link")
|
256
|
|
- return []
|
257
|
|
- js = json.loads(r)
|
|
220
|
+ js = self.get_movie_info(vid)
|
258
|
221
|
if js["message"]["translations"]["flash"]:
|
259
|
222
|
video_link = js["message"]["translations"]["flash"].values()[0].encode("utf8")
|
260
|
|
- lang = js["message"]["translations"]["flash"].keys()[0].encode("utf8")
|
|
223
|
+ video_link = self.decode_uppod_text(video_link)
|
|
224
|
+ lang = js["message"]["translations"]["flash"].keys()[0].encode("utf8") # TODO process several players/streams
|
261
|
225
|
else:
|
262
|
226
|
return []
|
263
|
227
|
|
264
|
228
|
if not series : # Filma
|
265
|
|
- url0 = self.decode_uppod_text(video_link)
|
|
229
|
+ url0 = video_link
|
266
|
230
|
streams2 = self.get_streams2(url0)
|
267
|
231
|
for st in streams2:
|
268
|
232
|
stream = util.item()
|
|
@@ -275,16 +239,7 @@ Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
|
275
|
239
|
return streams
|
276
|
240
|
|
277
|
241
|
else: # Seriāls
|
278
|
|
- r = util.request("https://m.filmix.me/"+path)
|
279
|
|
- i = r.find("var flashvars")
|
280
|
|
- if i == -1:
|
281
|
|
- raise Exception("Can not find series list")
|
282
|
|
- m = re.search('pl:"([^"]+)"', r[i:], re.DOTALL)
|
283
|
|
- if not m:
|
284
|
|
- #return []
|
285
|
|
- raise Exception("Can not find series list")
|
286
|
|
- pl_link = m.group(1)
|
287
|
|
- pl_link = self.decode_uppod_text(pl_link)
|
|
242
|
+ pl_link = video_link
|
288
|
243
|
js = self._http_request(pl_link)
|
289
|
244
|
js = self.decode_uppod_text(js)
|
290
|
245
|
js = json.loads(js)
|
|
@@ -311,6 +266,22 @@ Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
|
311
|
266
|
result = self._http_request(url,params,headers=headers)
|
312
|
267
|
return result
|
313
|
268
|
|
|
269
|
+ def get_movie_info(self,vid):
|
|
270
|
+ headers = headers2dict("""
|
|
271
|
+ User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0
|
|
272
|
+ Accept: application/json, text/javascript, */*; q=0.01
|
|
273
|
+ Accept-Language: en-US,en;q=0.5
|
|
274
|
+ Content-Type: application/x-www-form-urlencoded; charset=UTF-8
|
|
275
|
+ X-Requested-With: XMLHttpRequest
|
|
276
|
+ Referer: https://filmix.me/play/%s
|
|
277
|
+ """%vid )
|
|
278
|
+ post_data = {"post_id":vid}
|
|
279
|
+ r = util.post("https://filmix.me/api/movies/player_data", data=post_data, headers = headers)
|
|
280
|
+ if not r:
|
|
281
|
+ raise Exception("Can not get movie info")
|
|
282
|
+ #return []
|
|
283
|
+ js = json.loads(r)
|
|
284
|
+ return js
|
314
|
285
|
|
315
|
286
|
def decode_uppod_text(self, text):
|
316
|
287
|
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", "="]
|
|
@@ -340,8 +311,11 @@ Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
|
340
|
311
|
|
341
|
312
|
|
342
|
313
|
if __name__ == "__main__":
|
343
|
|
- country= "lv"
|
344
|
|
- c = Source(country)
|
|
314
|
+
|
|
315
|
+ c = Source()
|
|
316
|
+ #s = "ZnVuY3Rpb24gc2VuZE1lc3NhZ2U2MDc3ODkoZSl7dmFyIGg9bWdfd3M2MDc3ODkub25tZXNzYWdlOyBtZ193czYwNzc4OS5yZWFkeVN0YXRlPT1tZ193czYwNzc4OS5DTE9TRUQmJihtZ193czYwNzc4OT1uZXcgV2ViU29ja2V0KG1nX3dzNjA3Nzg5X2xvY2F0aW9uKSksbWdfd3M2MDc3ODkub25tZXNzYWdlPWgsd2FpdEZvclNvY2tldENvbm5lY3Rpb242MDc3ODkobWdfd3M2MDc3ODksZnVuY3Rpb24oKXttZ193czYwNzc4OS5zZW5kKGUpfSl9ZnVuY3Rpb24gd2FpdEZvclNvY2tldENvbm5lY3Rpb242MDc3ODkoZSx0KXtzZXRUaW1lb3V0KGZ1bmN0aW9uKCl7cmV0dXJuIDE9PT1lLnJlYWR5U3RhdGU/dm9pZChudWxsIT10JiZ0KCkpOnZvaWQgd2FpdEZvclNvY2tldENvbm5lY3Rpb242MDc3ODkoZSx0KX0sNSl9OyB2YXIgbWdfd3M2MDc3ODlfbG9jYXRpb24gPSAid3NzOi8vd3NwLm1hcmtldGdpZC5jb20vd3MiOyBtZ193czYwNzc4OSA9IG5ldyBXZWJTb2NrZXQobWdfd3M2MDc3ODlfbG9jYXRpb24pLCBtZ193czYwNzc4OS5vbm1lc3NhZ2UgPSBmdW5jdGlvbiAodCkge3Bvc3RNZXNzYWdlKHQuZGF0YSk7fSwgb25tZXNzYWdlID0gZnVuY3Rpb24oZSl7c2VuZE1lc3NhZ2U2MDc3ODkoZS5kYXRhKX0="
|
|
317
|
+
|
|
318
|
+ #txt = c.decode_uppod_text(s)
|
345
|
319
|
if len(sys.argv)>1:
|
346
|
320
|
data= sys.argv[1]
|
347
|
321
|
else:
|