Skip to content

Commit f702361

Browse files
committed
fix: Fix broken chrome crawler after layout change
1 parent 3777e1a commit f702361

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/crawlers/chrome-crawler.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ export async function crawlExtension(
4040
const sections = (document as HTMLElement).querySelectorAll(
4141
"main > * > section",
4242
);
43-
const header: HTMLElement = sections[0];
43+
const header: HTMLElement = sections[0].querySelector(
44+
"section > section > div",
45+
);
46+
4447
const description: HTMLElement = sections[2];
4548
const details: HTMLElement = sections[3];
4649

@@ -53,7 +56,7 @@ export async function crawlExtension(
5356
// 73 users
5457
// </div>
5558
// Remove the anchors and extract "73" from the text content
56-
const userCountRow = header.querySelector("div:first-child > div:last-child");
59+
const userCountRow = header.querySelector(":scope > div:last-child");
5760
userCountRow
5861
.querySelectorAll("a")
5962
.forEach((anchor: HTMLAnchorElement) => anchor.remove());
@@ -73,7 +76,7 @@ export async function crawlExtension(
7376
// </span>
7477
// </span>
7578
const ratingRow = header.querySelector(
76-
"div:first-child > div:nth-child(2) > span:last-child",
79+
"div:first-child > div:nth-child(2) > span:nth-child(3)",
7780
);
7881
const rating =
7982
ratingRow != null

0 commit comments

Comments
 (0)