source: titan/mediathek/localhoster/novamov.py @ 42882

Last change on this file since 42882 was 39651, checked in by obi, 7 years ago

fix

File size: 1.9 KB
Line 
1
2import sys
3import re
4from lib.net import Net
5import lib.common as common
6from lib import helpers
7
8class Resolver(object):
9    name = "novamov"
10    domains = ['novamov.com', 'auroravid.to']
11    pattern = '(?://|\.)(novamov.com|auroravid.to)/(?:video/|embed/\?v=|embed\.php\?v=)([A-Za-z0-9]+)'
12
13    def __init__(self):
14        self.net = Net()
15        url = str(sys.argv[1])
16        host = self.get_host_and_id(url)[0]
17        media_id = self.get_host_and_id(url)[1]
18
19        return self.get_media_url(host, media_id)
20
21    def get_host_and_id(self, url):
22        r = re.search(self.pattern, url, re.I)
23        if r:
24            return r.groups()
25        else:
26            return False
27
28    def get_media_url(self, host, media_id):
29        web_url = self.get_url(host, media_id)
30        headers = {'User-Agent': common.FF_USER_AGENT}
31        stream_url = ''
32        html = self.net.http_GET(web_url, headers=headers).content
33
34        try:
35            r = re.search('flashvars.filekey=(.+?);', html)
36            if r == None: raise Exception()
37
38            r = r.group(1)
39   
40            try: filekey = re.compile('\s+%s="(.+?)"' % r).findall(html)[-1]
41            except: filekey = r
42   
43            player_url = 'http://www.auroravid.to/api/player.api.php?key=%s&file=%s' % (filekey, media_id)
44   
45            html = self.net.http_GET(player_url).content
46   
47            r = re.search('url=(.+?)&', html)
48
49        except:
50            r = re.search('source src="(.+?)"', html)
51           
52        if r:
53            stream_url = r.group(1)
54            headers.update({'Referer': web_url, })
55            print stream_url + helpers.append_headers(headers)
56       
57        else:
58            print 'File Not Found or removed'
59
60 
61    def get_url(self, host, media_id):
62        return 'http://www.auroravid.to/embed/?v=%s' % media_id
63
64sys.stdout = Resolver()
Note: See TracBrowser for help on using the repository browser.