U
    g}                    @   sB  d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	Z	ddl
mZ ddlmZmZ ddlmZ ddlmZmZmZmZmZmZ ddlmZ ddlmZmZmZ dd	lmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z, dd
l-m.Z.m/Z/ dddZ0G dd dej1Z2G dd dej3Z4dd Z5dd Z6dS )    N   )compat_expanduser)SUPPORTED_BROWSERSSUPPORTED_KEYRINGS)list_external_downloaders)FFmpegExtractAudioPPFFmpegMergerPPFFmpegSubtitlesConvertorPPFFmpegThumbnailsConvertorPPFFmpegVideoRemuxerPPSponsorBlockPP)"DEFAULT_SPONSORBLOCK_CHAPTER_TITLE)UPDATE_SOURCESdetect_variantis_non_updateable)OUTTMPL_TYPESPOSTPROCESS_WHENConfigdeprecation_warningexpand_pathformat_fieldget_executable_pathget_system_config_dirsget_user_config_dirsjoin_nonemptyorderedSet_from_options
remove_endvariadicwrite_string)CHANNEL__version__if_overridec           
         sP  d t t dkr| d k	dd  fddd fdd	fd	d
}tddd}zrzz>| d k	rj	| dd nj	t
jdd  dd t| }W n. tk
r } zj|W 5 d }~X Y nX |r" d jr"tdd tjD d }|d k	r"j| zjd   W n0 tk
rd } zj|W 5 d }~X Y nX  \}}W nb tjk
r   ttj jdd\}}	W 5 Q R X  Y n" ttfk
r   d|_ Y nX W 5 |jod dddd  }|rt| d |jr2|r(td j  X |jrDt
  j||fS )Nyt-dlpr!   c                  W   s.   t jj|  }tj|d d}|d k	r*||fS d S )Ndefault)ospathjoinr   	read_file)pathsr&   conf r+   2/tmp/pip-unpacked-wheel-q5ljy6pj/yt_dlp/options.pyread_config2   s    zparseOpts.<locals>.read_configc                 3   s   | D ]}t j|\}}| ks@|t jtdd  ks@t|  dV  |drn|  dV  |dV  |dV  qd S )N~.z.confz	.conf.txtconfigz
config.txt)r%   r&   splitr'   r   AssertionError
startswith)Zconfig_dirsZ
config_dirheadtail)PACKAGE_NAMEr-   r+   r,   _load_from_config_dirs8   s    (
z)parseOpts.<locals>._load_from_config_dirsc                    sx     d jrdS |r@|dks"tttd| d\}}ntj|d}tj	|dd}|dk	rtj
||| d dS )	z- Adds config and returns whether to continue r   FN)NNzyt-dlp.confr#   labelT)parse_known_argsignoreconfigr2   nextfilterr%   r&   r'   r   r(   append_config)r9   r&   funcargscurrent_path)r6   r7   rootr+   r,   
add_configC   s     
zparseOpts.<locals>.add_configc                   3   s\    V   dt  V   dt d jdd V   dtdV   dtdV  d S )	NZPortableZHomer   home User)r?   System)r   r   r:   r)   getstripr   r   r+   )rC   ignore_config_filesrB   r+   r,   load_configsR   s
    &zparseOpts.<locals>.load_configsTF)verbose
print_help
z
| z	
[debug] r   ZOverrider8   zCommand-liner   c                 s   s    | ]\}}|j d kr|V  qdS )rF   Nr8   ).0ir*   r+   r+   r,   	<genexpr>h   s     
 zparseOpts.<locals>.<genexpr>)strict)NN)r   create_parseroptparseValuesrL   replacer   rM   parserr>   sysargvall
ValueErrorerrorr:   r;   r<   	enumerateZconfigspoprK   
parse_argsOptParseError
contextlibsuppress
SystemExitKeyboardInterruptexit)
ZoverrideArgumentsrJ   rK   optsrL   Zloaded_all_configserrZ	user_confr@   _r+   )r6   r7   rC   rJ   r-   rB   r,   	parseOpts+   sX    

"ri   c                       s(   e Zd Z fddZedd Z  ZS )_YoutubeDLHelpFormatterc                    s*   t  jpd}t j|td| d d S )NP   g?)widthmax_help_position)shutilget_terminal_sizecolumnssuper__init__int)self	max_width	__class__r+   r,   rr      s    z _YoutubeDLHelpFormatter.__init__c                 C   sB   t | jo| jd | jo| jd dd}|  r>|d| j 7 }|S )z, ('-o', '--option') -> -o, --format METAVAR r   , )delim )r   _short_opts
_long_optstakes_valuemetavar)optionrf   r+   r+   r,   format_option_strings   s    z-_YoutubeDLHelpFormatter.format_option_strings)__name__
__module____qualname__rr   staticmethodr   __classcell__r+   r+   rv   r,   rj      s   rj   c                       sd   e Zd ZdZdZ fddZejejfZ	ej
ZdddZd	d
 Zdd Zdd Z fddZ  ZS )_YoutubeDLOptionParserZ_triggered_aliasesd   c                    s@   t  jt dkrdnd tddt dd | | jtt	 d S )Nsourcer"   z%prog [OPTIONS] URL [URL...]zBSee full documentation at  https://github.com/yt-dlp/yt-dlp#readmeresolve)progversionusageepilog	formatterconflict_handler)
rq   rr   r   r    rj   set_default
ALIAS_DESTcollectionsdefaultdictrs   rt   rv   r+   r,   rr      s    z_YoutubeDLOptionParser.__init__NTc              
   C   s,  |  |g  | _| _|p|  | _| jr| jd }z~|dkrN| jd= W qnb|drj| | j| j nF|dr|dkr| | j| j n"| jr| j	| j
d nW qW q" tjk
r } zDt|| jr| j	|j n$|rt|| jr| t|  W 5 d}~X Y q"X q"| | j| jS )zUSame as parse_args, but ignore unknown switches. Similar to argparse.parse_known_argsr   ---N)	_get_argsrargslargsget_default_valuesvaluesr3   _process_long_opt_process_short_optsallow_interspersed_argsappendr^   rT   r`   
isinstance_UNKNOWN_OPTIONopt_str_BAD_OPTIONr\   strcheck_values)rt   r@   r   rR   argrg   r+   r+   r,   r:      s.    


z'_YoutubeDLOptionParser.parse_known_argsc                 C   s8   |    dt|  d}| jr4|   d| S |S )Nz	: error: rN   )get_prog_namer   rI   r   	get_usagert   msgr+   r+   r,   _generate_error_message   s    z._YoutubeDLOptionParser._generate_error_messagec                 C   s   t | |d S N)rT   r`   r   r   r+   r+   r,   r\      s    z_YoutubeDLOptionParser.errorc                 C   s   |d krt jdd  S t|S )Nr   )rX   rY   list)rt   r@   r+   r+   r,   r      s    z _YoutubeDLOptionParser._get_argsc              
      sh   zt  |W S  tjk
