From c38b7a2ae999331243ba35c8c688bc7201210f85 Mon Sep 17 00:00:00 2001 From: Alexei Bezborodov Date: Fri, 27 Oct 2023 23:15:16 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=B2=20=D0=BD=D0=B0=D1=87=D0=B0=D0=BB=D0=B5=20=D0=A0?= =?UTF-8?q?=D0=98=D0=90.=20=D0=A1=D1=81=D1=8B=D0=BB=D0=BA=D0=B8=20=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=B4=D1=80=D1=83=D0=B3=D0=B8=D0=B5=20=D0=B8=D1=81?= =?UTF-8?q?=D1=82=D0=BE=D1=87=D0=BD=D0=B8=D0=BA=D0=B8=20=D1=82=D0=B5=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D1=8C=20=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D1=8F?= =?UTF-8?q?=D1=8E=D1=82=D1=81=D1=8F.=20=D0=A1=D0=BF=D0=B8=D1=81=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=B2=20=D0=A0=D0=98=D0=90.=20#4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- news_parser.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/news_parser.js b/news_parser.js index 2d3bde3..37ddbd8 100644 --- a/news_parser.js +++ b/news_parser.js @@ -137,7 +137,7 @@ } function ElementCheckerRia(a_Element) { - if (a_Element.dataset.type == 'article' || a_Element.dataset.type == 'banner') { + if (a_Element.dataset.type == 'article' || a_Element.dataset.type == 'banner' || a_Element.dataset.type == 'media') { return false; } @@ -193,9 +193,9 @@ }); elements = clear_element.querySelectorAll('a'); - let re = new RegExp("(https?:\/\/.*)"); + //let re = new RegExp("(https?:\/\/.*)"); elements.forEach(function (element) { - if (!re.test(element.pathname)) { + if (element.host == location.hostname) { RemoveCurrentElementSaveChild(element, clear_element); } }); @@ -218,15 +218,6 @@ if (a_ClearTextFunc) { a_Content = a_ClearTextFunc(a_Content); } - if (a_Element && a_Element.dataset && a_Element.dataset.type == 'list') { - let childrens = FindElementsByRegExp(GetElementClassName, 'article__list-item', a_Element); - let content = ''; - for (let i = 0; i < childrens.length; i++) { - let c = childrens[i]; - content += '
  • ' + GrubTextFuncTemplate()(c) + '
  • '; - } - a_Content = ''; - } if (a_Element && CheckRegExp(GetElementClassName, 'PageContentCommonStyling_text.*', a_Element)) { let content = ''; let childrens = FindElementsByRegExp(GetNodeName, 'P', a_Element); @@ -285,6 +276,7 @@ ); } else if (location.hostname == 'ria.ru') { + // test: https://ria.ru/20231020/ssha-1904210900.html const base_element = document.getElementsByClassName('article__header')[0]; const base_element_text = document.getElementsByClassName('article__body')[0]; const tire = ['-', '–', '—', '‒', '―', '⸺', '⸻']; @@ -302,7 +294,7 @@ 'photoview__open', 'article__block', ElementCheckerRia, - clear_text + [''] ); } else if (location.hostname == 'rg.ru') {