Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6 | daniel-mar | 1 | ViaThinkSoft YouTube Downloader Util 2.2 |
2 | Author: Daniel Marschall <www.daniel-marschall.de> |
||
3 | Licensed under the terms of the Apache 2.0 license |
||
4 | |||
5 | Syntax: |
||
6 | ./ytdwn [-t|--type v:[ext]|a:[ext]] (default v:) |
||
7 | [-o|--outputDir <dir>] (default current working directory) |
||
8 | [-a|--alreadyDownloaded <file>] |
||
9 | [-f|--failList <file> <treshold>] (This file logs failures) |
||
10 | [-F|--failTreshold <num>] (Don't download if failure (-f) treshold is reached. Default: 3) |
||
11 | [-V|--version] (shows version) |
||
12 | [-v|--verbose] (displays verbose information to STDOUT) |
||
13 | [-h|--help] (shows help) |
||
14 | [-N|--no-mp3-tagtransfer] (disables transfer of video ID to MP3 ID tag) |
||
15 | (This feature requires the package "id3v2") |
||
16 | [-T|--default-template <t>] (Sets default filename template.) |
||
17 | (Default: '%(title)s-%(id)s.%(ext)s') |
||
18 | [-X|--extra-args <args>] (Additional arguments passed through) |
||
19 | (youtube-dl. Default "-ic") |
||
20 | [-A|--api-key <file|key>] (specifies the API key, or a file containing the API key) |
||
21 | (Default: ~/.yt_api_key) |
||
22 | [--cookies=<file>] A netscape compatible cookie file (for age restricted videos) |
||
23 | (Default: ~/.yt_cookkies) |
||
24 | [-C|--resultcache <file>] (allows video results to be cached in this file) |
||
25 | (only for playlists or channels) |
||
26 | [-O|--create-outputdir] (allows creation of the output directories, recursively) |
||
27 | [--] |
||
28 | <resource> [<resource> ...] |
||
29 | |||
30 | For all paths (outputDir, alreadyDownloaded, apikey, failList and resultcache), you can use the |
||
31 | term '[listname]' which will be replaced by the basename of the current list file (without file extension). |
||
32 | For example you can do following: |
||
33 | ./ytdwn -o 'downloads/[listname]' -- list:*.list |
||
34 | If no list file is processed, it will be replaced with nothing. |
||
35 | |||
36 | The "alreadyDownloaded" argument contains a file which will be managed by ytdwn. |
||
37 | It will contain all video IDs which have been downloaded. This allows you to |
||
38 | move away the already downloaded files, and ytdwn will not download them again. |
||
39 | |||
40 | Examples for type: |
||
41 | v: best video quality |
||
42 | a: best audio only |
||
43 | a:mp3 audio only, mp3 |
||
44 | Valid audio formats according to "man youtube-dl": |
||
45 | "best", "aac", "flac", "mp3", "m4a", "opus", "vorbis", or "wav"; "best" by default |
||
46 | |||
47 | A <resource> can be one of the following: |
||
48 | vid:<video ID> |
||
49 | vurl:<youtube video URL> |
||
50 | pid:<playlist ID> |
||
51 | purl:<playlist URL> |
||
52 | cid:<channel id> |
||
53 | cname:<channel name> |
||
54 | curl:<channel or username URL> |
||
55 | list:<file with resource entries> (comments can be #) |
||
56 | search:<searchterm> |
||
57 | |||
58 | For channels (cid, cname, curl) you can also perform a search to filter the results. |
||
59 | This can be done like this: |
||
60 | cname:[search="Elvis Presley"]channel_1234 |
||
61 | For the search option, following parameters are possible: |
||
62 | search:[order=date][maxresults=50]"Elvis Presley" |
||
63 | Acceptable order values are: date, rating, relevance, title, videoCount, viewCount |
||
64 | Default values are order=relevance and maxresults=10 |
||
65 | Use maxresults=-1 to download everything which matches the searchterm. |
||
66 | |||
67 | Requirements: |
||
68 | - PHP CLI |
||
69 | - Package "youtube-dl" (ytdwn will try to download it automatically, if possible) |
||
70 | - A YouTube API key (can be obtained here: https://console.developers.google.com/apis/credentials ) |
||
71 | - If you want to extract audio, you need additionally: ffmpeg or avconv and ffprobe or avprobe. |
||
72 | - Optional: package "id3v2" to allow the YouTube video id to be transferred to the MP3 ID tag |
||
73 | |||
74 | |||
75 | Age restricted videos how-to |
||
76 | ---------------------------- |
||
77 | |||
78 | To download age restricted videos, you need to supply cookies from a browser that has been logged in to YouTube. |
||
79 | |||
80 | Here is a method how to do this: |
||
81 | |||
82 | (1) Download and install this Chrome extension: |
||
83 | https://chrome.google.com/webstore/detail/cookiestxt/njabckikapfpffapmjgojcnbfjonfjfg/related |
||
84 | |||
85 | (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". |
||
86 | |||
87 | (3) Login to YouTube at the same network where the YouTube Downloader will run. |
||
88 | Press the cookie plugin button and copy the contents to a file called cookies.txt |
||
89 | |||
90 | (4) Edit cookies.txt and add following comment at the very top: |
||
91 | # HTTP Cookie File |
||
92 | |||
93 | (5) Rename and move the file to ~/.yt_cookies |
||
94 | OR |
||
95 | Add the argument "--cookies=cookies.txt" to ytdwn. |
||
96 |