File tree Expand file tree Collapse file tree 3 files changed +11
-7
lines changed
Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,11 @@ export default {
88
99 const articleHtml = utils . encodeText ( meta . charset , readability . getHTML ( ) ) ;
1010 const $p = cheerio . load ( articleHtml ) ( 'p' ) ;
11+ const articleText = $p . text ( ) ;
1112
12- if ( $p . text ( ) ) {
13+ if ( articleText ) {
1314 return {
14- articlebody : articleHtml
15+ articlebody : __readabilityEnabled === 'html' ? articleHtml : articleText . replace ( / \. ( [ ^ \. \d \s \n \r \' \" \” \) \] ] ) / g , '. $1' )
1516 }
1617 }
1718 } ,
Original file line number Diff line number Diff line change @@ -14,15 +14,18 @@ export default {
1414 || meta . twitter ?. card === 'summary_large_image'
1515 || meta . article ) )
1616
17- && ( options . getRequestOptions ( 'readability.articlebody' , false ) || CONFIG . providerOptions ?. app ?. allow_readability === true ) ) {
17+ && ( options . getRequestOptions ( 'readability.articlebody' ) || CONFIG . providerOptions ?. app ?. allow_readability === true ) ) {
1818
19- if ( ld ?. articlebody && / \/ > / . test ( ld . articlebody ) ) {
19+ const article_format = ( options . getRequestOptions ( 'readability.articlebody' ) === 'html'
20+ || CONFIG . providerOptions ?. app ?. allow_readability === true ) ? 'html' : 'txt' ;
21+
22+ if ( ld ?. articlebody && ( article_format !== 'html' || / \/ > / . test ( ld . articlebody ) ) ) {
2023 return {
2124 articlebody : ld . articlebody
2225 }
2326 } else if ( options . getProviderOptions ( 'app.allow_readability' ) ) {
2427 return {
25- __readabilityEnabled : true
28+ __readabilityEnabled : article_format
2629 }
2730 }
2831 }
Original file line number Diff line number Diff line change 11export default {
22
3- getData : function ( articlebody ) {
4- if ( CONFIG . providerOptions ?. app ?. allow_readability === true && ! CONFIG . SKIP_IFRAMELY_RENDERS ) {
3+ getData : function ( __readabilityEnabled , articlebody ) {
4+ if ( __readabilityEnabled === 'html' && CONFIG . providerOptions ?. app ?. allow_readability === true && ! CONFIG . SKIP_IFRAMELY_RENDERS ) {
55 return {
66 safe_html : articlebody
77 }
You can’t perform that action at this time.
0 commit comments