
    V|h                     J    S SK r SSKJr  SSKJrJrJrJrJr   " S S\5      r	g)    N   )InfoExtractor   )float_or_noneint_or_nonetry_getunified_timestampurl_or_nonec            
       j    \ rS rSrSrSSSSSSS	S
SS.S./rSrSr\\S.rS r	S r
\S 5       rS rSrg)BannedVideoIE   z<https?://(?:www\.)?banned\.video/watch\?id=(?P<id>[0-f]{24})z6https://banned.video/watch?id=5e7a859644e02200c6ef5f11 14b6e81d41beaaee2215cd75c6ed56e45e7a859644e02200c6ef5f11mp4zBChina Discovers Origin of Corona Virus: Issues Emergency Statementz8re:^https?://(?:www\.)?assets\.infowarsmedia.com/images/z$md5:560d96f02abbebe6c6b78b47465f6b2820200324iz^)idexttitle	thumbnaildescriptionupload_date	timestamp)urlmd5	info_dictaQ  
query GetVideoAndComments($id: String!) {
    getVideo(id: $id) {
        streamUrl
        directUrl
        unlisted
        live
        tags {
            name
        }
        title
        summary
        playCount
        largeImage
        videoDuration
        channel {
            _id
            title
        }
        createdAt
    }
    getVideoComments(id: $id, limit: 999999, offset: 0) {
        _id
        content
        user {
            _id
            username
        }
        voteCount {
            positive
        }
        createdAt
        replyCount
    }
}a  
query GetCommentReplies($id: String!) {
    getCommentReplies(id: $id, limit: 999999, offset: 0) {
        _id
        content
        user {
            _id
            username
        }
        voteCount {
            positive
        }
        createdAt
        replyCount
    }
})GetVideoAndCommentsGetCommentRepliesc                     U R                  SXSS0[        R                  " SU0UU R                  U   S.5      R	                  S5      S9R                  S5      $ )	Nz%https://api.infowarsmedia.com/graphqlzContent-Typezapplication/json; charset=utf-8r   )	variablesoperationNamequeryutf8)noteheadersdatar%   )_download_jsonjsondumps_GRAPHQL_QUERIESencodeget)selfvideo_idid_var	operationr#   s        V/home/james-whalen/.local/lib/python3.13/site-packages/yt_dlp/extractor/bannedvideo.py	_call_apiBannedVideoIE._call_apiW   si    ""3X AJJ"F^!*..y9   vf~ #   #s6{	+    c              #   $  #    U S h  vN   UR                  5        Hl  nUR                  S5      nUR                  S5      S:  d  M+  U R                  XSSU 35      nUR                  S5       H  nU R                  Xu5      v   M     Mn     g  N7f)N_id
replyCountr   r   z Downloading replies for comment getCommentReplies)copyr+   r1   _parse_comment)r,   r-   commentscomment_datacomment
comment_id
reply_jsonreplys           r0   _get_commentsBannedVideoIE._get_commentsb   s     #((*G U+J{{<(1,!^^*=6zlCE
 (^^,?@E--e@@ A + 	s   BB;BABc           
          U R                  S5      U R                  S5      [        U S 5      [        U S 5      [        U R                  S5      5      U[        U S 5      S.$ )Nr5   contentc                     U S   S   $ )Nuserusername xs    r0   <lambda>.BannedVideoIE._parse_comment.<locals>.<lambda>r   s    ai
6Kr3   c                     U S   S   $ )NrE   r5   rG   rH   s    r0   rJ   rK   s   s    659Ir3   	createdAtc                     U S   S   $ )N	voteCountpositiverG   rH   s    r0   rJ   rK   v   s    !K.:Tr3   )r   textauthor	author_idr   parent
like_count)r+   r   r	   )r;   rT   s     r0   r9   BannedVideoIE._parse_commentm   sa     ""5) $$Y/l,KL /IJ*<+;+;K+HI!,0TU
 	
r3   c                    U R                  U5      nU R                  X"SS5      nUS   nUR                  S5      nUR                  S5       Vs/ s H  o`R                  US5      PM     nn[	        UR                  S5      5      (       a  SS	UR                  S5      S
S./O/ nUR                  S5      (       a2  UR                  U R                  UR                  S5      US
SSSS95        UUR                  S5      S S UUUR                  S5      [        US 5      [        US 5      [        UR                  S5      5      [	        UR                  S5      5      [        UR                  S5      5      [        UR                  S5      5      UR                  S5       V	s/ s H  oR                  S5      PM     sn	U R                  UR                  S5      S9UU R                  X'UR                  S5      5      S.$ s  snf s  sn	f )Nr   zDownloading video metadatagetVideolivegetVideoCommentsroot	directUrldirectr   r   )	format_idqualityr   r   	streamUrlm3u8_nativehlsT)entry_protocolm3u8_idrY   r   summaryc                     U S   S   $ )Nchannelr   rG   rH   s    r0   rJ   -BannedVideoIE._real_extract.<locals>.<lambda>   s    Qy\'5Jr3   c                     U S   S   $ )Nrh   r5   rG   rH   s    r0   rJ   ri      s    )U8Kr3   	playCount
largeImagevideoDurationrM   tagsnameunlisted)is_unlisted)r   r   formatsis_liver   rh   
channel_id
view_countr   durationr   rn   availabilityr:   __post_extractor)	_match_idr1   r+   r9   r
   extend_extract_m3u8_formatsr   r   r   r	   _availabilityextract_comments)
r,   r   r-   
video_json
video_infors   r<   r:   rr   tags
             r0   _real_extractBannedVideoIE._real_extracty   s   >>#&^^H8MOkl

+
..(HRWiHjkHjW''8Hjk *..566	 ">>+.	
 
 =? 	 >>+&&NN455{+Xu,e$ 6 H I
 ^^G,Sb1%>>)4z+JK!*.KL%jnn[&AB$Z^^L%AB%jnn_&EF*:>>++FG0:v0FG0FWWV_0FG ..:>>*;U.V  $ 5 5h*..YkJl m
 	
 l2 Hs   G= HrG   N)__name__
__module____qualname____firstlineno__
_VALID_URL_TESTS_GRAPHQL_GETMETADATA_QUERY!_GRAPHQL_GETCOMMENTSREPLIES_QUERYr)   r1   r@   staticmethodr9   r   __static_attributes__rG   r3   r0   r   r      sx    PJG1,YTA%#
 F""H)%$  :>
	+	A 	
 	
"
r3   r   )
r'   commonr   utilsr   r   r   r	   r
   r   rG   r3   r0   <module>r      s#     ! N
M N
r3   