3
b`                 @   s   d dl m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mZmZmZ ddlmZmZ ddlmZ dd	 Zdd
dZdS )    )unicode_literalsN   )list_external_downloaders)compat_expandusercompat_get_terminal_sizecompat_getenvcompat_kwargscompat_shlex_split)preferredencodingwrite_string)__version__c                s   t dddddddg}tjdd	jd
d |D  d   fdd}tt|| } x8t| D ],\}}||kr\|d t| k r\d| |d < q\W | S )Nz-pz
--passwordz-uz
--usernamez--video-passwordz--ap-passwordz--ap-usernamez	^(?P<key>|c             s   s   | ]}t j|V  qd S )N)reescape).0Zpo r   >C:\Users\Broad\Desktop\All-Down\binaries\youtube_dl\options.py	<genexpr>   s    z#_hide_login_info.<locals>.<genexpr>z)=.+$c                s$    j | }|r|jdd S | S d S )Nkeyz=PRIVATE)matchgroup)om)eqrer   r   	_scrub_eq   s    
z#_hide_login_info.<locals>._scrub_eqr   ZPRIVATE)setr   compilejoinlistmap	enumeratelen)optsZPRIVATE_OPTSr   idxoptr   )r   r   _hide_login_info   s    "r%   c       #         s  g fdd  fdd}dd }dd }t  j}|r8|nd	}d	}tj||d
}||_t|ddd}tjf t|}	tj|	d}
|
j	ddddd |
j	dddd |
j	dddddd |
j	ddddd d!d" |
j	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d0d d1d" |
j	d2d3d4d5d6 |
j	d7dd8d |
j	d9d:d;d<d6 |
j	d=d>d?d@d dAdB |
j	dCddDd dEd" |
j	dFd$dDd dGd" |
j	dHdIddJd dKd" tj|	dL}|j	dMdNd dOdPdQ |j	dRdSt
d dTdUdV |j	dWdXdYd dZd[ |j	d\d]d>d^dYd_d` |j	dadbd>dcdYddd` tj|	de}|j	dfdgd dOdhdQ |j	didjd dOtjdQ |j	dkddldmdnd" |j	dod$dldmdpd" |j	dqdrdsd dtd[ |j	dudvdwd dxd[ tj|	dy}|j	dzd{d|d}td~d |j	ddd|d tdd |j	dddd dd |j	ddddd6 |j	ddddd6 |j	ddd|td dd |j	dddd dd[ |j	dddd dd[ |j	dddd dd[ |j	dddd dd[ |j	dddd dd[ |j	dddd tdd |j	dddd tdd |j	dddd dd[ |j	dddd dd" |j	dd$dd dd" |j	dddd tdd |j	ddddd |j	ddddd tj|	d}|j	dddddd6 |j	dddddd6 |j	dddddd6 |j	ddddd dd" |j	ddddd6 tj|	dك}|j	ddddd6 |j	ddddd6 |j	ddddd6 |j	dddd dd" tj|	d}|j	dddddd dd |j	dd>dddd |j	dddd dd" |j	dddddd |j	ddddmtjd" |j	dd$ddd |j	ddddd d d tj|	d}|j	ddddd dd" |j	d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d |j	dddddddg |dd
 tj|	d}|j	ddd d!d"d#d6 |j	d$d%d&d'd(d)d |j	d*d+d'd(d,d |j	d-dd.dmd/d" |j	d0d$d.d1d |j	d2dd3d d4d" |j	d5d6dd7d8d |j	d9dd:d d;d" |j	d<d=dd d>d |j	d?dd@d tjd" |j	dAddBd |j	dCddDd |j	dEdFddGd |j	dHdIdd dJdK |j	dLdId$d dMdK |j	dNdOddPd |j	dQdRdSdTdUjt  d6 |j	dVdWdXdYd6 tj|	dZ}|j	d[d\d]d^d6 |j	d_dd`d dad" |j	dbdcdddded |j	dfdgdhdid |j	djdOdkd dld[ |j	dmdndodpdqdr |j	dsdtddud |j	dvdwdTdxt
