Skip to content

plugins.filmon: fix/update #4335

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
Feb 13, 2022
Merged

plugins.filmon: fix/update #4335

merged 1 commit into from
Feb 13, 2022

Conversation

mkbloke
Copy link
Member

@mkbloke mkbloke commented Feb 5, 2022

  • use alternative/current sources for live and VOD stream info
  • update schemas
  • update URL regex
  • update tests
  • add support for mp4 VOD sources
  • add note to docs regarding mp4 VODs
  • use TLSSecLevel1Adapter()

closes #4332

@mkbloke mkbloke mentioned this pull request Feb 5, 2022
3 tasks
Copy link
Member

@bastimeyer bastimeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Apart from the HTTPStream concerns, the diff is looking good.

I can't verify the plugin though, because I'm getting SSL/TLS errors, even when setting --http-no-ssl-verify.

[cli][info] Found matching plugin filmon for URL https://www.filmon.com/tv/zdf
error: Unable to open URL: https://www.filmon.com/tv/zdf (HTTPSConnectionPool(host='www.filmon.com', port=443): Max retries exceeded with url: /tv/zdf (Caused by SSLError(SSLError(1, '[SSL: WRONG_SIGNATURE_TYPE] wrong signature type (_ssl.c:997)'))))

As you've already said in the gitter/matrix channel, the CI didn't start for some reason. You'll have to push to your branch again to re-trigger it.

@bastimeyer bastimeyer added the plugin issue A Plugin does not work correctly label Feb 6, 2022
@mkbloke
Copy link
Member Author

mkbloke commented Feb 6, 2022

As I mentioned in the last paragraph of #4334 (comment), the problem is regarding the minimum TLS version required in Open SSL's default configuration on newer distributions.

$ cat .openssl.cnf 
openssl_conf = default_conf

[ default_conf ]
ssl_conf = ssl_sect

[ssl_sect]
system_default = system_default_sect

[system_default_sect]
MinProtocol = TLSv1.2
CipherString = DEFAULT:@SECLEVEL=1

$ streamlink filmon.com/tv/e4 
[cli][info] Found matching plugin filmon for URL filmon.com/tv/e4
error: Unable to open URL: https://filmon.com/tv/e4 (HTTPSConnectionPool(host='filmon.com', port=443): Max retries exceeded with url: /tv/e4 (Caused by SSLError(SSLError(1, '[SSL: WRONG_SIGNATURE_TYPE] wrong signature type (_ssl.c:1131)'))))

$ OPENSSL_CONF=~/.openssl.cnf streamlink filmon.com/tv/e4 
[cli][info] Found matching plugin filmon for URL filmon.com/tv/e4
Available streams: low (worst), high (best)

@bastimeyer
Copy link
Member

A custom OpenSSL config with Python 3.10 on Arch Linux won't work. Apparently Python 3.10 hardcodes the list of allowed TLS ciphers with its default build arguments (which other distros / systems might be using as well):
https://wiki.archlinux.org/title/OpenSSL#Python_3.10_and_%22ca_md_too_weak%22_errors

A workaround is adding a different adapter for https requests for that specific plugin:
https://stackoverflow.com/a/59971965/15776887
https://stackoverflow.com/a/63349178/15776887
https://docs.python.org/3/library/ssl.html

"Transport Adapters" for specific hosts:
https://docs.python-requests.org/en/latest/user/advanced/#transport-adapters

from requests import adapters
import ssl

class TLSAdapter(adapters.HTTPAdapter):
    def init_poolmanager(self, *args, **kwargs):
        ctx = ssl.create_default_context()
        ctx.set_ciphers("DEFAULT:@SECLEVEL=1")

        return super().init_poolmanager(
            *args,
            **kwargs,
            ssl_context=ctx
        )

adapter = TLSAdapter()
self.session.http.mount("https://filmon.com", adapter)
self.session.http.mount("https://www.filmon.com", adapter)

@mkbloke
Copy link
Member Author

mkbloke commented Feb 9, 2022

That works nicely, thank you. Note, I also needed to add self.session.http.mount("https://vms-admin.filmon.com/", adapter) to get VODs working too.

@mkbloke
Copy link
Member Author

mkbloke commented Feb 9, 2022

Hmm, looks like it might need to be conditional for non-Windows systems?

Should I import is_win32 from compat and put the mounts in an if block based on is_win32?

Edit: I'm trying it anyway... if it's the wrong solution it can be changed.

Edit: Actually, that probably is the wrong solution. I didn't look carefully enough before, but I see this is only a problem on the Windows build with Python 3.6; builds > 3.6 are OK. https://github.com/streamlink/streamlink/runs/5129918618?check_suite_focus=true#step:9:255

Copy link
Member

@bastimeyer bastimeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might need to be conditional for non-Windows systems?

No. This is a Python 3.10 thing and the new default of the standard library's ssl module.

From your branch in my W10 VM:

$  streamlink -l debug 'https://filmon.com/tv/zdf'
[cli][debug] OS:         Windows 10
[cli][debug] Python:     3.10.2
[cli][debug] Streamlink: 1.3.1+795.ga9e51c7
[cli][debug] Requests(2.27.1), Socks(1.7.1), Websocket(1.2.3)
[cli][debug] Arguments:
[cli][debug]  url=https://filmon.com/tv/zdf
[cli][debug]  --loglevel=debug
[cli][debug]  --ffmpeg-ffmpeg=C:\Program Files (x86)\Streamlink\ffmpeg\ffmpeg.exe
[cli][info] Found matching plugin filmon for URL https://filmon.com/tv/zdf
error: Unable to open URL: https://filmon.com/tv/zdf (HTTPSConnectionPool(host='filmon.com', port=443): Max retries exceeded with url: /tv/zdf (Caused by SSLError(SSLError(1, '[SSL: WRONG_SIGNATURE_TYPE] wrong signature type (_ssl.c:997)'))))

- use alternative/current sources for live and VOD stream info
- update schemas
- update URL regex
- update tests
- add support for mp4 VOD sources
- add note to docs regarding mp4 VODs
- use TLSSecLevel1Adapter()
@bastimeyer bastimeyer merged commit 4e9ad85 into streamlink:master Feb 13, 2022
@mkbloke mkbloke deleted the filmon branch February 13, 2022 20:12
Billy2011 added a commit to Billy2011/streamlink-27 that referenced this pull request Feb 14, 2022
- use alternative/current sources for live and VOD stream info
- update schemas
- update URL regex
- update tests
- add support for .mp4 VOD sources
- add note to docs regarding mp4 VODs
- add note to docs regarding mp4 VODs
- use TLSSecLevel1Adapter()
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.filmon: all channels fail to start. Debug show invalid server response
2 participants