Comments (9)
Have you tried --exec [WHEN:]CMD
I haven't tried exactly as you have it, but with an RSS feed for a podcast it works, so perhaps this will work for you also;
yt-dlp -i --embed-thumbnail --add-metadata --extract-audio --audio-format mp3 --output "%(playlist_title)s/%(playlist_index)s - %(title)s.%(ext)s" --download-archive "downloaded_archive.txt" --exec "after_video:/bin/mv -v downloaded_archive.txt %(playlist_title)s/downloaded_archive.txt" <playlist>
See also for WHEN
-
Line 2795 in 3e35aa3
--exec [WHEN:]CMD Execute a command, optionally prefixed with
when to execute it, separated by a ":".
Supported values of "WHEN" are the same as
that of --use-postprocessor (default:
after_move). Same syntax as the output
template can be used to pass any field as
arguments to the command. If no fields are
passed, %(filepath,_filename|)q is appended
to the end of the command. This option can
be used multiple times
from yt-dlp.
Or is it even possible?
Not without an external script.
Open feature request #953
from yt-dlp.
Have you tried --exec [WHEN:]CMD
On repeated runs, this suggestion will prevent yt-dlp from actually checking the archive before downloading, and mv
would either clobber the existing archive file or fail
from yt-dlp.
This works (updated from %()s
to %()q
as per comments below from @bashonly)
Repeated runs will cause repeated entries for each ID in downloaded_archive.txt
Solved with sort -u downloaded_archive.txt -o downloaded_archive.txt
The rest is on you @cococry... π
yt-dlp -i --embed-thumbnail --add-metadata --extract-audio --audio-format mp3 --output "%(playlist_title)s/%(playlist_index)s - %(title)s.%(ext)s" --download-archive "downloaded_archive.txt" --exec "after_video:/bin/cat downloaded_archive.txt | tee -a %(playlist_title)q/downloaded_archive.txt; rm downloaded_archive.txt" https://youtube.com/playlist?list=PL0vfts4VzfNjQOM9VClyL5R0LeuTxlAR3
from yt-dlp.
A word of caution: using %()s
in an --exec
arg is NEVER safe -- if the value contains an '
it can escape your quoting and execute arbitrary shell commands
from yt-dlp.
A word of caution: using
%()s
in an--exec
arg is NEVER safe -- if the value contains an'
it can escape your quoting and execute arbitrary shell commands
Sure, but that's something that yt-dlp
should manage. After all, it's yt-dlp
that's expanding the values of any %()s
used.
from yt-dlp.
Sure, but that's something that
yt-dlp
should manage. After all, it'syt-dlp
that's expanding the values of any%()s
used.
No. You are responsible for how you use --exec
. And %()q
should always be used, NOT %()s
.
from yt-dlp.
Sure, but that's something that
yt-dlp
should manage. After all, it'syt-dlp
that's expanding the values of any%()s
used.No. You are responsible for how you use
--exec
. And%()q
should always be used, NOT%()s
.
Ah, so yt-dlp
does mitigate those sort of issues by escaping/quoting problematic values that it expands.
Is there a documented example and explanation of why %()q
should be favoured over %()s
when using --exec
? - I couldn't find anything, other than a passing mention of it in the README.md
. π«€
from yt-dlp.
https://github.com/yt-dlp/yt-dlp#output-template
- More Conversions:
q
= a string quoted for the terminal (flag#
to split a list into different arguments)
Again, though, you are responsible for how you use --exec
. It is basically just running commands with your shell. Your shell's documentation doesn't come with a warning telling you not to rm -rf /
from yt-dlp.
Related Issues (20)
- Get the output file name in lower case HOT 1
- Add support for site https://listeamed.net/ HOT 1
- The same link and command download much larger files on Linux than on Windows. HOT 4
- False test failure of download test for m3u8 format when first segment is small HOT 2
- "orf:on saves audio track with wrong language" - how to report this properly? HOT 3
- Does anyone have all the historical videos of ν루S2 sol3712 ? I want to buy them for free. HOT 1
- twitter changed domain name to x.com HOT 1
- Download thumbnails for playlist items when using `--flat-playlist` HOT 1
- [TikTok] Support for Collections HOT 1
- chatturbate
- tiktok dosnt work everytime it should HOT 2
- Unsupported URL error on Twitter.com / X.com: x.com does not work for yt-dlp HOT 3
- How to download part of video not whole video οΌFor example 10s - 20s HOT 3
- [TikTok] Support for Photos HOT 2
- [crunchyroll] Failed to download stream info: HTTP Error 403: Forbidden HOT 5
- homeloveporn.py in your directory HOT 5
- --download-sections "*10-20" how to add use python HOT 2
- Access Denied When Access Tiktok Download Video URL HOT 4
- not support x.com video HOT 3
- Falling back to generic extractor for voyo.nova.cz
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yt-dlp.