mirror of
https://github.com/streamlink/streamlink
synced 2024-11-01 01:19:33 +01:00
plugins.atresplayer: update input URLs
This commit is contained in:
parent
26e915e391
commit
bfcd3725c5
@ -22,10 +22,12 @@ log = logging.getLogger(__name__)
|
||||
r"https?://(?:www\.)?atresplayer\.com/"
|
||||
))
|
||||
class AtresPlayer(Plugin):
|
||||
def _get_streams(self):
|
||||
self.url = update_scheme("https://", self.url)
|
||||
path = urlparse(self.url).path
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.url = update_scheme("https://", f"{self.url.rstrip('/')}/")
|
||||
|
||||
def _get_streams(self):
|
||||
path = urlparse(self.url).path
|
||||
api_url = self.session.http.get(self.url, schema=validate.Schema(
|
||||
re.compile(r"""window.__PRELOADED_STATE__\s*=\s*({.*?});""", re.DOTALL),
|
||||
validate.none_or_all(
|
||||
|
@ -1,3 +1,7 @@
|
||||
from unittest.mock import Mock
|
||||
|
||||
import pytest
|
||||
|
||||
from streamlink.plugins.atresplayer import AtresPlayer
|
||||
from tests.plugins import PluginCanHandleUrl
|
||||
|
||||
@ -6,8 +10,20 @@ class TestPluginCanHandleUrlAtresPlayer(PluginCanHandleUrl):
|
||||
__plugin__ = AtresPlayer
|
||||
|
||||
should_match = [
|
||||
'http://www.atresplayer.com/directos/antena3/',
|
||||
'http://www.atresplayer.com/directos/lasexta/',
|
||||
'https://www.atresplayer.com/directos/antena3/',
|
||||
'https://www.atresplayer.com/flooxer/programas/unas/temporada-1/dario-eme-hache-sindy-takanashi-entrevista_123/',
|
||||
"http://www.atresplayer.com/directos/antena3/",
|
||||
"http://www.atresplayer.com/directos/lasexta/",
|
||||
"https://www.atresplayer.com/directos/antena3/",
|
||||
"https://www.atresplayer.com/flooxer/programas/unas/temporada-1/dario-eme-hache-sindy-takanashi-entrevista_123/",
|
||||
]
|
||||
|
||||
|
||||
class TestAtresPlayer:
|
||||
@pytest.mark.parametrize("url,expected", [
|
||||
("http://www.atresplayer.com/directos/antena3", "https://www.atresplayer.com/directos/antena3/"),
|
||||
("http://www.atresplayer.com/directos/antena3/", "https://www.atresplayer.com/directos/antena3/"),
|
||||
("https://www.atresplayer.com/directos/antena3", "https://www.atresplayer.com/directos/antena3/"),
|
||||
("https://www.atresplayer.com/directos/antena3/", "https://www.atresplayer.com/directos/antena3/"),
|
||||
])
|
||||
def test_url(self, url, expected):
|
||||
plugin = AtresPlayer(Mock(), url)
|
||||
assert plugin.url == expected
|
||||
|
Loading…
Reference in New Issue
Block a user