1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 04:05:39 +01:00

Add support of downloading mpd files to service raw

This commit is contained in:
dalgr 2018-02-11 21:04:13 +01:00
parent 7aaa68b267
commit fb07e84fa6
2 changed files with 20 additions and 12 deletions

View File

@ -202,7 +202,7 @@ def get_media(url, options):
generic = Generic(options, url)
url, stream = generic.get(sites)
if not stream:
if re.search(".f4m", url) or re.search(".m3u8", url):
if re.search(".f4m", url) or re.search(".m3u8", url) or re.search(".mpd", url):
stream = Raw(options, url)
if not stream:
log.error("That site is not supported. Make a ticket or send a message")

View File

@ -5,6 +5,7 @@ import re
from svtplay_dl.service import Service
from svtplay_dl.fetcher.hds import hdsparse
from svtplay_dl.fetcher.hls import hlsparse
from svtplay_dl.fetcher.dash import dashparse
class Raw(Service):
@ -13,7 +14,7 @@ class Raw(Service):
return
extention = False
filename = os.path.basename(self.url[:self.url.rfind("/") - 1])
filename = os.path.basename(self.url[:self.url.rfind("/")])
if self.options.output and os.path.isdir(self.options.output):
self.options.output = os.path.join(os.path.dirname(self.options.output), filename)
extention = True
@ -21,18 +22,25 @@ class Raw(Service):
self.options.output = filename
extention = True
streams = []
if re.search(".f4m", self.url):
if extention:
self.options.output = "%s.flv" % self.options.output
self.options.output = "{0}.flv".format(self.options.output)
streams.append(hdsparse(self.options, self.http.request("get", self.url, params={"hdcore": "3.7.0"}), self.url))
streams = hdsparse(self.options, self.http.request("get", self.url, params={"hdcore": "3.7.0"}), self.url)
if streams:
for n in list(streams.keys()):
yield streams[n]
if re.search(".m3u8", self.url):
streams = hlsparse(self.options, self.http.request("get", self.url), self.url)
if extention:
self.options.output = "%s.ts" % self.options.output
streams.append(hlsparse(self.options, self.http.request("get", self.url), self.url))
for n in list(streams.keys()):
yield streams[n]
if extention:
self.options.output = "{0}.ts".format(self.options.output)
if re.search(".mpd", self.url):
streams.append(dashparse(self.options, self.http.request("get", self.url), self.url))
if extention:
self.options.output = "{0}.mp4".format(self.options.output)
for stream in streams:
for n in list(stream.keys()):
yield stream[n]