Skip to content

plugins.wwenetwork: rewrite and fix plugin #6404

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

Conversation

Mehavoid
Copy link
Contributor

Closes: #5674

I can provide an account with an active subscription for testing purposes.

$ streamlink --no-config -l debug --hls-duration 5 -o /dev/null --wwenetwork-email REDACTED --wwenetwork-password REDACTED https://network.wwe.com/live/275587 best
[cli][debug] OS:         Linux-5.4.0-196-generic-x86_64-with-glibc2.31
[cli][debug] Python:     3.9.5
[cli][debug] OpenSSL:    OpenSSL 1.1.1f  31 Mar 2020
[cli][debug] Streamlink: 7.1.1+12.g6e2b7af3.dirty
[cli][debug] Dependencies:
[cli][debug]  certifi: 2024.12.14
[cli][debug]  exceptiongroup: 1.1.1
[cli][debug]  isodate: 0.6.0
[cli][debug]  lxml: 4.7.1
[cli][debug]  pycountry: 22.1.10
[cli][debug]  pycryptodome: 3.9.9
[cli][debug]  PySocks: 1.7.1
[cli][debug]  requests: 2.31.0
[cli][debug]  trio: 0.22.2
[cli][debug]  trio-websocket: 0.11.1
[cli][debug]  urllib3: 2.0.6
[cli][debug]  websocket-client: 1.2.3
[cli][debug] Arguments:
[cli][debug]  url=https://network.wwe.com/live/275587
[cli][debug]  stream=['best']
[cli][debug]  --no-config=True
[cli][debug]  --loglevel=debug
[cli][debug]  --output=/dev/null
[cli][debug]  --hls-duration=5.0
[cli][debug]  --wwenetwork-email=REDACTED
[cli][debug]  --wwenetwork-password=********
[cli][info] Found matching plugin wwenetwork for URL https://network.wwe.com/live/275587
[utils.l10n][debug] Language code: en_US
[stream.ffmpegmux][debug] ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil      56. 31.100 / 56. 31.100
libavcodec     58. 54.100 / 58. 54.100
libavformat    58. 29.100 / 58. 29.100
libavdevice    58.  8.100 / 58.  8.100
libavfilter     7. 57.100 /  7. 57.100
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  5.100 /  5.  5.100
libswresample   3.  5.100 /  3.  5.100
libpostproc    55.  5.100 / 55.  5.100
[stream.hls][debug] Using external audio tracks for stream 720p (language=en-US, name=English)
[stream.hls][debug] Using external audio tracks for stream 720p_alt (language=en-US, name=English)
[stream.hls][debug] Using external audio tracks for stream 720p_alt2 (language=en-US, name=English)
[stream.hls][debug] Using external audio tracks for stream 504p (language=en-US, name=English)
[stream.hls][debug] Using external audio tracks for stream 504p_alt (language=en-US, name=English)
[stream.hls][debug] Using external audio tracks for stream 1080p (language=en-US, name=English)
[stream.hls][debug] Using external audio tracks for stream 1080p_alt (language=en-US, name=English)
[stream.hls][debug] Using external audio tracks for stream 288p (language=en-US, name=English)
[stream.hls][debug] Using external audio tracks for stream 288p_alt (language=en-US, name=English)
[stream.hls][debug] Using external audio tracks for stream 1080p_alt2 (language=en-US, name=English)
[stream.hls][debug] Using external audio tracks for stream 360p (language=en-US, name=English)
[stream.hls][debug] Using external audio tracks for stream 360p_alt (language=en-US, name=English)
[cli][info] Available streams: 288p_alt (worst), 288p, 360p_alt, 360p, 504p_alt, 504p, 720p_alt2, 720p_alt, 720p, 1080p_alt2, 1080p_alt, 1080p (best)
[cli][info] Opening stream: 1080p (hls-multi)
[cli][info] Writing output to
/dev/null
[cli][debug] Checking file output
[stream.ffmpegmux][debug] Opening hls substream
[stream.hls][debug] Reloading playlist
[stream.ffmpegmux][debug] Opening hls substream
[stream.hls][debug] Reloading playlist
[utils.named_pipe][info] Creating pipe streamlinkpipe-2727140-1-2919
[utils.named_pipe][info] Creating pipe streamlinkpipe-2727140-2-4563
[stream.ffmpegmux][debug] ffmpeg command: /usr/bin/ffmpeg -y -nostats -loglevel info -i /tmp/streamlinkpipe-2727140-1-2919 -i /tmp/streamlinkpipe-2727140-2-4563 -c:v copy -c:a copy -map 0:v? -map 0:a? -map 1:a -f mpegts pipe:1
[stream.ffmpegmux][debug] Starting copy to pipe: /tmp/streamlinkpipe-2727140-1-2919
[stream.ffmpegmux][debug] Starting copy to pipe: /tmp/streamlinkpipe-2727140-2-4563
[cli][debug] Pre-buffering 8192 bytes
[stream.hls][debug] First Sequence: 556545; Last Sequence: 556555
[stream.hls][debug] Start offset: 0; Duration: 5; Start Sequence: 556553; End Sequence: None
[stream.hls][debug] Adding segment 556553 to queue
[stream.hls][info] Stopping stream early after 5
[stream.segmented][debug] Closing worker thread
[stream.hls][debug] First Sequence: 556541; Last Sequence: 556551
[stream.hls][debug] Start offset: 0; Duration: 5; Start Sequence: 556549; End Sequence: None
[stream.hls][debug] Adding segment 556549 to queue
[stream.hls][info] Stopping stream early after 5
[stream.segmented][debug] Closing worker thread
[stream.hls][debug] Writing segment 556549 to output
[stream.hls][debug] Segment 556549 complete
[stream.segmented][debug] Closing writer thread
[stream.hls][debug] Writing segment 556553 to output
[stream.hls][debug] Segment 556553 complete
[stream.segmented][debug] Closing writer thread
[cli][debug] Writing stream to output
[stream.ffmpegmux][debug] Pipe copy complete: /tmp/streamlinkpipe-2727140-2-4563
[stream.ffmpegmux][debug] Pipe copy complete: /tmp/streamlinkpipe-2727140-1-2919
[download] Written 3.96 MiB to /dev/null (0s)
[stream.ffmpegmux][debug] Closing ffmpeg thread
[stream.ffmpegmux][debug] Closed all the substreams
[cli][info] Stream ended
[cli][info] Closing currently open stream...

