yt-dlp: [bug] `-N` skipping fragments?

Sometimes file will fail to download (or merge, I’m really not sure since I haven’t seen any errors, though maybe I just missed them). This happened before I started using --path temp:D:\Temp\ but since using that, temporary files are getting left behind there for files that didn’t completely download (in this case fragments 377-745 and respective .part and .ytdl files. I understand the default is to resume downloads with previously downloaded fragments but it should still clear up all the fragments for that respective download on completion. The skipping of download might not be a bug but I was curious as to what --fragment-retries “infinite” really does since I have it set, I assume it is regarding that fragment as unavailable and by default getting skipped but I want it to retry until it finds it instead (at least for a minute).

Command (temporary switched back to batch files since the frontend I was using didn’t like some stuff):

yt-dlp -a "CR todownload - valarian.txt" -o "crunchyroll.com\%%(series)s - S%%(season_number)sE%%(episode_number)s - %%(episode)s - %%(epoch)s.%%(ext)s" --embed-subs --sub-lang en --cookies cookies-crunchyroll-com.txt --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0" --fragment-retries "infinite" -N 3 --no-mtime --download-archive archive.txt --path temp:D:\Temp\

_Originally posted by @Jules-A in https://github.com/yt-dlp/yt-dlp/issues/359#issuecomment-853906485_

About this issue

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

Commits related to this issue

Most upvoted comments

I need some way to check if mytitle contains a certain string so it can use the fallback but I’m hopeless at this… -o “%%(extractor)s%%(mytitle|title)s - %%(myindex)s.%%(ext)s” --parse-metadata “webpage_url:#%%(myindex)s” --parse-metadata “%%(series)s - S%%(season_number)sE%%(episode_number)s:%%(mytitle)s”

You were on the right track. But there are 2 issues

  1. Even if the fields are absent, mytitle will still be popylated with something like NA - SNAENA
  2. The right side of | is treated literally, not as the name of a field

This is what you want:

$ yt-dlp "https://www.zee5.com/movies/details/krishna-the-birth/0-0-63098#50" "https://zee5.com/tvshows/details/krishna-balram/0-6-1871/episode-1-the-test-of-bramha/0-1-233402#20" -O "%(extractor)s\%(title)s - %(myindex)s.%(ext)s" --parse-metadata "webpage_url:#%(myindex)s" --parse-metadata "%(series)s - S%(season_number)sE%(episode_number)s:^(?P<title>.+ - S\d+E\d+)$" --output-na-placeholder ""
WARNING: Could not interpret video %(series)s - S%(season_number)sE%(episode_number)s as "^(?P<title>.+ - S\d+E\d+)$"
Zee5\Krishna - The Birth - 50.mp4
Zee5\Krishna Balram - S1E1 - 20.mp4

This will use %(series)s - S%(season_number)sE%(episode_number)s if all 3 of these fields are present, else it will use %(title)s. ofc, change -O to -o and escape the % as needed