1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-27 21:54:17 +01:00

Generic class a way to find embeded videos

support for embeded svtplay videos.
This commit is contained in:
Johan Andersson 2013-02-08 12:37:43 +01:00
parent 289cd22b45
commit db85d3ede7

View File

@ -1118,6 +1118,20 @@ class Radioplay(object):
log.error("Can't find any streams.") log.error("Can't find any streams.")
sys.exit(2) sys.exit(2)
class generic(object):
''' Videos embed in sites '''
def get(self, sites, url):
data = get_http_data(url)
match = re.search("src=\"(http://www.svt.se/wd.*)\" frameborder", data)
stream = None
if match:
url = match.group(1)
for i in sites:
if i.handle(url):
stream = i
break
return url, stream
def progressbar(total, pos, msg=""): def progressbar(total, pos, msg=""):
""" """
Given a total and a progress position, output a progress bar Given a total and a progress position, output a progress bar
@ -1160,10 +1174,13 @@ def get_media(url, options):
if i.handle(url): if i.handle(url):
stream = i stream = i
break break
if not stream:
url, stream = generic().get(sites, url)
if not stream: if not stream:
log.error("That site is not supported. Make a ticket or send a message") log.error("That site is not supported. Make a ticket or send a message")
sys.exit(2) sys.exit(2)
url = url.replace("&", "&")
if not options.output or os.path.isdir(options.output): if not options.output or os.path.isdir(options.output):
data = get_http_data(url) data = get_http_data(url)
match = re.search("(?i)<title.*>\s*(.*?)\s*</title>", data) match = re.search("(?i)<title.*>\s*(.*?)\s*</title>", data)