Repository: yt-dlp/yt-dlp

Issue:
[GoPlay] Unable to download JSON metadata: HTTP Error 403: Forbidden
### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I remove or skip any mandatory\* field

### Checklist

- [X] I'm reporting a broken site
- [X] I've verified that I'm running yt-dlp version **2023.01.06** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)
- [X] I've checked that all provided URLs are playable in a browser with the same IP and same login details
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#video-url-contains-an-ampersand--and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command)
- [X] I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)
- [x] I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and I'm willing to share it if required

### Region

Belgium/EU

### Provide a description that is worded well enough to be understood

Unable to download JSON metadata: Error 403 forbidden.

Found an issue that might be related [(6016)](https://github.com/yt-dlp/yt-dlp/issues/6016) I am not knowledgable enough to confirm if same problem or not

using Debian on WSL2, Windows 10, same problem on Fedora 37

```
$ ~/yt-dlp -u <username> -p <passwd> https://www.goplay.be/video/de-verhulstjes/de-verhulstjes-s4/de-verhulstjes-s4-aflevering-1#autoplay
[GoPlay] Logging in
[GoPlay] Authenticating username
[GoPlay] Authenticating password
[GoPlay] Extracting URL: https://www.goplay.be/video/de-verhulstjes/de-verhulstjes-s4/de-verhulstjes-s4-aflevering-1#autoplay
[GoPlay] de-verhulstjes-s4-aflevering-1: Downloading webpage
[GoPlay] 7fdf2a78-5dfd-4e84-bdad-676fa6496da8: Downloading JSON metadata
ERROR: [GoPlay] None: Unable to download JSON metadata: HTTP Error 403: Forbidden (caused by <HTTPError 403: 'Forbidden'>); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
$ ~/yt-dlp -U
Latest version: 2023.01.06, Current version: 2023.01.06
yt-dlp is up to date (2023.01.06)
```

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
[debug] Command-line config: ['-vU', '-u', 'PRIVATE', '-p', 'PRIVATE', 'https://www.goplay.be/video/de-verhulstjes/de-verhulstjes-s4/de-verhulstjes-s4-aflevering-1#autoplay']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2023.01.06 [6becd25] (zip)
[debug] Python 3.9.2 (CPython x86_64 64bit) - Linux-5.15.79.1-microsoft-standard-WSL2-x86_64-with-glibc2.31 (OpenSSL 1.1.1n  15 Mar 2022, glibc 2.31)
[debug] exe versions: ffmpeg 4.3.5-0, ffprobe 4.3.5-0, rtmpdump 2.4
[debug] Optional libraries: Cryptodome-3.9.7, brotli-1.0.9, certifi-2020.06.20, mutagen-1.45.1, pyxattr-0.7.2, sqlite3-2.6.0, websockets-8.1
[debug] Proxy map: {}
[debug] Loaded 1760 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2023.01.06, Current version: 2023.01.06
yt-dlp is up to date (2023.01.06)
[GoPlay] Logging in
[GoPlay] Authenticating username
[GoPlay] Authenticating password
[GoPlay] Extracting URL: https://www.goplay.be/video/de-verhulstjes/de-verhulstjes-s4/de-verhulstjes-s4-aflevering-1#autoplay
[GoPlay] de-verhulstjes-s4-aflevering-1: Downloading webpage
[GoPlay] 7fdf2a78-5dfd-4e84-bdad-676fa6496da8: Downloading JSON metadata
ERROR: [GoPlay] None: Unable to download JSON metadata: HTTP Error 403: Forbidden (caused by <HTTPError 403: 'Forbidden'>); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
  File "/home/emversch/yt-dlp/yt_dlp/extractor/common.py", line 680, in extract
    ie_result = self._real_extract(url)
  File "/home/emversch/yt-dlp/yt_dlp/extractor/goplay.py", line 78, in _real_extract
    api = self._download_json(
  File "/home/emversch/yt-dlp/yt_dlp/extractor/common.py", line 1034, in download_content
    res = getattr(self, download_handle.__name__)(url_or_request, video_id, **kwargs)
  File "/home/emversch/yt-dlp/yt_dlp/extractor/common.py", line 998, in download_handle
    res = self._download_webpage_handle(
  File "/home/emversch/yt-dlp/yt_dlp/extractor/common.py", line 868, in _download_webpage_handle
    urlh = self._request_webpage(url_or_request, video_id, note, errnote, fatal, data=data, headers=headers, query=query, expected_status=expected_status)
  File "/home/emversch/yt-dlp/yt_dlp/extractor/common.py", line 825, in _request_webpage
    raise ExtractorError(errmsg, cause=err)

  File "/home/emversch/yt-dlp/yt_dlp/extractor/common.py", line 807, in _request_webpage
    return self._downloader.urlopen(self._create_request(url_or_request, data, headers, query))
  File "/home/emversch/yt-dlp/yt_dlp/YoutubeDL.py", line 3730, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "/usr/lib/python3.9/urllib/request.py", line 523, in open
    response = meth(req, response)
  File "/usr/lib/python3.9/urllib/request.py", line 632, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.9/urllib/request.py", line 561, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 641, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
```



Discussion:
Changed account checkbox: I am willing to provide my account
https://github.com/add-ons/plugin.video.viervijfzes/pull/114 might help us get this fixed here as well.

Resolving patch:
diff --git a/yt_dlp/extractor/goplay.py b/yt_dlp/extractor/goplay.py
--- a/yt_dlp/extractor/goplay.py
+++ b/yt_dlp/extractor/goplay.py
@@ -76,11 +76,11 @@ def _real_extract(self, url):
             }
 
         api = self._download_json(
-            f'https://api.viervijfzes.be/content/{video_id}',
-            video_id, headers={'Authorization': self._id_token})
+            f'https://api.goplay.be/web/v1/videos/long-form/{video_id}',
+            video_id, headers={'Authorization': 'Bearer %s' % self._id_token})
 
         formats, subs = self._extract_m3u8_formats_and_subtitles(
-            api['video']['S'], video_id, ext='mp4', m3u8_id='HLS')
+            api['manifestUrls']['hls'], video_id, ext='mp4', m3u8_id='HLS')
 
         info_dict.update({
             'id': video_id,


Test patch: