Repository: streamlink/streamlink

Issue:
plugins.pandalive: HTTP status 400 on API call
### Checklist

- [X] This is a [plugin issue](https://streamlink.github.io/plugins.html) and not [a different kind of issue](https://github.com/streamlink/streamlink/issues/new/choose)
- [X] [I have read the contribution guidelines](https://github.com/streamlink/streamlink/blob/master/CONTRIBUTING.md#contributing-to-streamlink)
- [X] [I have checked the list of open and recently closed plugin issues](https://github.com/streamlink/streamlink/issues?q=is%3Aissue+label%3A%22plugin+issue%22)
- [X] [I have checked the commit log of the master branch](https://github.com/streamlink/streamlink/commits/master)

### Streamlink version

streamlink 6.2.0

### Description

the livestreams can't resolved on pandalive
it was always resolved 400 Client Error 

### Debug log

```text
C:\Users\Jerry>C:\APP\Streamlink\bin\streamlink.exe https://www.pandalive.co.kr/live/play/pocet00 --loglevel=debug
[session][debug] Plugin pandalive is being overridden by C:\Users\Jerry\AppData\Roaming\streamlink\plugins\pandalive.py
[cli][debug] OS:         Windows 10
[cli][debug] Python:     3.11.5
[cli][debug] OpenSSL:    OpenSSL 3.0.9 30 May 2023
[cli][debug] Streamlink: 6.2.0
[cli][debug] Dependencies:
[cli][debug]  certifi: 2023.7.22
[cli][debug]  isodate: 0.6.1
[cli][debug]  lxml: 4.9.3
[cli][debug]  pycountry: 22.3.5
[cli][debug]  pycryptodome: 3.18.0
[cli][debug]  PySocks: 1.7.1
[cli][debug]  requests: 2.31.0
[cli][debug]  trio: 0.22.2
[cli][debug]  trio-websocket: 0.10.4
[cli][debug]  typing-extensions: 4.7.1
[cli][debug]  urllib3: 2.0.4
[cli][debug]  websocket-client: 1.6.3
[cli][debug] Arguments:
[cli][debug]  url=https://www.pandalive.co.kr/live/play/pocet00
[cli][debug]  --loglevel=debug
[cli][debug]  --ffmpeg-ffmpeg=C:\APP\Streamlink\ffmpeg\ffmpeg.exe
[cli][info] Found matching plugin pandalive for URL https://www.pandalive.co.kr/live/play/pocet00
[plugins.pandalive][debug] Media code: pocet00
error: Unable to open URL: https://api.pandalive.co.kr/v1/live/play (400 Client Error: Bad Request for url: https://api.pandalive.co.kr/v1/live/play)
```



Discussion:
> [session][debug] Plugin pandalive is being overridden by C:\Users\Jerry\AppData\Roaming\streamlink\plugins\pandalive.py

You are sideloading a different version of that plugin from a custom source.
https://streamlink.github.io/cli/plugin-sideloading.html

There won't be any support for custom plugin versions.

The issue however also exists on the regular plugin, which was updated last a year ago in #4591.

Resolving patch:
diff --git a/src/streamlink/plugins/pandalive.py b/src/streamlink/plugins/pandalive.py
--- a/src/streamlink/plugins/pandalive.py
+++ b/src/streamlink/plugins/pandalive.py
@@ -18,7 +18,7 @@
 
 
 @pluginmatcher(re.compile(
-    r"https?://(?:www\.)?pandalive\.co\.kr/",
+    r"https?://(?:www\.)?pandalive\.co\.kr/live/play/[^/]+",
 ))
 class Pandalive(Plugin):
     def _get_streams(self):
@@ -34,10 +34,14 @@ def _get_streams(self):
 
         json = self.session.http.post(
             "https://api.pandalive.co.kr/v1/live/play",
+            headers={
+                "Referer": self.url,
+            },
             data={
                 "action": "watch",
                 "userId": media_code,
             },
+            acceptable_status=(200, 400),
             schema=validate.Schema(
                 validate.parse_json(),
                 validate.any(


Test patch:
diff --git a/tests/plugins/test_pandalive.py b/tests/plugins/test_pandalive.py
--- a/tests/plugins/test_pandalive.py
+++ b/tests/plugins/test_pandalive.py
@@ -6,12 +6,6 @@ class TestPluginCanHandleUrlPandalive(PluginCanHandleUrl):
     __plugin__ = Pandalive
 
     should_match = [
-        "http://pandalive.co.kr/",
-        "http://pandalive.co.kr/any/path",
-        "http://www.pandalive.co.kr/",
-        "http://www.pandalive.co.kr/any/path",
-        "https://pandalive.co.kr/",
-        "https://pandalive.co.kr/any/path",
-        "https://www.pandalive.co.kr/",
-        "https://www.pandalive.co.kr/any/path",
+        "https://www.pandalive.co.kr/live/play/pocet00",
+        "https://www.pandalive.co.kr/live/play/rladbfl1208",
     ]