
    V|h                     J    S SK Jr  SSKJrJrJrJr  SSKJr   " S S\5      r	g)   )InfoExtractor   )ExtractorErrorextract_attributesget_elements_html_by_classurl_or_none)traverse_objc            
           \ rS rSrSrSrSrSrSSSS	S
SSS.S.SSSS	SSSS.S.SSSS	SSSS.SS0S./rSr	S r
S rS rg)!GBNewsIE   z(GB News clips, features and live streamsz=https?://(?:www\.)?gbnews\.(?:uk|com)/(?:\w+/)?(?P<id>[^#?]+)safariz+https://mm-v2.simplestream.com/ssmp/api.phpzPhttps://www.gbnews.com/news/bbc-claudine-gay-harvard-university-antisemitism-row52264136mp4z3re:https?://www\.gbnews\.\w+/.+\.(?:jpe?g|png|webp)z4bbc-claudine-gay-harvard-university-antisemitism-rowz>The post was criticised by former employers of the broadcasterzNBBC deletes post after furious backlash over headline downplaying antisemitism)idext	thumbnail
display_iddescriptiontitle)url	info_dictzWhttps://www.gbnews.com/royal/prince-harry-in-love-with-kate-meghan-markle-jealous-royal52328390z:prince-harry-in-love-with-kate-meghan-markle-jealous-royalzWIngrid Seward has published 17 books documenting the highs and lows of the Royal FamilyzORoyal author claims Prince Harry was 'in love' with Kate - Meghan was 'jealous'zhttps://www.gbnews.uk/watchlive1069	watchliveis_livezre:^GB News Live)r   r   r   r   live_statusr   skip_downloadm3u8)r   r   paramsNc                 N   U R                   (       d  0 U l         U(       d  SnU(       d  SnX4nU R                   R                  U5      nU(       a  U$ U R                  U R                  S SUUS.S9n[	        USS[
        145      nU(       d  [        S5      eX`R                   U'   U$ )	NGB003
productionz&Downloading Simplestream JSON metadata)r   envqueryresponseapi_hostnamezNo API host found)_SS_ENDPOINTSget_download_json	_SSMP_URLr	   r   r   )selfdata_iddata_envkeyresult	json_datameta_urls          Q/home/james-whalen/.local/lib/python3.13/site-packages/yt_dlp/extractor/gbnews.py_get_ss_endpointGBNewsIE._get_ss_endpoint3   s    !!!#DG#H##'',M''NND"JS ( 	
  	J+VW !455"*3    c                 "   U R                  U5      R                  S5      S   nU R                  X5      nS n[        SU5      nU H0  n[	        U5      nSUR                  S5      =(       d    S;  d  M.  UnM2     U(       d
  [        SSS	9eU R                  UR                  S
5      UR                  S5      5      nUS   n	UR                  S5      n
U
(       a  U
S:X  a  Sn
U R                  U SU
 SU	 3U	SUR                  S5      U R                  S.S9n[        US5      (       a  U R                  U	5        U	UU R                  US S9U R                  US S9U R                  [        USS[        145      U	S5      U R!                  US S9U
S:H  S.$ )N/r   simplestreamsidebarclass zCould not find video elementT)expectedzdata-idzdata-envz	data-uvidz	data-typevodshowz/api/z/stream/zDownloading stream JSONzdata-key)r/   platformr$   drm)defaultr&   streamr   live)r   r   r   r   formatsr   r   )	_match_id
rpartition_download_webpager   r   r)   r   r4   r*   	_PLATFORMr	   
report_drm_og_search_title_og_search_description_extract_m3u8_formatsr   _og_search_thumbnail)r,   r   r   webpage
video_dataelementshtml_tag
attributesendpoint_urluvid
video_typestream_datas               r3   _real_extractGBNewsIE._real_extractL   s   ^^C(33C8;
((9
-ngF H+H5J!8!>B?'
 !  !?$OO,,Z^^I-F
WaHbc+&^^K0
Z50J))nE*XdV<+!~~j1 NN4 *  U++OOD! $**7D*A66w6M11,{H{mM5 367;UD227D2I!V+	
 		
r6   )r(   )__name__
__module____qualname____firstlineno__IE_DESC
_VALID_URLrI   r+   _TESTSr(   r4   rX   __static_attributes__ r6   r3   r   r      s    8GQJI=IaOP[e

 iOVtj

 1O%$(
 #F+)F@ M2%
r6   r   N)
commonr   utilsr   r   r   r   utils.traversalr	   r   rb   r6   r3   <module>rf      s%    !  +f
} f
r6   