+
    i$                         ^ RI t ^ RIt^ RIHt ^ RIt^ RIt^ RIHt ]P                  ! ]P                  P                  4       R t
RR ltRR ltR# )    N)BeautifulSoup)datetimec                 6    V '       g   R # V P                  4       # ) strip)texts   &N/Users/bowang/.openclaw/workspace/skills/news-aggregator/scripts/rss_parser.py
clean_textr      s    ::<    c                
    \        V R4      p. pVP                  RR.4      pV EF  pVP                  R4      pV'       g   K  \        VP	                  4       4      pRp	VP                  R4      p
V
'       dw   V
P                  R4      '       d   V
R,          p	M*V
P	                  RR	7      '       d   V
P	                  RR	7      p	V	'       g$   \        V
P                  4      P                  4       p	V	'       gS   VP                  R
4      pV'       d:   VP	                  RR	7      P                  R4      '       d   VP	                  RR	7      p	VP                  . RO4      pV'       d   \        VP	                  4       4      MRpVP                  R4      pVP                  R4      pVP                  R4      pVP                  R4      p RpV'       d   VP	                  4       pMJV'       d   VP	                  4       pM1V'       d   VP	                  4       pMV '       d   V P	                  4       p\        VR4      p\        V4      R8  d"   VP	                  RRR7      R,          R,           MRpRpVP                  R4      pV'       d   VP	                  RR	7       R2pVP                  RVRVRV	RVRVRV/4       \        V4      V8  g   EK   V# 	  V#   \         d+   p\        RT 2\        P                  R7       . u Rp?# Rp?ii ; i)zA
Parses RSS/Atom content string (XML or HTML) and returns items.
zhtml.parseritementrytitler   linkhrefTr   guidhttpzcontent:encodeddescriptionsummarycontenti,   )	separatorr   :Ni,  Nz...zslash:commentsz	 commentssourceurltimeheatzContent Parse failed: fileN)pubdate	publishedupdatedzdc:date)r   find_allfindr   get_texthas_attrstrnext_siblingr   
startswithlenappend	Exceptionprintsysstderr)r   source_namelimitsoupitemsentriesr   	title_tagr   r   link_tagr   pubtime_strcontent_encodedr   r   raw_summary	soup_descclean_summaryr   commentses   &&&                    r
   parse_rss_contentr?      s   CWm4-- 12E

7+Ihy1134E Dzz&)H$$V,,#F+D&&T&22#,,4,8Dx445;;=Dzz&)DMMM5@@HH==t=4D **KLC58z#,,.1bH $jj):;O**]3Kjj+Gjj+GKo.F.F.HK,@,@,Bk(8(8(:+(8(8(:+%k=AI[^_j[knq[qI..D.I$ORWWwyM Dzz"23H"++$+78	BLL+t=  5zU"Es r  &qc*<	sn   BK !K 1K *K 6K &K 6BK K %K >K A)K ?K K 	K LK=7L=Lc                    RRRR/p\         P                  ! W^RR7      pVP                  ;'       g    RVn        \	        VP
                  W4      #   \         d.   p\        RT  R	T 2\        P                  R
7       . u Rp?# Rp?ii ; i)za
Robust RSS/Atom fetcher using BeautifulSoup.
Handles various feed formats (RSS 2.0, Atom, etc.)
z
User-AgentzuMozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36AcceptzUtext/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8F)headerstimeoutverifyzutf-8zRSS Fetch failed for z: r   N)
requestsgetapparent_encodingencodingr?   r   r,   r-   r.   r/   )r   r0   r1   rB   responser>   s   &&&   r
   fetch_rss_feedrJ   Y   s    
   Rm

 <<bO$66AA' !1!1;FF %cU"QC0szzB	s"   1A A B
"B?B
B
)   )r.   rE   bs4r   urllib3rer   disable_warnings
exceptionsInsecureRequestWarningr   r?   rJ    r   r
   <module>rS      sD    
    	    ++BB CGRr   