dydz |j	d{dTd|t
d}dz tj|	d~}|j	ddddd dd" |j	dddd ddK |j	ddddd dd" |j	dddd dd" |j	ddddd dd" |j	ddddd dd" |j	dddd dd" |j	dddd dd" |j	dddd dd" |j	dddd dd" |j	dddd dd" |j	dddd dd" |j	ddddd dd" |j	ddddd dd" |j	dddd dd" |j	dddd dd" |j	dddd dd" |j	dddd dd" |j	ddddd dd" |j	ddddd dd" |j	dddd dd" |j	dddd tjd" |j	dȐdɐddd dːdK |j	d̐d͐ddd dϐdK |j	dАdd$d dѐdK tj|	d҃}|j	dӐdԐdddd6 |j	dd ddؐdِdڍ |j	dېdܐdݐdސdd6 |j	ddd|ttjd |j	ddd|d}tdd |j	dddd dd" |j	ddddd tjd" |j	ddddd tjd" |j	ddd ddtjdڍ |j	ddddd dd" |j	dddddmdd" |j	dd$ddd |j	dddd dd" |j	dd$ddm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d6 |j	ddddd6 |j	ddd dddQ |j	dd>d ddd` |j	ddddd tj|	d}|j	dddd dd" |j	dddd d d" |j	d!dd"d d#d" tj|	d$}|j	d%d&dd'd d(d" |j	d)dd*dd+d[ |j	d,d-d.d/d0d[ |j	d1dd2d d3d[ |j	d4d5dXd6d6 |j	d7d8dd9d d:d" |j	d;dd<d d=d" |j	d>dd?d d@d" |j	dAddBd dCd" |j	dDddEd dFd" |j	dGddHdId |j	dJddKd dLd" |j	dMdNdOdPdQd[ |j	dRd$dSdTd |j	dUddSdVd |j	dWdXd;dYdZd |j	d[d\d]d^d |j	d_d`ddad dbd[ |	j|
 |	j| |	j| |	j| |	j| |	j| |	j| |	j| |	j| |	j| |	j| |	j| |	j| |	j| | d k	r|	j| \}}|jrtdct|  dd  n,dedf }|tjd}d  }|	j|\}}g  } }}d9|krHt|j}tjj|r tjj|dg}tjj|s>|	jdh|   |}n&d7|krTn di}d7|krn| }|| | | } |	j| \}}|jrxLdj|fdk|fdl|fdm|ffD ]$\}!}"tdn|!tt|"f  qW |	||fS (o  Nc             S   s`   yt | }W n tk
r    |S X z.|j }tjdk rB|jt }t|dd}W d |j  X |S )N   T)Zcomments)r&   )	openIOErrorreadsysversion_infodecoder
   r	   close)Zfilename_bytesdefaultZoptionfcontentsresr   r   r   _readOptions*   s    

zparseOpts.<locals>._readOptionsc                 s  t d} | r8tjj| dd}tjj|sntjj| d}n6tjjtdddd}tjj|sntjjtddd} |d }|d krt d}|rĈ tjj|ddd d}|d krĈ tjj|dd	d d}|d kr tjjtddd d}|d kr
 tjjtdd
d d}|d krg }|S )NZXDG_CONFIG_HOMEz
youtube-dlconfigzyoutube-dl.conf~z.configZappdata)r.   z
config.txtzyoutube-dl.conf.txt)r   ospathr   isfiler   )Zxdg_config_homeZuserConfFileZuserConfZappdata_dir)r1   r   r   _readUserConf9   s<    


z parseOpts.<locals>._readUserConfc             S   sj   g }| j r|j| j d  | jr0|j| jd  t|dkrH|jdd | j r`|jd| j  dj|S )z+ ('-o', '--option') -> -o, --format METAVARr   r   z, z %s )Z_short_optsappendZ
_long_optsr!   insertZtakes_valuemetavarr   )optionr"   r   r   r   _format_option_string^   s    z(parseOpts.<locals>._format_option_stringc             S   s   t |j| j|jd d S )N,)setattrvaluesdestsplit)r<   Zopt_strvalueparserr   r   r   (_comma_separated_values_options_callbacko   s    z;parseOpts.<locals>._comma_separated_values_options_callbackP   )widthmax_help_positionz%prog [OPTIONS] URL [URL...]Zresolve)version	formatterusageconflict_handlerzGeneral Optionsz-hz--helphelpzPrint this help text and exit)actionrM   z	--versionrI   zPrint program version and exitz-Uz--update
store_trueupdate_selfzoUpdate this program to latest version. Make sure that you have sufficient permissions (run with sudo if needed))rN   rA   rM   z-iz--ignore-errorsignoreerrorsFzQContinue on download errors, for example to skip unavailable videos in a playlist)rN   rA   r.   rM   z--abort-on-errorstore_falsez\Abort downloading of further videos (in the playlist or the command line) if an error occursz--dump-user-agentdump_user_agentz*Display the current browser identificationz--list-extractorslist_extractorszList all supported extractorsz--extractor-descriptionslist_extractor_descriptionsz/Output descriptions of all supported extractorsz--force-generic-extractorforce_generic_extractorz-Force extraction to use the generic extractorz--default-searchdefault_searchZPREFIXaw  Use this prefix for unqualified URLs. For example "gvsearch2:" downloads two videos from google videos for youtube-dl "large apple". Use the value "auto" to let youtube-dl 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.)rA   r;   rM   z--ignore-configzDo not read configuration files. When given in the global configuration file /etc/youtube-dl.conf: Do not read the user configuration in ~/.config/youtube-dl/config (%APPDATA%/youtube-dl/config.txt on Windows)z--config-locationconfig_locationPATHz^Location of the configuration file; either the path to the config or its containing directory.z--flat-playliststore_constextract_flatZin_playlistz8Do not extract the videos of a playlist, only list them.)rN   rA   constr.   rM   z--mark-watchedmark_watchedz"Mark videos watched (YouTube only)z--no-mark-watchedz)Do not mark videos watched (YouTube only)z
--no-colorz--no-colorsno_colorz!Do not emit color codes in outputzNetwork Optionsz--proxyproxyZURLzUse the specified HTTP/HTTPS/SOCKS proxy. To enable SOCKS proxy, specify a proper scheme. For example socks5://127.0.0.1:1080/. Pass in an empty string (--proxy "") for direct connection)rA   r.   r;   rM   z--socket-timeoutsocket_timeoutZSECONDSz)Time to wait before giving up, in seconds)rA   typer.   r;   rM   z--source-addressZIPsource_addressz!Client-side IP address to bind to)r;   rA   r.   rM   z-4z--force-ipv4z0.0.0.0zMake all connections via IPv4)rN   r\   rA   rM   z-6z--force-ipv6z::zMake all connections via IPv6zGeo Restrictionz--geo-verification-proxy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 downloading.z--cn-verification-proxycn_verification_proxyz--geo-bypass
geo_bypassTzDBypass geographic restriction via faking X-Forwarded-For HTTP headerz--no-geo-bypasszKDo not bypass geographic restriction via faking X-Forwarded-For HTTP headerz--geo-bypass-countryZCODEgeo_bypass_countryz_Force bypass geographic restriction with explicitly provided two-letter ISO 3166-2 country codez--geo-bypass-ip-blockZIP_BLOCKgeo_bypass_ip_blockzVForce bypass geographic restriction with explicitly provided IP block in CIDR notationzVideo Selectionz--playlist-startplayliststartNUMBERr   z0Playlist video to start at (default is %default))rA   r;   r.   ra   rM   z--playlist-endplaylistendz*Playlist video to end at (default is last)z--playlist-itemsplaylist_itemsZ	ITEM_SPECaB  Playlist video items to download. Specify indices of the videos in the playlist separated by commas like: "--playlist-items 1,2,5,8" if you want to download videos indexed 1, 2, 5, 8 in the playlist. You can specify range: "--playlist-items 1-3,7,10-13", it will download the videos at index 1, 2, 3, 7, 10, 11, 12 and 13.)rA   r;   r.   rM   z--match-title
matchtitleZREGEXz<Download only matching titles (regex or caseless sub-string)z--reject-titlerejecttitlez@Skip download for matching titles (regex or caseless sub-string)z--max-downloadsmax_downloadsz$Abort after downloading NUMBER files)rA   r;   ra   r.   rM   z--min-filesizeZSIZEmin_filesizez@Do not download any videos smaller than SIZE (e.g. 50k or 44.6m)z--max-filesizemax_filesizez?Do not download any videos larger than SIZE (e.g. 50k or 44.6m)z--dateZDATEdatez*Download only videos uploaded in this datez--datebefore
datebeforezEDownload only videos uploaded on or before this date (i.e. inclusive)z--dateafter	dateafterzDDownload only videos uploaded on or after this date (i.e. inclusive)z--min-viewsZCOUNT	min_viewsz5Do not download any videos with less than COUNT views)r;   rA   r.   ra   rM   z--max-views	max_viewsz5Do not download any videos with more than COUNT viewsz--match-filterZFILTERmatch_filtera  Generic video filter. Specify any key (see the "OUTPUT TEMPLATE" for a list of available keys) to match if the key is present, !key to check if the key is not present, key > NUMBER (like "comment_count > 12", also works with >=, <, <=, !=, =) to compare against a number, key = 'LITERAL' (like "uploader = 'Mike Smith'", also works with !=) to match against a string literal and & to require multiple matches. Values which are not known are excluded unless you put a question mark (?) after the operator. For example, to only match videos that have been liked more than 100 times and disliked less than 50 times (or the dislike functionality is not available at the given service), but who also have a description, use --match-filter "like_count > 100 & dislike_count <? 50 & description" .z--no-playlist
noplaylistzEDownload only the video, if the URL refers to a video and a playlist.z--yes-playlistzCDownload the playlist, if the URL refers to a video and a playlist.z--age-limitZYEARS	age_limitz/Download only videos suitable for the given agez--download-archiveZFILEdownload_archivezcDownload only videos not listed in the archive file. Record the IDs of all downloaded videos in it.)r;   rA   rM   z--include-adsinclude_adsz.Download advertisements as well (experimental))rA   rN   rM   zAuthentication Optionsz-uz
--usernameusernameZUSERNAMEzLogin with this account IDz-pz
--passwordpasswordZPASSWORDzPAccount password. If this option is left out, youtube-dl will ask interactively.z-2z--twofactor	twofactorZ	TWOFACTORzTwo-factor authentication codez-nz--netrcusenetrczUse .netrc authentication dataz--video-passwordvideopasswordz%Video password (vimeo, smotri, youku)zAdobe Pass Optionsz--ap-msoap_msoZMSOzlAdobe Pass multiple-system operator (TV provider) identifier, use --ap-list-mso for a list of available MSOsz--ap-usernameap_usernamez&Multiple-system operator account loginz--ap-passwordap_passwordziMultiple-system operator account password. If this option is left out, youtube-dl will ask interactively.z--ap-list-msoap_list_msoz,List all supported multiple-system operatorszVideo Format Optionsz-fz--formatstoreformatZFORMATz>Video format code, see the "FORMAT SELECTION" for all the info)rN   rA   r;   r.   rM   z--all-formatsallz$Download all available video formats)rN   rA   r\   rM   z--prefer-free-formatsprefer_free_formatsz<Prefer free video formats unless a specific one is requestedz-Fz--list-formatslistformatsz.List all available formats of requested videosz--youtube-include-dash-manifestyoutube_include_dash_manifestz--youtube-skip-dash-manifestzEDo not download the DASH manifests and related data on YouTube videosz--merge-output-formatmerge_output_formatzIf a merge is required (e.g. bestvideo+bestaudio), output to given container format. One of mkv, mp4, ogg, webm, flv. Ignored if no merge is requiredzSubtitle Optionsz--write-subz--write-srtwritesubtitleszWrite subtitle filez--write-auto-subz--write-automatic-subwriteautomaticsubz:Write automatically generated subtitle file (YouTube only)z
--all-subsallsubtitlesz1Download all the available subtitles of the videoz--list-subslistsubtitlesz*List all available subtitles for the videoz--sub-formatsubtitlesformatbestzQSubtitle format, accepts formats preference, for example: "srt" or "ass/srt/best"z
--sub-langz--sub-langsz
--srt-langcallbacksubtitleslangsZLANGSstrzrLanguages of the subtitles to download (optional) separated by commas, use --list-subs for available language tags)rN   rA   r;   ra   r.   r   rM   zDownload Optionsz-rz--limit-ratez--rate-limit	ratelimitZRATEz<Maximum download rate in bytes per second (e.g. 50K or 4.2M)z-Rz	--retriesretriesZRETRIES
   z7Number of retries (default is %default), or "infinite".z--fragment-retriesfragment_retriesz_Number of retries for a fragment (default is %default), or "infinite" (DASH, hlsnative and ISM)z--skip-unavailable-fragmentsskip_unavailable_fragmentsz4Skip unavailable fragments (DASH, hlsnative and ISM)z--abort-on-unavailable-fragmentz5Abort downloading when some fragment is not availablez--keep-fragmentskeep_fragmentsz`Keep downloaded fragments on disk after downloading is finished; fragments are erased by defaultz--buffer-size
buffersizeZ1024z@Size of download buffer (e.g. 1024 or 16K) (default is %default)z--no-resize-buffernoresizebufferzDo not automatically adjust the buffer size. By default, the buffer size is automatically resized from an initial value of SIZE.z--http-chunk-size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)Download playlist videos in reverse orderz--playlist-randomz(Download playlist videos in random orderz--xattr-set-filesizexattr_set_filesizez9Set file xattribute ytdl.filesize with expected file sizez--hls-prefer-nativehls_prefer_nativez/Use the native HLS downloader instead of ffmpeg)rA   rN   r.   rM   z--hls-prefer-ffmpegz/Use ffmpeg instead of the native HLS downloaderz--hls-use-mpegtshls_use_mpegtszUse the mpegts container for HLS videos, allowing to play the video while downloading (some players may not be able to play it)z--external-downloaderexternal_downloaderZCOMMANDz<Use the specified external downloader. Currently supports %sr>   z--external-downloader-argsexternal_downloader_argsZARGSz/Give these arguments to the external downloaderZWorkaroundsz
--encodingencodingENCODINGz+Force the specified encoding (experimental)z--no-check-certificateno_check_certificatez%Suppress HTTPS certificate validationz--prefer-insecurez--prefer-unsecureprefer_insecurezmUse an unencrypted connection to retrieve information about the video. (Currently supported only for YouTube)z--user-agentZUA
user_agentzSpecify a custom user agentz	--refererrefererzMSpecify a custom referer, use if the video access is restricted to one domainz--add-headerzFIELD:VALUEheadersr9   zlSpecify a custom HTTP header and its value, separated by a colon ':'. You can use this option multiple times)r;   rA   rN   rM   z--bidi-workaroundbidi_workaroundzhWork around terminals that lack bidirectional text support. Requires bidiv or fribidi executable in PATHz--sleep-intervalz--min-sleep-intervalsleep_intervalzNumber of seconds to sleep before each download when used alone or a lower bound of a range for randomized sleep before each download (minimum possible number of seconds to sleep) when used along with --max-sleep-interval.)r;   rA   ra   rM   z--max-sleep-intervalmax_sleep_intervalzUpper bound of a range for randomized sleep before each download (maximum possible number of seconds to sleep). Must only be used along with --min-sleep-interval.zVerbosity / Simulation Optionsz-qz--quietquietzActivate quiet modez--no-warningsno_warningszIgnore warningsz-sz
--simulatesimulatez;Do not download the video and do not write anything to diskz--skip-downloadskip_downloadzDo not download the videoz-gz	--get-urlgeturlzSimulate, quiet but print URLz-ez--get-titlegettitlezSimulate, quiet but print titlez--get-idgetidzSimulate, quiet but print idz--get-thumbnailgetthumbnailz'Simulate, quiet but print thumbnail URLz--get-descriptiongetdescriptionz+Simulate, quiet but print video descriptionz--get-durationgetdurationz&Simulate, quiet but print video lengthz--get-filenamegetfilenamez)Simulate, quiet but print output filenamez--get-format	getformatz'Simulate, quiet but print output formatz-jz--dump-jsondumpjsonzjSimulate, quiet but print JSON information. See the "OUTPUT TEMPLATE" for a description of available keys.z-Jz--dump-single-jsondump_single_jsonzSimulate, quiet but print JSON information for each command-line argument. If the URL refers to a playlist, dump the whole playlist information in a single line.z--print-json
print_jsonzSBe quiet and print the video information as JSON (video is still being downloaded).z	--newlineprogress_with_newlinez Output progress bar as new linesz--no-progress
noprogresszDo not print progress barz--console-titleconsoletitlez$Display progress in console titlebarz-vz	--verboseverbosez#Print various debugging informationz--dump-pagesz--dump-intermediate-pagesdump_intermediate_pageszLPrint downloaded pages encoded using base64 to debug problems (very verbose)z--write-pageswrite_pageszWWrite downloaded intermediary pages to files in the current directory to debug problemsz--youtube-print-sig-codeyoutube_print_sig_codez--print-trafficz--dump-headersdebug_printtrafficz"Display sent and read HTTP trafficz-Cz--call-home	call_homez+Contact the youtube-dl server for debuggingz--no-call-homez2Do NOT contact the youtube-dl server for debuggingzFilesystem Optionsz-az--batch-file	batchfilezFile containing URLs to download ('-' for stdin), one URL per line. Lines starting with '#', ';' or ']' are considered as comments and ignored.z--iduseidzUse only video ID in file name)r.   rN   rA   rM   z-oz--outputouttmplTEMPLATEzDOutput filename template, see the "OUTPUT TEMPLATE" for all the infoz--autonumber-sizeautonumber_size)rA   r;   ra   rM   z--autonumber-startautonumber_startz@Specify the start value for %(autonumber)s (default is %default)z--restrict-filenamesrestrictfilenameszRRestrict filenames to only ASCII characters, and avoid "&" and spaces in filenamesz-Az--auto-number
autonumberz-tz--titleusetitlez-lz	--literalz-wz--no-overwritesnooverwriteszDo not overwrite filesz-cz
--continuecontinue_dlzeForce resume of partially downloaded files. By default, youtube-dl will resume downloads if possible.z--no-continuezADo not resume partially downloaded files (restart from beginning)z	--no-partnopartz8Do not use .part files - write directly into output filez
--no-mtime
updatetimezEDo not use the Last-modified header to set the file modification timez--write-descriptionwritedescriptionz.Write video description to a .description filez--write-info-jsonwriteinfojsonz)Write video metadata to a .info.json filez--write-annotationswriteannotationsz2Write video annotations to a .annotations.xml filez--load-info-jsonz--load-infoload_info_filenamezXJSON file containing the video information (created with the "--write-info-json" option)z	--cookies
cookiefilez0File to read cookies from and dump cookie jar inz--cache-dircachedirZDIRa  Location in the filesystem where youtube-dl can store some downloaded information permanently. By default $XDG_CACHE_HOME/youtube-dl or ~/.cache/youtube-dl . At the moment, only YouTube player files (for videos with obfuscated signatures) are cached, but that may change.z--no-cache-dirzDisable filesystem cachingz--rm-cache-dirrm_cachedirz!Delete all filesystem cache fileszThumbnail imagesz--write-thumbnailwritethumbnailzWrite thumbnail image to diskz--write-all-thumbnailswrite_all_thumbnailsz)Write all thumbnail image formats to diskz--list-thumbnailslist_thumbnailsz1Simulate and list all available thumbnail formatszPost-processing Optionsz-xz--extract-audioextractaudiozZConvert video files to audio-only files (requires ffmpeg or avconv and ffprobe or avprobe)z--audio-formataudioformatzSpecify audio format: "best", "aac", "flac", "mp3", "m4a", "opus", "vorbis", or "wav"; "%default" by default; No effect without -xz--audio-qualityZQUALITYaudioquality5zSpecify ffmpeg/avconv audio quality, insert a value between 0 (better) and 9 (worse) for VBR or a specific bitrate like 128K (default %default)z--recode-videorecodevideoz_Encode the video to another format if necessary (currently supported: mp4|flv|ogg|webm|mkv|avi)z--postprocessor-argspostprocessor_argsz)Give these arguments to the postprocessorz-kz--keep-video	keepvideozUKeep the video file on disk after the post-processing; the video is erased by defaultz--no-post-overwritesnopostoverwriteszZDo not overwrite post-processed files; the post-processed files are overwritten by defaultz--embed-subsembedsubtitlesz@Embed subtitles in the video (only for mp4, webm and mkv videos)z--embed-thumbnailembedthumbnailz)Embed thumbnail in the audio as cover artz--add-metadataaddmetadataz Write metadata to the video filez--metadata-from-titlemetafromtitlea  Parse additional metadata like song title / artist from the video title. The format syntax is the same as --output. Regular expression with named capture groups may also be used. The parsed parameters replace existing values. Example: --metadata-from-title "%(artist)s - %(title)s" matches a title like "Coldplay - Paradise". Example (regex): --metadata-from-title "(?P<artist>.+?) - (?P<title>.+)"z--xattrsxattrszOWrite metadata to the video file's xattrs (using dublin core and xdg standards)z--fixupZPOLICYfixupZdetect_or_warnzAutomatically correct known faults of the file. One of never (do nothing), warn (only emit a warning), detect_or_warn (the default; fix file if we can, warn otherwise)z--prefer-avconvprefer_ffmpegz8Prefer avconv over ffmpeg for running the postprocessorsz--prefer-ffmpegzBPrefer ffmpeg over avconv for running the postprocessors (default)z--ffmpeg-locationz--avconv-locationffmpeg_locationz`Location of the ffmpeg/avconv binary; either the path to the binary or its containing directory.z--execZCMDexec_cmdzExecute a command on the file after downloading, similar to find's -exec syntax. Example: --exec 'adb push {} /sdcard/Music/ && rm {}'z--convert-subsz--convert-subtitlesconvertsubtitleszLConvert the subtitles to other format (currently supported: srt|ass|vtt|lrc)z[debug] Override config: 
c             S   s   t jdk rdd | D S | S )Nr&   c             S   s   g | ]}|j t d qS )replace)r,   r
   )r   ar   r   r   
