Youtube-dl # want to download only the playlist (list of file name) to a text file - youtube-dl

I want to download only the File list (File names in a playlits) to a output text file using YouTube dl.
Q

Have a easy method. use this code
youtube-dl -i -o %(playlist_index)s-%(title)s --get-filename --skip-download https://www.youtube.com/playlist?list=PLpQLftDPSfXzLsww0KvSRerT00G4frW7L > log.txt
According to this code you will get the log.txt file as follows
-i or --ignore-errors => continue download videos, skip unavilable videos
After the -o you can create the template as you want with the file name.
If you only need the file name, use this section %(title)s
If you only need the file name and playlist index number, use this
section %(playlist_index)s-%(title)s
extension if needed %(playlist_index)s-%(title)s.%(ext)s
uploader if needed %(playlist_index)s-%(uploader)s%(title)s.%(ext)s
This way you can customize the code. You can read the "readme file" in youtube-dl here

Related

youtube-dl and aria2c - batch download based on a list with YouTube links and saving each file according to a list of file names

There is some ways of saving files downloaded with youtube-dl, like this:
youtube-dl -o "1-%(uploader)s%(title)s.%(ext)s
What I trying to do is, the same way as I have a URL.TXT containing each YouTube link, line by line, I would like to save the downloaded video files names according to a file name list, line by line.
Example:
URL.TXT
https://www.youtube.com/watch?v=video1
https://www.youtube.com/watch?v=video2
https://www.youtube.com/watch?v=video3
https://www.youtube.com/watch?v=video4
FILES_NAMES.TXT
VIDEO_FILE_NAME1
VIDEO_FILE_NAME2
VIDEO_FILE_NAME3
VIDEO_FILE_NAME4
So, in my directory, instead of using YouTube's video name, it would write the downloaded file using my file name's list. Example:
VIDEO_FILE_NAME1.MP4
VIDEO_FILE_NAME2.MP4
VIDEO_FILE_NAME3.MP4
VIDEO_FILE_NAME4.MP4
I'm using youtube-dl and aria2c for downloading. According to aria2c documentation, it says:
"
These options have exactly same meaning of the ones in the command-line options, but it just applies to the URIs it belongs to. Please note that for options in input file -- prefix must be stripped.
For example, the content of uri.txt is:
http://server/file.iso http://mirror/file.iso
dir=/iso_images
out=file.img
http://foo/bar
If aria2 is executed with -i uri.txt -d /tmp options, then file.iso is saved as /iso_images/file.img and it is downloaded from http://server/file.iso and http://mirror/file.iso. The file bar is downloaded from http://foo/bar and saved as /tmp/bar.
In some cases, out parameter has no effect. See note of --out option for the restrictions.
"
What about this syntax:
.\youtube-dl_2021-04-17.exe --format best --write-all-thumbnails --newline --external-downloader aria2c --external-downloader-args "-x 16 -s 10 -k 1M -i URL.TXT" -a .\URL.TXT
Where URL.TXT contains this:
https://youtu.be/video1
out=Video_Filne_Name_01
https://youtu.be/video2
out=Video_Filne_Name_02
https://youtu.be/video3
out=Video_Filne_Name_03
https://youtu.be/video4
out=Video_Filne_Name_04

How to use youtube-dl to download multiple videos in one txt file on mac?

I got a txt file with one video url per line and there're 50 urls in total. I know youtube-dl has the feature that allows you to download multiple videos with youtube-dl -a sample.txt.
But I need another way to do this because I'm also using a download tool called you-get which works better on some sites. However, it doesn't support download from a txt file. Last week I find a method to convert multiple files with ffmpeg with this command for i in *.m4a; do ffmpeg -i "$i" "${i%.*}.mp3"; done. I am wondering that is there any similar one line command like this one can help me read urls from the txt file and download with youtube-dl. I am using a mac btw.
More generally, xargs is specific tool for that approach.
Example:
cat sample.txt | xargs --max-args=1 you-get
takes each line from sample.txt, giving them as an argument to you-get. This ends up with 50 command lines:
you-get url1
you-get url2
you-get url[...]
and so on. This is a good tutorial, from tutorialspoint: https://www.tutorialspoint.com/unix_commands/xargs.htm

Solaris: Regex how to select files with certain filename

First of all, the server runs Solaris.
The context of my question is Informatica PowerCenter.
I need to list files situated in the Inbox directory. Basically, the outcome should be one file list by type of file. The different file types are distinguished by the file name. I don't want to update the script every time a new file type starts to exist so I was thinking of a parameterized shell script with the regex, the inbox directory and the file list
An example:
/Inbox/ABC.DEFGHI.PAC.AE.1236547.49566
/Inbox/ABC.DEFGHI.PAC.AE.9876543.21036
/Inbox/DEF.JKLMNO.PAC.AI.1236547.49566
... has to result in 2 list files containing the path and file name of the listed files:
/Inbox/PAC.AE.FILELIST
-->/Inbox/ABC.DEFGHI.PAC.AE.1236547.49566
-->/Inbox/ABC.DEFGHI.PAC.AE.9876543.21036
/Inbox/PAC.AI.FILELIST
-->/Inbox/DEF.JKLMNO.PAC.AI.1236547.49566
Assuming all input files follow the convention you indicate (when splitting on dots, the 3rd and 4th column determine the type), this script might do the trick:
#! /usr/bin/env bash
# First parameter or current directory
INPUTDIR=${1:-.}
# Second parameter (or first input directory if not given)
OUTPUTDIR=${2:-$INPUTDIR}
# Filter out directories
INPUTFILES=$(ls -p $INPUTDIR | grep -v "/")
echo "Input: $INPUTDIR, output: $OUTPUTDIR"
for FILE in $INPUTFILES; do
FILETYPE=$(echo $FILE | cut -d. -f3,4)
COLLECTION_FILENAME="$OUTPUTDIR/${FILETYPE:-UNKNOWN}.FILELIST"
echo "$FILE" >> $COLLECTION_FILENAME
done
Usage:
./script.sh Inbox Inbox/collections
Will read all files (not directories) from Inbox, and write the collection files to Inbox/collections. Filenames inside collections should be sorted alphabetically.

Adding extension to file via filewatcher in WebStorm 9

I frequently have to send JS files through Outlook, which means that I have to modify the extension of the file to txt or the like so the recipient can receive it. I'd ideally like to implement a file watcher in WebStorm to simply output a child file with .txt appended to it similar to how it'll show a child CSS file for a LESS file.
To sum up, given a file named "file.js", I would like it to output a "file.js.txt" as well whenever I make a change.
Is there any simple way to go about doing this?
You can create a .bat file (shell script) that would copy files and then configure it as a file watcher. Like:
copy %1 %2 /Y
Watcher settings:
Program: path/to/your/batfile.bat
Arguments: $FileName$ $FileName$.txt
Working directory: $FileDir$
Output paths: $FileName$.txt

Unix List Files After Modified Date of a File

I know I can use ls -ltr to list files in time order, but is there a way to execute a command to only list the files created after the creation date of another file (let's call it acknowledge.tmp)?
I assume that the command will look something like this:
ls -1 /path/to/directory | ???
Use the -newer option to the find command:
-newer file True if the current file has been modi-
fied more recently than the argument
file.
So your command would be
find /path/to/directory -newer acknowledge.tmp
However, this will descend into, and return results from, sub-directories