@@ -267,7 +267,7 @@ export default function parse_page(lang, msg, content, embed, wiki, reaction, {n
267267 }
268268 }
269269 let extraImages = [ ] ;
270- if ( thumbnail && embed . data . thumbnail ?. url && ! / \. (?: p n g | j p g | j p e g | g i f ) (?: \/ | \? | $ ) / i. test ( embed . data . thumbnail ?. url ) ) embed . setThumbnail ( thumbnail ) ;
270+ if ( thumbnail && embed . data . thumbnail ?. url && ! / \. (?: p n g | j p g | j p e g | g i f | w e b p ) (?: \/ | \? | $ ) / i. test ( embed . data . thumbnail ?. url ) ) embed . setThumbnail ( thumbnail ) ;
271271 return got . get ( wiki + 'api.php?uselang=' + uselang + '&action=parse' + ( noRedirect ? '' : '&redirects=true' ) + '&prop=text|images|displaytitle&disablelimitreport=true&disableeditsection=true&disabletoc=true&page=' + encodeURIComponent ( title ) + '&format=json' , {
272272 timeout : {
273273 request : 10_000
@@ -333,7 +333,7 @@ export default function parse_page(lang, msg, content, embed, wiki, reaction, {n
333333 let imgURL = ( img . attribs . src ?. startsWith ?. ( 'data:' ) ? img . attribs [ 'data-src' ] : img . attribs . src ) ;
334334 if ( ! imgURL ) return false ;
335335 if ( img . attribs [ 'data-image-name' ] ?. toLowerCase ( ) . endsWith ( '.gif' ) ) return true ;
336- return ( / ^ (?: (?: h t t p s ? : ) ? \/ ) ? \/ / . test ( imgURL ) && / \. (?: p n g | j p g | j p e g | g i f ) (?: \/ | \? | $ ) / i. test ( imgURL ) ) ;
336+ return ( / ^ (?: (?: h t t p s ? : ) ? \/ ) ? \/ / . test ( imgURL ) && / \. (?: p n g | j p g | j p e g | g i f | w e b p ) (?: \/ | \? | $ ) / i. test ( imgURL ) ) ;
337337 } ) ;
338338 if ( image ) {
339339 let imgURL = ( image . attribs . src ?. startsWith ?. ( 'data:' ) ? image . attribs [ 'data-src' ] : image . attribs . src ) ;
@@ -469,19 +469,19 @@ export default function parse_page(lang, msg, content, embed, wiki, reaction, {n
469469 }
470470 else if ( embed . data . thumbnail ?. url === thumbnail ) {
471471 try {
472- response . body . parse . images = response . body . parse . images . map ( pageimage => pageimage . toString ( ) ) . filter ( pageimage => / \. (?: p n g | j p g | j p e g | g i f ) $ / . test ( pageimage . toLowerCase ( ) ) ) ;
473- let image = response . body . parse . images . find ( pageimage => pageimage . toLowerCase ( ) . replace ( / \. (?: p n g | j p g | j p e g | g i f ) $ / , '' ) === title . toLowerCase ( ) . replaceAll ( ' ' , wiki . spaceReplacement ?? '_' ) ) ;
472+ response . body . parse . images = response . body . parse . images . map ( pageimage => pageimage . toString ( ) ) . filter ( pageimage => / \. (?: p n g | j p g | j p e g | g i f | w e b p ) $ / . test ( pageimage . toLowerCase ( ) ) ) ;
473+ let image = response . body . parse . images . find ( pageimage => pageimage . toLowerCase ( ) . replace ( / \. (?: p n g | j p g | j p e g | g i f | w e b p ) $ / , '' ) === title . toLowerCase ( ) . replaceAll ( ' ' , wiki . spaceReplacement ?? '_' ) ) ;
474474 if ( ! image ) image = response . body . parse . images . find ( pageimage => pageimage . toLowerCase ( ) . includes ( title . toLowerCase ( ) . replaceAll ( ' ' , wiki . spaceReplacement ?? '_' ) ) ) ;
475475 if ( ! image ) {
476476 let first = $ ( infoboxList . join ( ', ' ) ) . find ( 'img' ) . filter ( ( i , img ) => {
477477 let imgURL = ( img . attribs . src ?. startsWith ?. ( 'data:' ) ? img . attribs [ 'data-src' ] : img . attribs . src ) ;
478478 if ( img . attribs [ 'data-image-name' ] ?. toLowerCase ( ) . endsWith ( '.gif' ) ) return true ;
479- return ( / ^ (?: (?: h t t p s ? : ) ? \/ ) ? \/ / . test ( imgURL ) && / \. (?: p n g | j p g | j p e g | g i f ) (?: \/ | \? | $ ) / i. test ( imgURL ) ) ;
479+ return ( / ^ (?: (?: h t t p s ? : ) ? \/ ) ? \/ / . test ( imgURL ) && / \. (?: p n g | j p g | j p e g | g i f | w e b p ) (?: \/ | \? | $ ) / i. test ( imgURL ) ) ;
480480 } ) . first ( ) ;
481481 if ( ! first . length ) first = $ ( 'img' ) . filter ( ( i , img ) => {
482482 let imgURL = ( img . attribs . src ?. startsWith ?. ( 'data:' ) ? img . attribs [ 'data-src' ] : img . attribs . src ) ;
483483 if ( img . attribs [ 'data-image-name' ] ?. toLowerCase ( ) . endsWith ( '.gif' ) ) return true ;
484- return ( / ^ (?: (?: h t t p s ? : ) ? \/ ) ? \/ / . test ( imgURL ) && / \. (?: p n g | j p g | j p e g | g i f ) (?: \/ | \? | $ ) / i. test ( imgURL ) ) ;
484+ return ( / ^ (?: (?: h t t p s ? : ) ? \/ ) ? \/ / . test ( imgURL ) && / \. (?: p n g | j p g | j p e g | g i f | w e b p ) (?: \/ | \? | $ ) / i. test ( imgURL ) ) ;
485485 } ) . first ( ) ;
486486 if ( first . length ) {
487487 if ( first . attr ( 'data-image-name' ) ?. toLowerCase ( ) . endsWith ( '.gif' ) ) image = first . attr ( 'data-image-name' ) ;
@@ -600,7 +600,7 @@ export default function parse_page(lang, msg, content, embed, wiki, reaction, {n
600600 ] . filter ( img => {
601601 let imgURL = ( img . attribs . src ?. startsWith ?. ( 'data:' ) ? img . attribs [ 'data-src' ] : img . attribs . src ) ;
602602 if ( ! imgURL ) return false ;
603- return ( / ^ (?: (?: h t t p s ? : ) ? \/ ) ? \/ / . test ( imgURL ) && / \. (?: p n g | j p g | j p e g | g i f ) (?: \/ | \? | $ ) / i. test ( imgURL ) ) ;
603+ return ( / ^ (?: (?: h t t p s ? : ) ? \/ ) ? \/ / . test ( imgURL ) && / \. (?: p n g | j p g | j p e g | g i f | w e b p ) (?: \/ | \? | $ ) / i. test ( imgURL ) ) ;
604604 } ) . map ( img => {
605605 if ( img . attribs [ 'data-image-name' ] ?. toLowerCase ( ) . endsWith ( '.gif' ) ) return wiki . toLink ( 'Special:FilePath/' + img . attribs [ 'data-image-name' ] ) ;
606606 try {
0 commit comments