source: titan/mediathek/localhoster/vidzi.py @ 42600

Last change on this file since 42600 was 39606, checked in by obi, 3 years ago

cleanup

File size: 882 bytes
Line 
1
2import re
3import urllib
4from lib import jsunpack
5import sys
6from lib.net import Net
7from lib import helpers
8
9
10class VidziResolver(object):
11    name = "vidzi"
12    domains = ["vidzi.tv"]
13    pattern = '(?://|\.)(vidzi\.tv)/(?:embed-)?([0-9a-zA-Z]+)'
14
15    def __init__(self):
16        self.net = Net()
17        url = str(sys.argv[1])
18        host = self.get_host_and_id(url)[0]
19        media_id = self.get_host_and_id(url)[1]
20
21        return self.get_media_url(host, media_id)
22
23    def get_host_and_id(self, url):
24        r = re.search(self.pattern, url, re.I)
25        if r:
26            return r.groups()
27        else:
28            return False
29
30    def get_media_url(self, host, media_id):
31        print helpers.get_media_url(self.get_url(host, media_id))
32
33    def get_url(self, host, media_id):
34        return 'http://%s/embed-%s.html' % (host, media_id)
35
36sys.stdout = VidziResolver()
Note: See TracBrowser for help on using the repository browser.