Subversion Repositories yt_downloader

Rev

Rev 14 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
9 daniel-mar 1
 
16 daniel-mar 2
# ViaThinkSoft YouTube Downloader 2.3.1
9 daniel-mar 3
 
16 daniel-mar 4
YouTube Downloader is a tool for Linux. It is a wrapper for youtube-dl (or any compatible forks) and offers several additional functionalities.
5
 
6
Special features:
7
- Downloading of all videos of a channel or a playlist.
8
- Automatic searching inside channels or globally (whole YouTube)
9
- You can download videos and audio files.
10
- YouTube-IDs can be automatically written in the ID tag of downloaded mp3 files.
11
- An automatically managed list of already downloaded videos allows you to move away from the downloaded files without the risk of downloading the already downloaded files again.
12
- An automatically managed list of failed downloads will avoid that a video, which is not available anymore, is tried to be downloaded too many times.
13
- Creation of SFV and/or MD5 checksum files.
14
- The tool is fully CLI and is optimized for cronjobs.
15
 
9 daniel-mar 16
## Syntax
17
 
16 daniel-mar 18
    ./ytdwn [-t|--type v:[ext]|a:[ext]] Type video or audio and preferred output type, e.g. 'a:mp3' (default v:)
19
            [-o|--outputDir <dir>]      Default current working directory
9 daniel-mar 20
            [-a|--alreadyDownloaded <file>]
16 daniel-mar 21
            [-f|--failList <file> <treshold>]  This file logs failures.
22
            [-F|--failTreshold <num>]   Don't download if failure (-f) treshold is reached. (Default: 3)
23
            [-V|--version]              Shows the version
24
            [-v|--verbose]              Displays verbose information to STDOUT
25
            [-h|--help]                 Shows the help page.
26
            [-N|--no-mp3-tagtransfer]   Disables transfer of video ID to MP3 ID tag.
27
                                        This feature requires the package "id3v2".
28
            [-H|--checksumMode]         Which checksum files shall be written for new files.
29
                                        Must be 'None', 'MD5', 'SFV', or 'MD5,SFV'.
30
            [-T|--default-template <t>] Sets default filename template.
9 daniel-mar 31
                                        (Default: '%(title)s-%(id)s.%(ext)s')
16 daniel-mar 32
            [-X|--extra-args <args>]    Additional arguments passed through youtube-dl. (Default "-ic")
33
            [-A|--api-key <file|key>]   Specifies the API key, or a file containing the API key
9 daniel-mar 34
                                        (Default: ~/.yt_api_key)
16 daniel-mar 35
            [--cookies=<file>]          A netscape compatible cookie file (for age restricted videos
9 daniel-mar 36
                                        (Default: ~/.yt_cookkies)
16 daniel-mar 37
            [-C|--resultcache <file>]   Allows video results to be cached in this file;
38
                                        only for playlists or channels.
39
            [-O|--create-outputdir]     Allows creation of the output directories, recursively.
40
            [--downloader=exename]      Binary file name of a youtube-dl compatible tool.
41
                                        Currently supported/tested: youtube-dl, youtube-dlc, yt-dlp.
9 daniel-mar 42
            [--]
43
            <resource> [<resource> ...]
44
 
45
For all paths (outputDir, alreadyDownloaded, apikey, failList and resultcache), you can use the
46
term '[listname]' which will be replaced by the basename of the current list file (without file extension).
47
For example you can do following:
48
 
49
    ./ytdwn -o 'downloads/[listname]' -- list:*.list
50
 
51
If no list file is processed, it will be replaced with nothing.
52
 
53
The "alreadyDownloaded" argument contains a file which will be managed by ytdwn.
54
It will contain all video IDs which have been downloaded. This allows you to
55
move away the already downloaded files, and ytdwn will not download them again.
56
 
57
Examples for type:
58
- `v:` = best video quality
59
- `a:` = best audio only
60
- `a:mp3` = audio only, mp3
61
- Valid audio formats according to "man youtube-dl" are
62
  "best", "aac", "flac", "mp3", "m4a", "opus", "vorbis", or "wav"; "best" by default
63
 
64
A `<resource>` can be one of the following:
65
 
66
    vid:<video ID>
67
    vurl:<youtube video URL>
68
    pid:<playlist ID>
69
    purl:<playlist URL>
70
    cid:<channel id>
71
    cname:<channel name>
72
    curl:<channel or username URL>
73
    list:<file with resource entries>   (comments can be #)
74
    search:<searchterm>
75
 
76
For channels (`cid`, `cname`, `curl`) you can also perform a search to filter the results.
77
This can be done like this: `cname:[search="Elvis Presley"]channel_1234`
78
For the search option, following parameters are possible: `search:[order=date][maxresults=50]"Elvis Presley"`
79
Acceptable order values are: `date`, `rating`, `relevance`, `title`, `videoCount`, `viewCount`
80
Default values are `order=relevance` and `maxresults=10`
81
Use `maxresults=-1` to download everything which matches the searchterm.
82
 
83
## Requirements
84
- PHP CLI
85
- A YouTube API key (can be obtained here: https://console.developers.google.com/apis/credentials )
86
- If you want to extract audio, you need additionally: ffmpeg or avconv and ffprobe or avprobe.
87
- Optional: package "id3v2" to allow the YouTube video id to be transferred to the MP3 ID tag
88
 
89
## Age restricted videos how-to
90
 
91
To download age restricted videos, you need to supply cookies from a browser that has been logged in to YouTube.
92
 
93
**Here is a method how to do this:**
94
 
95
(1) Download and install this Chrome extension:
96
https://chrome.google.com/webstore/detail/cookiestxt/njabckikapfpffapmjgojcnbfjonfjfg/related
97
 
98
(2) If you cannot see the Cookie-Button at the right top, then click the plugin button, and then enable "pinning" for the plugin "cookie.txt".
99
 
100
(3) Login to YouTube at the same network where the YouTube Downloader will run.
101
Press the cookie plugin button and copy the contents to a file called cookies.txt
102
 
103
(4) Edit cookies.txt and add following comment at the very top: `# HTTP Cookie File`
104
 
105
(5) Rename and move the file to **~/.yt_cookies**
106
OR
107
Add the argument `--cookies=cookies.txt` to ytdwn.
108
 
109
## License
110
 
111
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by  the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
112
 
113
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.