1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 12:15:40 +01:00
svtplay-dl/lib/svtplay_dl/service/raw.py

39 lines
1.3 KiB
Python
Raw Normal View History

from __future__ import absolute_import
import os
import re
from svtplay_dl.service import Service
from svtplay_dl.fetcher.hds import hdsparse
from svtplay_dl.fetcher.hls import hlsparse
2015-09-15 20:10:32 +02:00
class Raw(Service):
def get(self):
2016-05-14 22:54:30 +02:00
if self.exclude():
return
2015-01-28 20:57:37 +01:00
extention = False
2018-01-30 20:11:37 +01:00
filename = os.path.basename(self.url[:self.url.rfind("/") - 1])
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
elif self.options.output is None:
self.options.output = filename
2015-01-28 20:57:37 +01:00
extention = True
if re.search(".f4m", self.url):
2015-01-28 20:57:37 +01:00
if extention:
self.options.output = "%s.flv" % self.options.output
2015-01-28 20:57:37 +01:00
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)
2015-01-28 20:57:37 +01:00
if extention:
self.options.output = "%s.ts" % self.options.output
2015-01-28 18:58:38 +01:00
for n in list(streams.keys()):
yield streams[n]