rb } z4t fdd|jD dkrP|jd  W Y S  W 5 d}~X Y nX dS )z]Improve ambiguous argument resolution by comparing option objects instead of argument stringsc                    s   h | ]} j | qS r+   )	_long_opt)rO   pr   r+   r,   	<setcomp>   s     z9_YoutubeDLOptionParser._match_long_opt.<locals>.<setcomp>r   r   N)rq   _match_long_optrT   AmbiguousOptionErrorlenpossibilities)rt   opterv   r   r,   r      s    z&_YoutubeDLOptionParser._match_long_opt)NNT)r   r   r   r   ALIAS_TRIGGER_LIMITrr   rT   BadOptionErrorr   r   OptionValueErrorr   r:   r   r\   r   r   r   r+   r+   rv   r,   r      s   
r   c               "      s%  ddt jfdd} di dd fdd}d	d
d d dt jdfddfdd}t }t|dt   fdd}dd t|d}|jdddddd |jdddd |jd d!d"d#t	t
t d d$d%t	 d&d'd( |jd)d*d#d+d, |jd-d.d#d/d0t	d1d2  d3d4t d5 |jd6d7dd8d9d, |jd:d"d8d;d<d( |jd=d>d*d8d?d, |jd@ddAddBdC |jdDddEddFdC |jdGddHddIdC |jdJdKdLdMdNdOg | dPdQ	 |jdRddSdtjdC |jdTdUdVdWdX |jdYdZdd[d\d, |jd]d"d^g d_d( |jd`d^dadbdcdd |jdedfdadbdgdd |jdhd"didjddkdl |jdmd*didnd, |jdoddpdqd, |jdrd*dpdsd, |jdtdudvd dwdx |jdydud"d dzd{ |jd|dd}dd~dC |jdd*d}dd, |jddd"ddddtjd( |jdddi dOdLdddgt jddd	 |jdddt dOdL|ddddddddddddddddddddddddddhdddddgddddddgdddgdddddgg dddd	 |jddddOddL|dtj dd t|d}|jddd dddč |jddtd dddɍ |jdddd dd΍ |jdddd dd΍ |jdddddd֍ |jddd"ddddۍ |jddd"ddddۍ |jddddddC t|d}|jddd dddč |jddd dtjdč |jdddddd΍ |jdd"ddtjd( |jdd"ddtjd( |jdddtjd |jdddtjd t|d}|jddddttjd |jdddd ttjd |jddd dd ddx |jdddtjdX |jdddtjdX |jdd	d
d dd΍ |jdd	dd dd΍ |jdddd dd΍ |jdddd dd΍ |jdddd dd΍ |jdddd ttjd |jdddd ttjd |jdd d!dbd"d# |jd$d!d"d d%d{ |jd&d d'dbd(d# |jd)d'd"d d*d{ |jd+dd,dd-dC |jd.d*d,d/d, |jd0d1d2d td3d |jd4d5d6d7d |jd8d6d"d d9d{ |jd:d;dtd d<d= |jd>dd?dd@dC |jdAd*d?dBd, |jdCddDdtjdC |jdEddFddGdC |jdHd*dFdId, |jdJdKdLd tdMd |jdNdOdtjd |jdPdOd*tjd t|dQ}	|	jdRdSdTdUdVdX |	jdWdXdYdZd[dX |	jd\d]d^d_d`dX |	jdadbddcddddC |	jdedfdadgdX |	jdhdidjdkdX |	jdldmdZdndX |	jdodpdqdrdX |	jdsdtdUdudX |	jdvdwdZdxdX |	jdyddzdd{dC |	jd|d}d~ddX |	jdddddX |	jdddZddX t|d}
|
jddd.ddd dd |
jddddg dOdL| dbdidd
 |
jdddddddd |
jdd*ddddd |
jdddd ddC |
jdd*ddd, |
jdddd ddC |
jdd*ddd, |
jdd"ddtjd( |
jddddddC |
jdd*ddddC |
jdd"ddd dd |
jddddd, |
jdd*ddd, |
jdddddd, |
jddddtjdC |
jddd*dtjd, |
jdd.ddd dd4ttj dd |
jddddtjdC |
jdd*dtjd, t|d¡}|jdÐddddddC |jdǐdd*dŐdd, |jdʐddddddC |jdΐdd*ddddC |jddddtjdC |jddddddC |jdd.dאddؐdِd |jdڐddLdܐddOg | ddQ	 t|dߡ}|jddddKdtdd |jdddddddX |jdddddX |jdddddddx |jddddddx |jddddddx |jdddi dOdLdddd d	 |jdddddddC |jddd*ddd, |jddd	dd
dC |jdd*d	dd, |jddd	dddx |jdd*ddd, |jddddddC |jddd	d ddx |jddddtjdC |jdddtjd, |jdd*dtjd, |jdddd d, |jd!dd"d#d, |jd$d*d"d%d, |jd&d'dd(d |jd)d*dd tjd+ |jd,d*d*d tjd+ |jd-d.dd d/d+ |jd0d.d*d1d |jd2dd3dbd4d# |jd5d6d7d8i dOdLd9dt jdd:d4tt  d;d
 |jd<d=d>d?i dOdLd@dAttjt dtjddBd
 t|dC}|jdDdEdFdGdX |jdHddIddJdC |jdKddLddMdC |jdNdOddPdQd, |jdRdSdTtjd |jdUddVd tjd΍ |jdWdXdYi dOdLdZdid[d	 |jd\d]dd^d |jd_dǐd`tdadb |jdcdddǐdetdfdb |jdgdǐdhtdidb |jdjdǐdkd2tdld t|dm}|jdndoddpd dqdC |jdrd*dpdsd, |jdtdudddvd+ |jdwdxddyd dzdC |jd{d*dyd|d, |jd}dd~dddC |jdd*d~dd, |jdddddddC |jdZddd|dddi |jd[dddd|dddi |jdddddtjdC |jdddddtjdC |jddddtjdC |jddddtjdC |jddddtjdC |jddddtjdC |jddddtjdC |jddddtjdC |jdddddddC |jdddddddC |jddddtjdC |jddddddddC |jddddddC |jdddd ddC |jdd*ddd, |jddddddC |jdddi dOdLddÐddd	 |jddd.dtd2dǐdȍ |jdɐddddddC |jd͐ddddddC |jddddddC |jddddtjdC |jddddtjdC |jdؐdِddddېd+ |jdܐdݐdddtjd+ |jdߐdd*tjd t|d}|jdddd5ddX |jddd"d dd{ |jddddtjd |jddddi dOdLddAttjt dddd
 |jddddi dOdLdAttjt dddd
 |jddddddx |jdddttjd |jddddttjd |jddd dddC |jdd*d dd, |jddddddC |jdd*ddd, |jd	d
