
    V|hp                     F   S SK r S SKrS SKrS SKrS SKrS SKrS SKrS SKrS SKrS SK	r	SSK
Jr  SSKJr  SSKJrJr  SSKJrJrJrJrJrJrJrJrJrJrJrJrJr   " S S	\ R>                  5      r  " S
 S\5      r! " S S\!5      r" " S S\!5      r# " S S\!5      r$ " S S\!5      r% " S S\!5      r& " S S\!5      r'\(" 5       RS                  5        V Vs0 s H6  u  pU RU                  S5      (       d  M  U S;  d  M%  URW                  5       U_M8     snn r,S r-S r.gs  snn f )    N   )
FragmentFD   )Request)EXT_TO_OUT_FORMATSFFmpegPostProcessor)PopenRetryManager_configuration_argscheck_executableclasspropertycli_bool_option
cli_optioncli_valueless_optiondetermine_extencodeArgumentfind_available_port
remove_endtraverse_objc                   X    \ rS rSr\R
                  " 5       r\R
                  " 5       rSrg)Features     N)	__name__
__module____qualname____firstlineno__enumauto	TO_STDOUTMULTIPLE_FORMATS__static_attributes__r       T/home/james-whalen/.local/lib/python3.13/site-packages/yt_dlp/downloader/external.pyr   r       s    		Iyy{r#   r   c                       \ rS rSrSrSrSrS r\S 5       r	\
S 5       r\R                  S 5       r\SS
 j5       r\S 5       r\SS j5       rS rSS jrSS jrSS jrS rS rS rSrg	)
ExternalFD%   )httphttpsftpftpsr   Tc                 `   U R                  U5        U R                  U5      nS U l         [        R                  " 5       nU R	                  X25      nU R                  (       a  U R                  U R                  5        US:X  ax  US[        R                  " 5       W-
  S.nUS:w  aD  [        R                  R                  U5      nU R                  X15        UR                  UUS.5        U R                  Xb5        g	U R!                  S
5        U R#                  SU R                  5       U4-  5        g! [
         a@    UR                  S5      (       d  e SnU R                  SU R                  5        S35         GN)f = f! U R                  (       a  U R                  U R                  5        f f = f)Nis_liver   [z] Interrupted by userfinished)filenamestatuselapsed-)downloaded_bytestotal_bytesT
z%s exited with code %dF)report_destination	temp_name_cookies_tempfiletime_call_downloaderKeyboardInterruptget	to_screenget_basename
try_removeospathgetsize
try_renameupdate_hook_progress	to_stderrreport_error)selfr0   	info_dicttmpfilenamestartedretvalr1   fsizes           r$   real_downloadExternalFD.real_download*   s}   )nnX.!%	8iikG**;BF %% 6 67Q;$$99;0F
 346(-#(  2NN4 6!!#V:- - .? ! 	K==++ FNNQt00233HIJ	K %% 6 67 &s$   &D1 1AE;7E> :E;;E> >/F-c                 <    U R                   S S R                  5       $ )N)r   lowerclss    r$   r?   ExternalFD.get_basenameS   s    ||CR &&((r#   c                 "    U R                  5       $ N)r?   rT   s    r$   EXE_NAMEExternalFD.EXE_NAMEW   s    !!r#   c                     U R                   $ rX   rY   )rI   s    r$   exeExternalFD.exe[   s    }}r#   Nc                     [        US U R                  5       4;   a  U R                  OUU R                  /5      nU(       d  gXl        U$ )NF)r   r?   rY   AVAILABLE_OPTr]   rU   rB   s     r$   	availableExternalFD.available_   sH     T3+;+;+=$>>CLLD! r#   c                 R  ^  [        UR                  S5      (       + =(       d    [        R                  T R                  ;   SUS   ;  =(       d    [        R
                  T R                  ;   [        USSS5      (       + [        U 4S jUS   R                  S5       5       5      45      $ )N	to_stdout+protocol)hls_aes.extra_param_to_segment_urlextra_param_to_key_urlc              3   @   >#    U  H  oTR                   ;   v   M     g 7frX   )SUPPORTED_PROTOCOLS).0protorU   s     r$   	<genexpr>&ExternalFD.supports.<locals>.<genexpr>o   s     _>^U000>^s   )allr=   r   r    SUPPORTED_FEATURESr!   r   split)rU   rJ   s   ` r$   supportsExternalFD.supportsi   s    k**Zh.@.@CDZDZ.Zy,,c0I0ISMcMc0cY(8:VXpqq_i
>S>Y>YZ]>^__	
  	r#   c                 T    U R                  U5      =(       a    U R                  U5      $ rX   )rb   rt   )rU   rJ   rB   s      r$   can_downloadExternalFD.can_downloadr   s    }}T">s||I'>>r#   c                 .    [        U R                  X5      $ rX   )r   params)rI   command_optionparams      r$   _optionExternalFD._optionv   s    $++~==r#   c                 2    [        U R                  XX4U5      $ rX   )r   rz   )rI   r{   r|   
