"use strict";(()=>{var e={};e.id=8363,e.ids=[8363],e.modules={20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},56681:e=>{e.exports=require("playwright")},38355:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>g,patchFetch:()=>f,requestAsyncStorage:()=>d,routeModule:()=>m,serverHooks:()=>w,staticGenerationAsyncStorage:()=>u});var a={};r.r(a),r.d(a,{POST:()=>l});var s=r(49303),o=r(88716),i=r(60670),p=r(87070),n=r(56681),c=r.n(n);async function l(e){try{let{url:t,checkValidate:r=!0,headless:a}=await e.json();if(!t)return p.NextResponse.json({error:"URL is required"},{status:400});let s=await c().chromium.launch({headless:a}),o=await s.newPage();if(await o.goto(t,{waitUntil:"domcontentloaded",timeout:3e4}),await o.waitForTimeout(2e3),t.includes("yellowpages")||await o.route("**/*",e=>{let t=e.request();"stylesheet"===t.resourceType()||"script"===t.resourceType()?e.abort():e.continue()}),t.includes("yellowpages")&&r)for(;;)try{let e=await o.$(".mobileLoadMore button.loadMoreBtn");if(!e)break;await e.click(),await o.waitForTimeout(2e3)}catch(e){console.log(e);break}let i=await o.title(),n=await o.$eval("meta[name='description']",e=>e.content).catch(()=>""),l=await o.$eval("meta[name='keywords']",e=>e.content).catch(()=>""),m=await o.$$eval("img",e=>e.map(e=>e.src)),d=await o.content(),u=Array.from(d.matchAll(/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g),e=>e[0]),w=["privacy","wordpress","sample","example","test","sentry","wizpress","domain","example","website","yoursite","pixel","xxx","sexy","porn","mobile"],g=[...new Set(u.filter(e=>!/\.(png|jpe?g|gif|webp|svg|bmp|tiff|heif|heic|ico|cur|psd|cdr|ai|eps|raw|cr2|nef|orf|sr2|rw2|dng|raf|arw|pef|x3f|pbm|pgm|ppm|pnm|hdr|exr|sgi|pic|pict|txt|md|rtf|docx?|odt|pdf|pages|tex|log|ans|wpd|xlsx?|xlsm|ods|csv|tsv|numbers|dbf|qif|qfx|pptx?|odp|key|js|jsx|ts|tsx|py|pyc|java|class|kt|kts|rb|php3?|pl|ps1|sh|bash|c|cpp|h|hpp|cs|go|rs|scala|swift|m|mm|vb|r|lua|groovy|erl|exs?|html?|xhtml|css|scss|sass|less|xml|json|map|ya?ml|mp3|wav|aac|m4a|flac|ogg|oga|opus|wma|aiff|alac|amr|mp4|m4v|mov|avi|mkv|wmv|flv|webm|mpeg|mpg|ts|m2ts|zip|rar|tar|gz|tgz|bz2|xz|z|lz|cab|iso|img|dmg|jar|ttf|otf|woff2?|eot|sql|sqlite3?|db|mdb|accdb|ldf|bak|ini|cfg|conf|env|plist|reg|sys|service|desktop|exe|dll|so|bin|elf|app|deb|rpm|msi|apk|ipa|lock|toml|gradle|pom|war|ear|whl|gem|npmignore|json|yarnrc|dxf|dwg|stl|obj|fbx|blend|gltf|glb|kml|kmz|geojson|shp|shx|gpx|osm|eml|msg|vcf|ics|pem|crt|cer|key|p12|pfx|asc|bib|cls|sty|ipynb|rmd|nb|mnb|trace|out|metrics|perf|tmp|old|swp|part|crdownload|torrent|lnk|ace|zst|pak|cue|md5|sha1|sha256|checksum)$/i.test(e)))].filter(e=>w.every(t=>!e.includes(t))),f=Array.from(d.matchAll(/\+?\d{1,4}?[-.\s]?\(?\d{2,5}\)?[-.\s]?\d{3,4}[-.\s]?\d{4,9}/g),e=>e[0]),b=[...new Set(f.filter(e=>{let t=e.replace(/[^\d+]/g,"");return!(t.length<7||t.length>15||/^\d+$/.test(t)&&(t.length<10||t.length>14))&&!!/^\+?\d{1,4}[-.\s]?\(?\d{2,5}\)?[-.\s]?\d{3,4}[-.\s]?\d{4,9}$/.test(e)}))].map(e=>e.replace(/[\s()\-\+]/g,""))||[],h=[];return[/https?:\/\/(www\.)?facebook\.com\/[a-zA-Z0-9._-]+/gi,/https?:\/\/(www\.)?instagram\.com\/[a-zA-Z0-9._-]+/gi,/https?:\/\/(www\.)?linkedin\.com\/in\/[a-zA-Z0-9._-]+/gi,/https?:\/\/(www\.)?twitter\.com\/[a-zA-Z0-9._-]+/gi,/https?:\/\/(www\.)?youtube\.com\/[a-zA-Z0-9._-]+/gi].forEach(e=>{let t=d.match(e);t&&h.push(...t)}),h=[...new Set(h)].map(e=>{let t={"facebook.com":"facebook","instagram.com":"instagram","linkedin.com":"linkedIn","twitter.com":"twitter","youtube.com":"youTube"},r=Object.keys(t).find(t=>e.includes(t));return r?{title:t[r],url:e}:null}),await s.close(),p.NextResponse.json({url:t,title:i,description:n,keywords:l,images:m,emails:[...new Set(g)],phones:b,socialMediaLinks:h})}catch(e){return console.error("Scraping Error:",e),p.NextResponse.json({error:"Failed to scrape website"},{status:500})}}let m=new s.AppRouteRouteModule({definition:{kind:o.x.APP_ROUTE,page:"/api/business_directory_scraper/route",pathname:"/api/business_directory_scraper",filename:"route",bundlePath:"app/api/business_directory_scraper/route"},resolvedPagePath:"C:\\Users\\Design Collection\\OneDrive\\Desktop\\Jitendra Vishwakarma\\Next Dashboard\\web crawler for user dev\\Scrape Genius\\app\\api\\business_directory_scraper\\route.js",nextConfigOutput:"",userland:a}),{requestAsyncStorage:d,staticGenerationAsyncStorage:u,serverHooks:w}=m,g="/api/business_directory_scraper/route";function f(){return(0,i.patchFetch)({serverHooks:w,staticGenerationAsyncStorage:u})}}};var t=require("../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),a=t.X(0,[8948,5972],()=>r(38355));module.exports=a})();