+
    Aiu              	       ^   R t ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIt^ RIH	t	 ^ RI
t
^ RIt]
P                  P                  ]P                  P                  ]P                  P                  ]4      R4      4       ^ RIHt ]P&                  ! R4       ]P(                  ! ]P*                  RR7       ]P,                  ! ]4      tR	tR
tRR/tRt^t^tR tR t Rs!R t"R t#Rs$R t%R t&R t'R t(]R8X  Ed   ^ RI)t)])PT                  ! RR7      t+]+PY                  RRRR7       ]+P[                  4       t. ]P_                  R4       ].P`                  '       dN   ]P_                  R4       ]%! 4       w  t1t2]2Pg                  R 4       ]1Pi                  4        ]P_                  R!4       ]P_                  R"4       ] ! 4       t5]5s6]'! 4       t7]P_                  R#4       ](! 4       t8]P_                  R$4       ]P_                  R%]7R&,           R']7R(,           R)]7R*,           24       ]P_                  R+]8R&,           R']8R(,           R)]8R*,           24       ]7R&,          ]8R&,          ,           t9]7R(,          ]8R(,          ,           t:]7R*,          ]8R*,          ,           t;]P_                  R,]9 R']: R)]; 24       R# R#   i ; i)-aX  
Web Scraper and Embedding Tool for Dr. Robert Young's Content

This module scrapes articles from multiple sources (case studies and Dr. Robert Young's blog)
and stores them in a database with vector embeddings for semantic search.

Features:
- Scrapes content from WordPress blog and case studies
- Extracts clean article content with noise filtering
- Generates semantic embeddings using sentence-transformers
- Stores structured data in MySQL database
- Handles rate limiting and respectful scraping practices
- Supports multiple content sources and categories

Scraping Sources:
1. Main WordPress Site: https://phoreveryoung.wordpress.com/
2. Dr. Robert Young Blog: https://drrobertyoung.com/blog/

Data Processing Pipeline:
1. Extract raw HTML content
2. Clean and filter relevant text
3. Generate vector embeddings
4. Store in database with metadata
N)urljoin)BeautifulSoupz..)get_connectionignorez)%(asctime)s - %(levelname)s - %(message)s)levelformatzhttps://drrobertyoung.com/blog/z$https://phoreveryoung.wordpress.com/z
User-AgentzMozilla/5.0 (MultiSiteBot/1.0)i,  c           	     d   \        4       pRV  R2p \        P                  RV  24       \        P                  ! V\
        ^R7      p\        VP                  R4      pVP                  R\        P                  ! R\        P                  ! V 4       R24      R	7      pV F  pVP	                  R
4      pV'       g   K  R\        P                  ! V 4       R2p\        P                  ! W4      p	V	'       g   KX  V	P                  ^4      p
V
'       g   Ks  V
R9  g   K|  V  RV
 2pVP                  V4       \        P                  RV 24       K  	  \        P                  R\        V4       RV  24       \!        V4      #   \"         d(   p\        P%                  RT  RT 24       . u Rp?# Rp?ii ; i)z
Discover subcategories within a main category

Args:
    main_category_slug (str): Main category slug

Returns:
    list: List of subcategory slugs
-https://phoreveryoung.wordpress.com/category//u#   🔍 Discovering subcategories in: headerstimeouthtml.parsera/https://phoreveryoung\.wordpress\.com/category/z/[^/"]+/hrefr   z
/([^/"]+)/u     📂 Found subcategory: u
   ✅ Found z subcategories in u,   ⚠️ Could not discover subcategories for : N)feedpage)setloggerinforequestsgetHEADERSr   textfind_allrecompileescapesearchgroupaddlenlist	Exceptionwarning)main_category_slugsubcategoriesmain_category_urlresponsesoupsubcategory_linkslinkr   patternmatchsubcategoryfull_subcategory_pathes   &            bC:\Users\Aakash\Desktop\Scrapping\Chatbot-Dr.Young O Robert\scraper\..\scraper\scrape_and_embed.pydiscover_subcategoriesr5   A   s    EMGHZG[[\]9:L9MNO<< 17BOX]]M: !MM#BJJ>ryyI[?\>]]ef5hM i &D88F#DtLRYYWiMjLkkuv		'05"'++a.K"{{:J'J3E2Fa}0U-%))*?@&@AV@W$XY & 	j]!3 44FGYFZ[\M"" EFXEYY[\][^_`	s7   B%E= <5E= 6E= E= A"E= =F/F*$F/*F/c            	     |   \         P                  R4        \        P                  ! \        \
        ^R7      p \        V P                  R4      p\        4       pVP                  R\        P                  ! R4      R7      pV Fr  pVP                  R4      pV'       g   K  RV9   g   K'  VP                  R4      R%,          P                  R	4      pV'       g   KX  R
