I am using the last command from this SO answer https://stackoverflow.com/a/54818581/80353
cap()(cd /tmp;rm -f *.vtt;youtube-dl --skip-download --write-auto-sub "$1";sed '1,/^$/d' *.vtt|sed 's/<[^>]*>//g'|awk -F. 'NR%8==1{printf"%s ",$1}NR%8==3'|tee cap)
What this command currently do
- This command will download captions for a youtube video as a .vtt file and
- then print out on the terminal the simplified version of the .vtt file
This command works as described.
How to use this command
In the terminal I will run the above command once and then run cap $youtube_url
What I like to have
I would like to modify the original cap()
function so that the original behavior remains with one extra part
- This command will download captions for a youtube video as a .vtt file (unchanged)
- then print out the simplified version of the .vtt file into another file that's stated as parameter $2 (changed)
How I expect to call the new command
Originally, I would call the original command as
cap $youtube_url
Now I like to do this
cap $youtube_url $relative_or_absolute_path_of_text_or_markdown_file
How do I modify the original cap command to achieve the outcome I want?