I currently have youtube-dl set up to download new videos from my favorite YouTubers automatically. It stores each video in author/yyyymmdd-author-videotitle.ext, and is set to not overwrite.

This works fairly well, with a good balance between readability and sortability. However, if the title of the video is changed, there's nothing telling youtube-dl that it's already downloaded.

Is there a solution to this that lets me keep the title intact?
The only thing I've thought of is to name files as yyyymmdd-videoid.ext, and keep an EXTM3U playlist with video titles. (EXTM3U playlist let you override titles.)

  • I don't have a solution, but a hint: what about md5ing (or, if you insist, applying the good ol' crc32 on) the video file and doing a byte-wise file comparison? This would, however, have to be programmed into youtube-dl because once it has finished doing its work, there is no "post-operation" you can do on it. (Because you want to prevent the tool from downloading in the first place if the video already exists!) – syntaxerror Aug 28 '15 at 18:01
  • That seems like a good idea, but how would I implement that with my current setup? I just have youtube-dl -w https://youtube.com/someplaylist. – IBPX Aug 28 '15 at 18:06
  • youtube-dl is handling playlist parsing, and downloads. – IBPX Aug 28 '15 at 18:09
  • I'd say you can't. You must find a way to tell youtube-dl to skip downloading when files are equal byte-wise. And this can only be done in code (i. e. by expanding it (-->feature request??)), because the current version of the script will already have downloaded the video when you will be returned to your bash prompt again - no matter if already there or not.--- In comparison, think of an observer/intercepting mechanism in web servers that can hook in before any JavaScript is ever loaded. The same thing you need to do here before youtube-dl attempts to download from YT. – syntaxerror Aug 28 '15 at 18:09
  • Well actually, I think I could set up a script to have youtube-dl download the videos to artist/.tmp/vid_id.ext, test the checksum against a file of all video checksums, and if it matches, delete it. If not, move it to the correct directory. – IBPX Aug 28 '15 at 18:13

Just use --download-archive FILENAME. The md5-based solution won't work since YouTube adds unique data to each video so that md5 fluctuates until you remove this data yourself.

| improve this answer | |
  • Thanks for the info and the link. Well, in case that data is always added at the same (relative) offset (e. g. 1024 bytes before the end of the video, or even at invariable starting and ending offsets), even this would be possible to handle. But I'd have to do a more thorough test to be sure. :) – syntaxerror Aug 28 '15 at 23:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.