File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ export async function crawlExtension(
2121 const { document } = parseHTML ( html ) ;
2222
2323 // Uncomment to debug HTML
24- // Bun.write("chrome.html", document.documentElement.outerHTML);
24+ Bun . write ( "chrome.html" , document . documentElement . outerHTML ) ;
2525
2626 // Basic metadata
2727 const name = metaContent ( document , "property=og:title" ) ;
@@ -71,10 +71,17 @@ export async function crawlExtension(
7171 const ratingRow = header . querySelector (
7272 "div:first-child > div:nth-child(2) > span:last-child" ,
7373 ) ;
74- const rating = extractNumber (
75- ratingRow . querySelector ( "span:first-child > span:first-child" ) . textContent ,
76- ) ;
77- const reviewCount = extractNumber ( ratingRow . querySelector ( "p" ) . textContent ) ;
74+ const rating =
75+ ratingRow != null
76+ ? extractNumber (
77+ ratingRow . querySelector ( "span:first-child > span:first-child" )
78+ . textContent ,
79+ )
80+ : 0 ;
81+ const reviewCount =
82+ ratingRow != null
83+ ? extractNumber ( ratingRow . querySelector ( "p" ) . textContent )
84+ : 0 ;
7885
7986 // Details
8087
You can’t perform that action at this time.
0 commit comments