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
|
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):
|
2015-08-30 00:06:20 +02:00
|
|
|
data = self.get_urldata()
|
2015-01-18 18:03:38 +01:00
|
|
|
|
2016-05-14 22:54:30 +02:00
|
|
|
if self.exclude():
|
2015-01-18 18:03:38 +01:00
|
|
|
return
|
|
|
|
|
2015-01-28 20:57:37 +01:00
|
|
|
extention = False
|
|
|
|
filename = os.path.basename(self.url[:self.url.rfind("/")-1])
|
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-01-14 22:23:58 +01:00
|
|
|
if re.search(".f4m", self.url):
|
2015-01-28 20:57:37 +01:00
|
|
|
if extention:
|
2015-12-26 11:46:14 +01:00
|
|
|
self.options.output = "%s.flv" % self.options.output
|
2015-01-28 20:57:37 +01:00
|
|
|
|
2015-12-26 11:46:14 +01:00
|
|
|
streams = hdsparse(self.options, self.http.request("get", self.url, params={"hdcore": "3.7.0"}), self.url)
|
2015-01-18 18:03:38 +01:00
|
|
|
if streams:
|
|
|
|
for n in list(streams.keys()):
|
|
|
|
yield streams[n]
|
2018-01-14 22:23:58 +01:00
|
|
|
if re.search(".m3u8", self.url):
|
2015-12-26 11:46:14 +01:00
|
|
|
streams = hlsparse(self.options, self.http.request("get", self.url), self.url)
|
2015-01-28 20:57:37 +01:00
|
|
|
if extention:
|
2015-12-26 11:46:14 +01:00
|
|
|
self.options.output = "%s.ts" % self.options.output
|
2015-01-28 18:58:38 +01:00
|
|
|
|
2015-01-18 18:03:38 +01:00
|
|
|
for n in list(streams.keys()):
|
2015-10-04 14:37:16 +02:00
|
|
|
yield streams[n]
|