mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-28 06:04:17 +01:00
services: parse hls playlist first.
This commit is contained in:
parent
15e8fc94b7
commit
305ecf75a8
@ -41,16 +41,16 @@ def _get_full_url(url, srcurl):
|
|||||||
|
|
||||||
return returl
|
return returl
|
||||||
|
|
||||||
|
def hlsparse(url):
|
||||||
|
data = get_http_data(url)
|
||||||
|
globaldata, files = parsem3u(data)
|
||||||
|
streams = {}
|
||||||
|
|
||||||
|
for i in files:
|
||||||
|
streams[i[1]["RESOLUTION"].split("x")[1]] = i[0]
|
||||||
|
return streams
|
||||||
|
|
||||||
class HLS(VideoRetriever):
|
class HLS(VideoRetriever):
|
||||||
def parse(self):
|
|
||||||
data = get_http_data(self.url)
|
|
||||||
globaldata, files = parsem3u(data)
|
|
||||||
streams = {}
|
|
||||||
|
|
||||||
for i in files:
|
|
||||||
streams[i[1]["RESOLUTION"].split("x")[1]] = i[0]
|
|
||||||
return streams
|
|
||||||
|
|
||||||
def download(self):
|
def download(self):
|
||||||
if self.options.live and not self.options.force:
|
if self.options.live and not self.options.force:
|
||||||
raise LiveHLSException(self.url)
|
raise LiveHLSException(self.url)
|
||||||
|
@ -8,7 +8,7 @@ import sys
|
|||||||
from svtplay_dl.service import Service, OpenGraphThumbMixin
|
from svtplay_dl.service import Service, OpenGraphThumbMixin
|
||||||
from svtplay_dl.utils import get_http_data
|
from svtplay_dl.utils import get_http_data
|
||||||
from svtplay_dl.fetcher.rtmp import RTMP
|
from svtplay_dl.fetcher.rtmp import RTMP
|
||||||
from svtplay_dl.fetcher.hls import HLS
|
from svtplay_dl.fetcher.hls import HLS, hlsparse
|
||||||
from svtplay_dl.log import log
|
from svtplay_dl.log import log
|
||||||
|
|
||||||
class Dr(Service, OpenGraphThumbMixin):
|
class Dr(Service, OpenGraphThumbMixin):
|
||||||
@ -30,7 +30,9 @@ class Dr(Service, OpenGraphThumbMixin):
|
|||||||
|
|
||||||
for i in links:
|
for i in links:
|
||||||
if i["Target"] == "Ios":
|
if i["Target"] == "Ios":
|
||||||
yield HLS(options, i["Uri"], i["Bitrate"])
|
streams = hlsparse(i["Uri"])
|
||||||
|
for n in list(streams.keys()):
|
||||||
|
yield HLS(options, streams[n], n)
|
||||||
else:
|
else:
|
||||||
if i["Target"] == "Streaming":
|
if i["Target"] == "Streaming":
|
||||||
options.other = "-y '%s'" % i["Uri"].replace("rtmp://vod.dr.dk/cms/", "")
|
options.other = "-y '%s'" % i["Uri"].replace("rtmp://vod.dr.dk/cms/", "")
|
||||||
|
@ -14,7 +14,7 @@ from svtplay_dl.utils.urllib import urlparse, quote
|
|||||||
from svtplay_dl.service import Service
|
from svtplay_dl.service import Service
|
||||||
from svtplay_dl.utils import get_http_data
|
from svtplay_dl.utils import get_http_data
|
||||||
from svtplay_dl.log import log
|
from svtplay_dl.log import log
|
||||||
from svtplay_dl.fetcher.hls import HLS
|
from svtplay_dl.fetcher.hls import HLS, hlsparse
|
||||||
from svtplay_dl.fetcher.http import HTTP
|
from svtplay_dl.fetcher.http import HTTP
|
||||||
|
|
||||||
class JustinException(Exception):
|
class JustinException(Exception):
|
||||||
@ -148,4 +148,6 @@ class Justin(Service):
|
|||||||
if not options.output:
|
if not options.output:
|
||||||
options.output = channel
|
options.output = channel
|
||||||
|
|
||||||
yield HLS(options, hls_url, 0)
|
streams = hlsparse(hls_url)
|
||||||
|
for n in list(streams.keys()):
|
||||||
|
yield HLS(options, streams[n], n)
|
||||||
|
@ -9,7 +9,7 @@ from svtplay_dl.service import Service, OpenGraphThumbMixin
|
|||||||
from svtplay_dl.utils import get_http_data
|
from svtplay_dl.utils import get_http_data
|
||||||
from svtplay_dl.utils.urllib import urlparse
|
from svtplay_dl.utils.urllib import urlparse
|
||||||
from svtplay_dl.fetcher.hds import HDS
|
from svtplay_dl.fetcher.hds import HDS
|
||||||
from svtplay_dl.fetcher.hls import HLS
|
from svtplay_dl.fetcher.hls import HLS, hlsparse
|
||||||
from svtplay_dl.subtitle import subtitle_tt
|
from svtplay_dl.subtitle import subtitle_tt
|
||||||
from svtplay_dl.log import log
|
from svtplay_dl.log import log
|
||||||
|
|
||||||
@ -42,7 +42,9 @@ class Nrk(Service, OpenGraphThumbMixin):
|
|||||||
options.live = data["isLive"]
|
options.live = data["isLive"]
|
||||||
if options.hls:
|
if options.hls:
|
||||||
manifest_url = manifest_url.replace("/z/", "/i/").replace("manifest.f4m", "master.m3u8")
|
manifest_url = manifest_url.replace("/z/", "/i/").replace("manifest.f4m", "master.m3u8")
|
||||||
yield HLS(options, manifest_url, "0")
|
streams = hlsparse(manifest_url)
|
||||||
|
for n in list(streams.keys()):
|
||||||
|
yield HLS(options, streams[n], n)
|
||||||
else:
|
else:
|
||||||
manifest_url = "%s?hdcore=2.8.0&g=hejsan" % manifest_url
|
manifest_url = "%s?hdcore=2.8.0&g=hejsan" % manifest_url
|
||||||
yield HDS(options, manifest_url, "0")
|
yield HDS(options, manifest_url, "0")
|
||||||
|
@ -5,7 +5,7 @@ import re
|
|||||||
|
|
||||||
from svtplay_dl.service import Service
|
from svtplay_dl.service import Service
|
||||||
from svtplay_dl.utils import get_http_data
|
from svtplay_dl.utils import get_http_data
|
||||||
from svtplay_dl.fetcher.hls import HLS
|
from svtplay_dl.fetcher.hls import HLS, hlsparse
|
||||||
|
|
||||||
class Ruv(Service):
|
class Ruv(Service):
|
||||||
supported_domains = ['ruv.is']
|
supported_domains = ['ruv.is']
|
||||||
@ -18,5 +18,7 @@ class Ruv(Service):
|
|||||||
tengipunktur = js.split('"')[1]
|
tengipunktur = js.split('"')[1]
|
||||||
match = re.search(r"http.*tengipunktur [+] '([:]1935.*)'", data)
|
match = re.search(r"http.*tengipunktur [+] '([:]1935.*)'", data)
|
||||||
m3u8_url = "http://" + tengipunktur + match.group(1)
|
m3u8_url = "http://" + tengipunktur + match.group(1)
|
||||||
yield HLS(options, m3u8_url)
|
streams = hlsparse(m3u8_url)
|
||||||
|
for n in list(streams.keys()):
|
||||||
|
yield HLS(options, streams[n], n)
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ from svtplay_dl.service import Service, OpenGraphThumbMixin
|
|||||||
from svtplay_dl.utils import get_http_data
|
from svtplay_dl.utils import get_http_data
|
||||||
from svtplay_dl.utils.urllib import urlparse
|
from svtplay_dl.utils.urllib import urlparse
|
||||||
from svtplay_dl.fetcher.hds import HDS
|
from svtplay_dl.fetcher.hds import HDS
|
||||||
from svtplay_dl.fetcher.hls import HLS
|
from svtplay_dl.fetcher.hls import HLS, hlsparse
|
||||||
from svtplay_dl.fetcher.rtmp import RTMP
|
from svtplay_dl.fetcher.rtmp import RTMP
|
||||||
from svtplay_dl.fetcher.http import HTTP
|
from svtplay_dl.fetcher.http import HTTP
|
||||||
from svtplay_dl.subtitle import subtitle_wsrt
|
from svtplay_dl.subtitle import subtitle_wsrt
|
||||||
@ -56,7 +56,9 @@ class Svtplay(Service, OpenGraphThumbMixin):
|
|||||||
parse = urlparse(i["url"])
|
parse = urlparse(i["url"])
|
||||||
|
|
||||||
if parse.path.find("m3u8") > 0:
|
if parse.path.find("m3u8") > 0:
|
||||||
yield HLS(options, i["url"], i["bitrate"])
|
streams = hlsparse(i["url"])
|
||||||
|
for n in list(streams.keys()):
|
||||||
|
yield HLS(options, streams[n], n)
|
||||||
elif parse.path.find("f4m") > 0:
|
elif parse.path.find("f4m") > 0:
|
||||||
match = re.search(r"\/se\/secure\/", i["url"])
|
match = re.search(r"\/se\/secure\/", i["url"])
|
||||||
if not match:
|
if not match:
|
||||||
|
@ -9,7 +9,7 @@ import xml.etree.ElementTree as ET
|
|||||||
from svtplay_dl.service import Service, OpenGraphThumbMixin
|
from svtplay_dl.service import Service, OpenGraphThumbMixin
|
||||||
from svtplay_dl.utils import get_http_data
|
from svtplay_dl.utils import get_http_data
|
||||||
from svtplay_dl.fetcher.rtmp import RTMP
|
from svtplay_dl.fetcher.rtmp import RTMP
|
||||||
from svtplay_dl.fetcher.hls import HLS
|
from svtplay_dl.fetcher.hls import HLS, hlsparse
|
||||||
from svtplay_dl.log import log
|
from svtplay_dl.log import log
|
||||||
from svtplay_dl.subtitle import subtitle_tt
|
from svtplay_dl.subtitle import subtitle_tt
|
||||||
|
|
||||||
@ -41,11 +41,15 @@ class Urplay(Service, OpenGraphThumbMixin):
|
|||||||
hls = "%s%s" % (http, jsondata["streaming_config"]["http_streaming"]["hls_file"])
|
hls = "%s%s" % (http, jsondata["streaming_config"]["http_streaming"]["hls_file"])
|
||||||
rtmp = "rtmp://%s/%s" % (basedomain, jsondata["streaming_config"]["rtmp"]["application"])
|
rtmp = "rtmp://%s/%s" % (basedomain, jsondata["streaming_config"]["rtmp"]["application"])
|
||||||
path = "mp%s:%s" % (jsondata["file_flash"][-1], jsondata["file_flash"])
|
path = "mp%s:%s" % (jsondata["file_flash"][-1], jsondata["file_flash"])
|
||||||
yield HLS(options, hls, "480")
|
streams = hlsparse(hls)
|
||||||
|
for n in list(streams.keys()):
|
||||||
|
yield HLS(options, streams[n], n)
|
||||||
options.other = "-v -a %s -y %s" % (jsondata["streaming_config"]["rtmp"]["application"], path)
|
options.other = "-v -a %s -y %s" % (jsondata["streaming_config"]["rtmp"]["application"], path)
|
||||||
yield RTMP(options, rtmp, "480")
|
yield RTMP(options, rtmp, "480")
|
||||||
if hd:
|
if hd:
|
||||||
yield HLS(options, hls_hd, "720")
|
streams = hlsparse(hls_hd)
|
||||||
|
for n in list(streams.keys()):
|
||||||
|
yield HLS(options, streams[n], n)
|
||||||
options.other = "-v -a %s -y %s" % (jsondata["streaming_config"]["rtmp"]["application"], path_hd)
|
options.other = "-v -a %s -y %s" % (jsondata["streaming_config"]["rtmp"]["application"], path_hd)
|
||||||
yield RTMP(options, rtmp, "720")
|
yield RTMP(options, rtmp, "720")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user