diff --git a/utils/scraper.ts b/utils/scraper.ts index e7b7b8e..49f121b 100644 --- a/utils/scraper.ts +++ b/utils/scraper.ts @@ -164,7 +164,7 @@ export const extractScrapedResult = (content:string, scraper_type:string): Searc export const getSerp = (domain:string, result:SearchResult[]) : SERPObject => { if (result.length === 0 || !domain) { return { postion: false, url: '' }; } const foundItem = result.find((item) => { - const itemDomain = item.url.match(/^(?:https?:)?(?:\/\/)?([^/?]+)/i); + const itemDomain = item.url.replace('www.', '').match(/^(?:https?:)?(?:\/\/)?([^/?]+)/i); return itemDomain && itemDomain.includes(domain); }); return { postion: foundItem ? foundItem.position : 0, url: foundItem && foundItem.url ? foundItem.url : '' };