yt-dlp: ERROR: unable to download video data: [Errno 13] Permission denied:

Checklist

  • I’m reporting a broken site support issue
  • I’ve verified that I’m running yt-dlp version 2021.07.07
  • I’ve checked that all provided URLs are alive and playable in a browser
  • I’ve checked that all URLs and arguments with special characters are properly quoted or escaped
  • I’ve searched the bugtracker for similar bug reports including closed ones
  • I’ve read bugs section in FAQ

Verbose log

[debug] Encodings: locale cp1252, fs utf-8, out utf-8, pref cp1252
[debug] yt-dlp version 2021.07.07 (exe)
[debug] Python version 3.9.6 (CPython 64bit) - Windows-10-10.0.19043-SP0
[debug] exe versions: ffmpeg 4.3.1-2020-11-19-full_build-www.gyan.dev, ffprobe 4.3.1-2020-11-19-full_build-www.gyan.dev
[debug] Proxy map: {}
[debug] [generic] Extracting URL: _Link Redacted_
[generic] master: Requesting header
WARNING: [generic] Falling back on generic information extractor.
[generic] master: Downloading webpage
[generic] master: Downloading m3u8 information
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, vcodec:vp9.2(10), acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[debug] Downloading subtitles: de, he, fr, es, en, ru, yi

Description

when using native downloader a lot of times it fails with error “ERROR: unable to download video data: [Errno 13] Permission denied:” but if i retry it works, how do i make it retry automatically ? i tried --retries infinite but its not retrying

(i didnt checkbox latest version 2021.07.07 because i am using version built today but also fails on latest “stable”)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 22 (9 by maintainers)

Commits related to this issue

Most upvoted comments

$ yt-dlp -vci -R5 -f mp4,webm --write-description --write-info-json --all-subs --write-thumbnail --add-metadata https://www.youtube.com/c/DecimalZ/videos
...
[youtube:tab] UCpzhzlCa-QgORPIkddepgSg page 1: Downloading API JSON
[info] Writing playlist metadata as JSON to: Decimal Z - Videos [UCpzhzlCa-QgORPIkddepgSg].info.json
ERROR: Cannot write playlist metadata to JSON file Decimal Z - Videos [UCpzhzlCa-QgORPIkddepgSg].info.json
Traceback (most recent call last):
  File "/snap/yt-dlp/1/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 3591, in _write_info_json
    write_json_file(self.sanitize_info(ie_result, self.params.get('clean_infojson', True)), infofn)
  File "/snap/yt-dlp/1/lib/python3.8/site-packages/yt_dlp/utils.py", line 1842, in write_json_file
    tf = tempfile.NamedTemporaryFile(**compat_kwargs(args))
  File "/usr/lib/python3.8/tempfile.py", line 679, in NamedTemporaryFile
    (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
  File "/usr/lib/python3.8/tempfile.py", line 389, in _mkstemp_inner
    fd = _os.open(file, flags, 0o600)
PermissionError: [Errno 13] Permission denied: 'Decimal Z - Videos [UCpzhzlCa-QgORPIkddepgSg].info.json.y1jfkxmi.tmp'

The command fails each time, also during each regular download (without any parameters).

Maybe snap version of yt-dlp doesn’t have access to the temporary directory? Or it’s using the wrong path?

$ mount | grep dlp
/var/lib/snapd/snaps/yt-dlp_1.snap on /snap/yt-dlp/1 type squashfs (ro,nodev,relatime,x-gdu.hide)
nsfs on /run/snapd/ns/yt-dlp.mnt type nsfs (rw)

Workaround

I’ve removed the snap version and installed manually and it works fine.