V9  g   Ka  VP                  V4       Kt  	  VP                  R\        P                  ! R4      RR7      pV Fr  pVP                  R4      pV'       g   K  RV9   g   K'  VP                  R4      R%,          P                  R	4      pV'       g   KX  R
V9  g   Ka  VP                  V4       Kt  	  VP                  \        P                  ! R4      R7      pV Fv  p	V	P                  R. 4      p
V
 F[  pVP                  R4      '       g   K  VR8w  g   K%  VP!                  RR4      pV'       g   KA  RV9  g   KJ  VP                  V4       K]  	  Kx  	  \#        \%        V4      4      p\         P                  R\'        V4       R24       \)        V^4       F!  w  r\         P                  RVR RV 24       K#  	  VP+                  4       p\         P                  R4       V F5  p\-        V4      pVP/                  V4       \0        P2                  ! ^4       K7  	  \#        \%        \        V4      4      4      p\         P                  R4       \         P                  R\'        V4       24       \'        V4      p\'        V4      V,
          p\         P                  RV 24       \         P                  RV 24       \         P                  R4       \)        V^4       F.  w  rW9   d   RMR p\         P                  RVR RV R!V 24       K0  	  V#   \4         d<   p\         P7                  R"T 24       \         P                  R#4       . R&Ou R$p?# R$p?ii ; i)'a)  
Dynamically discover all categories and subcategories from the main WordPress page

This function scrapes the main page and identifies all available categories
and their subcategories by analyzing the HTML structure.

Returns:
    list: List of category slugs to scrape (including subcategories)
uF   🔍 DISCOVERING CATEGORIES AND SUBCATEGORIES FROM MAIN WORDPRESS PAGEr   r   r   r   r   r   
/category/r
   ?zcategory tag)r   relzcategory-[\w-]+class_classz	category-category _u   ✅ DISCOVERED z MAIN CATEGORIES:z  2dz. u"   
🔍 DISCOVERING SUBCATEGORIES...u   
✅ FINAL DISCOVERY COMPLETE!u1   📊 TOTAL CATEGORIES (including subcategories): u      • Main categories: u      • Subcategories: u    
📚 ALL DISCOVERED CATEGORIES:u   📁u   📂 u#   ❌ Failed to discover categories: u!   🔄 Using fallback category listN)	zbefore-and-afterfunnyzalkaline-lifestyle-and-diethealthzhealth/nutritionresearchzproducts/waterzhealth/weight-lossretreats)r   r   r   r   MAIN_WORDPRESS_URLr   r   r   r   r   r   r   splitrstripr#   
startswithreplacesortedr%   r$   	enumeratecopyr5   extendtimesleepr&   error)r+   r,   categories_found	nav_linksr.   r   category_partarticle_linkscategory_elementselemclassesclscategory_namemain_categoriesicat!all_categories_with_subcategoriesmain_catsubcatsfinal_categories
main_count	sub_countprefixr3   s                           r4   discover_all_categoriesrf   k   s}    KKXYW
<< 2GRPX]]M:5 MM#BJJ7i,jMk	D88F#Dt, $

