Skip to content

Commit

Permalink
fix: www.androidauthority.com - Clear polls
Browse files Browse the repository at this point in the history
Remove polls that require JavaScript
  • Loading branch information
jocmp committed Jan 15, 2025
1 parent 00f01a6 commit 22a29c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/extractors/custom/www.androidauthority.com/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,23 @@ export const WwwAndroidauthorityComExtractor = {
// remove if not following a paragraph. Adding this empty paragraph fixes it, and
// the empty paragraph will be removed anyway.
content: {
selectors: ['.d_Dd', '.e_Ac'],
selectors: ['main'],
transforms: {
ol: node => {
node.attr('class', 'mercury-parser-keep');
},
h2: $node => $node.attr('class', 'mercury-parser-keep'),
h3: $node => $node.attr('class', 'mercury-parser-keep'),
p: node => {
if (node.text().startsWith('Affiliate links')) {
node.remove();
}
},
},
clean: [
'.d_f .d_nr', // Lead image
'h1', // Clean title
'h1 ~ *', // Clean subtitle
'.e_Oh', // Polls
],
},
};
1 change: 1 addition & 0 deletions src/utils/dom/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const REMOVE_ATTR_LIST = REMOVE_ATTRS.join(',');
export const WHITELIST_ATTRS = [
'src',
'srcset',
'start',
'sizes',
'type',
'href',
Expand Down

0 comments on commit 22a29c3

Please sign in to comment.