-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
plugins.soop: rewrite authentication #6321
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
plugins.soop: rewrite authentication #6321
Conversation
08f6bec
to
c4f5858
Compare
Thanks for working on this. I'm facing an issue: (sl-6321) A:\folder>streamlink --loglevel=debug --output "{author} {id}.ts" --retry-streams 3 --retry-max 0 --hls-live-restart https://play.sooplive.co.kr/cooksuxtv best
[session][debug] Loading plugin: soop
[cli][debug] OS: Windows 10
[cli][debug] Python: 3.12.7
[cli][debug] OpenSSL: OpenSSL 3.0.15 3 Sep 2024
[cli][debug] Streamlink: 7.0.0+25.gc4f58582
[cli][debug] Dependencies:
[cli][debug] certifi: 2024.8.30
[cli][debug] isodate: 0.7.2
[cli][debug] lxml: 5.3.0
[cli][debug] pycountry: 24.6.1
[cli][debug] pycryptodome: 3.21.0
[cli][debug] PySocks: 1.7.1
[cli][debug] requests: 2.32.3
[cli][debug] trio: 0.27.0
[cli][debug] trio-websocket: 0.11.1
[cli][debug] urllib3: 2.2.3
[cli][debug] websocket-client: 1.8.0
[cli][debug] Arguments:
[cli][debug] url=https://play.sooplive.co.kr/cooksuxtv
[cli][debug] stream=['best']
[cli][debug] --loglevel=debug
[cli][debug] --player=C:\Program Files\DAUM\PotPlayer\PotPlayerMini64.exe
[cli][debug] --output={author} {id}.ts
[cli][debug] --retry-streams=3.0
[cli][debug] --retry-max=0
[cli][debug] --hls-live-restart=True
[cli][debug] --ffmpeg-ffmpeg=C:\ProgramData\chocolatey\bin\ffmpeg.exe
[cli][debug] --soop-username=********
[cli][debug] --soop-password=********
[cli][debug] --twitch-disable-ads=True
[cli][debug] --twitch-low-latency=True
[cli][debug] --twitch-api-header=[('Authorization', 'OAuth <redacted>')]
[plugins.soop][debug] Restored cookies: AbroadVod, _ausa, _ausb, AbroadChk, _au, _au3rd, AuthTicket, BbsTicket, UserTicket, RDB, isBbs
[cli][info] Found matching plugin soop for URL https://play.sooplive.co.kr/cooksuxtv
[cli][error] Unable to validate response text: ValidationError(dict):
Key 'LOGIN_ID' not found in <{'CHANNEL': {'IS_LOGIN': 1, 'LOGIN_ID': '<redacted_username>',...>
[cli][info] Waiting for streams, retrying every 3.0 second(s)
[cli][error] Unable to validate response text: ValidationError(dict):
Key 'LOGIN_ID' not found in <{'CHANNEL': {'IS_LOGIN': 1, 'LOGIN_ID': '<redacted_username>',...>
[cli][error] Unable to validate response text: ValidationError(dict):
Key 'LOGIN_ID' not found in <{'CHANNEL': {'IS_LOGIN': 1, 'LOGIN_ID': '<redacted_username>',...>
Interrupted! Exiting... Guess it's because of this line and how |
c4f5858
to
5b241da
Compare
[plugins.soop][debug] Restored cookies: AbroadChk, _au, _au3rd, AuthTicket, BbsTicket, UserTicket, RDB, isBbs, AbroadVod, _ausa, _ausb
[cli][info] Found matching plugin soop for URL https://play.sooplive.co.kr/cooksuxtv
[plugins.soop][debug] Authentication using stored credentials was successful
[cli][info] Waiting for streams, retrying every 3.0 second(s)
[plugins.soop][debug] Authentication using stored credentials was successful
[plugins.soop][debug] Authentication using stored credentials was successful
[plugins.soop][debug] Authentication using stored credentials was successful
[plugins.soop][debug] Authentication using stored credentials was successful
Interrupted! Exiting... LGTM Thank you |
|
Sorry I completely skipped over that part. My mistake. (sl-6321) A:\folder>streamlink --loglevel=debug --output "{author} {id}.ts" --retry-streams 3 --retry-max 0 --hls-live-restart --soop-purge-credentials https://play.sooplive.co.kr/cooksuxtv best
[session][debug] Loading plugin: soop
[cli][debug] OS: Windows 10
[cli][debug] Python: 3.12.7
[cli][debug] OpenSSL: OpenSSL 3.0.15 3 Sep 2024
[cli][debug] Streamlink: 7.0.0+25.g5b241da9
[cli][debug] Dependencies:
[cli][debug] certifi: 2024.8.30
[cli][debug] isodate: 0.7.2
[cli][debug] lxml: 5.3.0
[cli][debug] pycountry: 24.6.1
[cli][debug] pycryptodome: 3.21.0
[cli][debug] PySocks: 1.7.1
[cli][debug] requests: 2.32.3
[cli][debug] trio: 0.27.0
[cli][debug] trio-websocket: 0.11.1
[cli][debug] urllib3: 2.2.3
[cli][debug] websocket-client: 1.8.0
[cli][debug] Arguments:
[cli][debug] url=https://play.sooplive.co.kr/cooksuxtv
[cli][debug] stream=['best']
[cli][debug] --loglevel=debug
[cli][debug] --player=C:\Program Files\DAUM\PotPlayer\PotPlayerMini64.exe
[cli][debug] --output={author} {id}.ts
[cli][debug] --retry-streams=3.0
[cli][debug] --retry-max=0
[cli][debug] --hls-live-restart=True
[cli][debug] --ffmpeg-ffmpeg=C:\ProgramData\chocolatey\bin\ffmpeg.exe
[cli][debug] --soop-username=********
[cli][debug] --soop-password=********
[cli][debug] --soop-purge-credentials=True
[cli][debug] --twitch-disable-ads=True
[cli][debug] --twitch-low-latency=True
[cli][debug] --twitch-api-header=[('Authorization', 'OAuth <redacted>')]
[plugins.soop][debug] Restored cookies: UserTicket, RDB, isBbs, _ausa, _ausb, AbroadChk, _au, _au3rd, AuthTicket, BbsTicket, AbroadVod
[cli][info] Found matching plugin soop for URL https://play.sooplive.co.kr/cooksuxtv
[plugins.soop][info] All credentials were successfully removed
[plugins.soop][debug] Attempting to login using username and password
[plugins.soop][debug] Saved cookies: AbroadChk, AbroadVod, _au, _au3rd, _ausa, _ausb, AuthTicket, BbsTicket, UserTicket, isBbs, RDB, BbsSaveTicket
[plugins.soop][info] Login was successful
[cli][info] Waiting for streams, retrying every 3.0 second(s)
[plugins.soop][info] All credentials were successfully removed
[plugins.soop][debug] Attempting to login using username and password
[plugins.soop][debug] Saved cookies: AbroadChk, AbroadVod, _au, _au3rd, _ausa, _ausb, AuthTicket, BbsTicket, UserTicket, isBbs, RDB, BbsSaveTicket
[plugins.soop][info] Login was successful
[plugins.soop][info] All credentials were successfully removed
[plugins.soop][debug] Attempting to login using username and password
[plugins.soop][debug] Saved cookies: AbroadChk, AbroadVod, _au, _au3rd, _ausa, _ausb, AuthTicket, BbsTicket, UserTicket, isBbs, RDB, BbsSaveTicket
[plugins.soop][info] Login was successful
Interrupted! Exiting... Seems to be working fine. It's up to you on how you want to implement the credentials purging while waiting for a stream - whether you want to to keeping purging the credentials as it's doing currently or not. Although, I expected passing in Just Purge
(sl-6321) A:\>streamlink --loglevel=debug --output "{author} {id}.ts" --retry-streams 3 --retry-max 0 --hls-live-restart --soop-purge-credentials
[cli][debug] OS: Windows 10
[cli][debug] Python: 3.12.7
[cli][debug] OpenSSL: OpenSSL 3.0.15 3 Sep 2024
[cli][debug] Streamlink: 7.0.0+25.g5b241da9
[cli][debug] Dependencies:
[cli][debug] certifi: 2024.8.30
[cli][debug] isodate: 0.7.2
[cli][debug] lxml: 5.3.0
[cli][debug] pycountry: 24.6.1
[cli][debug] pycryptodome: 3.21.0
[cli][debug] PySocks: 1.7.1
[cli][debug] requests: 2.32.3
[cli][debug] trio: 0.27.0
[cli][debug] trio-websocket: 0.11.1
[cli][debug] urllib3: 2.2.3
[cli][debug] websocket-client: 1.8.0
[cli][debug] Arguments:
[cli][debug] --loglevel=debug
[cli][debug] --player=C:\Program Files\DAUM\PotPlayer\PotPlayerMini64.exe
[cli][debug] --output={author} {id}.ts
[cli][debug] --retry-streams=3.0
[cli][debug] --retry-max=0
[cli][debug] --hls-live-restart=True
[cli][debug] --ffmpeg-ffmpeg=C:\ProgramData\chocolatey\bin\ffmpeg.exe
[cli][debug] --soop-username=********
[cli][debug] --soop-password=********
[cli][debug] --soop-purge-credentials=True
[cli][debug] --twitch-disable-ads=True
[cli][debug] --twitch-low-latency=True
[cli][debug] --twitch-api-header=[('Authorization', 'OAuth <redacted>')]
usage: streamlink [OPTIONS] <URL> [STREAM]
Use -h/--help to see the available options or read the manual at https://streamlink.github.io/ To add on to what I was saying, I assumed that since the combination of |
5b241da
to
7dc98cc
Compare
This is a one-time operation which doesn't make sense when retrying streams. I've moved it to the plugin constructor now, so that it's actually only run once. You can give this update a try if you want, otherwise I'm going to merge later. Thanks.
No, a plugin first has to be matched/resolved in order for any plugin-arguments to be relevant. Without an input URL, no plugins are resolved and initialized. |
Went ahead and tested it before I removed my conda env and it worked fine. Thanks again for your time and effort on this issue. (sl-6321) A:\folder>streamlink --loglevel=debug --output "{author} {id}.ts" --retry-streams 3 --retry-max 0 --hls-live-restart --soop-purge-credentials https://play.sooplive.co.kr/cooksuxtv best
[session][debug] Loading plugin: soop
[cli][debug] OS: Windows 10
[cli][debug] Python: 3.12.7
[cli][debug] OpenSSL: OpenSSL 3.0.15 3 Sep 2024
[cli][debug] Streamlink: 7.0.0+25.g7dc98cc3
[cli][debug] Dependencies:
[cli][debug] certifi: 2024.8.30
[cli][debug] isodate: 0.7.2
[cli][debug] lxml: 5.3.0
[cli][debug] pycountry: 24.6.1
[cli][debug] pycryptodome: 3.21.0
[cli][debug] PySocks: 1.7.1
[cli][debug] requests: 2.32.3
[cli][debug] trio: 0.27.0
[cli][debug] trio-websocket: 0.11.1
[cli][debug] urllib3: 2.2.3
[cli][debug] websocket-client: 1.8.0
[cli][debug] Arguments:
[cli][debug] url=https://play.sooplive.co.kr/cooksuxtv
[cli][debug] stream=['best']
[cli][debug] --loglevel=debug
[cli][debug] --player=C:\Program Files\DAUM\PotPlayer\PotPlayerMini64.exe
[cli][debug] --output={author} {id}.ts
[cli][debug] --retry-streams=3.0
[cli][debug] --retry-max=0
[cli][debug] --hls-live-restart=True
[cli][debug] --ffmpeg-ffmpeg=C:\ProgramData\chocolatey\bin\ffmpeg.exe
[cli][debug] --soop-username=********
[cli][debug] --soop-password=********
[cli][debug] --soop-purge-credentials=True
[cli][debug] --twitch-disable-ads=True
[cli][debug] --twitch-low-latency=True
[cli][debug] --twitch-api-header=[('Authorization', 'OAuth <redacted>')]
[plugins.soop][debug] Restored cookies: AbroadChk, _au, _au3rd, AuthTicket, BbsTicket, AbroadVod, RDB, isBbs, _ausa, _ausb
[plugins.soop][info] All credentials were successfully removed
[cli][info] Found matching plugin soop for URL https://play.sooplive.co.kr/cooksuxtv
[plugins.soop][debug] Attempting to login using username and password
[plugins.soop][debug] Saved cookies: AbroadChk, AbroadVod, _au, _au3rd, _ausa, _ausb, AuthTicket, BbsTicket, UserTicket, isBbs, RDB, BbsSaveTicket
[plugins.soop][info] Login was successful
[cli][info] Waiting for streams, retrying every 3.0 second(s)
[plugins.soop][debug] Authentication using stored credentials was successful
[plugins.soop][debug] Authentication using stored credentials was successful
[plugins.soop][debug] Authentication using stored credentials was successful
Interrupted! Exiting... |
Resolves #6320
@Infinitay please give this PR a quick test and report back with the results. This site requires a phone number when trying to register a new account, so I'm not able to test this myself as I'm surely not going to give them any of my personal data. Please also try purging the stored credentials, logging back in, and checking the stored auth credentials again. Thank you.
https://github.com/streamlink/streamlink/blob/master/CONTRIBUTING.md#pull-request-feedback
Instead of checking a list of specific/hardcoded cookies, this PR rewrites the auth logic by checking whether any cookies are available on the HTTP session (restored from the plugin cache) for the
.sooplive.co.kr
domain, and if that's the case, then it attempts to verify the cookies onGET https://afevent2.sooplive.co.kr/api/get_private_info.php
, which apparently is what their website uses as API endpoint. If the JSON response includes an emptyLOGIN_ID
field, then the user is not authenticated. The endpoint apparently seems to always return status 200, but I'm not fully sure.