2015-01-18 18:03:38 +01:00
|
|
|
from __future__ import absolute_import
|
|
|
|
import copy
|
|
|
|
import os
|
|
|
|
|
|
|
|
from svtplay_dl.service import Service
|
|
|
|
from svtplay_dl.fetcher.hds import hdsparse
|
|
|
|
from svtplay_dl.fetcher.hls import hlsparse, HLS
|
|
|
|
from svtplay_dl.log import log
|
|
|
|
|
2015-09-15 20:10:32 +02:00
|
|
|
|
2015-01-18 18:03:38 +01:00
|
|
|
class Raw(Service):
|
|
|
|
def get(self, options):
|
2015-08-30 00:06:20 +02:00
|
|
|
data = self.get_urldata()
|
2015-01-18 18:03:38 +01:00
|
|
|
|
|
|
|
if self.exclude(options):
|
|
|
|
return
|
|
|
|
|
2015-01-28 20:57:37 +01:00
|
|
|
extention = False
|
|
|
|
filename = os.path.basename(self.url[:self.url.rfind("/")-1])
|
|
|
|
if options.output and os.path.isdir(options.output):
|
2015-08-24 23:02:18 +02:00
|
|
|
options.output = os.path.join(os.path.dirname(options.output), filename)
|
2015-01-28 20:57:37 +01:00
|
|
|
extention = True
|
|
|
|
elif options.output is None:
|
|
|
|
options.output = "%s" % filename
|
|
|
|
extention = True
|
|
|
|
|
2015-01-18 18:03:38 +01:00
|
|
|
if self.url.find(".f4m") > 0:
|
2015-01-28 20:57:37 +01:00
|
|
|
if extention:
|
|
|
|
options.output = "%s.flv" % options.output
|
|
|
|
|
2015-08-31 19:45:15 +02:00
|
|
|
streams = hdsparse(copy.copy(options), self.http.request("get", self.url, params={"hdcore": "3.7.0"}).text, self.url)
|
2015-01-18 18:03:38 +01:00
|
|
|
if streams:
|
|
|
|
for n in list(streams.keys()):
|
|
|
|
yield streams[n]
|
|
|
|
if self.url.find(".m3u8") > 0:
|
2015-09-13 22:09:23 +02:00
|
|
|
streams = hlsparse(self.url, self.http.request("get", self.url).text)
|
2015-01-28 20:57:37 +01:00
|
|
|
if extention:
|
|
|
|
options.output = "%s.ts" % options.output
|
2015-01-28 18:58:38 +01:00
|
|
|
|
2015-01-18 18:03:38 +01:00
|
|
|
for n in list(streams.keys()):
|
|
|
|
yield HLS(copy.copy(options), streams[n], n)
|