1 | |
---|
2 | import sys |
---|
3 | import re |
---|
4 | from lib import jsunpack |
---|
5 | from lib.net import Net |
---|
6 | |
---|
7 | class StreamzResolver(object): |
---|
8 | name = "streamz" |
---|
9 | domains = ['streamz.cc|streamcrypt.net'] |
---|
10 | pattern = r'(?://|\.)(streamz\.cc|streamcrypt\.net)/([0-9a-zA-Z]+)' |
---|
11 | |
---|
12 | def __init__(self): |
---|
13 | self.net = Net() |
---|
14 | url = str(sys.argv[1]) |
---|
15 | host = self.get_host_and_id(url)[0] |
---|
16 | media_id = self.get_host_and_id(url)[1] |
---|
17 | |
---|
18 | return self.get_media_url(host, media_id, url) |
---|
19 | |
---|
20 | def get_host_and_id(self, url): |
---|
21 | r = re.search(self.pattern, url, re.I) |
---|
22 | if r: |
---|
23 | return r.groups() |
---|
24 | else: |
---|
25 | return False |
---|
26 | |
---|
27 | def get_media_url(self, host, media_id, url): |
---|
28 | web_url = self.get_url(host, media_id, url) |
---|
29 | # print "web_url", web_url |
---|
30 | html = self.net.http_GET(web_url).content |
---|
31 | |
---|
32 | js_data = re.findall('(eval\(function.*?)</script>', html.replace('\n', '')) |
---|
33 | # print "js_data1", js_data |
---|
34 | for i in js_data: |
---|
35 | html += jsunpack.unpack(i) |
---|
36 | # print "js_data2", js_data |
---|
37 | |
---|
38 | # print "html", html |
---|
39 | #var video=videojs("video_1");video.src({type:\'video/mp4\',src:\'https://streamz.cc/getlink-197df2a579744943a23671891d481fa3.dll\'});var |
---|
40 | |
---|
41 | # var = re.search('video.src.*\[([^;]+)\];', html) |
---|
42 | |
---|
43 | match = re.findall('''["']?src:['"]?\s*:\s*\[(.*?)\]''', html) |
---|
44 | # print "match", match |
---|
45 | match = re.findall("var video(.+?)'", html) |
---|
46 | # print "match", match |
---|
47 | match = re.findall("var video(.+?)\}\);var", html) |
---|
48 | # print "match", match |
---|
49 | match = re.findall(",src:\\\\'(.+?)\\\\'", html) |
---|
50 | print match[0] |
---|
51 | # if match: |
---|
52 | # stream_url = re.findall('''['"]?file['"]?\s*:\s*['"]?([^'"]+)''', match[0]) |
---|
53 | # if stream_url: |
---|
54 | # print stream_url[-1] |
---|
55 | |
---|
56 | def get_url(self, host, media_id, url): |
---|
57 | # return 'http://%s/%s' % (host,media_id) |
---|
58 | return '%s' % (url) |
---|
59 | |
---|
60 | |
---|
61 | sys.stdout = StreamzResolver() |
---|