Skip to content

plugins.tvp: rewrite and fix plugin, add VODs #4905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 28, 2022

Conversation

bastimeyer
Copy link
Member

Fixes #4904

The old URLs get properly redirected, so I kept them in the plugin matcher regex.

When retrieving the video ID, the Connection: close header had to be set, because otherwise, the server would abort the next request for some reason. Took me a bit figure out, because I couldn't observe the behavior in my web browser or via curl, and it wasn't caused by session data like cookies, etc. Also had a look at urllib3's connection pool, but setting the header seems to work and is far easier than trying to close any connections in the connection pool, which is a private low-level API call anyway and probably not wise to use.

$ streamlink -l debug 'https://stream.tvp.pl/' best
[cli][debug] OS:         Linux-5.17.0-rc6-1-git-01595-gf3fa490960e8-x86_64-with-glibc2.36
[cli][debug] Python:     3.10.8
[cli][debug] Streamlink: 5.0.1+22.ge32d2dae
[cli][debug] Dependencies:
[cli][debug]  isodate: 0.6.1
[cli][debug]  lxml: 4.9.1
[cli][debug]  pycountry: 22.3.5
[cli][debug]  pycryptodome: 3.14.1
[cli][debug]  PySocks: 1.7.1
[cli][debug]  requests: 2.28.1
[cli][debug]  websocket-client: 1.3.1
[cli][debug]  importlib-metadata: 5.0.0
[cli][debug] Arguments:
[cli][debug]  url=https://stream.tvp.pl/
[cli][debug]  stream=['best']
[cli][debug]  --loglevel=debug
[cli][debug]  --player=mpv
[cli][info] Found matching plugin tvp for URL https://stream.tvp.pl/
[plugins.tvp][debug] video ID: 14812849
[utils.l10n][debug] Language code: en_US
[cli][info] Available streams: 288p_alt (worst), 288p, 404p_alt, 404p, 576p, 720p, 1080p (best)
[cli][info] Opening stream: 1080p (hls)
[cli][info] Starting player: mpv
...
$ streamlink -l debug 'https://stream.tvp.pl/?channel_id=63759349' best
[cli][debug] OS:         Linux-5.17.0-rc6-1-git-01595-gf3fa490960e8-x86_64-with-glibc2.36
[cli][debug] Python:     3.10.8
[cli][debug] Streamlink: 5.0.1+22.ge32d2dae
[cli][debug] Dependencies:
[cli][debug]  isodate: 0.6.1
[cli][debug]  lxml: 4.9.1
[cli][debug]  pycountry: 22.3.5
[cli][debug]  pycryptodome: 3.14.1
[cli][debug]  PySocks: 1.7.1
[cli][debug]  requests: 2.28.1
[cli][debug]  websocket-client: 1.3.1
[cli][debug]  importlib-metadata: 5.0.0
[cli][debug] Arguments:
[cli][debug]  url=https://stream.tvp.pl/?channel_id=63759349
[cli][debug]  stream=['best']
[cli][debug]  --loglevel=debug
[cli][debug]  --player=mpv
[cli][info] Found matching plugin tvp for URL https://stream.tvp.pl/?channel_id=63759349
[plugins.tvp][debug] video ID: 63759349
[utils.l10n][debug] Language code: en_US
[cli][info] Available streams: 288p_alt (worst), 288p, 404p_alt, 404p, 576p, 720p, 1080p (best)
[cli][info] Opening stream: 1080p (hls)
[cli][info] Starting player: mpv
...

@bastimeyer bastimeyer added the plugin issue A Plugin does not work correctly label Oct 26, 2022
@Irek7
Copy link

Irek7 commented Oct 26, 2022

new plugin works.

@ghost
Copy link

ghost commented Oct 26, 2022

Tested, works.

@bastimeyer
Copy link
Member Author

Added support for VODs:
#4907

Authentication won't be supported though and the URL matcher is technically not 100% correct and could lead to 403 error responses from the API if a URL of a show instead of an episode was set. Since some shows/films/whatever don't have episodes and use the same URL format, this couldn't be fixed easily. Most VODs are also geo-blocked, so 403 errors will also be shown in those cases.

VOD with episode

$ streamlink 'https://vod.tvp.pl/informacje-i-publicystyka,205/woronicza-17-odcinki,273788/odcinek-471,S01E471,375966'
[cli][info] Found matching plugin tvp for URL https://vod.tvp.pl/informacje-i-publicystyka,205/woronicza-17-odcinki,273788/odcinek-471,S01E471,375966
Available streams: 224p (worst), 270p, 360p, 450p, 540p, 720p, 1080p (best)

Invalid URL

$ streamlink 'https://vod.tvp.pl/informacje-i-publicystyka,205/woronicza-17-odcinki,273788'
[cli][info] Found matching plugin tvp for URL https://vod.tvp.pl/informacje-i-publicystyka,205/woronicza-17-odcinki,273788
error: Unable to open URL: https://vod.tvp.pl/api/products/273788/videos/playlist (403 Client Error: Forbidden for url: https://vod.tvp.pl/api/products/273788/videos/playlist?platform=BROWSER&videoType=MOVIE)

Geo-blocked

$ streamlink 'https://vod.tvp.pl/filmy-dokumentalne,163/krolowa-wladczyni-i-matka,284734'
[cli][info] Found matching plugin tvp for URL https://vod.tvp.pl/filmy-dokumentalne,163/krolowa-wladczyni-i-matka,284734
error: Unable to open URL: https://vod.tvp.pl/api/products/284734/videos/playlist (403 Client Error: Forbidden for url: https://vod.tvp.pl/api/products/284734/videos/playlist?platform=BROWSER&videoType=MOVIE)

@bastimeyer bastimeyer changed the title plugins.tvp: rewrite and fix plugin plugins.tvp: rewrite and fix plugin, add VODs Oct 27, 2022
@Irek7
Copy link

Irek7 commented Oct 27, 2022

VOD works as excepted. Geo-blocked works in Poland.

@gravyboat gravyboat merged commit 37dc0b2 into streamlink:master Oct 28, 2022
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request Nov 5, 2022
@bastimeyer bastimeyer deleted the plugins/tvp/rewrite branch November 7, 2022 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin issue A Plugin does not work correctly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

plugins.tvp: Adapt to new version of streaming portal
3 participants