true_valuefalse_value	separators         r$   _bool_optionExternalFD._bool_optiony   s    t{{N:\effr#   c                 0    [        U R                  XU5      $ rX   )r   rz   )rI   r{   r|   expected_values       r$   _valueless_optionExternalFD._valueless_option|   s    #DKKWWr#   c                     [        U R                  5       U R                  R                  S5      U R                  U/UQ70 UD6$ )Nexternal_downloader_args)r   r?   rz   r=   rY   )rI   keysargskwargss       r$   r   ExternalFD._configuration_args   sD    "1K!Ldmm##!# 	#r#   c                    U R                   R                  R                  (       dU  [        R                  " SSS9nUR                  5         UR                  U l        U R                  SU R                   S35        U R                   R                  R                  U R                  5        U R                   R                  R                  =(       d    U R                  $ )Nz.cookiesF)suffixdeletez.[download] Writing temporary cookies file to "")
ydl	cookiejarr0   tempfileNamedTemporaryFileclosenamer9   r>   save)rI   tmp_cookiess     r$   _write_cookiesExternalFD._write_cookies   s    xx!!**"55ZPUVK%0%5%5D"NNKDLbLbKccdef 6 67xx!!**Dd.D.DDr#   c                    U R                  X5       Vs/ s H  n[        U5      PM     nnU R                  U5        SU;  a5  U R                  XB5      u  pVnU(       a  U(       a  U R	                  U5        U$ U R
                  R                  SS5      n[        U R
                  R                  S5      U R                  SU(       + S9n	U	 HG  n
U R                  XB5      u  pVnU(       d    O+U(       a  U R	                  U5        [        5       U
l
        MI     U(       d  U	R                  (       a  gU R                  U5      nU R                  US5      u  p[        US   5       H  u  pU S	U 3n U R                  US
5      u  nnUR#                  U" UUR%                  5       5      5        UR'                  5         U R
                  R                  SS5      (       a  M{  U R)                  U5        M     UR'                  5         U R)                  U S35        gs  snf ! [         aG  nU(       a  US:  a  U R                  UU5         SnAM  U R!                  SU SU 35         SnA  gSnAff = f)z-Either overwrite this or implement _make_cmd 	fragmentsskip_unavailable_fragmentsTfragment_retriesN)
frag_indexfatalwb-Fragrbr   zUnable to open fragment z; keep_fragmentsF
.frag.urlsr   )	_make_cmdr   
_debug_cmd_call_processrG   rz   r=   r
   report_retry	Exceptionerror	decryptersanitize_open	enumerateOSErrorreport_skip_fragmentrH   writereadr   r@   )rI   rK   rJ   acmd_stderr
returncoder   retry_managerretrydecrypt_fragmentdestr   fragmentfragment_filenamesrcerrs                     r$   r;   ExternalFD._call_downloader   s!   *...*PQ*PQ~a *PQi'$($6$6s$F!Azfv&%)[[__5QSW%X"$T[[__5G%H$J[J[04@Z<Z\"E$($6$6s$F!Az v&#+EK # *m.A.A>>)4$$[$7$-i.D$E J#.-uZL A++,=tDQ JJ'#((*=>IIK;;??#3U;; 12 %F 	

;-z23[ RB  -*q.--j#>!!$<ZL3%"PQs#   H-H
I+$I&	I&&I+c                 t    [         R                  " USU R                  (       a  [        R                  S9$ S S9$ )NT)textr   )r	   run_CAPTURE_STDERR
subprocessPIPE)rI   r   rJ   s      r$   r   ExternalFD._call_process   s*    yy44CWCW
bb]abbr#   )r9   rX   )truefalseN)T)r   r   r   r   rl   rr   r   rO   classmethodr?   r   rY   	functoolscached_propertyr]   rb   rt   rw   r}   r   r   r   r   r;   r   r"   r   r#   r$   r&   r&   %   s    :O'R ) ) " "       ? ?>gX#
E/bcr#   r&   c                   "    \ rS rSrSrSrS rSrg)CurlFD   -VFc                    U R                   SSUS/nU R                  R                  R                  US   5      nU(       a  USU/-  nUR	                  S5      b(  US   R                  5        H  u  pVUSU SU 3/-  nM     X0R                  S	S
SS5      -  nX0R                  SS5      -  nX0R                  SS5      -  nX0R                  SS5      -  nU R                  SS5      n[        U5      S:X  a  US   S;   a  SUS'   X7-  nX0R                  SS5      -  nX0R                  SS5      -  nX0R                  SS5      -  nX0R                  SS 5      -  nX0R                  5       -  nUS!US   /-  nU$ )"Nz
--location-oz--compressedurlz--cookiehttp_headers--header: z--continue-at
continuedlr3   0z--silent
noprogressz	--verboseverbose--limit-rate	ratelimitz--retryretriesr   r   infinfinite
2147483647z--max-filesizemax_filesize--interfacesource_addressz--proxyproxyz
--insecurenocheckcertificate--)r]   r   r   get_cookie_headerr=   itemsr   r   r}   lenr   )rI   rK   rJ   r   cookie_headerkeyvalr   s           r$   r   CurlFD._make_cmd   s   xxt[.I**<<Yu=MNJ..C==(4%n5;;=
se2cUO44 > 	  ,SII%%j,??%%k9==||NK88Y	2u:?Qx..'aLC||,n==||M+;<<||Iw//%%l4HII''))i&''
r#   r   N)r   r   r   r   r`   r   r   r"   r   r#   r$   r   r      s    MOr#   r   c                       \ rS rSrSrS rSrg)AxelFD   r   c                 D   U R                   SU/nUR                  S5      b(  US   R                  5        H  u  pEUSU SU 3/-  nM     U R                  R                  R                  US   5      nU(       a  USSU 3S/-  nX0R                  5       -  nUSUS   /-  nU$ )	Nr   r   z-Hr   r   zCookie: z--max-redirect=0r   )r]   r=   r   r   r   r   r   rI   rK   rJ   r   r   r   r   s          r$   r   AxelFD._make_cmd   s    xx{+==(4%n5;;=Ruo.. >**<<Yu=MNDH]O46HIIC''))i&''
r#   r   Nr   r   r   r   r`   r   r"   r   r#   r$   r   r      s    M
r#   r   c                       \ rS rSrSrS rSrg)WgetFD   	--versionc                    U R                   SUSS/nU R                  R                  R                  US   5      (       a  USU R	                  5       /-  nUR                  S5      b(  US   R                  5        H  u  pEUSU SU 3/-  nM     X0R                  S	S
5      -  nU R                  SS5      n[        U5      S:X  a  US   S;   a  SUS'   X6-  nX0R                  SS5      -  nU R                  R                  S5      nU(       a  S H  nUSU SU 3/-  nM     X0R                  SS5      -  nX0R                  5       -  nUSUS   /-  nU$ )Nz-Oz-nvz--compression=autor   z--load-cookiesr   r   r   r   r   z--triesr   r   r   r   r   z--bind-addressr   r   )
http_proxyhttps_proxyz	--execute=z--no-check-certificater   r   )r]   r   r   r   r   r=   r   r}   r   rz   r   r   )	rI   rK   rJ   r   r   r   r   r   vars	            r$   r   WgetFD._make_cmd   sl   xx{E3GH88//	%0@AA$d&9&9&;<<C==(4%n5;;=
se2cUO44 >||NK88Y	2u:?Qx..aLC||,.>??(4uAeW%566 5%%&>@TUU''))i&''
r#   r   Nr   r   r#   r$   r   r      s    Mr#   r   c                   l   ^  \ rS rSrSrSr\S 5       r\S 5       rU 4S jr	S r
SS	 jrU 4S
 jrSrU =r$ )Aria2cFDi  z-v)r(   r)   r*   r+   dash_frag_urlsm3u8_frag_urlsc                 8   ^  S/nU 4S jU 5       n[        U5      $ )Nz#EXT-X-BYTERANGEc              3   \   >#    U  H!  n[         R                  " UT5      (       + v   M#     g 7frX   )research)rm   featuremanifests     r$   ro   -Aria2cFD.supports_manifest.<locals>.<genexpr>  s$     ^I]gRYYw999I]s   ),)rq   )r  UNSUPPORTED_FEATUREScheck_resultss   `  r$   supports_manifestAria2cFD.supports_manifest  s)       
 _I]^=!!r#   c                     [         R                  R                  U 5      (       a  U $ S[         R                  R                   U  3$ )N.)rA   rB   isabssep)fns    r$   _aria2c_filenameAria2cFD._aria2c_filename  s2    WW]]2&&rAa}RD,AAr#   c                 $   >  [        TU ]  X5      $ rX   )rz   r=   r   struuiduuid4superr;   )rI   rK   rJ   	__class__s      r$   r;   Aria2cFD._call_downloader  s    
 w'??r#   c                    U R                   SSSSSSSSS	S
/nSU;   a  USS/-  nOUSS/-  nU R                  R                  R                  US   5      (       a  USU R	                  5        3/-  nUR                  S5      b(  US   R                  5        H  u  pEUSU SU 3/-  nM     X0R                  SS5      -  nX0R                  SS5      -  nX0R                  SS5      -  nX0R                  SSSSS5      -  nX0R                  S S!SSS5      -  nX0R                  S"S#SSS5      -  nX0R                  5       -  nS$U;   a  US%S&US$   S'    3S(US$   S)    3/-  n[        R                  R                  U5      nU(       a1  US*U R                  U5      [        R                  R                  -   /-  nSU;  a3  US+U R                  [        R                  R                  U5      5      /-  nUS,/-  nSU;   a  US-/-  nU S.3n/ n[!        US   5       H\  u  p[        R                  R                  U5       S/U	 3nUR#                  S0R%                  U
S   U R                  U5      5      5        M^     U R'                  US15      u  pUR)                  S2R+                  U5      R-                  5       5        UR/                  5         US3U R                  U5      /-  nU$ US4US   /-  nU$ )5N-cz	--no-confz--console-log-level=warnz--summary-interval=0z--download-result=hidez--http-accept-gzip=truez--file-allocation=nonez-x16z-j16z-s16r   z--allow-overwrite=truez --allow-piece-length-change=truez--min-split-size1Mr   z--load-cookies=r   r   r   z--max-overall-download-limitr   r   r   z--all-proxyr   z--check-certificater   r   r   r   z--remote-time
updatetimez--show-console-readoutr   __rpcz--enable-rpcz--rpc-listen-port=portz--rpc-secret=secretz--dirz--outz--auto-file-renaming=falsez--uri-selector=inorderr   r   z
{}
	out={}r   r6   -ir   )r]   r   r   r   r   r=   r   r}   r   r   rA   rB   dirnamer  r  basenamer   appendformatr   r   joinencoder   )rI   rK   rJ   r   r   r   dnurl_list_fileurl_listr   r   r   streamr   s                 r$   r   Aria2cFD._make_cmd'  s@   xx{)+AC[(*BFFTZ\ )#,.PQQC&--C88//	%0@AAod&9&9&;%<=>>C==(4%n5;;=
