+
    Bi/                     D   R t ^ RIt^ RIt^ RIHtHt ^ RIHtHt R. ROR. ROR. ROR. ROR. ROR	. RO/t^
t	]	3R
 R llt
R R lt]R8X  dT   ]P                  4        F=  t]! ]4      t]! R] R24       ] F   t]! R]R,           R]R,           R24       K"  	  K?  	  R# R# )u~   
Reddit Poller — Fetch trending posts from subreddits in the last 24 hours.
Uses public Reddit JSON API (no auth required).
N)datetime	timedelta)ListDictzUSMC / MilitaryzMilitary FamilyzReformed Christian	PatrioticzPrint on DemandzAI Services / Small Businessc                h    V ^8  d   QhR\         \        ,          R\        R\         \        ,          /# )   
subredditsmin_upvotesreturn)r   strintr   )formats   "V/Users/tonyclaw/.openclaw/workspace/scripts/research-pipeline/sources/reddit_poller.py__annotate__r      s1     *A *A49 *A3 *AQUVZQ[ *A    c                b   . pRR/pV  F  p RV R2p\         P                  ! WS^
R7      pVP                  4        VP                  4       pRV9  g   RVR,          9  d   KY  VR,          R,           F}  pVP                  R/ 4      p	V	P                  R^ 4      p
W8  g   K/  VP	                  R	V	P                  R	R
4      RV
RRV	P                  RR
4       2RVRV	P                  R^ 4      /4       K  	  K  	  \        VR RR7      #   \
         d   p\        RT RT 24        Rp?EK   Rp?ii ; i)z
Fetch top posts from subreddit in last 24 hours.
Args:
    subreddits: List of subreddit names (without r/)
    min_upvotes: Minimum upvote threshold
Returns:
    List of post dicts with score, title, niche
z
User-Agentz*ResearchPipeline/1.0 (Research monitoring)zhttps://www.reddit.com/r/z	/new.json)headerstimeoutdatachildrenscoretitle urlzhttps://reddit.com	permalink	subredditcreated_utcz[WARN] Failed to fetch r/z: Nc                     V R ,          # )r    )xs   &r   <lambda>$fetch_reddit_posts.<locals>.<lambda>C   s    qzr   T)keyreverse)requestsgetraise_for_statusjsonappend	Exceptionprintsorted)r	   r
   postsr   r   r   responser   post	post_datar   es   &&          r   fetch_reddit_postsr2      sA    EBG  		-i[	BC||C"EH%%'==?DT!ZtF|%CVZ00 HHVR0	!gq1 'LLw!;!3IMM+r4R3ST#Y%y}}]A'F"  1  8 %14@@	  	-i[1#>?	s%   AD":D!ADD.D))D.c                F    V ^8  d   QhR\         R\        \        ,          /# )r   nicher   )r   r   r   )r   s   "r   r   r   F   s      c d4j r   c                    V \         9  d   . # \         V ,          p\        V4      p. pVR,           F<  pVP                  RRRV RVR,          RVR,          RVR,          R	VR
,          /4       K>  	  V# )ze
Get trending signals for a niche from its subreddits.
Returns signals with title, score, niche tag.
:N   Nsourceredditr4   r   
engagementr   r   	timestampr   )REDDIT_SOURCESr2   r)   )r4   r	   r-   signalsr/   s   &    r   get_reddit_signalsr=   F   s    
 N"	&Jz*E Gb		hUT']$w-4;m,
 	  Nr   __main__
:u     • r   z (r9   z	 upvotes))USMCveteransmilitary)Military_SpousesMilitaryFamilyPrideOfAMilitaryFamily)ChristianMemesReformedPresbyterianism)ConservativePatriot2ndAmendment)printondemandEtsySellersEtsy)smallbusinessEntrepreneuraiwx)__doc__r(   r%   r   r   typingr   r   r;   MIN_UPVOTESr2   r=   __name__keysr4   r<   r+   sigr   r   r   <module>rY      s   
   (  7WK<?"$M  BM *AZ4 z$$&$U+5'mCF3w<.3|+<*=YGH  ' r   