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 -*-
|
|
|
|
import copy
|
2019-08-25 00:40:39 +02:00
|
|
|
import re
|
2018-01-30 22:07:21 +01:00
|
|
|
from urllib.parse import urlparse
|
2016-08-23 00:59:57 +02:00
|
|
|
|
|
|
|
from svtplay_dl.error import ServiceError
|
2019-08-25 00:40:39 +02:00
|
|
|
from svtplay_dl.fetcher.hls import hlsparse
|
|
|
|
from svtplay_dl.service import OpenGraphThumbMixin
|
|
|
|
from svtplay_dl.service import Service
|
2022-12-10 14:05:56 +01:00
|
|
|
from svtplay_dl.subtitle import subtitle_probe
|
2016-08-23 00:59:57 +02:00
|
|
|
|
|
|
|
|
|
|
|
class Flowonline(Service, OpenGraphThumbMixin):
|
2019-08-25 00:27:31 +02:00
|
|
|
supported_domains_re = [r"^([a-z]{1,4}\.|www\.)?flowonline\.tv$"]
|
2016-08-23 00:59:57 +02:00
|
|
|
|
|
|
|
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)
|
|
|
|
|
2021-04-27 19:44:09 +02:00
|
|
|
url = f"{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:
|
2022-12-10 14:05:56 +01:00
|
|
|
yield from subtitle_probe(copy.copy(self.config), match.group(1))
|
2016-08-23 00:59:57 +02:00
|
|
|
|
2019-09-06 22:49:49 +02:00
|
|
|
match = re.search('source src="([^"]+)" type="application/x-mpegURL"', data.text)
|
2016-08-23 00:59:57 +02:00
|
|
|
if not match:
|
|
|
|
yield ServiceError("Cant find video file")
|
|
|
|
return
|
|
|
|
|
2021-05-16 02:22:37 +02:00
|
|
|
yield from hlsparse(self.config, self.http.request("get", match.group(1)), match.group(1), output=self.output)
|