< 8 < C CC H =S%=$((7  c

;m0n  uC  D!D88F#Dt, $

< 8 < C CC H =S%=$((7 " !MM<N1OMP%Dhhw+G>>+..3*3D$'KKR$@M$}M)A(,,];	  & !&6!78oc/&:%;;LMN3FAKK"QrF"SE*+ 4 -<,@,@,B)9:'H,X6G-44W=JJqM	 ( "$s+L'M"NO57GL\H]G^_` )
()J6	.zl;<,YK8978 0!4FA"5V6FKK"QrF"VHAcU34 5   
:1#>?78

 
	
	
si   BO5 O5 (,O5 O5 "AO5 ?O5 ,O5 9O5 A+O5 2O5 ;O5 O5  GO5 5P; 0P60P;6P;c                  :    \         f   ^ RIHp  V ! R4      s \         # )NSentenceTransformerzall-MiniLM-L6-v2)_modelsentence_transformersri   rh   s    r4   	get_modelrl      s    ~=$%78M    c           	       aa . ROpRpV F  pV P                  V4      pV'       g   K   M	  V'       g   V P                  R4      pV'       g   R# ^ RIpVP                  V4      p. ROpVP                  RP	                  V4      4       F  pVP                  4        K  	  . pVP                  . RO4       F  p	\        ;QJ d-    R V	P                  RRR7       4       F  '       g   K   RM"	  RM! R V	P                  RRR7       4       4      p
V
'       d   Kc  V	P                  R	RR
7      p\        V4      ^8  g   K  VP                  4       o\        ;QJ d    V3R lR 4       F  '       g   K   RM	  RM! V3R lR 4       4      '       d   K  W9  g   K  VP                  V4       K  	  \        RP	                  V4      4      \        8  d   VP                  RRR
7      pVP                  R4       Uu. uF3  p\        VP                  4       4      ^8  g   K#  VP                  4       NK5  	  pp. pV FV  o\        ;QJ d    V3R lR 4       F  '       g   K   RM	  RM! V3R lR 4       4      '       d   KE  VP                  S4       KX  	  RP	                  V4      pMRP	                  V4      pVP                  RR4      pVP                  4       # u upi )z;
Extract clean article content from a BeautifulSoup object
Nbodyr>   z, c              3   @   "   T F  pVP                   R9   x  K  	  R# 5i)pNrq   h1h2h3h4h5lidiv)name).0childs   & r4   	<genexpr>0extract_clean_article_content.<locals>.<genexpr>  s"      N*L $jj,\\*Ls   TF)	recursiverA   stripc              3   ,   <"   T F	  qS9   x  K  	  R # 5iN )r{   skip
lower_texts   & r4   r}   r~     s     u:t$:-:ts   z


c              3   H   <"   T F  qSP                  4       9   x  K  	  R # 5ir   )lower)r{   r   lines   & r4   r}   r~     s     e8dtzz|+8ds   "u   ZeolitéZeolite)zdiv.entry-contentarticlez'div.elementor-widget-theme-post-contentzdiv.post-contentzdiv.contentmain)scriptstylenavfooteriframenoscriptz.sharedaddyz.wpcntz.jp-relatedpostsz.entry-metaz.post-thumbnailz.author-bioz.comments-areaz.widget-arearr   )
share thisrelated posts	like thisz
loading...)r   r   r   )
select_onefindrN   selectjoin	decomposer   anyget_textr$   r   appendMIN_CONTENT_LENGTHrH   r   rK   )r,   	selectorscontent_rootselrN   rootjunk_selectorsjunkcontent_partselhas_block_childr   r   linescleaned_linescleaned_textr   s   &           `   @r4   extract_clean_article_contentr      sG   
I Ls+< 
 yy( 99\"DN
 DIIn56 7
 M mmLM # N*,++de+*LN### N*,++de+*LN N ;;s$;/D4y2~!ZZ\
su:tusssu:tuuu0%,,T2 N  6;;}%&);;}}V4}0*.**T*:U*:$c$**,>ORT>T*:UD3e8de333e8deee$$T*  {{=1{{=1''
I>L Vs   5 KKFc                      \        4       p V P                  4       p\        '       g$   VP                  R 4       V P	                  4        RsW3# )z
        CREATE TABLE IF NOT EXISTS dr_young_all_articles (
            id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
            title TEXT,
            url TEXT UNIQUE,
            content LONGTEXT,
            embedding LONGTEXT
        )
        T)r   cursor_db_initializedexecutecommit)conncurs     r4   get_dbr   ,  sC    D
++-C?  	 	9rm   c                   R^ R^ R^ /p\        4       w  r#RV  R2pTp\        P                  RV  24       V'       Ed    \        P                  ! V\
        ^R7      p\        VP                  R4      pTP                  R4      p	T	'       g   \        P                  RT 24       EM\        P                  R\        T	4       RT 24       \        T	^4       EF  w  rTP                  RRR7      pT'       g   K#  TR,          p \        P                  ! T\
        ^
RR7      p\        TP                  R4      pTP                  RR7      ;'       g-    TP                  RRR7      ;'       g    TP                  R4      pT'       gK   TP                  R4      pT F3  pTP                  RR7      pT'       g   K  RT9  g   K(  RT9  g   K1  Tp M	  T'       d   TP                  RR7      MRpTR8X  g   \        T4      ^8  di   TP                  RR R!7      ;'       g    TP                  R"4      pT'       d5   TP                   R8X  d   TP	                  R#4      MTP                  RR7      pTP#                  R$R%4      P#                  R&R%4      P%                  4       p\        P                  R'T  R(T
 R\        T	4       R
T 24       \'        T4      p\        T4      \(        8  d)   \        P+                  R)T R*\        T4       R+24       EK5  \        P                  R,\        T4       R-24       \-        4       P/                  T4      P1                  4       pTP3                  R.T34       TP5                  4       pTP7                  4        T'       d   Tw  ppTT8X  d4   TR;;,          ^,          uu&   \        P                  R/T  R0T 24       EK  TP3                  R1TT\9        T4      T34       TP;                  4        TR;;,          ^,          uu&   \        P                  R2T  R3T R4T 24       MnTP3                  R5TTT\9        T4      34       TP<                  pTP;                  4        TR;;,          ^,          uu&   \        P                  R6T  R7T R4T 24       \>        P@                  ! \B        4       EK  	  TP                  RR8R7      pT'       d   \E        TTR,          4      MRpT'       g   EK  \        P                  R9T 24       \>        P@                  ! \F        4       EK  \        P                  R:V  R
VR,           R;VR,           R<VR,           R=2	4       V#   \         d'   p\        P                  R	T R
T 24        Rp?Ke  Rp?ii ; i  \         d(   p\        P                  RT R
T 24        Rp?EK  Rp?ii ; i)>z
Scrape a single category from phoreveryoung.wordpress.com

Args:
    category_slug (str): The category slug (e.g., 'health/nutrition' or 'research')

Returns:
    dict: Counts of new, updated, and skipped articles
newupdatedskippedr	   r
   u   🚀 SCRAPING CATEGORY: r   r   u   ❌ Failed to fetch r   Nr   u   ⚠️ No articles found on    📄 Found z articles on page: r   Tr   r   Fr   r   verifyu   ⚠️ Failed to fetch article entry-titler:   rs   
post-titler   zpHorever YoungBlogUntitledmetaog:titlepropertytitlecontent    – pHorever Youngr>    | Dr. Robert Young   📝 [] Processing article    ⏭️ Content too short for  ( chars)   📊 Content length:  characters:SELECT id, content FROM dr_young_all_articles WHERE url=%s   ⏭️ [] SKIPPED (no changes): z
                    UPDATE dr_young_all_articles
                    SET title=%s, content=%s, embedding=%s
                    WHERE id=%s
                   🔄 [] UPDATED (ID: ): z
                    INSERT INTO dr_young_all_articles
                    (title, url, content, embedding)
                    VALUES (%s, %s, %s, %s)
                   ✅ [] NEW (ID: nextu   ➡️ Moving to next page: u   🏁 FINISHED CATEGORY z new, z
 updated, z skipped)$r   r   r   r   r   r   r   r   r&   rR   r   r'   r$   rM   r   r   rz   rK   r   r   r   debugrl   encodetolistr   fetchonefetchallstrr   	lastrowidrP   rQ   ARTICLE_DELAYr   
PAGE_DELAY)category_slugstatsr   r   base_urlpage_urlr+   r,   r3   articlesr]   art
title_linkurl
detail_resdetail_soup
title_elemh1_tagsrs   r   r   
meta_titler   	embeddingexistingexisting_idexisting_contentinserted_id	next_links   &                            r4   scrape_single_categoryr   F  sT    Ay!Y2EID>}oQOHH
KK*=/:;
(	||HgrJH >D ==+NN9(DEk#h-0CH:NO!,FA#D1JV$C	%\\# 	
 (
GK %)))?  I  I;CSCSTXamCSCn  I  Ir}  sC  sC  DH  sIJ%..t4!B;;T;2Dt 0 <tAS%'
	 " 8BJ''d'3zE
"c%j1n(--fz-JggkN^N^_fNg
9CF9RJNN95XbXkXkrvXkXwE MM"7<DDEZ\^_eegEKK&/DQCqXWYZ_Y`ab 4K@G7|00<UG2c'l^SZ[\KK/G~[IJ "**73::<I KKTWZV\]||~HLLN08--#w.)$)$KK(=/9QRWQX YZ  Wc)nkB	D
 i A% f]O?;-sSXRYZ[   S'3y>:	<
 "mme!eM?+k]#eWUV JJ}%q -v IIc&I1	;D78Yv%67$8KK6xjABJJz"
KK)-5<.uU^O_N``jkpqzk{j|  }E  F  GL]  	LL/zA3?@	8  !@RsKLs/   3U& V&V1VVW%WWc            	        R^ R^ R^ /p . p\         P                  R4       \         P                  R\        \        4       24       \	        \        ^4       F  w  r#\         P                  RV R\        \        4       RV 24        \        V4      pV R;;,          VR,          ,          uu&   V R;;,          VR,          ,          uu&   V R;;,          VR,          ,          uu&   V\        \        4      8  g   K  \         P                  R4       \        P                  ! ^4       K  	  \         P                  R4       \         P                  RV R,           RV R,           RV R,           24       V'       d   \         P                  RV 24       V #   \         d7   p\         P                  R	T R
T 24       TP                  T4        Rp?LRp?ii ; i)a*  
Scrape all categories from phoreveryoung.wordpress.com

