
    Ği	                     b    d dl Z d dlZddlmZ ddlmZ ddlmZ ddlm	Z	  G d d	e          Z
dS )
    N   )FileDownloader)HlsFD   )_cloudfront_auth_request)network_exceptionsc                       e Zd ZdZd Zd ZdS )	SoopVodFDz
    Downloads Soop subscription VODs with required cookie refresh requests
    Note, this is not a part of public API, and will be removed without notice.
    DO NOT USE
    c                    |                      d| j         d           t          | j        | j                  }|d         }|d         }t          j                    }t          j        | j        |||f          }|	                                 	 |
                    ||          |                                 S # |                                 w xY w)N[z'] Downloading Soop subscription VOD HLS_cookie_refresh_paramswebpage_url)targetargs)	to_screenFD_NAMEr   ydlparams	threadingEventThread_cookie_refresh_threadstartreal_downloadset)selffilename	info_dictfdrefresh_paramsreferer_url
stop_eventrefresh_threads           [C:\Users\betacode\Desktop\descargarYoutube\venv\Lib\site-packages\yt_dlp/downloader/soop.pyr   zSoopVodFD.real_download   s    P4<PPPQQQ48T[))"#;<._&&
").nk:
 
 
 		##Hi88NNJNNs   B9 9Cc                 (    |d         }|d         }|d         } fd}|                     d          st          j                    } ||          }	|                    dd          }
|	r	||	dz
  k    p|	 o||
z
  d	k    }|rz	  j                            t          ||||                                                     ||d<   n7# t          $ r*}                     d
 j	         d|            Y d }~nd }~ww xY w|                     d          d S d S )Nm3u8_urlstrm_idvideo_idc                 x    j         j                            |           }t          d |D             d          S )Nc              3   D   K   | ]}d |j         v |j        |j        V  dS )
CloudFrontN)nameexpires).0cookies     r$   	<genexpr>z^SoopVodFD._cookie_refresh_thread.<locals>._get_cloudfront_cookie_expiration.<locals>.<genexpr>*   s;      oo6PVP[@[@[`f`n@[@[@[@[@[oo    r   )default)r   	cookiejarget_cookies_for_urlmin)r&   cookiesr   s     r$   !_get_cloudfront_cookie_expirationzKSoopVodFD._cookie_refresh_thread.<locals>._get_cloudfront_cookie_expiration(   s>    h(<<XFFGooWoooyz{{{{r1      _last_refreshr      K   r   z!] Cookie refresh attempt failed: )
waittimegetr   urlopenr   readr   r   r   )r   r"   r    r!   r&   r'   r(   r7   current_timeexpiration_timelast_refresh_checkshould_refreshes   `            r$   r   z SoopVodFD._cookie_refresh_thread#   s   !*- +!*-	| 	| 	| 	| 	| //!$$ 	[9;;L??IIO!/!3!3OQ!G!G !I\_r5I%I U''SL;M,MQS,S 
  [[H$$%= '8[&B &B C CCG46666BN?33) [ [ [NN#Yt|#Y#YVW#Y#YZZZZZZZZ[! //!$$ 	[ 	[ 	[ 	[ 	[s   AC 
C8 C33C8N)__name__
__module____qualname____doc__r   r    r1   r$   r
   r
   
   sA           $[ [ [ [ [r1   r
   )r   r=   commonr    r   extractor.afreecatvr   networking.exceptionsr   r
   rJ   r1   r$   <module>rO      s         " " " " " "       : : : : : : 6 6 6 6 6 63[ 3[ 3[ 3[ 3[ 3[ 3[ 3[ 3[ 3[r1   