X-Git-Url: https://git.rapsys.eu/youtubedl/blobdiff_plain/929d540d5979815dd13aa119b6fdb41454907d0c..bad87b6c6e31ea0056d795ca3e7aa81ceaad2291:/youtube-dl.1 diff --git a/youtube-dl.1 b/youtube-dl.1 index 119ecd2..ea1ef9e 100644 --- a/youtube-dl.1 +++ b/youtube-dl.1 @@ -906,8 +906,8 @@ its containing directory. .RE .TP .B \-\-exec \f[I]CMD\f[] -Execute a command on the file after downloading, similar to find\[aq]s -\-exec syntax. +Execute a command on the file after downloading and post\-processing, +similar to find\[aq]s \-exec syntax. Example: \-\-exec \[aq]adb push {} /sdcard/Music/ && rm {}\[aq] .RS .RE @@ -1550,8 +1550,8 @@ instructions (https://ytdl-org.github.io/youtube-dl/download.html): .IP .nf \f[C] -sudo\ wget\ https://yt\-dl.org/latest/youtube\-dl\ \-O\ /usr/local/bin/youtube\-dl -sudo\ chmod\ a+x\ /usr/local/bin/youtube\-dl +sudo\ wget\ https://yt\-dl.org/downloads/latest/youtube\-dl\ \-O\ /usr/local/bin/youtube\-dl +sudo\ chmod\ a+rx\ /usr/local/bin/youtube\-dl hash\ \-r \f[] .fi @@ -1711,10 +1711,21 @@ See above for how to update youtube\-dl. .PP These two error codes indicate that the service is blocking your IP address because of overuse. -Contact the service and ask them to unblock your IP address, or \- if -you have acquired a whitelisted IP address already \- use the -\f[C]\-\-proxy\f[] or \f[C]\-\-source\-address\f[] options to select -another IP address. +Usually this is a soft block meaning that you can gain access again +after solving CAPTCHA. +Just open a browser and solve a CAPTCHA the service suggests you and +after that pass cookies to youtube\-dl. +Note that if your machine has multiple external IPs then you should also +pass exactly the same IP you\[aq]ve used for solving CAPTCHA with +\f[C]\-\-source\-address\f[]. +Also you may need to pass a \f[C]User\-Agent\f[] HTTP header of your +browser with \f[C]\-\-user\-agent\f[]. +.PP +If this is not the case (no CAPTCHA suggested to solve by the service) +then you can contact the service and ask them to unblock your IP +address, or \- if you have acquired a whitelisted IP address already \- +use the \f[C]\-\-proxy\f[] or \f[C]\-\-source\-address\f[] options to +select another IP address. .SS SyntaxError: Non\-ASCII character .PP The error @@ -2125,7 +2136,7 @@ Add tests and code for as many as you want. .IP " 8." 4 Make sure your code follows youtube\-dl coding conventions and check the code with -flake8 (http://flake8.pycqa.org/en/latest/index.html#quickstart): +flake8 (https://flake8.pycqa.org/en/latest/index.html#quickstart): .RS 4 .IP .nf @@ -2423,6 +2434,86 @@ Incorrect: \[aq]PLMYEtVRpaqY00V9W81Cwmzp6N6vZqfUKD4\[aq] \f[] .fi +.SS Inline values +.PP +Extracting variables is acceptable for reducing code duplication and +improving readability of complex expressions. +However, you should avoid extracting variables used only once and moving +them to opposite parts of the extractor file, which makes reading the +linear flow difficult. +.SS Example +.PP +Correct: +.IP +.nf +\f[C] +title\ =\ self._html_search_regex(r\[aq]([^<]+)\[aq],\ webpage,\ \[aq]title\[aq]) +\f[] +.fi +.PP +Incorrect: +.IP +.nf +\f[C] +TITLE_RE\ =\ r\[aq]([^<]+)\[aq] +#\ ...some\ lines\ of\ code... +title\ =\ self._html_search_regex(TITLE_RE,\ webpage,\ \[aq]title\[aq]) +\f[] +.fi +.SS Collapse fallbacks +.PP +Multiple fallback values can quickly become unwieldy. +Collapse multiple fallback values into a single expression via a list of +patterns. +.SS Example +.PP +Good: +.IP +.nf +\f[C] +description\ =\ self._html_search_meta( +\ \ \ \ [\[aq]og:description\[aq],\ \[aq]description\[aq],\ \[aq]twitter:description\[aq]], +\ \ \ \ webpage,\ \[aq]description\[aq],\ default=None) +\f[] +.fi +.PP +Unwieldy: +.IP +.nf +\f[C] +description\ =\ ( +\ \ \ \ self._og_search_description(webpage,\ default=None) +\ \ \ \ or\ self._html_search_meta(\[aq]description\[aq],\ webpage,\ default=None) +\ \ \ \ or\ self._html_search_meta(\[aq]twitter:description\[aq],\ webpage,\ default=None)) +\f[] +.fi +.PP +Methods supporting list of patterns are: \f[C]_search_regex\f[], +\f[C]_html_search_regex\f[], \f[C]_og_search_property\f[], +\f[C]_html_search_meta\f[]. +.SS Trailing parentheses +.PP +Always move trailing parentheses after the last argument. +.SS Example +.PP +Correct: +.IP +.nf +\f[C] +\ \ \ \ lambda\ x:\ x[\[aq]ResultSet\[aq]][\[aq]Result\[aq]][0][\[aq]VideoUrlSet\[aq]][\[aq]VideoUrl\[aq]], +\ \ \ \ list) +\f[] +.fi +.PP +Incorrect: +.IP +.nf +\f[C] +\ \ \ \ lambda\ x:\ x[\[aq]ResultSet\[aq]][\[aq]Result\[aq]][0][\[aq]VideoUrlSet\[aq]][\[aq]VideoUrl\[aq]], +\ \ \ \ list, +) +\f[] +.fi .SS Use convenience conversion and parsing functions .PP Wrap all extracted numeric data into safe functions from