2015-01-18 18:03:38 +01:00
|
|
|
from __future__ import absolute_import
|
|
|
|
import os
|
2018-01-14 22:23:58 +01:00
|
|
|
import re
|
2015-01-18 18:03:38 +01:00
|
|
|
|
|
|
|
from svtplay_dl.service import Service
|
|
|
|
from svtplay_dl.fetcher.hds import hdsparse
|
2015-10-04 14:37:16 +02:00
|
|
|
from svtplay_dl.fetcher.hls import hlsparse
|
2018-02-11 21:04:13 +01:00
|
|
|
from svtplay_dl.fetcher.dash import dashparse
|
2015-01-18 18:03:38 +01:00
|
|
|
|
2015-09-15 20:10:32 +02:00
|
|
|
|
2015-01-18 18:03:38 +01:00
|
|
|
class Raw(Service):
|
2015-12-26 11:46:14 +01:00
|
|
|
def get(self):
|
2018-02-11 21:04:13 +01:00
|
|
|
filename = os.path.basename(self.url[:self.url.rfind("/")])
|
2015-12-26 11:46:14 +01:00
|
|
|
if self.options.output and os.path.isdir(self.options.output):
|
|
|
|
self.options.output = os.path.join(os.path.dirname(self.options.output), filename)
|
2015-01-28 20:57:37 +01:00
|
|
|
extention = True
|
2015-12-26 11:46:14 +01:00
|
|
|
elif self.options.output is None:
|
2017-10-09 22:35:13 +02:00
|
|
|
self.options.output = filename
|
2015-01-28 20:57:37 +01:00
|
|
|
extention = True
|
|
|
|
|
2018-02-11 21:04:13 +01:00
|
|
|
streams = []
|
2018-01-14 22:23:58 +01:00
|
|
|
if re.search(".f4m", self.url):
|
2018-05-08 22:46:11 +02:00
|
|
|
self.output["ext"] = "flv"
|
|
|
|
streams.append(hdsparse(self.config, self.http.request("get", self.url, params={"hdcore": "3.7.0"}), self.url))
|
2015-01-28 20:57:37 +01:00
|
|
|
|
2018-01-14 22:23:58 +01:00
|
|
|
if re.search(".m3u8", self.url):
|
2018-05-08 22:46:11 +02:00
|
|
|
streams.append(hlsparse(self.config, self.http.request("get", self.url), self.url))
|
2018-02-11 21:04:13 +01:00
|
|
|
|
|
|
|
if re.search(".mpd", self.url):
|
2018-05-08 22:46:11 +02:00
|
|
|
streams.append(dashparse(self.config, self.http.request("get", self.url), self.url))
|
2018-02-11 21:04:13 +01:00
|
|
|
|
|
|
|
for stream in streams:
|
2018-02-12 21:18:13 +01:00
|
|
|
if stream:
|
|
|
|
for n in list(stream.keys()):
|
|
|
|
yield stream[n]
|