This function scrapes articles from all identified categories,
extracts their content, generates embeddings, and stores them in the database.

Returns:
    tuple: (total_articles, category_stats_dict) - Total articles and per-category stats
r   r   r   u#   🚀 STARTING FULL CATEGORY SCRAPERu!   📋 Total categories to scrape: z
[r
   z] Processing category: u   ❌ Failed to scrape category r   Nu#   ⏳ Waiting before next category...u&   
🏁 FULL CATEGORY SCRAPING COMPLETEDu
   📊 NEW:  | UPDATED:  | SKIPPED: u   ⚠️ Failed categories: )r   r   r$   ALL_CATEGORIESrM   r   r&   rR   r   rP   rQ   r'   )totalsfailed_categoriesr]   r=   	cat_statsr3   s         r4   scrape_all_categoriesr     s    Q	1i3F
KK56
KK3C4G3HIJ 3c!Ac.122I(TU	/.x8I5MYu--M99!5599!55 s>""KK=?JJqM 4  KK9:
KK*VE]O<y8I7J,W]^gWhVijk34E3FGHM  	/LL9(2aSIJ$$X..	/s   AFG,GGc                   a R^ R^ R^ /p \        4       w  r\        P                  R4        \        P                  ! \
        \        ^R7      p\        VP                  R4      pVP                  R\        P                  ! R4      R	7      p\        4       pV Fr  oSP	                  R
4      pV'       g   K  RV9   g   K'  VP                  R4      P                  R4      RE,          pV'       g   KX  VRF9  g   Ka  VP                  V4       Kt  	  \        P                  R\!        V4       R\#        V4       24       \
        .V U	u. uF	  p	RV	 R2NK  	  up	,           p
V
 EF  p\        P                  RV 24        \        P                  ! V\        ^R7      p\        VP                  R4      pVP                  \        P                  ! R4      R7      p\        P                  R\!        V4       R24       . pV F;  pVP                  R\        P                  ! R4      R	7      pVP)                  V4       K=  	  VP                  R\        P                  ! R4      R	7      pVP)                  V4       \+        \        V Uau. uFx  oSP	                  R
