From 80270cf16bb6e607a3ad27bc80c3a387ea43fb0f Mon Sep 17 00:00:00 2001
From: Mohamed El Morabity <melmorabity@fedoraproject.org>
Date: Sun, 31 Mar 2019 18:06:08 +0200
Subject: [PATCH 1/7] Update stream URL computation
---
src/streamlink/plugins/playtv.py | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/streamlink/plugins/playtv.py b/src/streamlink/plugins/playtv.py
index 4d6056a5e..28277cc83 100644
--- a/src/streamlink/plugins/playtv.py
+++ b/src/streamlink/plugins/playtv.py
@@ -1,5 +1,7 @@
import re
+import jwt
+
from streamlink.plugin import Plugin
from streamlink.plugin.api import validate
from streamlink.stream import HDSStream, HLSStream
@@ -27,9 +29,12 @@ class PlayTV(Plugin):
}
)
})
- _api_schema = validate.Schema({
- 'url': validate.url()
- })
+ _api_schema = validate.Schema(
+ validate.transform(lambda x: jwt.decode(x, algorithms=['HS256'], verify=False)),
+ {
+ 'url': validate.url()
+ }
+ )
@classmethod
def can_handle_url(cls, url):
@@ -57,7 +62,7 @@ def _get_streams(self):
continue
api_url = self.API_URL.format(channel, protocol, language, bitrate['value'])
res = self.session.http.get(api_url)
- video_url = self.session.http.json(res, schema=self._api_schema)['url']
+ video_url = self._api_schema.validate(res.text)['url']
bs = '{0}k'.format(bitrate['value'])
if protocol == 'hls':
From df2ac77fac06e43d62ec7b71b58bd2cbc47740ce Mon Sep 17 00:00:00 2001
From: Mohamed El Morabity <melmorabity@fedoraproject.org>
Date: Sun, 31 Mar 2019 18:06:48 +0200
Subject: [PATCH 2/7] Add HTTPS support
---
src/streamlink/plugins/playtv.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/streamlink/plugins/playtv.py b/src/streamlink/plugins/playtv.py
index 28277cc83..2f0dd9b21 100644
--- a/src/streamlink/plugins/playtv.py
+++ b/src/streamlink/plugins/playtv.py
@@ -8,10 +8,10 @@
class PlayTV(Plugin):
- FORMATS_URL = 'http://playtv.fr/player/initialize/{0}/'
- API_URL = 'http://playtv.fr/player/play/{0}/?format={1}&language={2}&bitrate={3}'
+ FORMATS_URL = 'https://playtv.fr/player/initialize/{0}/'
+ API_URL = 'https://playtv.fr/player/play/{0}/?format={1}&language={2}&bitrate={3}'
- _url_re = re.compile(r'http://(?:playtv\.fr/television|play\.tv/live-tv/\d+)/(?P<channel>[^/]+)/?')
+ _url_re = re.compile(r'https?://(?:playtv\.fr/television|play\.tv/live-tv/\d+)/(?P<channel>[^/]+)/?')
_formats_schema = validate.Schema({
'streams': validate.any(
From e90d70057e11524829383dae798f36d754642b45 Mon Sep 17 00:00:00 2001
From: Mohamed El Morabity <melmorabity@fedoraproject.org>
Date: Sun, 31 Mar 2019 18:12:51 +0200
Subject: [PATCH 3/7] Improve support for international Play TV websites (fix
#1905)
---
src/streamlink/plugins/playtv.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/streamlink/plugins/playtv.py b/src/streamlink/plugins/playtv.py
index 2f0dd9b21..db4843037 100644
--- a/src/streamlink/plugins/playtv.py
+++ b/src/streamlink/plugins/playtv.py
@@ -11,7 +11,7 @@ class PlayTV(Plugin):
FORMATS_URL = 'https://playtv.fr/player/initialize/{0}/'
API_URL = 'https://playtv.fr/player/play/{0}/?format={1}&language={2}&bitrate={3}'
- _url_re = re.compile(r'https?://(?:playtv\.fr/television|play\.tv/live-tv/\d+)/(?P<channel>[^/]+)/?')
+ _url_re = re.compile(r'https?://(?:playtv\.fr/television|(:?\w+\.)?play\.tv/live-tv/\d+)/(?P<channel>[^/]+)/?')
_formats_schema = validate.Schema({
'streams': validate.any(
From 14336d826f13d4f49ce6d33b47f7505ed5ee16fb Mon Sep 17 00:00:00 2001
From: Mohamed El Morabity <melmorabity@fedoraproject.org>
Date: Sun, 31 Mar 2019 18:15:41 +0200
Subject: [PATCH 4/7] Add dependency on JWT for PlayTV
---
docs/install.rst | 2 ++
setup.py | 3 ++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/docs/install.rst b/docs/install.rst
index a2a28a3a3..cd2af74d4 100644
--- a/docs/install.rst
+++ b/docs/install.rst
@@ -292,6 +292,7 @@ Name Notes
`iso-639`_ Used for localization settings, provides language information
`iso3166`_ Used for localization settings, provides country information
`isodate`_ Used for MPEG-DASH streams
+`jwt`_ Used for some plugins
`PySocks`_ Used for SOCKS Proxies
`websocket-client`_ Used for some plugins
`shutil_get_terminal_size`_ Only needed on Python versions older than **3.3**
@@ -333,6 +334,7 @@ With these two environment variables it is possible to use `pycrypto`_ instead o
.. _websocket-client: https://pypi.org/project/websocket-client/
.. _shutil_get_terminal_size: https://pypi.org/project/backports.shutil_get_terminal_size/
.. _shutil_which: https://pypi.org/project/backports.shutil_which/
+.. _jwt: https://pypi.org/project/jwt/
Windows binaries
diff --git a/setup.py b/setup.py
index cde8848cf..24ecd8fb1 100644
--- a/setup.py
+++ b/setup.py
@@ -23,7 +23,8 @@
'win-inet-pton;python_version<"3.0" and platform_system=="Windows"',
# shutil.get_terminal_size and which were added in Python 3.3
'backports.shutil_which;python_version<"3.3"',
- 'backports.shutil_get_terminal_size;python_version<"3.3"'
+ 'backports.shutil_get_terminal_size;python_version<"3.3"',
+ 'jwt'
]
# for encrypted streams
From 17bf133f2aafee8d2ba8f53d834289323d78d9e2 Mon Sep 17 00:00:00 2001
From: Mohamed El Morabity <melmorabity@fedoraproject.org>
Date: Sun, 31 Mar 2019 18:46:00 +0200
Subject: [PATCH 5/7] Fix JWT library reference
---
docs/install.rst | 4 ++--
setup.py | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/install.rst b/docs/install.rst
index cd2af74d4..ace93b092 100644
--- a/docs/install.rst
+++ b/docs/install.rst
@@ -292,7 +292,7 @@ Name Notes
`iso-639`_ Used for localization settings, provides language information
`iso3166`_ Used for localization settings, provides country information
`isodate`_ Used for MPEG-DASH streams
-`jwt`_ Used for some plugins
+`PyJWT`_ Used for some plugins
`PySocks`_ Used for SOCKS Proxies
`websocket-client`_ Used for some plugins
`shutil_get_terminal_size`_ Only needed on Python versions older than **3.3**
@@ -334,7 +334,7 @@ With these two environment variables it is possible to use `pycrypto`_ instead o
.. _websocket-client: https://pypi.org/project/websocket-client/
.. _shutil_get_terminal_size: https://pypi.org/project/backports.shutil_get_terminal_size/
.. _shutil_which: https://pypi.org/project/backports.shutil_which/
-.. _jwt: https://pypi.org/project/jwt/
+.. _PyJWT: https://pypi.org/project/pyjwt/
Windows binaries
diff --git a/setup.py b/setup.py
index 24ecd8fb1..ba03a9ad8 100644
--- a/setup.py
+++ b/setup.py
@@ -24,7 +24,7 @@
# shutil.get_terminal_size and which were added in Python 3.3
'backports.shutil_which;python_version<"3.3"',
'backports.shutil_get_terminal_size;python_version<"3.3"',
- 'jwt'
+ 'pyjwt'
]
# for encrypted streams
From 2be76e2c460a8c3a041dda23edbcf539b53fb696 Mon Sep 17 00:00:00 2001
From: Mohamed El Morabity <melmorabity@fedoraproject.org>
Date: Sun, 31 Mar 2019 19:42:49 +0200
Subject: [PATCH 6/7] Add pyjwt to Windows installer deps
---
script/makeinstaller.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/script/makeinstaller.sh b/script/makeinstaller.sh
index fbaa2a288..4d5f41ced 100755
--- a/script/makeinstaller.sh
+++ b/script/makeinstaller.sh
@@ -84,6 +84,7 @@ format=bundled
; - socks / sockshandler
; - websocket-client
; - isodate
+; - pyjwt
packages=pkg_resources
six
iso639
@@ -97,6 +98,7 @@ packages=pkg_resources
socks
sockshandler
isodate
+ pyjwt
pypi_wheels=pycryptodome==3.6.4
files=../win32/LICENSE.txt > \$INSTDIR
From bede7b898a3035ad51c1ab1b108a5d746906228a Mon Sep 17 00:00:00 2001
From: Mohamed El Morabity <melmorabity@fedoraproject.org>
Date: Mon, 1 Apr 2019 02:32:13 +0200
Subject: [PATCH 7/7] Fix dependencies in Windows installer script
---
script/makeinstaller.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/script/makeinstaller.sh b/script/makeinstaller.sh
index 4d5f41ced..ad6277abc 100755
--- a/script/makeinstaller.sh
+++ b/script/makeinstaller.sh
@@ -98,7 +98,7 @@ packages=pkg_resources
socks
sockshandler
isodate
- pyjwt
+ jwt
pypi_wheels=pycryptodome==3.6.4
files=../win32/LICENSE.txt > \$INSTDIR