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

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

add new test hoster

File size: 1.2 KB
Line 
1
2import re
3import sys
4from lib.net import Net
5
6class VodlockerResolver(object):
7    name = "vodlocker.com"
8    domains = ["vodlocker.com"]
9    pattern = '(?://|\.)(vodlocker\.com)/(?:embed-)?([0-9a-zA-Z]+)'
10
11    def __init__(self):
12        self.net = Net()
13        url = str(sys.argv[1])
14        host = self.get_host_and_id(url)[0]
15        media_id = self.get_host_and_id(url)[1]
16
17        return self.get_media_url(host, media_id)
18
19    def get_host_and_id(self, url):
20        r = re.search(self.pattern, url, re.I)
21        if r:
22            return r.groups()
23        else:
24            return False
25
26    def get_media_url(self, host, media_id):
27        web_url = self.get_url(host, media_id)
28        link = self.net.http_GET(web_url).content
29        if 'FILE WAS DELETED' in link:
30            print 'File deleted.'
31        else:
32            video_link = str(re.compile('file[: ]*"(.+?)"').findall(link)[0])
33
34            if len(video_link) > 0:
35                print video_link
36            else:
37                print 'No playable video found.'
38
39    def get_url(self, host, media_id):
40        return 'http://vodlocker.com/embed-%s-640x400.html' % media_id
41
42sys.stdout = VodlockerResolver()
Note: See TracBrowser for help on using the repository browser.