ddd2tdd |jddd*dd ddC |jdddddd, |jdd"dd dd( |jdddddddC |jdd*ddd, |jdd*ddddC |jd ddd!d, |jd"dd#dd$dC |jd%d*d#d&d, |jd'dd(dd)dC |jd*d*d(d+d, |jd,dd-d d.dC |jd/d*d-d0d, |jd1dd2dtjdC |jd3d*d2tjd, |jd4dd5d d6dC |jd7d*d5d8d, |jd9d:dd;d d<dC |jd=d>d*d;d?d, |jd@dAddBddCdC |jdDdEd*dBdFd, |jdGdHdId5dJdX |jdKdLd5dMdX |jdNd"d dLd5dOdP |jdQdRdSdTd4tt  dUd4tt jtt! dX |jdVd"d dRdWdۍ |jdXdYd dZd[dč |jd\d*dYd]d, |jd^dd_d`d, t|da}|jdbdLdcdddd dedf |jdgd*dcdhd, |jdid"dcddjd( |jdkddlddmdC t|dn}|jdoddpddqdC |jdrddsddtdC |jduddvddwdC |jdxddyddzdC t|d{}|jd|d}dd~dddC |jddddؐdd4tt"j dd΍ |jdddddd΍ |jdddd dd4t#j dd΍ |jdddd dd΍ |jddd>di dOdLddtjdddd
 |jdddddddC |jdd*ddd, |jdd*ddd, |jddddddC |jddddddC |jdd*ddd, |jddddddC |jdd*ddd, |jdddddddC |jddd*ddd, |jddddd ddC |jddd*ddd, |jdddd ddC |jdd*ddd, |jdddtjd |jd\ddÐd|dăddi |jd]dÐdǐddȜ|dăddi |jdʐddddddC |jdΐdϐdАdѐdҐdӐdԍ |jdՐdϐdd dאdؐdԍ |jdِdd*dtjd, |jdܐddddtjdC |jdސddaddd |jd^ddd|dddi |jdd"di dd( |jdddbdtjd |jdd"dd tjd( |jdddddd dd4tt$j dd΍ |jdddd dd4tt%j dd΍ |jddddddd+ |jdddd*dd |jddd dbdd# |jdd d"d dd{ |jddddddC |jdd*ddd, d_d
d|jdddg dOdL| d fddddd	 tj|ddd}|jdddt dLdO|t&j' ddgiddd4t&j'  dd	 |jdddt dLdO|tt&j' tt&j(  dddgiddd4t&j(  dd	 |jdd t)d!d"d# |jd$ddd%d&d |jd'dd(d)d*d# |jd+dd,dtjdC |jd-d*d,tjd, |jd.ddd/tjd |jd0d*d/tjd, |jd1ddd2tjd |jd3dd2tjd, |jd4dad5d	tjd΍ |jd6d7d8tjdX t|d9}|jd:d;ddd<dx |jd=d>dd?dd@dC |jdAdBd*d?dCd, |jdDdEdddFd+ |jdGdEd*dHd d`dId|jdJdKdLi dOdLdfdMddNdOd	 |jdPdQddRdtjdC |jdSdTd*dRtjd, |jdUdVddWdtjdC |jdXdYd*dWtjd, |*| |*| |*| |*| |*| |*| |*| |*| |*| |*| |*|
 |*| |*|	 |*| |*| |*| |S (a  NT,c                 S   sn   |rt t|j| jng }t td |d kr2||gnt|||}t|j| j|dkr`|| n||  d S NT)r   getattrr   destr=   mapr1   setattr)r   r   valuerW   r   ry   processcurrentr+   r+   r,   _list_from_options_callback   s    , z2create_parser.<locals>._list_from_options_callbackc                 S   s   |    S r   )lowerrI   )xr+   r+   r,   <lambda>       zcreate_parser.<locals>.<lambda>c                 S   s   |d kr||gnt |||}z(t|t|d|it|j| jd}	W nF tk
r }
 z(t	
d| j d| d|
jd  W 5 d }
~
X Y nX t|j| jt|	 d S )NrZ   )startwrong z for z: r   )r   r1   r   r   ChainMapr   r   r   r[   rT   r   r~   r@   r   set)r   r   r   rW   allowed_valuesry   aliasesr   r   	requestedr   r+   r+   r,   _set_from_options_callback   s    "
6z1create_parser.<locals>._set_from_options_callbackz[\w-]+:Fc              
   S   sp  t t|j| j}t|t }|r4d| d| d}td| d| d|rT|d n|}|d k	r|d	d	|d
 }}|r|f|dd  }n8|d k	rt
|| }}n td| d| j d| dz&|	rt|	|n|}|r||n|}W n: tk
r. } ztd| d| W 5 d }~X Y nX |D ]&}|
rP||g |fn|||< q4t|j| j| d S )N(z)(,(z))*z(?is)(?P<keys>)z(?P<val>.*)$r   keysr   valr   r   z formatting; it should be z, not "" formatting; )dictr   r   r   r   r   rematchgroupr1   r   rT   r   r~   r   	ExceptionrH   r   )r   r   r   rW   allowed_keys	delimiterdefault_keyr   multiple_keysZprocess_keyr   Zout_dictZmultiple_argsZmobjr   r   rg   keyr+   r+   r,   _dict_from_options_callback   s2    ($z2create_parser.<locals>._dict_from_options_callbackc              	      s(   i dd d ttjt| ddddS )Nr   callback|FT)r   r   r   r   )r$   typeactionr   callback_kwargs)r'   r   r   escaper   r#   )r   r+   r,   when_prefix  s    z"create_parser.<locals>.when_prefixZAliasesc           	         s6  |\}}z4t dd t |D }|jttt|  W n8 tk
rt } zt	d| d| W 5 d }~X Y nX |j
kr| dd ttj|dD }zPdd	 t|D }j|||j|rd
nd d||j| d||dd W n: tk
r0 } zt	d| d| W 5 d }~X Y nX d S )Nc                 S   s0   h | ](\}\}}}}|d k	r|dkr(|n|qS )NrE   r+   )rO   rP   rh   fr+   r+   r,   r   #  s    z7create_parser.<locals>._create_alias.<locals>.<setcomp>r   z OPTIONS formatting; c                 s   s&   | ]}| d r|nd| V  qdS )r   r   N)r3   )rO   r   r+   r+   r,   rQ   +  s     z7create_parser.<locals>._create_alias.<locals>.<genexpr>r   c                 S   s   g | ]}d | qS )ZARGr+   )rO   rP   r+   r+   r,   
<listcomp>-  s     z8create_parser.<locals>._create_alias.<locals>.<listcomp>r   rz   r   )rf   nargs)r   r   r   r~   helpr   r   r   r   )r   r]   parseformatr   r   ranger   rT   r   option_groupsadd_option_grouprI   r1   
add_optionr   r'   )	r   r   r   rW   r   rf   r   rg   r@   )	Formatter_alias_callbackalias_groupr+   r,   _create_alias   s4    (

   
   z$create_parser.<locals>._create_aliasc                 S   s   t |j| j}||  d7  < || |jkr>td| d|dkrL|g}|dkr\|d kslt||ksltt	|d kr||n|j
ttj| |jd d< d S )Nr   zAlias z exceeded invocation limitr   )r   r   r   r   rT   r   r   r2   shlexr1   r   r   quoter   )r   r   r   rW   rf   r   counterr+   r+   r,   r   5  s     z&create_parser.<locals>._alias_callbackzGeneral Optionsz-hz--helprM   
store_truezPrint this help text and exit)r   r   r   z	--versionr   zPrint program version and exit)r   r   z-Uz--updatestore_constZupdate_selfz"Check if updates are available. %sz"Update this program to the latest z versionr#   )r   r   constr   z--no-updatestore_falsez"Do not check for updates (default))r   r   r   z--update-tostorez[CHANNEL]@[TAG]zjUpgrade/downgrade to a specific version. CHANNEL can be a repository as well. CHANNEL and TAG default to "@r   zV" and "latest" respectively if omitted; See "UPDATE" for details. Supported channels: rx   )r   r   r~   r   z-iz--ignore-errorsZignoreerrorszvIgnore download and postprocessing errors. The download will be considered successful even if the postprocessing failsz--no-abort-on-errorZonly_downloadzdContinue with next video on download errors; e.g. to skip unavailable videos in a playlist (default)z--abort-on-errorz--no-ignore-errorszRAbort downloading of further videos if an error occurs (Alias: --no-ignore-errors)z--dump-user-agentZdump_user_agentz'Display the current user-agent and exit)r   r   r$   r   z--list-extractorsZlist_extractorsz&List all supported extractors and exitz--extractor-descriptionsZlist_extractor_descriptionsz8Output descriptions of all supported extractors and exitz--use-extractorsz--iesr   Zallowed_extractorsZNAMESr   a#  Extractor names to use separated by commas. You can also use regexes, "all", "default" and "end" (end URL matching); e.g. --ies "holodex.*,end,youtube". Prefix the name with a "-" to exclude it, e.g. --ies default,-generic. Use --list-extractors for a list of extractor names. (Alias: --ies))r   r   r~   r   r$   r   r   z--force-generic-extractorZforce_generic_extractorz--default-searchZdefault_searchPREFIXaq  Use this prefix for unqualified URLs. E.g. "gvsearch2:python" downloads two videos from google videos for the search term "python". Use the value "auto" to let yt-dlp guess ("auto_warning" to emit a warning when guessing). "error" just throws an error. The default value "fixup_error" repairs broken URLs, but emits an error if this is not possible instead of searching)r   r~   r   z--ignore-configz--no-configr;   zDon't load any more configuration files except those given to --config-locations. For backward compatibility, if this option is found inside the system configuration file, the user configuration is not loaded. (Alias: --no-config)z--no-config-locationsZconfig_locationszDo not load any custom configuration files (default). When given inside a configuration file, ignore all previous --config-locations defined in the current filez--config-locationsPATHr   zLocation of the main configuration file; either the path to the config or its containing directory ("-" for stdin). Can be used multiple times and inside other configuration files)r   r~   r   r   z--plugin-dirsZplugin_dirsa  Path to an additional directory to search for plugins. This option can be used multiple times to add multiple directories. Note that this currently only works for extractor plugins; postprocessor plugins can only be loaded from the default plugin directoriesz--flat-playlistZextract_flatZin_playlistz7Do not extract the videos of a playlist, only list them)r   r   r   r$   r   z--no-flat-playlistz0Fully extract the videos of a playlist (default)z--live-from-startZlive_from_startzXDownload livestreams from the start. Currently only supported for YouTube (Experimental)z--no-live-from-startz4Download livestreams from the current time (default)z--wait-for-videoZwait_for_videoz	MIN[-MAX]zuWait for scheduled streams to become available. Pass the minimum number of seconds (or range) to wait between retries)r   r~   r$   r   z--no-wait-for-videoz+Do not wait for scheduled streams (default))r   r   r   r   z--mark-watchedZmark_watchedz*Mark videos watched (even with --simulate)z--no-mark-watchedz$Do not mark videos watched (default)z--no-colorsz--no-colourscolorno_color)stdoutstderrz--colorz[STREAM:]POLICYzstdout|stderrr  r  )r   r   r   a?  Whether to emit color codes in output, optionally prefixed by the STREAM (stdout or stderr) to apply the setting to. Can be one of "always", "auto" (default), "never", or "no_color" (use non color terminal sequences). Use "auto-tty" or "no_color-tty" to decide based on terminal support only. Can be used multiple times)r   r~   r$   r   r   r   r   r   z--compat-optionsZOPTSZcompat_optsfilenamezfilename-sanitizationzformat-sortzabort-on-errorzformat-speczno-playlist-metafilesZmultistreamszno-live-chatzplaylist-indexzlist-formatszno-direct-mergezplaylist-match-filterzno-attach-info-jsonzembed-thumbnail-atomicparsleyzno-external-downloader-progresszembed-metadatazseperate-video-versionszno-clean-infojsonzno-keep-subsz
no-certifizno-youtube-channel-redirectzno-youtube-unavailable-videosz!no-youtube-prefer-utc-upload-datezprefer-legacy-http-handlerzmanifest-filesize-approxzallow-unsafe-extrZ   z-multistreamsz-playlist-match-filterz-manifest-filesize-approxz-allow-unsafe-extz-no-youtube-channel-redirectz-no-live-chat20222023)z
youtube-dlzyoutube-dlcZ2021r  r  )r   r   zOptions that can help keep compatibility with youtube-dl or youtube-dlc configurations by reverting some of the changes made in yt-dlp. See "Differences in default behavior" for details)r~   r   r$   r   r   r   r   r   z--aliaszALIASES OPTIONSrh      aD  Create aliases for an option string. Unless an alias starts with a dash "-", it is prefixed with "--". Arguments are parsed according to the Python string formatting mini-language. E.g. --alias get-audio,-X "-S=aext:{0},abr -x --audio-format {0}" creates options "--get-audio" and "-X" that takes an argument (ARG0) and expands to "-S=aext:ARG0,abr -x --audio-format ARG0". All defined aliases are listed in the --help output. Alias options can trigger more aliases; so be careful to avoid defining recursive options. As a safety measure, each alias may be triggered a maximum of z. times. This option can be used multiple times)r~   r   r   r   r   r   r   zNetwork Optionsz--proxyproxyURLzUse the specified HTTP/HTTPS/SOCKS proxy. To enable SOCKS proxy, specify a proper scheme, e.g. socks5://user:pass@127.0.0.1:1080/. Pass in an empty string (--proxy "") for direct connection)r   r$   r~   r   z--socket-timeoutsocket_timeoutZSECONDSz)Time to wait before giving up, in seconds)r   r   r$   r~   r   z--source-addressZIPsource_addressz!Client-side IP address to bind to)r~   r   r$   r   z--impersonatezCLIENT[:OS]ZimpersonatezClient to impersonate for requests. E.g. chrome, chrome-110, chrome:windows-10. Pass --impersonate="" to impersonate any client. Note that forcing impersonation for all requests may have a detrimental impact on download speed and stabilityz--list-impersonate-targetsZlist_impersonate_targetsz&List available clients to impersonate.)r   r$   r   r   z-4z--force-ipv4z0.0.0.0zMake all connections via IPv4)r   r   r   r   z-6z--force-ipv6z::zMake all connections via IPv6z--enable-file-urlsZenable_file_urlszFEnable file:// URLs. This is disabled by default for security reasons.zGeo-restrictionz--geo-verification-proxyZgeo_verification_proxyzUse this proxy to verify the IP address for some geo-restricted sites. The default proxy specified by --proxy (or none, if the option is not present) is used for the actual downloadingz--cn-verification-proxyZcn_verification_proxyz--xffZVALUEZ
geo_bypassr$   zHow to fake X-Forwarded-For HTTP header to try bypassing geographic restriction. One of "default" (only when known to be useful), "never", an IP block in CIDR notation, or a two-letter ISO 3166-2 country codez--geo-bypassz--no-geo-bypassneverz--geo-bypass-countryZCODE)r~   r   r   z--geo-bypass-ip-blockZIP_BLOCKzVideo Selectionz--playlist-startZplayliststartNUMBERr   )r   r~   r$   r   r   z--playlist-endZplaylistendz-Iz--playlist-itemsZplaylist_itemsZ	ITEM_SPECal  Comma separated playlist_index of the items to download. You can specify a range using "[START]:[STOP][:STEP]". For backward compatibility, START-STOP is also supported. Use negative indices to count from the right and negative STEP to download in reverse order. E.g. "-I 1:3,7,-5::2" used on a playlist of size 15 will download the items at index 1,2,3,7,11,13,15z--match-titleZ
matchtitleZREGEXz--reject-titleZrejecttitlez--min-filesizeZSIZEZmin_filesizezBAbort download if filesize is smaller than SIZE, e.g. 50k or 44.6Mz--max-filesizeZmax_filesizezAAbort download if filesize is larger than SIZE, e.g. 50k or 44.6Mz--dateZDATEdatezDownload only videos uploaded on this date. The date can be "YYYYMMDD" or in the format [now|today|yesterday][-N[day|week|month|year]]. E.g. "--date today-2weeks" downloads only videos uploaded on the same day two weeks agoz--datebeforeZ
datebeforezfDownload only videos uploaded on or before this date. The date formats accepted are the same as --datez--dateafterZ	dateafterzeDownload only videos uploaded on or after this date. The date formats accepted are the same as --datez--min-viewsZCOUNTZ	min_views)r~   r   r$   r   r   z--max-viewsZ	max_viewsz--match-filtersZFILTERZmatch_filtera)  Generic video filter. Any "OUTPUT TEMPLATE" field can be compared with a number or a string using the operators defined in "Filtering Formats". You can also simply specify a field to match if the field is present, use "!field" to check if the field is not present, and "&" to check multiple conditions. Use a "\" to escape "&" or quotes if needed. If used multiple times, the filter matches if at least one of the conditions is met. E.g. --match-filters !is_live --match-filters "like_count>?100 & description~='(?i)\bcats \& dogs\b'" matches only videos that are not live OR those that have a like count more than 100 (or the like field is not available) and also has a description that contains the phrase "cats & dogs" (caseless). Use "--match-filters -" to interactively ask whether to download each video)r~   r   r   r   z--no-match-filtersz(Do not use any --match-filters (default)z--break-match-filtersZbreaking_match_filterzQSame as "--match-filters" but stops the download process when a video is rejectedz--no-break-match-filtersz.Do not use any --break-match-filters (default)z--no-playlistZ
noplaylistzDDownload only the video, if the URL refers to a video and a playlistz--yes-playlistzBDownload the playlist, if the URL refers to a video and a playlistz--age-limitZYEARSZ	age_limitz/Download only videos suitable for the given agez--download-archiveFILEZdownload_archivezbDownload only videos not listed in the archive file. Record the IDs of all downloaded videos in itz--no-download-archivez!Do not use archive file (default)z--max-downloadsZmax_downloadsz$Abort after downloading NUMBER files)r   r~   r   r$   r   z--break-on-existingZbreak_on_existingzIStop the download process when encountering a file that is in the archivez--no-break-on-existingzZDo not stop the download process when encountering a file that is in the archive (default)z--break-on-rejectZbreak_on_rejectz--break-per-inputZbreak_per_urlziAlters --max-downloads, --break-on-existing, --break-match-filters, and autonumber to reset per input URLz--no-break-per-inputzL--break-on-existing and similar options terminates the entire download queuez--skip-playlist-after-errorsNZskip_playlist_after_errorszDNumber of allowed failures until the rest of the playlist is skippedz--include-adsZinclude_adsz--no-include-adszAuthentication Optionsz-uz
--usernameusernameUSERNAMEzLogin with this account IDz-pz
--passwordpasswordZPASSWORDzKAccount password. If this option is left out, yt-dlp will ask interactivelyz-2z--twofactorZ	twofactorZ	TWOFACTORzTwo-factor authentication codez-nz--netrcZusenetrczUse .netrc authentication dataz--netrc-locationZnetrc_locationziLocation of .netrc authentication data; either the path or its containing directory. Defaults to ~/.netrcz--netrc-cmdZ	netrc_cmdZ	NETRC_CMDz;Command to execute to get the credentials for an extractor.z--video-passwordZvideopasswordzVideo-specific passwordz--ap-msoZap_msoZMSOzlAdobe Pass multiple-system operator (TV provider) identifier, use --ap-list-mso for a list of available MSOsz--ap-usernameZap_usernamez&Multiple-system operator account loginz--ap-passwordZap_passwordzdMultiple-system operator account password. If this option is left out, yt-dlp will ask interactivelyz--ap-list-msoZap_list_msoz,List all supported multiple-system operatorsz--client-certificateZclient_certificateZCERTFILEzJPath to client certificate file in PEM format. May include the private keyz--client-certificate-keyZclient_certificate_keyZKEYFILEz/Path to private key file for client certificatez--client-certificate-passwordZclient_certificate_passwordzPassword for client certificate private key, if encrypted. If not provided, and the key is encrypted, yt-dlp will ask interactivelyzVideo Format Optionsz-fz--formatr   ZFORMATz:Video format code, see "FORMAT SELECTION" for more details)r   r   r~   r$   r   z-Sz--format-sortZ	SORTORDERZformat_sortzLSort the formats by the fields given, see "Sorting Formats" for more detailsz--format-sort-forcez	--S-forceZformat_sort_forcez}Force user specified sort order to have precedence over all fields, see "Sorting Formats" for more details (Alias: --S-force)z--no-format-sort-forcezHSome fields have precedence over the user specified sort order (default)z--video-multistreamsZallow_multiple_video_streamsz<Allow multiple video streams to be merged into a single filez--no-video-multistreamszBOnly one video stream is downloaded for each output file (default)z--audio-multistreamsZallow_multiple_audio_streamsz<Allow multiple audio streams to be merged into a single filez--no-audio-multistreamszBOnly one audio stream is downloaded for each output file (default)z--all-formatsz--prefer-free-formatsZprefer_free_formatszPrefer video formats with free containers over non-free ones of the same quality. Use with "-S ext" to strictly prefer free containers irrespective of qualityz--no-prefer-free-formatsz>Don't give any special preference to free containers (default)z--check-formatsselectedZcheck_formatszMMake sure formats are selected only from those that are actually downloadable)r   r   r   r$   r   z--check-all-formatsz<Check all formats for whether they are actually downloadablez--no-check-formatsz7Do not check that the formats are actually downloadablez-Fz--list-formatsZlistformatszKList available formats of each video. Simulate unless --no-simulate is usedz--list-formats-as-tableZlistformats_tablez--list-formats-oldz--no-list-formats-as-tablez--merge-output-formatZmerge_output_formatzContainers that may be used when merging formats, separated by "/", e.g. "mp4/mkv". Ignored if no merge is required. (currently supported: r   z--allow-unplayable-formatsZallow_unplayable_formatsz--no-allow-unplayable-formatszSubtitle Optionsz--write-subsz--write-srtZwritesubtitleszWrite subtitle filez--no-write-subsz--no-write-srtz$Do not write subtitle file (default)z--write-auto-subsz--write-automatic-subsZwriteautomaticsubzKWrite automatically generated subtitle file (Alias: --write-automatic-subs)z--no-write-auto-subsz--no-write-automatic-subszRDo not write auto-generated subtitles (default) (Alias: --no-write-automatic-subs)z
--all-subsZallsubtitlesz--list-subsZlistsubtitleszMList available subtitles of each video. Simulate unless --no-simulate is usedz--sub-formatZsubtitlesformatbestzZSubtitle format; accepts formats preference separated by "/", e.g. "srt" or "ass/srt/best"z--sub-langsz--srt-langsZsubtitleslangsZLANGSay  Languages of the subtitles to download (can be regex) or "all" separated by commas, e.g. --sub-langs "en.*,ja" (where "en.*" is a regex pattern that matches "en" followed by 0 or more of any character). You can prefix the language code with a "-" to exclude it from the requested languages, e.g. --sub-langs all,-live_chat. Use --list-subs for a list of available language tagszDownload Optionsz-Nz--concurrent-fragmentsZconcurrent_fragment_downloadszjNumber of fragments of a dash/hlsnative video that should be downloaded concurrently (default is %default)z-rz--limit-ratez--rate-limitZ	ratelimitZRATEz;Maximum download rate in bytes per second, e.g. 50K or 4.2Mz--throttled-rateZthrottledratelimitzyMinimum download rate in bytes per second below which throttling is assumed and the video data is re-extracted, e.g. 100Kz-Rz	--retriesretriesZRETRIES
   z6Number of retries (default is %default), or "infinite"z--file-access-retriesZfile_access_retries   zRNumber of times to retry on file access error (default is %default), or "infinite"z--fragment-retriesZfragment_retriesz_Number of retries for a fragment (default is %default), or "infinite" (DASH, hlsnative and ISM)z--retry-sleepZretry_sleepz[TYPE:]EXPRz#http|fragment|file_access|extractorhttp)r   r   a  Time to sleep between retries in seconds (optionally) prefixed by the type of retry (http (default), fragment, file_access, extractor) to apply the sleep to. EXPR can be a number, linear=START[:END[:STEP=1]] or exp=START[:END[:BASE=2]]. This option can be used multiple times to set the sleep for the different retry types, e.g. --retry-sleep linear=1::2 --retry-sleep fragment:exp=1:20z--skip-unavailable-fragmentsz#--no-abort-on-unavailable-fragmentsZskip_unavailable_fragmentszwSkip unavailable fragments for DASH, hlsnative and ISM downloads (default) (Alias: --no-abort-on-unavailable-fragments)z --abort-on-unavailable-fragmentsz--no-skip-unavailable-fragmentszTAbort download if a fragment is unavailable (Alias: --no-skip-unavailable-fragments)z--keep-fragmentsZkeep_fragmentsz?Keep downloaded fragments on disk after downloading is finishedz--no-keep-fragmentszCDelete downloaded fragments after downloading is finished (default)z--buffer-sizeZ
buffersizeZ1024z?Size of download buffer, e.g. 1024 or 16K (default is %default)z--resize-bufferZnoresizebufferzYThe buffer size is automatically resized from an initial value of --buffer-size (default)z--no-resize-bufferz+Do not automatically adjust the buffer sizez--http-chunk-sizeZhttp_chunk_sizezSize of a chunk for chunk-based HTTP downloading, e.g. 10485760 or 10M (default is disabled). May be useful for bypassing bandwidth throttling imposed by a webserver (experimental)z--testtestz--playlist-reverseZplaylist_reversez--no-playlist-reversez--playlist-randomZplaylist_randomz(Download playlist videos in random orderz--lazy-playlistZlazy_playlistzwProcess entries in the playlist as they are received. This disables n_entries, --playlist-random and --playlist-reversez--no-lazy-playlistzQProcess videos in the playlist only after the entire playlist is parsed (default)z--xattr-set-filesizeZxattr_set_filesizez9Set file xattribute ytdl.filesize with expected file sizez--hls-prefer-nativeZhls_prefer_native)r   r   r$   r   z--hls-prefer-ffmpegz--hls-use-mpegtsZhls_use_mpegtszUse the mpegts container for HLS videos; allowing some players to play the video while downloading, and reducing the chance of file corruption if download is interrupted. This is enabled by default for live streamsz--no-hls-use-mpegtszaDo not use the mpegts container for HLS videos. This is default when not downloading live streamsz--download-sectionsZdownload_rangesa  Download only chapters that match the regular expression. A "*" prefix denotes time-range instead of chapter. Negative timestamps are calculated from the end. "*from-url" can be used to download between the "start_time" and "end_time" extracted from the URL. Needs ffmpeg. This option can be used multiple times to download multiple sections, e.g. --download-sections "*10:15-inf" --download-sections "intro"z--downloaderz--external-downloaderZexternal_downloaderz[PROTO:]NAMEz http|ftp|m3u8|dash|rtsp|rtmp|mmszName or path of the external downloader to use (optionally) prefixed by the protocols (http, ftp, m3u8, dash, rstp, rtmp, mms) to use it for. Currently supports native, a  . You can use this option multiple times to set different downloaders for different protocols. E.g. --downloader aria2c --downloader "dash,m3u8:native" will use aria2c for http/ftp downloads, and the native downloader for dash/m3u8 downloads (Alias: --external-downloader)z--downloader-argsz--external-downloader-argsz	NAME:ARGSZexternal_downloader_argszffmpeg_[io]\d*|{}r   ab  Give these arguments to the external downloader. Specify the downloader name and the arguments separated by a colon ":". For ffmpeg, arguments can be passed to different positions using the same syntax as --postprocessor-args. You can use this option multiple times to give different arguments to different downloaders (Alias: --external-downloader-args)ZWorkaroundsz
--encodingencodingENCODINGz+Force the specified encoding (experimental)z--legacy-server-connectZlegacy_server_connectz^Explicitly allow HTTPS connection to servers that do not support RFC 5746 secure renegotiationz--no-check-certificatesZno_check_certificatez%Suppress HTTPS certificate validationz--prefer-insecurez--prefer-unsecureZprefer_insecurezlUse an unencrypted connection to retrieve information about the video (Currently supported only for YouTube)z--user-agentZUA
user_agentz	--refererZrefererz--add-headerszFIELD:VALUEheadersr   zlSpecify a custom HTTP header and its value, separated by a colon ":". You can use this option multiple timesz--bidi-workaroundZbidi_workaroundzhWork around terminals that lack bidirectional text support. Requires bidiv or fribidi executable in PATHz--sleep-requestsZsleep_interval_requestszBNumber of seconds to sleep between requests during data extraction)r~   r   r   r   z--sleep-intervalz--min-sleep-intervalZsleep_intervalzNumber of seconds to sleep before each download. This is the minimum time to sleep when used along with --max-sleep-interval (Alias: --min-sleep-interval)z--max-sleep-intervalZmax_sleep_intervalzTMaximum number of seconds to sleep. Can only be used along with --min-sleep-intervalz--sleep-subtitlesZsleep_interval_subtitlesz8Number of seconds to sleep before each subtitle downloadz Verbosity and Simulation Optionsz-qz--quietquietzDActivate quiet mode. If used with --verbose, print the log to stderrz
--no-quietz Deactivate quiet mode. (Default)z--no-warningsZno_warningszIgnore warningsz-sz
--simulateZsimulatez;Do not download the video and do not write anything to diskz--no-simulatez<Download the video even if printing/listing options are usedz--ignore-no-formats-errorZignore_no_formats_errorzIgnore "No video formats" error. Useful for extracting metadata even if the videos are not actually available for download (experimental)z--no-ignore-no-formats-errorzBThrow error when no downloadable video formats are found (default)z--skip-downloadz--no-downloadZskip_downloadzLDo not download the video but write all related files (Alias: --no-download)-O--printz[WHEN:]TEMPLATEZ
forceprint)r~   r   videor   aK  Field name or output template to print to screen, optionally prefixed with when to print it, separated by a ":". Supported values of "WHEN" are the same as that of --use-postprocessor (default: video). Implies --quiet. Implies --simulate unless --no-simulate or later stages of WHEN are used. This option can be used multiple times--print-to-filez[WHEN:]TEMPLATE FILEZprint_to_file)r~   r   r   zAppend given template to the file. The values of WHEN and TEMPLATE are the same as that of --print. FILE uses the same syntax as the output template. This option can be used multiple timesz-gz	--get-urlgeturlz-ez--get-titleZgettitlez--get-idZgetidz--get-thumbnailZgetthumbnailz--get-descriptionZgetdescriptionz--get-durationZgetdurationz--get-filenameZgetfilenamez--get-formatZ	getformatz-jz--dump-jsonZdumpjsonzQuiet, but print JSON information for each video. Simulate unless --no-simulate is used. See "OUTPUT TEMPLATE" for a description of available keysz-Jz--dump-single-jsonZdump_single_jsonzQuiet, but print JSON information for each URL or infojson passed. Simulate unless --no-simulate is used. If the URL refers to a playlist, the whole playlist information is dumped in a single linez--print-jsonZ
print_jsonz--force-write-archivez--force-write-download-archivez--force-download-archiveZforce_write_download_archivezForce download archive entries to be written as far as no errors occur, even if -s or another simulation option is used (Alias: --force-download-archive)z	--newlineZprogress_with_newlinez Output progress bar as new linesz--no-progressZ
noprogresszDo not print progress barz
--progressz(Show progress bar, even if in quiet modez--console-titleZconsoletitlez$Display progress in console titlebarz--progress-templatez[TYPES:]TEMPLATEZprogress_templatez(download|postprocess)(-title)?downloadau  Template for progress outputs, optionally prefixed with one of "download:" (default), "download-title:" (the console title), "postprocess:",  or "postprocess-title:". The video's fields are accessible under the "info" key and the progress attributes are accessible under "progress" key. E.g. --console-title --progress-template "download-title:%(info.id)s-%(progress.eta)s"z--progress-deltaZprogress_deltaz)Time between progress output (default: 0))r~   r   r   r   r$   r   z-vz	--verboserL   z#Print various debugging informationz--dump-pagesz--dump-intermediate-pagesZdump_intermediate_pageszLPrint downloaded pages encoded using base64 to debug problems (very verbose)z--write-pagesZwrite_pageszWWrite downloaded intermediary pages to files in the current directory to debug problemsz--load-pagesZ
load_pagesz--youtube-print-sig-codeZyoutube_print_sig_codez--print-trafficz--dump-headersZdebug_printtrafficz"Display sent and read HTTP trafficz-Cz--call-homeZ	call_homez--no-call-homezFilesystem Optionsz-az--batch-fileZ	batchfilezFile containing URLs to download ("-" for stdin), one URL per line. Lines starting with "#", ";" or "]" are considered as comments and ignoredz--no-batch-filez*Do not read URLs from batch file (default)z--idZuseid)r$   r   r   r   z-Pz--pathsz[TYPES:]PATHr)   zhome|temp|{}rD   a  The paths where the files should be downloaded. Specify the type of file and the path separated by a colon ":". All the same TYPES as --output are supported. Additionally, you can also provide "home" (default) and "temp" paths. All intermediary files are first downloaded to the temp path and then the final files are moved over to the home path after download is finished. This option is ignored if --output is an absolute pathz-oz--outputZouttmplz;Output filename template; see "OUTPUT TEMPLATE" for detailsz--output-na-placeholderZouttmpl_na_placeholderZTEXTZNAzDPlaceholder for unavailable fields in --output (default: "%default")z--autonumber-sizeZautonumber_size)r   r~   r   r   z--autonumber-startZautonumber_startz--restrict-filenamesZrestrictfilenameszRRestrict filenames to only ASCII characters, and avoid "&" and spaces in filenamesz--no-restrict-filenamesz?Allow Unicode characters, "&" and spaces in filenames (default)z--windows-filenamesZwindowsfilenamesz(Force filenames to be Windows-compatiblez--no-windows-filenameszAMake filenames Windows-compatible only if using Windows (default)z--trim-filenamesz--trim-file-namesZLENGTHZtrim_file_namezULimit the filename length (excluding extension) to the specified number of charactersz-wz--no-overwritesZ
overwriteszDo not overwrite any filesz--force-overwritesz--yes-overwriteszJOverwrite all video and metadata files. This option includes --no-continuez--no-force-overwriteszADo not overwrite the video, but overwrite related files (default)z-cz
--continueZcontinue_dlz5Resume partially downloaded files/fragments (default)z--no-continuezpDo not resume partially downloaded fragments. If the file is not fragmented, restart download of the entire filez--partZnopartzFUse .part files instead of writing directly into output file (default)z	--no-partz8Do not use .part files - write directly into output filez--mtimeZ
updatetimezHUse the Last-modified header to set the file modification time (default)z
--no-mtimezEDo not use the Last-modified header to set the file modification timez--write-descriptionZwritedescriptionz.Write video description to a .description filez--no-write-descriptionz(Do not write video description (default)z--write-info-jsonZwriteinfojsonzQWrite video metadata to a .info.json file (this may contain personal information)z--no-write-info-jsonz%Do not write video metadata (default)z--write-annotationsZwriteannotationsz--no-write-annotationsz--write-playlist-metafilesZallow_playlist_fileszzWrite playlist metadata in addition to the video metadata when using --write-info-json, --write-description etc. (default)z--no-write-playlist-metafileszUDo not write playlist metadata when using --write-info-json, --write-description etc.z--clean-info-jsonz--clean-infojsonZclean_infojsonzKRemove some internal metadata such as filenames from the infojson (default)z--no-clean-info-jsonz--no-clean-infojsonz Write all fields to the infojsonz--write-commentsz--get-commentsgetcommentszRetrieve video comments to be placed in the infojson. The comments are fetched even without this option if the extraction is known to be quick (Alias: --get-comments)z--no-write-commentsz--no-get-commentszdDo not retrieve video comments unless the extraction is known to be quick (Alias: --no-get-comments)z--load-info-jsonz--load-infoZload_info_filenamezXJSON file containing the video information (created with the "--write-info-json" option)z	--cookiesZ
cookiefilezCNetscape formatted file to read cookies from and dump cookie jar inz--no-cookiesz/Do not read/dump cookies from/to file (default))r   r   r   r~   r   z--cookies-from-browserZcookiesfrombrowserz(BROWSER[+KEYRING][:PROFILE][::CONTAINER]zPThe name of the browser to load cookies from. Currently supported browsers are: aV  . Optionally, the KEYRING used for decrypting Chromium cookies on Linux, the name/path of the PROFILE to load cookies from, and the CONTAINER name (if Firefox) ("none" for no container) can be given with their respective separators. By default, all containers of the most recently accessed profile are used. Currently supported keyrings are: z--no-cookies-from-browserz*Do not load cookies from browser (default)z--cache-dirZcachedirZDIRzLocation in the filesystem where yt-dlp can store some downloaded information (such as client ids and signatures) permanently. By default ${XDG_CACHE_HOME}/yt-dlpz--no-cache-dirzDisable filesystem cachingz--rm-cache-dirZrm_cachedirz!Delete all filesystem cache fileszThumbnail Optionsz--write-thumbnailZwritethumbnailc                 S   s   t |j| jt|j| jpdS r   )r   r   r   r   )r   rh   __rW   r+   r+   r,   r     s     zWrite thumbnail image to disk)r   r   r$   r   r   z--no-write-thumbnailz.Do not write thumbnail image to disk (default)z--write-all-thumbnailsz)Write all thumbnail image formats to diskz--list-thumbnailsZlist_thumbnailszNList available thumbnails of each video. Simulate unless --no-simulate is usedzInternet Shortcut Optionsz--write-linkZ	writelinkzWrite an internet shortcut file, depending on the current platform (.url, .webloc or .desktop). The URL may be cached by the OSz--write-url-linkZwriteurllinkzTWrite a .url Windows internet shortcut. The OS caches the URL based on the file pathz--write-webloc-linkZwritewebloclinkz'Write a .webloc macOS internet shortcutz--write-desktop-linkZwritedesktoplinkz(Write a .desktop Linux internet shortcutzPost-Processing Optionsz-xz--extract-audioZextractaudiozEConvert video files to audio-only files (requires ffmpeg and ffprobe)z--audio-formatZaudioformatzVFormat to convert the audio to when -x is used. (currently supported: best (default), zG). You can specify multiple rules using similar syntax as --remux-videoz--audio-qualityZQUALITYZaudioquality5zSpecify ffmpeg audio quality to use when converting the audio with -x. Insert a value between 0 (best) and 10 (worst) for VBR or a specific bitrate like 128K (default %default)z--remux-videoZ
remuxvideozJRemux the video into another container if necessary (currently supported: z). If the target container does not support the video/audio codec, remuxing will fail. You can specify multiple rules; e.g. "aac>m4a/mov>mp4/mkv" will remux aac to m4a, mov to mp4 and anything else to mkvz--recode-videoZrecodevideoztRe-encode the video into another format if necessary. The syntax and supported formats are the same as --remux-videoz--postprocessor-argsz--ppaZpostprocessor_argsz\w+(?:\+\w+)?zdefault-compat)r   r   r   r   a  Give these arguments to the postprocessors. Specify the postprocessor/executable name and the arguments separated by a colon ":" to give the argument to the specified postprocessor/executable. Supported PP are: Merger, ModifyChapters, SplitChapters, ExtractAudio, VideoRemuxer, VideoConvertor, Metadata, EmbedSubtitle, EmbedThumbnail, SubtitlesConvertor, ThumbnailsConvertor, FixupStretched, FixupM4a, FixupM3u8, FixupTimestamp and FixupDuration. The supported executables are: AtomicParsley, FFmpeg and FFprobe. You can also specify "PP+EXE:ARGS" to give the arguments to the specified executable only when being used by the specified postprocessor. Additionally, for ffmpeg/ffprobe, "_i"/"_o" can be appended to the prefix optionally followed by a number to pass the argument before the specified input/output file, e.g. --ppa "Merger+ffmpeg_i1:-v quiet". You can use this option multiple times to give different arguments to different postprocessors. (Alias: --ppa)z-kz--keep-videoZ	keepvideoz>Keep the intermediate video file on disk after post-processingz--no-keep-videozBDelete the intermediate video file after post-processing (default)z--post-overwritesZnopostoverwritesz(Overwrite post-processed files (default)z--no-post-overwritesz%Do not overwrite post-processed filesz--embed-subsZembedsubtitlesz@Embed subtitles in the video (only for mp4, webm and mkv videos)z--no-embed-subsz Do not embed subtitles (default)z--embed-thumbnailZembedthumbnailz)Embed thumbnail in the video as cover artz--no-embed-thumbnailz Do not embed thumbnail (default)z--embed-metadataz--add-metadataZaddmetadatazEmbed metadata to the video file. Also embeds chapters/infojson if present unless --no-embed-chapters/--no-embed-info-json are used (Alias: --add-metadata)z--no-embed-metadataz--no-add-metadataz@Do not add metadata to file (default) (Alias: --no-add-metadata)z--embed-chaptersz--add-chaptersZaddchaptersz=Add chapter markers to the video file (Alias: --add-chapters)z--no-embed-chaptersz--no-add-chaptersz?Do not add chapter markers (default) (Alias: --no-add-chapters)z--embed-info-jsonZembed_infojsonz:Embed the infojson as an attachment to mkv/mka video filesz--no-embed-info-jsonz<Do not embed the infojson as an attachment to the video filez--metadata-from-titleZmetafromtitle--parse-metadataz[WHEN:]FROM:TOZparse_metadataZpre_processzParse additional metadata like title/artist from other fields; see "MODIFYING METADATA" for details. Supported values of "WHEN" are the same as that of --use-postprocessor (default: pre_process)--replace-in-metadataz[WHEN:]FIELDS REGEX REPLACE)r   r~   r   zReplace text in a metadata field using the given regex. This option can be used multiple times. Supported values of "WHEN" are the same as that of --use-postprocessor (default: pre_process)z--xattrsz--xattrZxattrszOWrite metadata to the video file's xattrs (using Dublin Core and XDG standards)z--concat-playlistZPOLICYZconcat_playlistmulti_video)r  alwaysr.  ar  Concatenate videos in a playlist. One of "never", "always", or "multi_video" (default; only when the videos form a single show). All the video files must have the same codecs and number of streams to be concatenable. The "pl_video:" prefix can be used with "--paths" and "--output" to set the output filename for the concatenated files. See "OUTPUT TEMPLATE" for details)r~   r   r$   choicesr   z--fixupfixup)r  ignorewarnZdetect_or_warnforcezAutomatically correct known faults of the file. One of never (do nothing), warn (only emit a warning), detect_or_warn (the default; fix the file if we can, warn otherwise), force (try fixing even if the file already exists)z--prefer-avconvz--no-prefer-ffmpegZprefer_ffmpegz--prefer-ffmpegz--no-prefer-avconvz--ffmpeg-locationz--avconv-locationZffmpeg_locationzXLocation of the ffmpeg binary; either the path to the binary or its containing directory--execz
[WHEN:]CMDZexec_cmdZ
after_movea  Execute a command, optionally prefixed with when to execute it, separated by a ":". Supported values of "WHEN" are the same as that of --use-postprocessor (default: after_move). The same syntax as the output template can be used to pass any field as arguments to the command. If no fields are passed, %(filepath,_filename|)q is appended to the end of the command. This option can be used multiple timesz	--no-execz$Remove any previously defined --execz--exec-before-downloadZCMDZexec_before_dl_cmd)r~   r   r   r   z--no-exec-before-downloadz--convert-subsz--convert-subz--convert-subtitlesZconvertsubtitlesz>Convert the subtitles to another format (currently supported: zY). Use "--convert-subs none" to disable conversion (default) (Alias: --convert-subtitles)z--convert-thumbnailsZconvertthumbnailsz?Convert the thumbnails to another format (currently supported: z). You can specify multiple rules using similar syntax as "--remux-video". Use "--convert-thumbnails none" to disable conversion (default)z--split-chaptersz--split-tracksZsplit_chapterszSplit video into multiple files based on internal chapters. The "chapter:" prefix can be used with "--paths" and "--output" to set the output filename for the split files. See "OUTPUT TEMPLATE" for detailsz--no-split-chaptersz--no-split-tracksz.Do not split video based on chapters (default)z--remove-chaptersZremove_chapterszRemove chapters whose title matches the given regular expression. The syntax is the same as --download-sections. This option can be used multiple timesz--no-remove-chaptersz2Do not remove any chapters from the file (default)z--force-keyframes-at-cutsZforce_keyframes_at_cutszForce keyframes at cuts when downloading/splitting/removing sections. This is slow due to needing a re-encode, but the resulting video may have fewer artifacts around the cutsz--no-force-keyframes-at-cutszKDo not force keyframes around the chapters when cutting/splitting (default)rE   c                 S   s,   dd |r| dng D dt| dffS )Nc                 s   s   | ]}| d dV  qdS =r   Nr1   )rO   itemr+   r+   r,   rQ     s     2create_parser.<locals>.<lambda>.<locals>.<genexpr>;r   ZPP)r1   r   )r   r   r+   r+   r,   r     s    z--use-postprocessorzNAME[:ARGS]Zadd_postprocessorsc                    s   t  | dd S )Nr   r   r   r1   r   )_postprocessor_opts_parserr+   r,   r     r   )ry   r   a  The (case-sensitive) name of plugin postprocessors to be enabled, and (optionally) arguments to be passed to it, separated by a colon ":". ARGS are a semicolon ";" delimited list of NAME=VALUE. The "when" argument determines when the postprocessor is invoked. It can be one of "pre_process" (after video extraction), "after_filter" (after video passes filter), "video" (after --format; before --print/--output), "before_dl" (before each video download), "post_process" (after each video download; default), "after_move" (after moving the video file to its final location), "after_video" (after downloading and processing all formats of a video), or "playlist" (at end of playlist). This option can be used multiple times to add different postprocessorszSponsorBlock OptionszMake chapter entries for, or remove various segments (sponsor, introductions, etc.) from downloaded YouTube videos using the SponsorBlock API (https://sponsor.ajay.app))descriptionz--sponsorblock-markZCATSZsponsorblock_markz^SponsorBlock categories to create chapters for, separated by commas. Available categories are z, all and default (=all). You can prefix the category with a "-" to exclude it. See [1] for descriptions of the categories. E.g. --sponsorblock-mark all,-preview [1] https://wiki.sponsor.ajay.app/w/Segment_Categories)r~   r   r$   r   r   r   r   r   z--sponsorblock-removeZsponsorblock_removez-fillera  SponsorBlock categories to be removed from the video file, separated by commas. If a category is present in both mark and remove, remove takes precedence. The syntax and available categories are the same as for --sponsorblock-mark except that "default" refers to "all,-filler" and z are not availablez--sponsorblock-chapter-titleTEMPLATEZsponsorblock_chapter_titlezAn output template for the title of the SponsorBlock chapters created by --sponsorblock-mark. The only available fields are start_time, end_time, category, categories, name, category_names. Defaults to "%default")r~   r$   r   r   z--no-sponsorblockZno_sponsorblockz:Disable both --sponsorblock-mark and --sponsorblock-removez--sponsorblock-apizhttps://sponsor.ajay.appZsponsorblock_apiz/SponsorBlock API location, defaults to %defaultz--sponskrubZ	sponskrubz--no-sponskrubz--sponskrub-cutZsponskrub_cutz--no-sponskrub-cutz--sponskrub-forceZsponskrub_forcez--no-sponskrub-forcez--sponskrub-locationZsponskrub_pathz--sponskrub-argsZsponskrub_argsZARGSzExtractor Optionsz--extractor-retriesZextractor_retrieszQNumber of retries for known extractor errors (default is %default), or "infinite"z--allow-dynamic-mpdz--no-ignore-dynamic-mpdZdynamic_mpdzIProcess dynamic DASH manifests (default) (Alias: --no-ignore-dynamic-mpd)z--ignore-dynamic-mpdz--no-allow-dynamic-mpdzEDo not process dynamic DASH manifests (Alias: --no-allow-dynamic-mpd)z--hls-split-discontinuityZhls_split_discontinuityzMSplit HLS playlists to different formats at discontinuities such as ad breaksz--no-hls-split-discontinuityz`Do not split HLS playlists into different formats at discontinuities such as ad breaks (default)c                 S   s*   |    dddd td|D fS )Nr   rh   c                 S   s   g | ]}| d d qS )z\,r   )rV   rI   )rO   r   r+   r+   r,   r   l  s    z3create_parser.<locals>.<lambda>.<locals>.<listcomp>z(?<!\\),)rI   r   rV   r   r1   )r   valsr+   r+   r,   r   l  s   
z--extractor-argszIE_KEY:ARGSZextractor_argsc                    s   t  fdd| dD S )Nc                 3   s   | ]} | d d V  qdS r6  r8  )rO   r   _extractor_arg_parserr+   r,   rQ   t  s    r:  r;  r<  r=  rB  r+   r,   r   t  s   )r   r   zPass ARGS arguments to the IE_KEY extractor. See "EXTRACTOR ARGUMENTS" for details. You can use this option multiple times to give arguments for different extractorsz--youtube-include-dash-manifestz--no-youtube-skip-dash-manifestZyoutube_include_dash_manifestz--youtube-skip-dash-manifestz"--no-youtube-include-dash-manifestz--youtube-include-hls-manifestz--no-youtube-skip-hls-manifestZyoutube_include_hls_manifestz--youtube-skip-hls-manifestz!--no-youtube-include-hls-manifest)r#  r$  )r&  )r,  )r-  )r5  )rE   )rE   )+r   rI   r   r   rT   OptionGroupstringr   r   r   r   r   	partitionr'   r   SUPPRESS_HELPr   r   floatrs   sortedr   ZSUPPORTED_EXTSr   r   r   r   r   r   r1   r   r   r   r   r   r   r	   r
   r   
CATEGORIESZNON_SKIPPABLE_CATEGORIESr   r   )r   r   r   rW   r   ZgeneralnetworkZgeoZ	selectionZauthenticationZvideo_formatZ	subtitles
downloaderZworkarounds	verbosity
filesystemZ	thumbnaillinkZpostprocZsponsorblockZ	extractorr+   )r   r   r   rC  r>  r   r,   rS      s   	 
     
        
                    
   	                                                                                                                                                                                                                                              
                                                   	                                                                                                                                                                                                        .                                                                           
  	        	                             
                                                   















rS   c                 C   s   t dt d t| S )Nr   zz._hide_login_info" is deprecated and may be removed in a future version. Use "yt_dlp.utils.Config.hide_login_info" instead)r   r   r   Zhide_login_info)rf   r+   r+   r,   _hide_login_info  s    rP  )Nr!   )7r   ra   rT   os.pathr%   r   r   rn   rE  rX   compatr   cookiesr   r   Zdownloader.externalr   Zpostprocessorr   r   r	   r
   r   r   Zpostprocessor.modify_chaptersr   updater   r   r   utilsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    ri   IndentedHelpFormatterrj   OptionParserr   rS   rP  r+   r+   r+   r,   <module>   sD    @
[B             P