+
    i                         R t ^ RIt^ RIHu Ht ^ RIt^ RIHtH	t	 Rt
R R ltR R ltR R	 lt]R
8X  dH   ]! 4       t]! R]! ]4       R24       ]R,           F  t]! R]R,           R]R,           24       K!  	  R# R# )uv   
YouTube RSS Poller — Extract trends from YouTube channel RSS feeds.
Loads channel list from youtube-channels.json.
NListDictz9/Users/tonyclaw/.openclaw/workspace/youtube-channels.jsonc                :    V ^8  d   QhR\         \        ,          /#    return)r   str)formats   "T/Users/tonyclaw/.openclaw/workspace/scripts/research-pipeline/sources/youtube_rss.py__annotate__r      s      tCy     c                     \        \        R4      ;_uu_ 4       p \        P                  ! V 4      pRRR4       . pXP	                  4        Fo  w  r4\        V\        4      '       g   K  RV9   g   K&  VR,           F<  p\        V\        4      '       g   K  RV9   g   K$  VP                  VR,          4       K>  	  Kq  	  V#   + '       g   i     L; i  \         d   p\        RT 24       . u Rp?# Rp?ii ; i)zz
Load YouTube channel IDs from youtube-channels.json.
Parses nested structure with categories containing channel objects.
rNchannels	channelIdz([WARN] Failed to load YouTube channels: )
openYOUTUBE_CHANNELS_FILEjsonloaditems
isinstancedictappend	Exceptionprint)fdatachannel_idscategorycategory_datachanneles          r   load_youtube_channelsr#      s    
'--99Q<D . '+zz|#H-..:3N,Z88G!'400[G5K#**7;+?@  9 (4  .-  8<=	sK   C C 2C (C 1C C !C  C	C C8C3-C83C8c                F    V ^8  d   QhR\         R\        \        ,          /# )r   
channel_idr   )r	   r   r   )r
   s   "r   r   r   &   s     # #3 #4: #r   c           
         RV  2p\         P                  ! V^
R7      pVP                  4        \        P                  ! VP
                  4      pRRRR/p. pVP                  RRR	/4       Fj  pVP                  R
4      pVP                  R4      pVf   K+  Vf   K1  TP                  RVP                  ;'       g    RRVP                  RR4      /4       Kl  	  VR,          #   \         d   p	\        RT  RT	 24       . u Rp	?	# Rp	?	ii ; i)z
Fetch RSS feed for a YouTube channel.
Args:
    channel_id: YouTube channel ID
Returns:
    List of video dicts with title, url
z4https://www.youtube.com/feeds/videos.xml?channel_id=)timeoutytz.http://www.youtube.com/xml/schemas/youtube.rssmediazhttp://search.yahoo.com/mrss/z
atom:entryatomzhttp://www.w3.org/2005/Atomz"{http://www.w3.org/2005/Atom}titlez!{http://www.w3.org/2005/Atom}linkNtitle urlhref:N   Nz([WARN] Failed to fetch YouTube feed for z: )requestsgetraise_for_statusET
fromstringcontentfindallfindr   textr   r   )
r%   rss_urlresponserootnsvideosentry
title_elem	link_elemr"   s
   &         r   fetch_channel_feedrA   &   s   HU<<4!!#}}X--. B4

 \\,9V0WXE$HIJ

#FGI%)*?Z__229==4  Y bz 8BqcJK	s0   BC" C" C" ;&C" "D
-D?D
D
c                :    V ^8  d   QhR\         \        ,          /# r   r   )r
   s   "r   r   r   L   s     ! !T$Z !r   c                     \        4       p . p. ROp\        V 4       FZ  w  r4\        V4      pW#\        V4      ,          ,          pV F,  pVP	                  RRRVRVR,          RVR,          R^ /4       K.  	  K\  	  V# )z
Get trending signals from YouTube RSS feeds.
Returns signals across all tracked channels.
Assigns signals to niches based on source data.
sourceyoutubenicher+   r-   
engagement)zUSMC / MilitaryzMilitary FamilyzReformed Christian	PatrioticzPrint on DemandzAI Services / Small Business)r#   	enumeraterA   lenr   )r   all_signalsniches_listidxr%   r=   rF   videos           r   get_youtube_signalsrO   L   s     ()KKK %[1#J/#k"223E)wuU|a    2 r   __main__zFound z YouTube signals:N   Nz  [rF   z] r+   )__doc__r   xml.etree.ElementTreeetreeElementTreer3   r0   typingr   r   r   r#   rA   rO   __name__signalsr   rJ   sig r   r   <module>r[      s   
  " "  S .#L!H z!#G	F3w<. 0
12r{{CL>CL>23 	 r   