File tree 1 file changed +12
-5
lines changed
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(
21
21
const { document } = parseHTML ( html ) ;
22
22
23
23
// Uncomment to debug HTML
24
- // Bun.write("chrome.html", document.documentElement.outerHTML);
24
+ Bun . write ( "chrome.html" , document . documentElement . outerHTML ) ;
25
25
26
26
// Basic metadata
27
27
const name = metaContent ( document , "property=og:title" ) ;
@@ -71,10 +71,17 @@ export async function crawlExtension(
71
71
const ratingRow = header . querySelector (
72
72
"div:first-child > div:nth-child(2) > span:last-child" ,
73
73
) ;
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 ;
78
85
79
86
// Details
80
87
You can’t perform that action at this time.
0 commit comments