4      '       g   K  RSP	                  R
4      9   g   K4  \,        ;QJ d    V3R lRG 4       F  '       g   K   RM	  RM! V3R lRG 4       4      '       d   Kv  SNKz  	  up4      4      p\        P                  R\!        V4       R24       V'       d?   \        P/                  RVR,           Uu. uF  pVP	                  R
4      NK  	  up 24       V\
        8w  d(   VP                  R4      P                  R4      RE,          MRp\1        V^4       EF  w  poSP	                  R
4      pV'       g   K"   \        P                  ! V\        ^
RR 7      p\        VP                  R4      pTP5                  R#4      ;'       g.    TP5                  R$R7      ;'       g    TP5                  R#R%R7      pT'       d   TP7                  RR&7      MR'pTR'8X  g   \!        T4      ^8  di   TP5                  R(R)R*7      ;'       g    TP5                  R+4      pT'       d5   TP8                  R(8X  d   TP	                  R,4      MTP7                  RR&7      pTP;                  R-R.4      P;                  R/R.4      P=                  4       p\        P                  R0T R1T R\!        T4       R"T 24       \?        T4      p\!        T4      \@        8  d)   \        P/                  R2T R3\!        T4       R424       EK  \        P                  R5\!        T4       R624       \C        4       PE                  T4      PG                  4       pTPI                  R7T34       TPK                  4       pTPM                  4        T'       d   Tw  ppTT8X  d4   T R;;,          ^,          uu&   \        P                  R8T R9T 24       EK  TPI                  R:TT\O        T4      T34       TPQ                  4        T R;;,          ^,          uu&   \        P                  R;T R<T R=T 24       MnTPI                  R>TTT\O        T4      34       TPR                  p TPQ                  4        T R;;,          ^,          uu&   \        P                  R?T R@T  R=T 24       \T        PV                  ! \X        4       EK  	  \T        PV                  ! \Z        4       EK  	  \        P                  RBV R,           RCV R,           RDV R,           24       V # u up	i   \$         d+   p\        P'                  RT 24       \
        .p
 Rp?ELjRp?ii ; iu upi u upi   \$         d(   p\        P3                  R!T R"T 24        Rp?EKT  Rp?ii ; i  \$         d(   p\        P'                  RAT R"T 24        Rp?EK  Rp?ii ; i)HaR  
Scrape articles from Dr. Robert Young's blog (https://drrobertyoung.com/blog/)

This function scrapes articles from the main blog page and all category pages,
extracts their content, generates embeddings, and stores them in the database.

Returns:
    tuple: (total_articles, category_stats_dict) - Total articles and per-category stats
r   r   r   u#   🚀 SCRAPING DR. ROBERT YOUNG BLOGr   r   r   z"https://drrobertyoung\.com/[^/]+/$r   r   zdrrobertyoung.comr
   u
   ✅ FOUND z BLOG CATEGORIES: zhttps://drrobertyoung.com/u(   ❌ Failed to discover blog categories: Nu   🔍 Scraping: postr:   r   z post elementszhttps://drrobertyoung\.com/z(https://drrobertyoung\.com/[^/]+/[^/]+/$c              3   J   <"   T F  qSP                  R 4      9   x  K  	  R# 5i)r   N)r   )r{   r   r.   s   & r4   r}   'scrape_dr_young_blog.<locals>.<genexpr>9  s'      /l/j MQtxx7G/G/js    #TFz potential articleszFirst 3 article links: :N   N	main_blogr   u   ⚠️ Failed to fetch r   rs   r   r   r   r   r   r   r   r   r   r   r>   r   r   r   r   r   r   r   r   r   r   r   z
                        UPDATE dr_young_all_articles
                        SET title=%s, content=%s, embedding=%s
                        WHERE id=%s
                    r   r   r   z
                        INSERT INTO dr_young_all_articles
                        (title, url, content, embedding)
                        VALUES (%s, %s, %s, %s)
                    r   r   u   ❌ Failed to scrape u*   🏁 FINISHED DR. ROBERT YOUNG BLOG: NEW: r   r   rB   )blogz
