@@ -215,12 +215,8 @@ class ReLibraryPlugin implements Plugin.PluginBase {
215215 novel . path = $ ( el ) . find ( 'table > tbody > tr > td > a' ) . attr ( 'href' ) ;
216216 if ( novel . name === undefined || novel . path === undefined ) return ;
217217 novel . cover = this . ensureCover (
218- $ ( el )
219- . find ( 'table > tbody > tr > td > a > img' )
220- . attr ( 'data-cfsrc' ) ||
221- $ ( el )
222- . find ( 'table > tbody > tr > td > a > img' )
223- . attr ( 'src' )
218+ $ ( el ) . find ( 'table > tbody > tr > td > a > img' ) . attr ( 'data-cfsrc' ) ||
219+ $ ( el ) . find ( 'table > tbody > tr > td > a > img' ) . attr ( 'src' ) ,
224220 ) ;
225221 if ( novel . path . startsWith ( this . site ) ) {
226222 novel . path = novel . path . slice ( this . site . length ) ;
@@ -246,9 +242,9 @@ class ReLibraryPlugin implements Plugin.PluginBase {
246242 $ ( el )
247243 . find ( '.entry-content > table > tbody > tr > td > a >img' )
248244 . attr ( 'data-cfsrc' ) ||
249- $ ( el )
250- . find ( '.entry-content > table > tbody > tr > td > a >img' )
251- . attr ( 'src' )
245+ $ ( el )
246+ . find ( '.entry-content > table > tbody > tr > td > a >img' )
247+ . attr ( 'src' ) ,
252248 ) ;
253249 if ( novel . path . startsWith ( this . site ) ) {
254250 novel . path = novel . path . slice ( this . site . length ) ;
@@ -290,9 +286,7 @@ class ReLibraryPlugin implements Plugin.PluginBase {
290286 const $ = loadCheerio ( body ) ;
291287
292288 // If it doesn't find the name I should just throw an error (or early return) since the scraping is broken
293- novel . name = $ ( 'header.entry-header > .entry-title' )
294- . text ( )
295- . trim ( ) ;
289+ novel . name = $ ( 'header.entry-header > .entry-title' ) . text ( ) . trim ( ) ;
296290
297291 if ( novel . name === undefined || novel . name === '404 – Page not found' )
298292 throw new Error ( `Invalid novel for url ${ novelPath } ` ) ;
@@ -301,51 +295,39 @@ class ReLibraryPlugin implements Plugin.PluginBase {
301295 novel . cover = this . ensureCover (
302296 // $('.entry-content > table > tbody > tr > td > a > img')
303297 $ ( '.entry-content > table img' ) . attr ( 'data-cfsrc' ) ||
304- $ ( '.entry-content > table img' ) . attr ( 'src' )
298+ $ ( '.entry-content > table img' ) . attr ( 'src' ) ,
305299 ) ;
306300
307301 novel . status = NovelStatus . Unknown ;
308- $ ( '.entry-content > table > tbody > tr > td > p' ) . each (
309- function ( _i , el ) {
310- // Handle the novel status
311- // Sadly some novels just state the status inside the summary...
312- if (
313- $ ( el )
314- . find ( 'strong' )
315- . text ( )
316- . toLowerCase ( )
317- . trim ( )
318- . startsWith ( 'status' )
319- ) {
320- $ ( el ) . find ( 'strong' ) . remove ( ) ;
321- const status = $ ( el ) . text ( ) . toLowerCase ( ) . trim ( ) ;
322- if ( status . includes ( 'on-going' ) ) {
323- novel . status = NovelStatus . Ongoing ;
324- } else if ( status . includes ( 'completed' ) ) {
325- novel . status = NovelStatus . Completed ;
326- } else if ( status . includes ( 'hiatus' ) ) {
327- novel . status = NovelStatus . OnHiatus ;
328- } else if ( status . includes ( 'cancelled' ) ) {
329- novel . status = NovelStatus . Cancelled ;
330- } else {
331- novel . status = loadCheerio ( el ) . text ( ) ;
332- }
333- }
334- // Handle the genres
335- else if (
336- $ ( el )
337- . find ( 'strong' )
338- . text ( )
339- . toLowerCase ( )
340- . trim ( )
341- . startsWith ( 'Category' )
342- ) {
343- $ ( el ) . find ( 'strong' ) . remove ( ) ;
344- // previously, list of '> span > a'
345- novel . genres = $ ( el ) . text ( ) ;
302+ $ ( '.entry-content > table > tbody > tr > td > p' ) . each ( function ( _i , el ) {
303+ // Handle the novel status
304+ // Sadly some novels just state the status inside the summary...
305+ if (
306+ $ ( el ) . find ( 'strong' ) . text ( ) . toLowerCase ( ) . trim ( ) . startsWith ( 'status' )
307+ ) {
308+ $ ( el ) . find ( 'strong' ) . remove ( ) ;
309+ const status = $ ( el ) . text ( ) . toLowerCase ( ) . trim ( ) ;
310+ if ( status . includes ( 'on-going' ) ) {
311+ novel . status = NovelStatus . Ongoing ;
312+ } else if ( status . includes ( 'completed' ) ) {
313+ novel . status = NovelStatus . Completed ;
314+ } else if ( status . includes ( 'hiatus' ) ) {
315+ novel . status = NovelStatus . OnHiatus ;
316+ } else if ( status . includes ( 'cancelled' ) ) {
317+ novel . status = NovelStatus . Cancelled ;
318+ } else {
319+ novel . status = loadCheerio ( el ) . text ( ) ;
346320 }
347- } ,
348- ) ;
321+ }
322+ // Handle the genres
323+ else if (
324+ $ ( el ) . find ( 'strong' ) . text ( ) . toLowerCase ( ) . trim ( ) . startsWith ( 'Category' )
325+ ) {
326+ $ ( el ) . find ( 'strong' ) . remove ( ) ;
327+ // previously, list of '> span > a'
328+ novel . genres = $ ( el ) . text ( ) ;
329+ }
330+ } ) ;
349331
350332 // Handle the author names
351333 // Both the author and the translator (if present) seem to be written out as links,
@@ -379,7 +361,7 @@ class ReLibraryPlugin implements Plugin.PluginBase {
379361 if ( chap_path . startsWith ( this . site ) ) {
380362 chap_path = chap_path . slice ( this . site . length ) ;
381363 }
382-
364+
383365 const epochStr = $ ( chap_el ) . attr ( 'data-date' ) ;
384366 // if we can't get the released time (at least without any additional fetches), set it to null purposfully
385367 let epoch = null ;
@@ -452,7 +434,7 @@ class ReLibraryPlugin implements Plugin.PluginBase {
452434 // edge cases like this.
453435 content . find ( 'p:has(>code)+code:has(+p:has(>code))' ) . each ( ( _i , el ) => {
454436 if (
455- el . attribs . style . match ( / ( .* ; ) ? f o n t - f a m i l y : ' M e r r i w e a t h e r ' , s e r i f ; .* / )
437+ el . attribs . style . match ( / ( .* ? ; ) ? f o n t - f a m i l y : ' M e r r i w e a t h e r ' , s e r i f .* / )
456438 ) {
457439 $ ( el . prev ! ! ) . remove ( ) ;
458440 $ ( el . next ! ! ) . remove ( ) ;
0 commit comments