$ streamlink --no-config -l debug --hls-duration 5 -o /dev/null --wwenetwork-email REDACTED --wwenetwork-password REDACTED https://network.wwe.com/video/738781 best
[cli][debug] OS:         Linux-5.4.0-196-generic-x86_64-with-glibc2.31
[cli][debug] Python:     3.9.5
[cli][debug] OpenSSL:    OpenSSL 1.1.1f  31 Mar 2020
[cli][debug] Streamlink: 7.1.1+13.gc32403ba
[cli][debug] Dependencies:
[cli][debug]  certifi: 2024.12.14
[cli][debug]  exceptiongroup: 1.1.1
[cli][debug]  isodate: 0.6.0
[cli][debug]  lxml: 4.7.1
[cli][debug]  pycountry: 22.1.10
[cli][debug]  pycryptodome: 3.9.9
[cli][debug]  PySocks: 1.7.1
[cli][debug]  requests: 2.31.0
[cli][debug]  trio: 0.22.2
[cli][debug]  trio-websocket: 0.11.1
[cli][debug]  urllib3: 2.0.6
[cli][debug]  websocket-client: 1.2.3
[cli][debug] Arguments:
[cli][debug]  url=https://network.wwe.com/video/738781
[cli][debug]  stream=['best']
[cli][debug]  --no-config=True
[cli][debug]  --loglevel=debug
[cli][debug]  --output=/dev/null
[cli][debug]  --hls-duration=5.0
[cli][debug]  --wwenetwork-email=REDACTED
[cli][debug]  --wwenetwork-password=********
[cli][info] Found matching plugin wwenetwork for URL https://network.wwe.com/video/738781
[utils.l10n][debug] Language code: en_US
[stream.ffmpegmux][debug] ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil      56. 31.100 / 56. 31.100
libavcodec     58. 54.100 / 58. 54.100
libavformat    58. 29.100 / 58. 29.100
libavdevice    58.  8.100 / 58.  8.100
libavfilter     7. 57.100 /  7. 57.100
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  5.100 /  5.  5.100
libswresample   3.  5.100 /  3.  5.100
libpostproc    55.  5.100 / 55.  5.100
[stream.hls][debug] Using external audio tracks for stream 720p (language=eng, name=English (United States))
[stream.hls][debug] Using external audio tracks for stream 1080p (language=eng, name=English (United States))
[stream.hls][debug] Using external audio tracks for stream 1080p_alt (language=eng, name=English (United States))
[stream.hls][debug] Using external audio tracks for stream 720p_alt (language=eng, name=English (United States))
[stream.hls][debug] Using external audio tracks for stream 504p (language=eng, name=English (United States))
[stream.hls][debug] Using external audio tracks for stream 360p (language=eng, name=English (United States))
[stream.hls][debug] Using external audio tracks for stream 288p (language=eng, name=English (United States))
[cli][info] Available streams: 288p (worst), 360p, 504p, 720p_alt, 720p, 1080p_alt, 1080p (best)
[cli][info] Opening stream: 1080p (hls-multi)
[cli][info] Writing output to
/dev/null
[cli][debug] Checking file output
[stream.ffmpegmux][debug] Opening hls substream
[stream.hls][debug] Reloading playlist
[stream.ffmpegmux][debug] Opening hls substream
[stream.hls][debug] Reloading playlist
[utils.named_pipe][info] Creating pipe streamlinkpipe-2730584-1-1460
[utils.named_pipe][info] Creating pipe streamlinkpipe-2730584-2-2739
[stream.ffmpegmux][debug] ffmpeg command: /usr/bin/ffmpeg -y -nostats -loglevel info -i /tmp/streamlinkpipe-2730584-1-1460 -i /tmp/streamlinkpipe-2730584-2-2739 -c:v copy -c:a copy -map 0:v? -map 0:a? -map 1:a -f mpegts pipe:1
[stream.ffmpegmux][debug] Starting copy to pipe: /tmp/streamlinkpipe-2730584-1-1460
[stream.ffmpegmux][debug] Starting copy to pipe: /tmp/streamlinkpipe-2730584-2-2739
[cli][debug] Pre-buffering 8192 bytes
[stream.hls][debug] First Sequence: 0; Last Sequence: 812
[stream.hls][debug] Start offset: 0; Duration: 5; Start Sequence: 0; End Sequence: 812
[stream.hls][debug] Adding segment 0 to queue
[stream.hls][info] Stopping stream early after 5
[stream.segmented][debug] Closing worker thread
[stream.hls][debug] First Sequence: 0; Last Sequence: 812
[stream.hls][debug] Start offset: 0; Duration: 5; Start Sequence: 0; End Sequence: 812
[stream.hls][debug] Adding segment 0 to queue
[stream.hls][info] Stopping stream early after 5
[stream.segmented][debug] Closing worker thread
[stream.hls][debug] Writing segment 0 to output
[stream.hls][debug] Segment 0 complete
[stream.segmented][debug] Closing writer thread
[stream.hls][debug] Writing segment 0 to output
[stream.hls][debug] Segment 0 complete
[stream.segmented][debug] Closing writer thread
[cli][debug] Writing stream to output
[stream.ffmpegmux][debug] Pipe copy complete: /tmp/streamlinkpipe-2730584-2-2739
[stream.ffmpegmux][debug] Pipe copy complete: /tmp/streamlinkpipe-2730584-1-1460
[download] Written 5.92 MiB to /dev/null (0s)
[stream.ffmpegmux][debug] Closing ffmpeg thread
[stream.ffmpegmux][debug] Closed all the substreams
[cli][info] Stream ended
[cli][info] Closing currently open stream...