wp-contentzwp-admin)r7   z/tag/z/page/#r8   z.jpgz.png).r   r   r   r   r   DR_YOUNG_BLOG_URLr   r   r   r   r   r   r   rI   rH   r#   r$   rL   r&   rR   rO   r%   r   r   rM   r'   r   r   rz   rK   r   r   r   rl   r   r   r   r   r   r   r   r   rP   rQ   r   r   )!r   r   r   r+   r,   category_links
categoriesr   r=   r^   urls_to_scraper3   r   post_elementsrV   r   linksdirect_post_linksr.   r[   r]   article_urlr   r   r   r   r   r   r   r   r   r   r   s!                     `              r4   scrape_dr_young_blogr    sX    Q	1i3FID
KK56-<< 17BOX]]M: s<a1bcU
"D88F#Dt+t3;;s+11#6r:80R RNN8, # 	jZ 11CF:DVCWXY ,,_i/j_iX[2LSEQR0S_i/jj ocU+,m	||C"EH >D !MMG1DMEMKK+c-&8%9HI M%c

;Y0Z[$$U+ & !%c

Cn8o p  !23 !} &m}t'+xx'7 '+':dhhv>N'N '+ ,/3 /l/j/l333 /l/j/l ,l '+d} &m "n oM KK+c-&8%99LMN 6UbceUf7gUfT8HUf7g6hij>AEV>VCJJsO11#6r:\gM$]A64"hhv."!)k7TV_d!eJ"/
"OK )--d3  M  M{7G7G}7G7]  M  Malaqaqrv  @Laq  bM
;E
++$+7:J&#e*q.!,!1!1&:!1!N!k!kR]RbRbcjRkJ!=G__PV=V
y 9\f\o\ovz\o\{ &;R@HHI^`bciikf]O3H1SQ^M_L``bchbijk 8Dw<"44LL#@r#g,W^!_`3CL>MN &K..w7>>@	 X[fZhi<<>4<1K!1'72y)Q.)h}o=UV[U\$]^ KK !  #i.+F	H
 KKM9%*%KK&{mSVW\V] ^_ KK !  gs9~F	H
 #&--KKKM5MQ&MKK%k+cRWQX YZ 