se2cUO44 >||:KHH||M+;<<||M733  !68LgW]_bcc  ,QTUU  !9<RXZ]^^''))i$Yw%7%?$@A	' 28 <=>@ @C WW__[)GT2226DEECi'GT222773C3CK3PQRRC,--)#,--C*m:6MH(1)K2H(I$
')ww'7'7'D&EU:,$W! 5 5huotG\G\]nGo pq )J **=$?IFLL8,3356LLND$//>??C 
 D)E*++C
r#   r   c                    [        [        R                  " 5       5      n[        R                  " SUUSU 3/UQS.5      R                  5       n[        SU S3US[        U5       S.SS 0S	9nU R                  R                  U5       n[        R                  " U5      n	S S S 5        W	R                  S
5      U:X  d   S5       eU	S   $ ! , (       d  f       N/= f)Nz2.0ztoken:)jsonrpcidmethodrz   zhttp://localhost:z/jsonrpczapplication/json)zContent-TypezContent-Lengthrq   )dataheadersproxiesr5  z$Something went wrong with RPC serverresult)r  r  r  jsondumpsr-  r   r   r   urlopenloadr=   )
rI   rpc_port
rpc_secretr6  rz   sanitycheckdrequestrresps
             r$   
aria2c_rpcAria2cFD.aria2c_rpc_  s    $**,'JJ
|,6v6	
 
 68 	
 z2 2%(VH t}& XXg&!99Q<D 'xx~,T.TT,H~ '&s   C
