orhO2ddlmZddlmZddlZdZdZdS))date)sync_playwrightNc i}t5}|jd}|}|| d}||||}|rd|}tj d|}|r| d|d<|d} t| |d<| r| } tj d | } | r%t| d|d <d } || } | d krU| }tj d|}|r| d|d <d}||}|r`|}tj d|tj}|r| d|d<|d}|rtj d|}tj d|}tj d|}tj d|}|r| d|d<|r| d|d<|rd|vr| d|d<|r| d|d<d}||}|r9|d}d|D}d||d<|dd }|r||d!<n/|d"d }|r||d!<t+|}||cd#d#d#S#t.$r<}t1d$|Yd#}~|d#d#d#d#Sd#}~wwxYw#|wxYw#1swxYwYd#S)%a Scrapes game details (title, NSUID, price, original price, discount, release date, discount end date, description, fsId, image URL) from a Nintendo eShop webpage. Args: url (str): The URL of the Nintendo eShop game page. Returns: dict: A dictionary containing the extracted information, or None if the information cannot be found. T)headlesszdiv.plm-price__mainz (\d+,\d{2})pricezspan.plm-price__discount is_discountedz\(-\s*(\d+)%\)discount_percentagezdiv.plm-price__originalroriginal_pricezdiv.plm-price__disclaimerz#jusqu\'au\s*:\s*(\d{2}/\d{2}/\d{4})discount_end_datea () => { const scripts = document.querySelectorAll('script'); for (const script of scripts) { if (script.textContent.includes('window.dataLayer')) { return script.textContent; } } return null; } z"gameTitle":\s*"([^"]+)"z"offdeviceNsuID":\s*"([^"]+)"zreleaseDate:\s*"([^"]+)"z"pageID":\s*"([^"]+)" gameTitleoffdeviceNsuID releaseDatefsIdzdiv.col-xs-12.contentpcZg|](}|)S) inner_textstrip).0rs ./var/lib/jenkins/jobs/Dev/workspace/Scraper.py z$get_game_details..[s,$P$P$PQ\\^^%9%9%;%;$P$P$Pz descriptionzmeta[property="og:image"]content image_urlzmeta[itemprop="image"]NzAn error occurred: )rchromiumlaunchnew_pagegotowait_for_selectorquery_selectorrrresearchgroupboolintlocatorcount IGNORECASEevaluatequery_selector_alljoin get_attributesanitizeScraperResultsclose Exceptionprint) url game_datarbrowserpageprice_selector price_elementfull_price_text price_matchdiscount_element discount_textdiscount_matchoriginal_price_selectororiginal_price_elementoriginal_price_textoriginal_price_matchdiscount_end_date_selectordiscount_end_date_elementdiscount_end_date_text date_matchscript_content title_match nsuid_matchrelease_date_match page_id_matchdescription_selectordescription_element paragraphsdescription_partsrsanitizedDatases rget_game_detailsrQs\I   \a*##T#22!! #W 2N  " "> 2 2 2 //??M X"/":":"<"<"B"B"D"D iHH >)4):):1)=)=Ig�#?#?@Z#[#[ -12B-C-C /*# X$4$?$?$A$A$G$G$I$IM%'Y/@-%P%PN%X;>~?S?STU?V?V;W;W "78.G+-1\\:Q-R-R*-335599.D.O.O.Q.Q.W.W.Y.Y+/1yI\/]/],/X:N:T:TUV:W:WI&67*E &(,(;(;->q-A-AIk*G2=2C2CA2F2FI./%K-y*H*H/A/G/G/J/JIm, ?(5(;(;A(>(>If%$; "&"5"56J"K"K " J0CCCHH $P$PZ$P$P$P!+1;;7H+I+I -( %@AAOOPYZZI 7)2 +&& LL)ABBPPQZ[[ 7-6Ik*3I>>N! MMOOOy\\\\\\\\n    +++ , , ,444 MMOOOy\\\\\\\\n  MMOOOOy\\\\\\\\\\sOAQ>N$P;Q> Q"&Q8Q%<Q>Q""Q%%Q;;Q>>RRcbd|vrn |d|d<d|vrnd|d<d|vrnd|d<d|vrnd|d<|S) Nr rr z 24/12/2030r 0r Fr)r4s rr/r/rsp y ( (*3G*rVs^////// jjjZ. 6 6r