=)O 7\ 	

:e h KK<VE]O<X^_hXiWjjvw}  H  xI  wJ  K  LM{ 0k -?sCD+,-8&m 8h ! NN%<[MA3#OP@  	LL0Rs;<	s   B^ 4^ =,^ .^ 7A^ ^	^ :D`?__5
_ __7_=A`_'A+`4_``9`A``4J`^ _
 __

``	"`=``		``>`99`>__main__zScrape and embed articles)descriptionz--clear
store_truezClear database before scraping)actionhelpu!   🚀 STARTING MULTI-SITE SCRAPINGu&   🗑️ CLEARING DATABASE AS REQUESTEDz$TRUNCATE TABLE dr_young_all_articlesu   ✅ Database clearedz$
=== PHOREVERYOUNG.WORDPRESS.COM ===z
=== DRROBERTYOUNG.COM/BLOG ===u#   
🎉 MULTI-SITE SCRAPING COMPLETEDzWordPress  - NEW: r   r   r   r   r   zBlog       - NEW: zTOTAL      - NEW: )<__doc__rP   loggingwarningsr   urllib.parser   r   bs4r   sysospathr   r   dirname__file__database.dbr   filterwarningsbasicConfigINFO	getLogger__name__r   r  rG   r   r   r   r   r5   rf   rj   rl   r   r   r   r   r   r  argparseArgumentParserparseradd_argument
parse_argsargsr   clearr   r   r   r   all_categoriesr   wp_stats
blog_stats	total_newtotal_updatedtotal_skippedr   rm   r4   <module>r0     s  4    	      	 RWW__X6= > & 	   !   
,,6 
		8	$ 6 ; 9
: 
(Tc
N 
K \ 4DN&P`N z$$1LMF
	,=]^D78:::KK@AID#KK>?KKMKK./ 	;<02'(* 	67)+
 	:;(%(9hyFYEZZfgopygzf{|}(E):(;<
S\H]G^^jkuv  lA  kB  C  	DUOj&77	 +j.CC +j.CC(<l[hZijk 	I H 	s   /"J* EJ* *J,