2013-03-02 21:26:28 +01:00
|
|
|
# ex:ts=4:sw=4:sts=4:et
|
|
|
|
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
2013-03-01 23:39:42 +01:00
|
|
|
from __future__ import absolute_import
|
2013-02-12 19:43:37 +01:00
|
|
|
import re
|
|
|
|
|
2013-04-21 12:44:31 +02:00
|
|
|
from svtplay_dl.service import Service
|
2013-09-15 00:29:26 +02:00
|
|
|
from svtplay_dl.utils import get_http_data, subtitle_tt
|
|
|
|
from svtplay_dl.utils.urllib import urlparse
|
2013-03-17 19:55:19 +01:00
|
|
|
from svtplay_dl.fetcher.hds import download_hds
|
|
|
|
from svtplay_dl.fetcher.hls import download_hls
|
2013-02-12 19:43:37 +01:00
|
|
|
|
2013-04-21 12:44:31 +02:00
|
|
|
class Nrk(Service):
|
2014-01-01 14:57:17 +01:00
|
|
|
supported_domains = ['nrk.no']
|
2013-01-17 00:21:47 +01:00
|
|
|
|
|
|
|
def get(self, options, url):
|
|
|
|
data = get_http_data(url)
|
|
|
|
match = re.search(r'data-media="(.*manifest.f4m)"', data)
|
|
|
|
manifest_url = match.group(1)
|
|
|
|
if options.hls:
|
|
|
|
manifest_url = manifest_url.replace("/z/", "/i/").replace("manifest.f4m", "master.m3u8")
|
|
|
|
download_hls(options, manifest_url)
|
|
|
|
else:
|
|
|
|
manifest_url = "%s?hdcore=2.8.0&g=hejsan" % manifest_url
|
|
|
|
download_hds(options, manifest_url)
|
2013-09-15 00:29:26 +02:00
|
|
|
if options.subtitle:
|
|
|
|
match = re.search("data-subtitlesurl = \"(/.*)\"", data)
|
|
|
|
if match:
|
|
|
|
parse = urlparse(url)
|
|
|
|
subtitle = "%s://%s%s" % (parse.scheme, parse.netloc, match.group(1))
|
|
|
|
data = get_http_data(subtitle)
|
|
|
|
subtitle_tt(options, data)
|
2013-01-17 00:21:47 +01:00
|
|
|
|