
    biI                         d dl Z d dlZddlmZ ddlmZ ddlmZm	Z	m
Z
mZmZmZmZ ddlmZmZmZ  G d d	e          ZdS )
    N   )BrightcoveNewIE)InfoExtractor   )
clean_htmlint_or_noneparse_durationparse_iso8601smuggle_urlstr_or_noneurl_or_none)requiretraverse_objtrim_strc                      e Zd ZdZdZdi dddddd	d
ddddddd	dddddddddddddddddd d!d"d#d$id%d&i dd'dddd(d)d*gd
d+dd,dd-dd(dd,dddddddd(dd,dd.dddd/d0d$d1d%d2i dd3dddd4d)d*gd
d5dd6dd7dd4dd6dd8dddddd9dd:dd;dddd<d=d$d1d%gZd>Zd? Zd@S )ATvoIETVOzChttps?://(?:www\.)?tvo\.org/video(?:/documentaries)?/(?P<id>[\w-]+)z?https://www.tvo.org/video/how-can-ontario-survive-the-trade-warid6377531034112extmp4titlez&How Can Ontario Survive the Trade War?descriptionz$md5:e7455d9cd4b6b1270141922044161457
display_idz%how-can-ontario-survive-the-trade-wardurationi  episode
episode_idepisode_numberr   seasonzSeason 1season_numberseriesz
TVO at AMO	series_idz
tvo-at-amotagszcount:17	thumbnailzre:https?://.+	timestampiָhupload_date20250904uploader_id18140038001)url	info_dictz1https://www.tvo.org/video/documentaries/the-pitch6382500333112z	The Pitch
categoriesDocumentariesz$md5:9d4246b70dce772a3a396c4bd84c8506z	the-pitchi#  zcount:8i`i20251109)r&   r(   z6https://www.tvo.org/video/documentaries/valentines-day6387298331112zValentine's Dayz$md5:b142149beb2d3a855244816c50cd2f14zvalentines-dayi1  r   zHow We Celebratezhow-we-celebratezcount:6ii20260206zPhttps://players.brightcove.net/18140038001/default_default/index.html?videoId=%sc                    |                      |          }|                     d|ddit          j        ddt          j                            |          j                            d          iddd	
          	                                          d         d         }t          |ddt          ht          d          hf          }dt          j                    t          | j        |z  ddgi          ||dt          |dt"          ht$          fdt"          ht$          t&          t$          fdt"          ht$          fdt(          hfdt"          ht$          fdt*          hfdt*          hfddt"          ht$          fdt,          hfdt.          hfd
          t          |d dt"          ht$          fd!t"          ht1          d"#          ht$          fd$f          S )%NzAhttps://hmy0rc1bo2.execute-api.ca-central-1.amazonaws.com/graphqlzContent-Typezapplication/jsongetVideoslug/aM  query getVideo($slug: String) {
                  getTVOOrgVideo(slug: $slug) {
                    contentCategory
                    description
                    length
                    program {
                      nodeUrl
                      title
                    }
                    programOrder
                    publishedAt
                    season
                    tags
                    thumbnail
                    title
                    videoSource {
                      brightcoveRefId
                    }
                  }
                })operationName	variablesquery),:)
separators)headersdatar=   getTVOOrgVideovideoSourcebrightcoveRefIdzBrightcove IDurl_transparentgeo_countriesCA)_typeie_keyr*   r   r   r   contentCategoryr   lengthprogramOrderr   r#   .r$   publishedAt)
r   r-   r   r   r   r   r    r#   r$   r%   programnodeUrlz
/programs/)start)r!   r"   )	_match_id_download_jsonjsondumpsurllibparseurlparsepathrstripencoder   r   r   r   rE   r   BRIGHTCOVE_URL_TEMPLATEr   filterallr	   r   r   r
   r   )selfr*   r   
video_databrightcove_ids        N/DATA/AppData/hermes/venv/lib/python3.11/site-packages/yt_dlp/extractor/tvo.py_real_extractzTvoIE._real_extract`   s	   ^^C((
((O1C D!+$fl&;&;C&@&@&E&L&LS&Q&QR . %/& & &. '-fhh5 ) 
 
6 76 #7$
: %Z,{mgo>V>V=W2Y Z Z '%,..t;mKo`d_eMfgg$$
 
 :!J<80:,VT -
|VD%'78#j\6:#1K="A"*[M!:zlF;)K=9+m_=( (  
$ :	"ZL&9'*|8T8T8T7UW]^4 4 (  %
 	
    N)__name__
__module____qualname__IE_NAME
_VALID_URL_TESTSrW   r^    r_   r]   r   r      s)       GWJP
/
5
 =
 A	

 A
 
 ?
 A
 a
 j
 Q
 l
 
 J
 *
  !
" :#
$ =%
 
 . C
/
5
 [
 ?+	

 A
 +
 
 {
 +
 a
 j
 Q
 k
 
 I
  *!
" #
$ &('
 
 
 0 H
/
5
 '
 ?+	

 A
 *
 
 )
 *
 a
 j
 Q
 (
 +
 I
  *!
" #
$ &('
 
 
 [DFJ q8
 8
 8
 8
 8
r_   r   )rO   urllib.parserQ   
brightcover   commonr   utilsr   r   r	   r
   r   r   r   utils.traversalr   r   r   r   rf   r_   r]   <module>rl      s        ' ' ' ' ' ' ! ! ! ! ! !                          B
 B
 B
 B
 B
M B
 B
 B
 B
 B
r_   