Cc                   > SU;  a  [         TU ]  X5      $ [        R                  " U R                  US   S   US   S   5      n[
        R
                  " 5       nSU;   nU(       a  [        US   5      OSnUR                  S5      SSSU(       a  UOS U(       a  SOS S	.nU R                  Xr5        S
S.S jn[        US[        R                  [        R                  S9 n	[
        R                  " S5        U	R                  5       n
U
Gc  U" S5      nU" SSU/5      nU" SU5      U" SU5      -   nU" SU5      nXh" SXSS9-  nX:  a  S nUR                  [!        U5      UU(       a  S OUUX-
  U=(       d    S-  U(       a  [#        U[        U5      S-   5      OS [
        R
                  " 5       U-
  S.5        U R                  Xr5        U(       d(  [        U5      U:  a  U" S5        U	R%                  5       n
O,[
        R                  " S5        U	R                  5       n
U
c  GM  SU	R&                  R)                  5       U
4sS S S 5        $ ! , (       d  f       g = f)Nr$  r%  r&  r   r   	_filenamedownloadingr   )r0   r1   r2   r4   fragment_countfragment_indexF)averagec                    [        [        S [        [        [	        USSU 45      5      5      5      =(       d    S/n[        U5      U(       a  [        U5      -  $ S-  $ )N.r   r   )tuplefiltermapfloatr   sumr   )r   rM  objr   s       r$   get_stat(Aria2cFD._call_process.<locals>.get_stat  sM    tSS3S/0R%STU\Z[Y\Cs87s3x::::r#   T)r   stdoutr   g?zaria2.tellActivezaria2.tellStoppedtotalLengthcompletedLengthdownloadSpeed)r4   speedr5   total_bytes_estimateetarL  r2   zaria2.shutdowng? )r  r   r   partialrF  r:   r   r=   rF   r	   r   DEVNULLr   sleeppollrE   intminwaitr   r   )rI   r   rJ   send_rpcrL   
fragmented
frag_countr1   rU  prM   active	completed
downloadedr[  totalr  s                   r$   r   Aria2cFD._call_processs  s!   )#7(88$$T__i6H6PR[\cRdemRno))+ I-
4>S;/0A
!k2# !,6jD#-a4
 	F.(- 	; 3T**<*<Z__UYZ JJsOVVXF. ""45$%81j/J	%mY?(K\^dBee
 &9"XmVX\%]]% E(+J"+545,1!.5:A>MWc*c)nq6H&I]a#yy{W4  ##F6#i.J">-.VVXF

3; .> qxx}}.I VUUs    EI%I
I)r   )r   r   r   r   r`   rl   staticmethodr  r  r;   r   rF  r   r"   __classcell__)r  s   @r$   r  r    sQ    M^" " B B@6p(;/ ;/r#   r  c                   "    \ rS rSrSrSrS rSrg)HttpieFDi  r   r(   c                     SSSXS   /nUR                  S5      b&  US   R                  5        H  u  pEX4 SU 3/-  nM     U R                  R                  R	                  US   5      nU(       a	  USU 3/-  nU$ )Nr(   z
--downloadz--outputr   r   :zCookie:)r=   r   r   r   r   r   s          r$   r   HttpieFD._make_cmd  s    |Z>NO==(4%n5;;=%q'' > **<<Yu=MNgm_-..C
r#   r   N)r   r   r   r   r`   rY   r   r"   r   r#   r$   rr  rr    s    MHr#   rr  c                   x    \ rS rSrSr\R                  \R                  4r\	S	S j5       r
S r\	S 5       rS rSrg)
FFmpegFDi  )r(   r)   r*   r+   m3u8m3u8_nativertsprtmprtmp_ffmpegmmshttp_dash_segmentsNc                 *    [        5       R                  $ rX   )r   rb   ra   s     r$   rb   FFmpegFD.available  s    "$...r#   c                     g)zOverride this in subclasses  Nr   )rI   procstdins      r$   on_process_startedFFmpegFD.on_process_started  s    r#   c                     UR                  S5      =(       ab    UR                  S5      =(       aJ    UR                  S5      (       + =(       a-    SUR                  S/ 5      ;  =(       a    U R                  U5      $ )Nrequested_formatsrg   allow_unplayable_formatszno-direct-mergecompat_opts)r=   rw   )rU   rJ   rz   s      r$   can_merge_formatsFFmpegFD.can_merge_formats  sk     MM-. ,j),JJ9::, "M2)FF,   +	-r#   c           	      x   [        U S9nUR                  (       d  U R                  S5        gUR                  5         UR                  S/nS H-  nU R
                  R                  US5      (       d  M&  USU/-  n  O   U R
                  R                  S5      (       d  US/-  nU[        US	5      -  nXBR                  S
5      =(       d    / -  nUR                  S5      nUb  USU(       a  SOS/-  nS nU R
                  R                  S5      nU(       a  [        R                  " SU5      (       d  SU 3nUR                  S5      (       a"  U R                  U R                  5        S35        [        R                  R                  5       nXS'   XS'   UR                  S5      n	U	S:X  Ga  UR                  S5      n
UR                  S5      nUR                  S5      nUR                  S5      nUR                  S5      nUR                  S5      nUR                  SS5      nUR                  S5      nU
b  US U
/-  nUb  US!U/-  nUb  US"U/-  nUb  US#U/-  nUb  US$U/-  nUb  US%U/-  nU(       a  US&S'/-  n[!        U["        5      (       a  U H
  nUS(U/-  nM     O[!        U[$        5      (       a  US(U/-  nUR                  S)5      =(       d    S*UR                  S+5      nnUR                  S,5      =(       d    U/n['        U5       GH  u  nn[        R                  " S-US.   5      nU(       a(  U R(                  R*                  R-                  US.   5      O/ nU(       a)  UR/                  S/S0R1                  S1 U 5       5      /5        UR                  S25      (       aA  U(       a:  UR/                  S3S0R1                  S4 US2   R3                  5        5       5      /5        U(       a  US5[%        U5      /-  nU(       a  US6[%        UU-
  5      /-  nUS.   nU R
                  R                  S75      (       aK  UR                  S85      (       a5  US9S:/-  n[        R4                  " S;[        R6                  S<:X  a  S8OS=U5      nU/ U R9                  S>US?-    3S>45      QS@PUP-  nGM     U(       d  U(       a   U R
                  R                  SA5      (       d  USBSC/-  nUR                  S,5      (       d  U	SD:X  a?  ['        U5       H0  u  nnUR                  SES*5      nUR/                  SFU SGU 3/5        M2     U R
                  R                  SHS5      (       a  USI[%        U R:                  5      /-  nUSJ   nU	SK;   a  USL:H  =(       d    U R
                  R                  SM5      nUc  UR                  SN5      nU(       a	  USOSP/-  nGOUSOSQ/-  nUR<                  SR:X  aX  UR>                  R                  SS5      (       a8  UR                  ST5      (       a  UST   RA                  SU5      S*   SV;   a  USWSX/-  nOU	S:X  a  USOSY/-  nOUSQ:X  a  USL:X  a  USOSP/-  nOUSZ:X  a_  [C        [E        US[5      5      nUSZ:X  a  U R                  S\5        ONU R                  S]U S^35        USO[F        R                  " UU5      /-  nOUSO[F        R                  " UU5      /-  nU[        US_5      -  nX@R9                  S`5      -  nU Vs/ s H  n[I        U5      PM     nnURK                  URM                  U5      5        U RO                  U5        [Q        Sa U 5       5      n[S        U[T        RV                  USb9 n U(       a  U RY                  U U RZ                  5         U R]                  5       n!U!sS S S 5        $ s  snf ! [^         aW  n"[!        U"[`        5      (       a-  [b        Rd                  Sc:w  a  U(       d  U Rg                  Sd5        e U Ri                  S Se9  e S n"A"ff = f! , (       d  f       g = f)fN)
downloaderzDm3u8 download detected but ffmpeg could not be found. Please installFz-y)quietr   z	-loglevelr   z-hide_banner)downloader_optionsffmpeg_args._ffmpeg_args	_seekablez	-seekable1r   r   z[\da-zA-Z]+://zhttp://sockszt does not support SOCKS proxies. Downloading is likely to fail. Consider adding --hls-prefer-native to your command.
HTTP_PROXYr   rg   r{  
player_urlpage_urlapp	play_pathtc_urlflash_version	rtmp_live	rtmp_connz-rtmp_swfverifyz-rtmp_pageurlz	-rtmp_appz-rtmp_playpathz-rtmp_tcurlz-rtmp_flashverz
-rtmp_livelivez
-rtmp_connsection_startr   section_endr  z	https?://r   z-cookiesr^  c           	   3      #    U  H;  nUR                    S UR                   SUR                   SUR                   S3v   M=     g7f)r   z; path=z	; domain=z;
N)r   valuerB   domain)rm   cookies     r$   ro   ,FFmpegFD._call_downloader.<locals>.<genexpr>2  sD      1+") {{m1V\\N'&++iPVP]P]^cd")s   AAr   z-headersc              3   6   #    U  H  u  pU S U S3v   M     g7f)r   z
Nr   )rm   r   r   s      r$   ro   r  8  s!     0qUpC53%t1DUps   z-ssz-tenable_file_urlszfile:z-protocol_whitelistz#file,crypto,data,http,https,tcp,tlsz^file://(?:localhost)?/ntzfile:/_ir   r'  force_keyframes_at_cutsr!  copyr~  manifest_stream_numberz-maprt  testz-fsext)rx  ry  r3   hls_use_mpegtsr-   z-fmpegtsmp4ffmpegneeds_adtstoascacodecr  )aacmp4az-bsf:aaac_adtstoascflvunknown_videoz.partzThe video format is unknown and cannot be downloaded by ffmpeg. Explicitly set the extension in the filename to attempt download in that formatz3The video format is unknown. Trying to download as z according to the filename)r  ffmpeg_args_out.)_o1_or^  c              3   0   #    U  H  oS    S;   v   M     g7f)r   )r3   zpipe:Nr   )rm   fmts     r$   ro   r  }  s     M<LSJ.0<Ls   )r  envwin32   q)timeout)5r   rb   rH   check_version
executablerz   r=   r   r	  match
startswithreport_warningr?   rA   environr  
isinstancelistr  r   r   r   get_cookies_for_urlextendr,  r   subr   r   _TEST_FILE_SIZEr)  	_featuresrs   r   r   r   r   r*  _ffmpeg_filename_argumentr   anyr	   r   r   r  r  re  BaseExceptionr<   sysplatformcommunicate_or_killkill)#rI   rK   rJ   ffppr   	log_levelseekabler  r   rg   r  r  r  r  r  r  r  connentry
start_timeend_timeselected_formatsir  is_httpcookiesr   stream_numberr  
use_mpegtsoptpipedr  rM   es#                                      r$   r;   FFmpegFD._call_downloader  s   "d3~~de&-I{{y%00i00 . {{y))^$$DY(RSS 	n-33==- [#s;;D(88-u55!%)((##((*+ ,K KL **//#C % %==,v"|4J }}Z0H--&C!k2I]]8,F%MM/:M==e4D==-D%*J77#(33c**$)955!//()=99v..$%%!E\511D "D#&&t,,(}}_=BIMMR_D`H
$==)<=L) 01FAshh|SZ8GLSdhh((<<SZHY[GZ 1+")1+ *+ , - ww~&&7 Z0qUXYgUhUnUnUp0q)qrsJ00s8j#89::e*C{{122s~~g7N7N .0UVV ff7BGGtOYacfgPd.."QUGd/CDPdPCPPD? 2B ht{{?X/Y/YT6N"D==,--=Q1Q#$453 #(@! DVs!M?%;<= 6 ;;??65))UC 4 4566D..%,RAQ1RJ!&]]95
x((u%MMX-$..2D2DEV2W2Wbkbobopxbyby  ~G  HP  ~Q  ~W  ~W  X[  ~\  ]^  ~_  cr  ~rX77DT5M!DE\kS0T8$$DO#
; @ACo%##fg ##&YZ]Y^^x$yz155c3?@@T-11#s;<<DY(VWW(():;;/34ts#t4D22;?@M<LMM4zC8D''djj9 ! 98 5 ! 
 a!2338OX],,T2  IIdI+
 98s7   _$`+'_7`+
`(A`##`((`++
`9r   rX   )r   r   r   r   rl   r   r    r!   rr   r   rb   r  r  r;   r"   r   r#   r$   rw  rw    sS     N",,h.G.GH/ / - -sr#   rw  FD)r&   r   c                  <    [        [        R                  5       5      $ rX   )sorted_BY_NAMEr   r   r#   r$   list_external_downloadersr    s    (--/""r#   c                 
  ^ [         R                  R                  [         R                  R                  U 5      5      S   m[        R                  T5      =(       d(    [        U4S j[        R                  5        5       S5      $ )zNGiven the name of the executable, see whether we support the given downloader r   c              3   J   >#    U  H  oR                   T;   d  M  Uv   M     g 7frX   r\   )rm   klassbns     r$   ro   *get_external_downloader.<locals>.<genexpr>  s       %,%"0D,s   #	#N)rA   rB   splitextr)  r  r=   nextvalues)external_downloaderr  s    @r$   get_external_downloaderr    s`    			"''**+>?	@	CB<< t %#??,%  r#   )/r   r   r;  rA   r	  r   r  r   r:   r  r   r   
networkingr   postprocessor.ffmpegr   r   utilsr	   r
   r   r   r   r   r   r   r   r   r   r   r   Enumr   r&   r   r   r   r  rr  rw  globalsr   endswithr?   r  r  r  )r   r  s   00r$   <module>r     s      	 	  
        J   "#tyy #
[c [c|Z >Z  Z 6a/z a/Hz *Hz HZ y((}}T  #+GG  E%(#s   D5D=D