<listcomp>t  s    z2parseOpts.<locals>.compat_conf.<locals>.<listcomp>)r&   )r*   r+   )confr   r   r   compat_confr  s    
zparseOpts.<locals>.compat_confzyoutube-dl.confz"config-location %s does not exist.z/etc/youtube-dl.confzSystem configzUser configzCustom configzCommand-line argsz[debug] %s: %s
)r   columnsoptparseZIndentedHelpFormatterZformat_option_stringsr   OptionParserr   ZOptionGroup
add_optionfloatZSUPPRESS_HELPintr   r   Zadd_option_group
parse_argsr   r   reprr*   argvr   rX   r4   r5   isdirexistserrorr%   )#ZoverrideArgumentsr7   r=   rE   r   Z	max_widthrH   fmtkwrD   ZgeneralnetworkZgeoZ	selectionZauthenticationZ
adobe_passZvideo_formatZ	subtitles
downloaderZworkarounds	verbosityZ
filesystemZ	thumbnailZpostprocr"   argsr   Zcommand_line_confZsystem_confZ	user_confZcustom_conflocationr   Z
conf_labelr   r   )r1   r   	parseOpts)   s   %




















































































































 r  )N)
__future__r   Zos.pathr4   r   r   r*   Zdownloader.externalr   compatr   r   r   r   r	   utilsr
   r   rI   r   r%   r  r   r   r   r   <module>   s   