mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-24 04:05:39 +01:00
nrk: yield the subs
This commit is contained in:
parent
a374a55c21
commit
994e9832fb
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user