$ streamlink --no-config -l debug --locale es_ES --hls-duration 5 -o /dev/null --wwenetwork-email REDACTED --wwenetwork-password REDACTED https://network.wwe.com/video/738781 best
[cli][debug] OS:         Linux-5.4.0-196-generic-x86_64-with-glibc2.31
[cli][debug] Python:     3.9.5
[cli][debug] OpenSSL:    OpenSSL 1.1.1f  31 Mar 2020
[cli][debug] Streamlink: 7.1.1+13.gc32403ba
[cli][debug] Dependencies:
[cli][debug]  certifi: 2024.12.14
[cli][debug]  exceptiongroup: 1.1.1
[cli][debug]  isodate: 0.6.0
[cli][debug]  lxml: 4.7.1
[cli][debug]  pycountry: 22.1.10
[cli][debug]  pycryptodome: 3.9.9
[cli][debug]  PySocks: 1.7.1
[cli][debug]  requests: 2.31.0
[cli][debug]  trio: 0.22.2
[cli][debug]  trio-websocket: 0.11.1
[cli][debug]  urllib3: 2.0.6
[cli][debug]  websocket-client: 1.2.3
[cli][debug] Arguments:
[cli][debug]  url=https://network.wwe.com/video/738781
[cli][debug]  stream=['best']
[cli][debug]  --no-config=True
[cli][debug]  --locale=es_ES
[cli][debug]  --loglevel=debug
[cli][debug]  --output=/dev/null
[cli][debug]  --hls-duration=5.0
[cli][debug]  --wwenetwork-email=REDACTED
[cli][debug]  --wwenetwork-password=********
[cli][info] Found matching plugin wwenetwork for URL https://network.wwe.com/video/738781
[utils.l10n][debug] Language code: es_ES
[stream.ffmpegmux][debug] ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil      56. 31.100 / 56. 31.100
libavcodec     58. 54.100 / 58. 54.100
libavformat    58. 29.100 / 58. 29.100
libavdevice    58.  8.100 / 58.  8.100
libavfilter     7. 57.100 /  7. 57.100
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  5.100 /  5.  5.100
libswresample   3.  5.100 /  3.  5.100
libpostproc    55.  5.100 / 55.  5.100
[stream.hls][debug] Using external audio tracks for stream 720p (language=spa, name=Español (Latinoamérica))
[stream.hls][debug] Using external audio tracks for stream 1080p (language=spa, name=Español (Latinoamérica))
[stream.hls][debug] Using external audio tracks for stream 1080p_alt (language=spa, name=Español (Latinoamérica))
[stream.hls][debug] Using external audio tracks for stream 720p_alt (language=spa, name=Español (Latinoamérica))
[stream.hls][debug] Using external audio tracks for stream 504p (language=spa, name=Español (Latinoamérica))
[stream.hls][debug] Using external audio tracks for stream 360p (language=spa, name=Español (Latinoamérica))
[stream.hls][debug] Using external audio tracks for stream 288p (language=spa, name=Español (Latinoamérica))
[cli][info] Available streams: 288p (worst), 360p, 504p, 720p_alt, 720p, 1080p_alt, 1080p (best)
[cli][info] Opening stream: 1080p (hls-multi)
[cli][info] Writing output to
/dev/null
[cli][debug] Checking file output
[stream.ffmpegmux][debug] Opening hls substream
[stream.hls][debug] Reloading playlist
[stream.ffmpegmux][debug] Opening hls substream
[stream.hls][debug] Reloading playlist
[utils.named_pipe][info] Creating pipe streamlinkpipe-2731490-1-9463
[utils.named_pipe][info] Creating pipe streamlinkpipe-2731490-2-9029
[stream.ffmpegmux][debug] ffmpeg command: /usr/bin/ffmpeg -y -nostats -loglevel info -i /tmp/streamlinkpipe-2731490-1-9463 -i /tmp/streamlinkpipe-2731490-2-9029 -c:v copy -c:a copy -map 0:v? -map 0:a? -map 1:a -f mpegts pipe:1
[stream.ffmpegmux][debug] Starting copy to pipe: /tmp/streamlinkpipe-2731490-1-9463
[stream.ffmpegmux][debug] Starting copy to pipe: /tmp/streamlinkpipe-2731490-2-9029
[cli][debug] Pre-buffering 8192 bytes
[stream.hls][debug] First Sequence: 0; Last Sequence: 812
[stream.hls][debug] Start offset: 0; Duration: 5; Start Sequence: 0; End Sequence: 812
[stream.hls][debug] Adding segment 0 to queue
[stream.hls][info] Stopping stream early after 5
[stream.segmented][debug] Closing worker thread
[stream.hls][debug] First Sequence: 0; Last Sequence: 812
[stream.hls][debug] Start offset: 0; Duration: 5; Start Sequence: 0; End Sequence: 812
[stream.hls][debug] Adding segment 0 to queue
[stream.hls][info] Stopping stream early after 5
[stream.segmented][debug] Closing worker thread
[stream.hls][debug] Writing segment 0 to output
[stream.hls][debug] Writing segment 0 to output
[stream.hls][debug] Segment 0 complete
[stream.segmented][debug] Closing writer thread
[stream.hls][debug] Segment 0 complete
[stream.segmented][debug] Closing writer thread
[cli][debug] Writing stream to output
[stream.ffmpegmux][debug] Pipe copy complete: /tmp/streamlinkpipe-2731490-2-9029
[stream.ffmpegmux][debug] Pipe copy complete: /tmp/streamlinkpipe-2731490-1-9463
[download] Written 5.91 MiB to /dev/null (0s)
[stream.ffmpegmux][debug] Closing ffmpeg thread
[stream.ffmpegmux][debug] Closed all the substreams
[cli][info] Stream ended
[cli][info] Closing currently open stream...

