2016-08-23 00:59:57 +02:00
|
|
|
# ex:ts=4:sw=4:sts=4:et
|
|
|
|
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
|
|
|
from __future__ import absolute_import
|
|
|
|
import re
|
|
|
|
import copy
|
2018-01-30 22:07:21 +01:00
|
|
|
from urllib.parse import urlparse
|
2016-08-23 00:59:57 +02:00
|
|
|
|
|
|
|
from svtplay_dl.service import Service, OpenGraphThumbMixin
|
|
|
|
from svtplay_dl.fetcher.hls import hlsparse
|
|
|
|
from svtplay_dl.error import ServiceError
|
|
|
|
from svtplay_dl.subtitle import subtitle
|
|
|
|
|
|
|
|
|
|
|
|
class Flowonline(Service, OpenGraphThumbMixin):
|
|
|
|
supported_domains_re = [
|
|
|
|
r'^([a-z]{1,4}\.|www\.)?flowonline\.tv$',
|
|
|
|
]
|
|
|
|
|
|
|
|
def get(self):
|
|
|
|
match = re.search('iframe src="(/embed/[^"]+)"', self.get_urldata())
|
|
|
|
if not match:
|
|
|
|
yield ServiceError("Cant find video")
|
|
|
|
return
|
|
|
|
parse = urlparse(self.url)
|
|
|
|
|
2017-10-09 22:35:13 +02:00
|
|
|
url = "{0}://{1}{2}".format(parse.scheme, parse.netloc, match.group(1))
|
2016-08-23 00:59:57 +02:00
|
|
|
|
|
|
|
data = self.http.get(url)
|
|
|
|
|
|
|
|
match = re.search('src="([^"]+vtt)"', data.text)
|
|
|
|
if match:
|
2018-05-13 13:06:45 +02:00
|
|
|
yield subtitle(copy.copy(self.config), "wrst", match.group(1))
|
2016-08-23 00:59:57 +02:00
|
|
|
|
|
|
|
match = re.search('source src="([^"]+)" type="application/x-mpegURL"', data.text)
|
|
|
|
if not match:
|
|
|
|
yield ServiceError("Cant find video file")
|
|
|
|
return
|
|
|
|
|
2018-05-13 13:06:45 +02:00
|
|
|
streams = hlsparse(self.config, self.http.request("get", match.group(1)), match.group(1))
|
2016-08-23 00:59:57 +02:00
|
|
|
for n in list(streams.keys()):
|
2018-02-26 00:02:53 +01:00
|
|
|
yield streams[n]
|