From 22a29c31cded250bb50931a28706cb28e29fc165 Mon Sep 17 00:00:00 2001 From: Josiah Campbell <9521010+jocmp@users.noreply.github.com> Date: Tue, 14 Jan 2025 22:16:03 -0600 Subject: [PATCH] fix: www.androidauthority.com - Clear polls Remove polls that require JavaScript --- .../custom/www.androidauthority.com/index.js | 11 +++++++++-- src/utils/dom/constants.js | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/extractors/custom/www.androidauthority.com/index.js b/src/extractors/custom/www.androidauthority.com/index.js index e67784d3..99329f15 100644 --- a/src/extractors/custom/www.androidauthority.com/index.js +++ b/src/extractors/custom/www.androidauthority.com/index.js @@ -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 ], }, }; diff --git a/src/utils/dom/constants.js b/src/utils/dom/constants.js index b664a857..abb0a15f 100644 --- a/src/utils/dom/constants.js +++ b/src/utils/dom/constants.js @@ -36,6 +36,7 @@ export const REMOVE_ATTR_LIST = REMOVE_ATTRS.join(','); export const WHITELIST_ATTRS = [ 'src', 'srcset', + 'start', 'sizes', 'type', 'href',