plugins.zattoo: fix app token and new recording URL

This commit is contained in:
back-to 2020-04-12 08:22:33 +02:00 committed by Forrest
parent 2007b32102
commit 5378c4f5ea
2 changed files with 10 additions and 4 deletions

View File

@ -50,7 +50,7 @@ class Zattoo(Plugin):
)/
(?:
(?:
recordings\?recording=
recording(?:s\?recording=|/)
|
(?:ondemand/)?(?:watch/(?:[^/\s]+)(?:/[^/]+/))
)(?P<recording_id>\d+)
@ -155,7 +155,11 @@ class Zattoo(Plugin):
# a new session is required for the app_token
self.session.http.cookies = cookiejar_from_dict({})
res = self.session.http.get(self.base_url)
if self.base_url == 'https://zattoo.com':
app_token_url = 'https://zattoo.com/int/'
else:
app_token_url = self.base_url
res = self.session.http.get(app_token_url)
match = self._app_token_re.search(res.text)
app_token = match.group(1)

View File

@ -39,15 +39,17 @@ class TestPluginZattoo(unittest.TestCase):
"https://zattoo.com/ondemand/watch/srf_zwei/110223896-die-schweizermacher/52845783/1455130800000"
+ "/1455137700000/6900000",
"https://zattoo.com/watch/tve/130920738-viaje-al-centro-de-la-tele/96847859/1508777100000/1508779800000/0",
"https://zattoo.com/recording/193074536",
"https://zattoo.com/recordings?recording=186466965"
]
for url in should_match:
self.assertTrue(Zattoo.can_handle_url(url))
self.assertTrue(Zattoo.can_handle_url(url), url)
def test_can_handle_url_negative(self):
should_not_match = [
"https://ewe.de",
"https://netcologne.de",
"https://zattoo.com"
]
for url in should_not_match:
self.assertFalse(Zattoo.can_handle_url(url))
self.assertFalse(Zattoo.can_handle_url(url), url)