
    i	                     Z    S SK r S SKrSSKJr  SSKJr  SSKJr  SSKJ	r	   " S S	\5      r
g)
    N   )FileDownloader)HlsFD   )_cloudfront_auth_request)network_exceptionsc                   $    \ rS rSrSrS rS rSrg)	SoopVodFD
   z
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                    U R                  SU R                   S35        [        U R                  U R                  5      nUS   nUS   n[
        R                  " 5       n[
        R                  " U R                  XdU4S9nUR                  5          UR                  X5      UR                  5         $ ! UR                  5         f = f)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/app/mltbenv/lib/python3.13/site-packages/yt_dlp/downloader/soop.pyr   SoopVodFD.real_download   s    4<<.(OPQ488T[[)"#;<.__&
"))..k:
 		##H8NNJNNs   B2 2Cc                 2  ^  US   nUS   nUS   nU 4S jnUR                  S5      (       d  [        R                  " 5       nU" U5      n	UR                  SS5      n
U	=(       a    XS-
  :  =(       d    U	(       + =(       a    X-
  S	:  nU(       a8   T R                  R	                  [        XEXc5      5      R                  5         XS'   UR                  S5      (       d  M  g g ! [         a+  nT R                  S
T R                   SU 35         S nANJS nAff = f)Nm3u8_urlstrm_idvideo_idc                 p   > TR                   R                  R                  U 5      n[        S U 5       SS9$ )Nc              3      #    U  H6  nS UR                   ;   d  M  UR                  (       d  M(  UR                  v   M8     g7f)
CloudFrontN)nameexpires).0cookies     r%   	<genexpr>^SoopVodFD._cookie_refresh_thread.<locals>._get_cloudfront_cookie_expiration.<locals>.<genexpr>*   s/     oW6PVP[P[@[`f`n`nWs   A A A r   )default)r   	cookiejarget_cookies_for_urlmin)r(   cookiesr   s     r%   !_get_cloudfront_cookie_expirationKSoopVodFD._cookie_refresh_thread.<locals>._get_cloudfront_cookie_expiration(   s1    hh((<<XFGoWoyz{{       _last_refreshr      K   r   z!] Cookie refresh attempt failed: )
waittimegetr   urlopenr   readr   r   r   )r   r#   r!   r"   r(   r)   r*   r9   current_timeexpiration_timelast_refresh_checkshould_refreshes   `            r%   r    SoopVodFD._cookie_refresh_thread#   s   !*- +!*-	| //!$$99;L?IO!/!3!3OQ!G !I\r5I%I U''SL,MQS,S 
 [HH$$%= 8&B CCG466B?3 //!$$  * [NNQt||n4UVWUX#YZZ[s   7C! !
D+!DD N)__name__
__module____qualname____firstlineno____doc__r   r   __static_attributes__rK   r;   r%   r
   r
   
   s    $[r;   r
   )r   rA   commonr    r   extractor.afreecatvr   networking.exceptionsr   r
   rK   r;   r%   <module>rV      s%      "  : 63[ 3[r;   