source: titan/mediathek/localhoster/nosvideo.py @ 40097

Last change on this file since 40097 was 38985, checked in by obi, 5 years ago

localhoster add allmyvideos

File size: 1.5 KB
Line 
1
2import sys
3import re
4from lib.net import Net
5
6class NosvideoResolver(object):
7    name = "nosvideo"
8    domains = ["nosvideo.com", "noslocker.com"]
9    pattern = '(?://|\.)(nosvideo.com|noslocker.com)/(?:\?v\=|embed/|.+?\u=)?([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
29        html = self.net.http_GET(web_url).content
30
31        if 'File Not Found' in html:
32            raise ResolverError('File Not Found')
33
34        web_url = 'http://nosvideo.com/vj/video.php?u=%s&w=&h=530' % media_id
35
36        html = self.net.http_GET(web_url).content
37
38        smil_url = re.compile('\':\'(.+?)\'').findall(html)
39        smil_url = [i for i in smil_url if '.smil' in i][0]
40
41        html = self.net.http_GET(smil_url).content
42
43        streamer = re.findall('base\s*=\s*"(.+?)"', html)[0]
44        playpath = re.findall('src\s*=\s*"(.+?)"', html)[0]
45
46        stream_url = '%s playpath=%s' % (streamer, playpath)
47
48        print stream_url
49
50    def get_url(self, host, media_id):
51        return 'http://nosvideo.com/%s' % media_id
52
53sys.stdout = NosvideoResolver()
54
Note: See TracBrowser for help on using the repository browser.