Repository: yt-dlp
Issue: Respect `--ignore-errors` for `--write-info-json`
Labels: bug,question

### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field

### Checklist

- [X] I'm asking a question and **not** reporting a bug or requesting a feature
- [X] I've looked through the [README](https://github.com/yt-dlp/yt-dlp#readme)
- [X] I've verified that I'm running yt-dlp version **2023.07.06** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)
- [X] I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar questions **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)

### Please make sure the question is worded well enough to be understood

video in question is xo5qfiAR6GY

yt-dlp --write-info-json --continue --ignore-errors  xo5qfiAR6GY

It downloads perfectly on windows but getting error on linux

I thought "/" on the title causing the issue but video downloads without any issue when not using "--write-info-json" parameters.

is there any way to ignore json errors and keep downloading the video and what causing this error?


![image](https://github.com/yt-dlp/yt-dlp/assets/88805679/b1a47053-7c32-43d5-a5a7-c37506868ebf)


### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [ ] If using API, add `'verbose': True` to `YoutubeDL` params instead
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
yt-dlp -vU --write-info-json --continue --ignore-errors  xo5qfiAR6GY
[debug] Command-line config: ['-vU', '--write-info-json', '--continue', '--ignore-errors', 'xo5qfiAR6GY']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.07.06 [b532a3481] (zip)
[debug] Python 3.10.4 (CPython x86_64 64bit) - Linux-5.10.0-0.bpo.15-amd64-x86_64-with-glibc2.28 (OpenSSL 1.1.1n  15 Mar 2022, glibc 2.28)
[debug] exe versions: ffmpeg 4.1.9-0, ffprobe 4.1.9-0
[debug] Optional libraries: certifi-2023.05.07, sqlite3-2.6.0
[debug] Proxy map: {}
[debug] Loaded 1855 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Available version: stable@2023.07.06, Current version: stable@2023.07.06
Current Build Hash: cedf44a9cf3c241520a692c1006d276e6f434d4d945727c47cb1a70d32953f4a
yt-dlp is up to date (stable@2023.07.06)
[youtube] Extracting URL: xo5qfiAR6GY
[youtube] xo5qfiAR6GY: Downloading webpage
[youtube] xo5qfiAR6GY: Downloading ios player API JSON
[youtube] xo5qfiAR6GY: Downloading android player API JSON
[debug] [youtube] Extracting signature function js_f2f137c6_100
[debug] Loading youtube-sigfuncs.js_f2f137c6_100 from cache
[debug] Loading youtube-nsig.f2f137c6 from cache
[debug] [youtube] Decrypted nsig LZhJTdXCb3whrlvU => Yg07V6B38_R2qQ
[youtube] xo5qfiAR6GY: Downloading m3u8 information
[debug] Sort order given by extractor: quality, res, fps, hdr:12, source, vcodec:vp9.2, channels, acodec, lang, proto
[debug] Formats sorted by: hasvid, ie_pref, quality, res, fps, hdr:12(7), source, vcodec:vp9.2(10), channels, acodec, lang, proto, size, br, asr, vext, aext, hasaud, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] xo5qfiAR6GY: Downloading 1 format(s): 137+251
[info] Writing video metadata as JSON to: 브레이브걸스(Brave Girls)_Thank you⧸땡큐 수트댄스_점핑안무 점핑 점핑피트니스 최신점핑 점핑작품 점핑동작 최신가요 다이어트점핑 쉬운점핑 트램펄린안무⧸에어로점핑 [xo5qfiAR6GY].info.json
ERROR: Cannot write video metadata to JSON file 브레이브걸스(Brave Girls)_Thank you⧸땡큐 수트댄스_점핑안무 점핑 점핑피트니스 최신점핑 점핑작품 점핑동작 최신가요 다이어트점핑 쉬운점핑 트램펄린안무⧸에어로점핑 [xo5qfiAR6GY].info.json
Traceback (most recent call last):
  File "server/yt-dlp/yt_dlp/YoutubeDL.py", line 4073, in _write_info_json
    write_json_file(self.sanitize_info(ie_result, self.params.get('clean_infojson', True)), infofn)
  File "server/yt-dlp/yt_dlp/utils/_utils.py", line 264, in write_json_file
  File "server/.pyenv/versions/3.10.4/lib/python3.10/tempfile.py", line 553, in NamedTemporaryFile
    (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
  File "server/.pyenv/versions/3.10.4/lib/python3.10/tempfile.py", line 256, in _mkstemp_inner
    fd = _os.open(file, flags, 0o600)
OSError: [Errno 36] File name too long: '브레이브걸스(Brave Girls)_Thank you⧸땡큐 수트댄스_점핑안무 점핑 점핑피트니스 최신점핑 점핑작품 점핑동작 최신가요 다이어트점핑 쉬운점핑 트램펄린안무⧸에어로점핑 [xo5qfiAR6GY].info.json.4po3w3rg.tmp'
```