@Mehavoid Mehavoid force-pushed the plugins/wwenetwork/fix-and-rewrite branch from c32403b to eb03712 Compare January 17, 2025 06:28
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, appreciated. Looks very clean. 👍
Two minor things though that might be worth changing...

Considering that auth data is required and that you've included a few debug logs, I'm going to trust you that this plugin implementation is indeed correct, without having a look myself.

@bastimeyer bastimeyer added the plugin issue A Plugin does not work correctly label Jan 17, 2025
@Mehavoid Mehavoid force-pushed the plugins/wwenetwork/fix-and-rewrite branch from eb03712 to 25c3219 Compare January 18, 2025 17:38
@Mehavoid
Copy link
Contributor Author

Thanks for the review! I have also made changes to the scheme for retrieving playback_streams, as scheduled broadcasts now return an object with any missing playlists. Example:
https://network.wwe.com/live/278763

{'eventId': 278763, 'posterUrl': 'https://img.dge-prod.dicelaboratory.com/original/2024/12/03164406-qulwllpctdrrsorr.jpg', 'statusCode': 200}

@bastimeyer
Copy link
Member

Thanks.


What about the non-optional id and title concerns?


Using the plugin without authentication also currently does this instead of failing gracefully:

$ streamlink https://network.wwe.com/live/278763
Enter wwenetwork email: 
Enter wwenetwork password: 
[cli][info] Found matching plugin wwenetwork for URL https://network.wwe.com/live/278763
error: Unable to open URL: https://dce-frontoffice.imggaming.com/api/v2/login (422 Client Error:  for url: https://dce-frontoffice.imggaming.com/api/v2/login)

With invalid auth data:

$ streamlink https://network.wwe.com/live/278763
Enter wwenetwork email: invalid
Enter wwenetwork password: 
[cli][info] Found matching plugin wwenetwork for URL https://network.wwe.com/live/278763
error: Unable to validate response text: ValidationError(AnySchema):
  ValidationError(dict):
    Unable to validate value of key 'messages'
    Context(ListSchema):
      Length of list (3) does not match expectation (1)
  ValidationError(dict):
    Key 'authorisationToken' not found in <{'status': 404, 'code': 'NOT_FOUND', 'messages': ['fail...>

With no auth data and 422 added to acceptable_status:

$ streamlink https://network.wwe.com/live/278763
Enter wwenetwork email: 
Enter wwenetwork password: 
[cli][info] Found matching plugin wwenetwork for URL https://network.wwe.com/live/278763
error: Unable to validate response text: ValidationError(AnySchema):
  ValidationError(dict):
    Unable to validate value of key 'messages'
    Context(ListSchema):
      Length of list (2) does not match expectation (1)
  ValidationError(dict):
    Key 'authorisationToken' not found in <{'status': 422, 'code': '422', 'messages': ['passwordIs...>

diff --git a/src/streamlink/plugins/wwenetwork.py b/src/streamlink/plugins/wwenetwork.py
index ea1f4869..86414e49 100644
--- a/src/streamlink/plugins/wwenetwork.py
+++ b/src/streamlink/plugins/wwenetwork.py
@@ -52,14 +52,14 @@ class WWENetwork(Plugin):
     def _login(self, email, password):
         success, data = self.session.http.post(
             self._API_LOGIN_URL,
-            acceptable_status=(200, 401, 404),
+            acceptable_status=(200, 401, 404, 422),
             json={"id": email, "secret": password},
             headers=self._API_HEADERS,
             schema=validate.Schema(
                 validate.parse_json(),
                 validate.any(
                     validate.all(
-                        {"messages": validate.list(str)},
+                        {"messages": [str]},
                         validate.get(("messages", 0)),
                         validate.transform(lambda data: (False, data)),
                     ),
@@ -88,7 +88,7 @@ class WWENetwork(Plugin):
                 validate.parse_json(),
                 validate.any(
                     validate.all(
-                        {"messages": validate.list(str)},
+                        {"messages": [str]},
                         validate.get(("messages", 0)),
                         validate.transform(lambda message: (False, message)),
                     ),
$ streamlink https://network.wwe.com/live/278763
Enter wwenetwork email: 
Enter wwenetwork password: 
[cli][info] Found matching plugin wwenetwork for URL https://network.wwe.com/live/278763
[plugins.wwenetwork][error] passwordIsRequired
error: No playable streams found on this URL: https://network.wwe.com/live/278763
$ streamlink https://network.wwe.com/live/278763
Enter wwenetwork email: invalid
Enter wwenetwork password: 
[cli][info] Found matching plugin wwenetwork for URL https://network.wwe.com/live/278763
[plugins.wwenetwork][error] failedAuthentication
error: No playable streams found on this URL: https://network.wwe.com/live/278763

@Mehavoid
Copy link
Contributor Author

As for id and title I checked how the title would look on the page if it were removed from the api response. It looks like there are no checks on the client side and it just crashes. I can make them optional.

After your review, I definitely got the 400 error once. I couldn't reproduce it again. Is it that this status code needs to be added as well?

$ streamlink --no-config -l debug https://network.wwe.com/video/742161
Enter wwenetwork email: Invalid
Enter wwenetwork password:
[cli][info] Found matching plugin wwenetwork for URL https://network.wwe.com/video/742161
error: Unable to open URL: https://dce-frontoffice.imggaming.com/api/v2/login (400 Client Error: Bad Request for url: https://dce-frontoffice.imggaming.com/api/v2/login)

@bastimeyer
Copy link
Member

I don't get a 400 status code response on that address with none, partial or invalid auth data.
At this point, it might be better to set raise_for_status=False instead of listing several different acceptable_status numbers.

@Mehavoid Mehavoid force-pushed the plugins/wwenetwork/fix-and-rewrite branch from 25c3219 to 28163ac Compare January 18, 2025 22:47
@bastimeyer bastimeyer merged commit 7d79cdc into streamlink:master Jan 18, 2025
16 checks passed
@bastimeyer
Copy link
Member

Thanks

@Mehavoid Mehavoid deleted the plugins/wwenetwork/fix-and-rewrite branch January 19, 2025 00:13
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.wwenetwork: API Request Failed: 401:UNAUTHORIZED (API Key is invalid)
2 participants