From 994e9832fbb1bcf46dab7d2055cdbf978b1b3a8d Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Mon, 21 Apr 2014 19:53:03 +0200 Subject: [PATCH] nrk: yield the subs --- lib/svtplay_dl/service/nrk.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/svtplay_dl/service/nrk.py b/lib/svtplay_dl/service/nrk.py index 65e0d13..4e552e7 100644 --- a/lib/svtplay_dl/service/nrk.py +++ b/lib/svtplay_dl/service/nrk.py @@ -6,10 +6,11 @@ import sys import json from svtplay_dl.service import Service, OpenGraphThumbMixin -from svtplay_dl.utils import get_http_data, subtitle_tt +from svtplay_dl.utils import get_http_data from svtplay_dl.utils.urllib import urlparse from svtplay_dl.fetcher.hds import HDS from svtplay_dl.fetcher.hls import HLS +from svtplay_dl.subtitle import subtitle_tt from svtplay_dl.log import log class Nrk(Service, OpenGraphThumbMixin): @@ -17,6 +18,11 @@ class Nrk(Service, OpenGraphThumbMixin): def get(self, options): data = self.get_urldata() + match = re.search("data-subtitlesurl = \"(/.*)\"", data) + if match: + parse = urlparse(self.url) + subtitle = "%s://%s%s" % (parse.scheme, parse.netloc, match.group(1)) + yield subtitle_tt(subtitle) match = re.search(r'data-media="(.*manifest.f4m)"', data) if match: manifest_url = match.group(1) @@ -40,13 +46,3 @@ class Nrk(Service, OpenGraphThumbMixin): else: manifest_url = "%s?hdcore=2.8.0&g=hejsan" % manifest_url yield HDS(options, manifest_url, "0") - - - def get_subtitle(self, options): - match = re.search("data-subtitlesurl = \"(/.*)\"", self.get_urldata()) - if match: - parse = urlparse(self.url) - subtitle = "%s://%s%s" % (parse.scheme, parse.netloc, match.group(1)) - data = get_http_data(subtitle) - subtitle_tt(options, data) -