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

service: support for HDS and HLS stream playlists.

this fixes #201
This commit is contained in:
Johan Andersson 2015-01-18 18:03:38 +01:00
parent 6a374ffa06
commit 7b0ff9437e
2 changed files with 39 additions and 0 deletions

View File

@ -113,6 +113,7 @@ from svtplay_dl.service.picsearch import Picsearch
from svtplay_dl.service.qbrick import Qbrick
from svtplay_dl.service.radioplay import Radioplay
from svtplay_dl.service.ruv import Ruv
from svtplay_dl.service.raw import Raw
from svtplay_dl.service.sr import Sr
from svtplay_dl.service.svtplay import Svtplay
from svtplay_dl.service.tv4play import Tv4play
@ -204,6 +205,10 @@ class Generic(object):
if i.handles(url):
return url, i(url)
if url.find(".f4m") > 0:
return url, Raw(url)
if url.find(".m3u8") > 0:
return url, Raw(url)
return url, stream
def service_handler(url):

View File

@ -0,0 +1,34 @@
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
class Raw(Service):
def get(self, options):
error, data = self.get_urldata()
if error:
log.error("Can't get the page")
return
if self.exclude(options):
return
if self.url.find(".f4m") > 0:
if options.output is None:
filename = os.path.basename(self.url[:self.url.rfind("/")-1])
options.output = "%s.flv" % filename
streams = hdsparse(copy.copy(options), self.url)
if streams:
for n in list(streams.keys()):
yield streams[n]
if self.url.find(".m3u8") > 0:
streams = hlsparse(self.url)
if options.output is None:
filename = os.path.basename(self.url[:self.url.rfind("/")-1])
options.output = "%s.ts" % filename
for n in list(streams.keys()):
yield HLS(copy.copy(options), streams[n], n)