File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 1- import { getImageScore , logMarian , delay } from "../shared/utils.js" ;
1+ import { getImageScore , logMarian } from "../shared/utils.js" ;
22
33async function getKoboDetails ( ) {
44 logMarian ( "Extracting Kobo details" ) ;
@@ -130,9 +130,20 @@ function getKoboFormatInfo(bookDetails, url) {
130130
131131}
132132
133+ function joinContent ( elements ) {
134+ return Array . from ( elements ) . map ( item => item . textContent . trim ( ) ) . join ( "\n" ) ;
135+ }
136+
133137function extractKoboDescription ( bookDetails ) {
134- const descriptionEl = document . querySelector ( '.synopsis-description p' ) ;
135- bookDetails [ "Description" ] = descriptionEl ? descriptionEl . textContent . trim ( ) : null ;
138+ const descriptionEl = document . querySelectorAll ( '#synopsis div[data-full-synopsis] p' ) ;
139+ const fallbackDescriptionEl = document . querySelectorAll ( '.synopsis-description p' ) ;
140+ let description = null ;
141+ if ( descriptionEl ) {
142+ description = joinContent ( descriptionEl ) ;
143+ } else if ( fallbackDescriptionEl ) {
144+ description = joinContent ( fallbackDescriptionEl ) ;
145+ }
146+ bookDetails [ "Description" ] = description ;
136147}
137148
138149
You can’t perform that action at this time.
0 commit comments