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

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

localhoster add allmyvideos

File size: 1.3 KB
Line 
1
2import sys
3import re
4from lib import jsunpack
5from lib.net import Net
6
7class VidUpMeResolver(object):
8    name = "vidup.me"
9    domains = ["vidup.me", "beta.vidup.me"]
10    pattern = '(?://|\.)(vidup\.me)/(?:embed-)?([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)
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):
28        web_url = self.get_url(host, media_id)
29        html = self.net.http_GET(web_url).content
30
31        js_data = re.findall('(eval\(function.*?)</script>', html.replace('\n', ''))
32
33        for i in js_data:
34            try: html += jsunpack.unpack(i)
35            except: pass
36
37        match = re.findall('''["']?sources['"]?\s*:\s*\[(.*?)\]''', html)
38
39        if match:
40            stream_url = re.findall('''['"]?file['"]?\s*:\s*['"]?([^'"]+)''', match[0])
41            if stream_url:
42                 print stream_url[-1]
43
44    def get_url(self, host, media_id):
45        return 'http://beta.vidup.me/embed-%s.html' % media_id
46
47
48sys.stdout = VidUpMeResolver()
Note: See TracBrowser for help on using the repository browser.