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') {