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

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

[tithek] add first python hoster

File size: 1.8 KB
Line 
1'''
2Nosvideo urlresolver plugin
3Copyright (C) 2013 Vinnydude
4
5This program is free software: you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation, either version 3 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>.
17'''
18
19import re
20from urlresolver import common
21from urlresolver.resolver import UrlResolver, ResolverError
22
23class NosvideoResolver(UrlResolver):
24    name = "nosvideo"
25    domains = ["nosvideo.com", "noslocker.com"]
26    pattern = '(?://|\.)(nosvideo.com|noslocker.com)/(?:\?v\=|embed/|.+?\u=)?([0-9a-zA-Z]+)'
27
28    def __init__(self):
29        self.net = common.Net()
30
31    def get_media_url(self, host, media_id):
32        web_url = self.get_url(host, media_id)
33
34        html = self.net.http_GET(web_url).content
35
36        if 'File Not Found' in html:
37            raise ResolverError('File Not Found')
38
39        web_url = 'http://nosvideo.com/vj/video.php?u=%s&w=&h=530' % media_id
40
41        html = self.net.http_GET(web_url).content
42
43        smil_url = re.compile('\':\'(.+?)\'').findall(html)
44        smil_url = [i for i in smil_url if '.smil' in i][0]
45
46        html = self.net.http_GET(smil_url).content
47
48        streamer = re.findall('base\s*=\s*"(.+?)"', html)[0]
49        playpath = re.findall('src\s*=\s*"(.+?)"', html)[0]
50
51        stream_url = '%s playpath=%s' % (streamer, playpath)
52
53        return stream_url
54
55    def get_url(self, host, media_id):
56        return 'http://nosvideo.com/%s' % media_id
57
Note: See TracBrowser for help on using the repository browser.