Skip to content

plugins.afreeca: rename to soop #6247

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 5 commits into from
Oct 16, 2024

Conversation

minibox24
Copy link
Contributor

Resolves #6246

Worked on changing hosts as afreecatv.com was rebranded to sooplive.co.kr.
Fixed login functionality that was not working due to this.

@bastimeyer
Copy link
Member

Thanks for the PR.

Considering that they completely rebranded, it doesn't make sense keeping the "afreeca" plugin name.

So, could you please

  1. rename the plugin and its test file from afreeca to sooplive
  2. rename the plugin class, the HLS subclasses and test class to SoopLive
  3. change the order of host names, both in the plugin module metadata at the top as well as in the plugin-matcher regex, so that afreeca comes last (as it's only a fallback host name now)
  4. change the order of test URLs

@bastimeyer bastimeyer added the plugin issue A Plugin does not work correctly label Oct 15, 2024
@bastimeyer bastimeyer changed the title fix: change to sooplive.co.kr plugins.afreeca: rename to sooplive Oct 15, 2024
@minibox24 minibox24 force-pushed the plugins/afreeca/soop branch from 3d45a7d to 909ede1 Compare October 15, 2024 13:50
@minibox24
Copy link
Contributor Author

I've made the changes based on the feedback you gave me. In Korea, it is referred to as 'soop' rather than 'sooplive,' so I changed the plugin name to soop.

I was wondering if there's any way to alias the plugin name so that users don't find it inconvenient when they have to change --afreeca-username to --soop-username?

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.

so I changed the plugin name to soop

👍

I was wondering if there's any way to alias the plugin name so that users don't find it inconvenient when they have to change --afreeca-username to --soop-username?

Plugin arguments currently don't support aliases (similar to the argparse module). This requires adding duplicates and suppressing them, so they're not listed in the docs, man page and help output. Their values then need to be set in place of the regular arguments if they are missing.

However, the values of suppressed arguments currently get discarded/ignored when set, because there wasn't a use-case for this yet. I've just changed this behavior in #6249 which I just opened. You'll have to rebase your PR onto the new HEAD of master once #6249 got merged in order to test this.

Another limitation of suppressed plugin arguments is that any argument requirements will be ignored, so if only --afreeca-username is set, it won't ask for a value of --afreeca-password/--soop-password.

Here's a diff that would add support for the old arguments:

diff --git a/src/streamlink/plugins/soop.py b/src/streamlink/plugins/soop.py
index d41eb7e9..073a2d23 100644
--- a/src/streamlink/plugins/soop.py
+++ b/src/streamlink/plugins/soop.py
@@ -8,6 +8,7 @@ $metadata author
 $metadata title
 """
 
+import argparse
 import logging
 import re
 
@@ -60,7 +61,37 @@ class SoopHLSStream(HLSStream):
     metavar="STREAM_PASSWORD",
     help="The password for the stream.",
 )
+@pluginargument(
+    "afreeca-username",
+    argument_name="afreeca-username",
+    sensitive=True,
+    help=argparse.SUPPRESS,
+)
+@pluginargument(
+    "afreeca-password",
+    argument_name="afreeca-password",
+    sensitive=True,
+    help=argparse.SUPPRESS,
+)
+@pluginargument(
+    "afreeca-purge-credentials",
+    argument_name="afreeca-purge-credentials",
+    action="store_true",
+    help=argparse.SUPPRESS,
+)
+@pluginargument(
+    "afreeca-stream-password",
+    argument_name="afreeca-stream-password",
+    help=argparse.SUPPRESS,
+)
 class Soop(Plugin):
+    _OPTIONS_DEPRECATED = {
+        "afreeca-username": "username",
+        "afreeca-password": "password",
+        "afreeca-purge-credentials": "purge-credentials",
+        "afreeca-stream-password": "stream-password",
+    }
+
     _re_bno = re.compile(r"window\.nBroadNo\s*=\s*(?P<bno>\d+);")
 
     CHANNEL_API_URL = "https://live.sooplive.co.kr/afreeca/player_live_api.php"
@@ -99,6 +130,11 @@ class Soop(Plugin):
 
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
+
+        for opt_deprecated, opt_name in self._OPTIONS_DEPRECATED.items():
+            if (opt_value := self.options.get(opt_deprecated)) and not self.options.get(opt_name):
+                self.options.set(opt_name, opt_value)
+
         self._authed = (
             self.session.http.cookies.get("PdboxBbs")
             and self.session.http.cookies.get("PdboxSaveTicket")

I'll have a look at adding plugin argument aliases in the future, so plugins don't have to deal with this nonsense.

@minibox24
Copy link
Contributor Author

image

nice

@bastimeyer
Copy link
Member

@minibox24 Could you please quickly check and see if the authentication is working for these kinds of streams:
#6246 (comment)

If everything's working, then we can merge this.

Thanks.

@bastimeyer bastimeyer changed the title plugins.afreeca: rename to sooplive plugins.afreeca: rename to soop Oct 15, 2024
@minibox24
Copy link
Contributor Author

@minibox24 Could you please quickly check and see if the authentication is working for these kinds of streams: #6246 (comment)

If everything's working, then we can merge this.

Thanks.

I tested it, and everything works fine.

@bastimeyer bastimeyer merged commit 516d6ef into streamlink:master Oct 16, 2024
23 checks passed
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.afreeca: The afreeca domain has changed to https://www.sooplive.co.kr/
2 participants