Line | |
---|
1 | |
---|
2 | import re |
---|
3 | import sys |
---|
4 | from lib.net import Net |
---|
5 | |
---|
6 | class 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 | |
---|
42 | sys.stdout = VodlockerResolver() |
---|
Note: See
TracBrowser
for help on using the repository browser.