This commit is contained in:
2026-05-15 09:12:28 -07:00
parent 55703bb7ed
commit 2e350ce3dc
18 changed files with 14733 additions and 18 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,918 @@
// ==UserScript==
// @name Bypass Paywalls Clean - es/pt/south america
// @version 4.3.5.2
// @description Bypass Paywalls of news sites
// @author magnolia1234
// @downloadURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=userscript/bpc.es.pt.user.js
// @updateURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=userscript/bpc.es.pt.user.js
// @homepageURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters
// @supportURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters
// @license MIT; https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=LICENSE
// @noframes
// @match *://*.es/*
// @match *://*.abcmais.com/*
// @match *://*.abril.com.br/*
// @match *://*.ara.cat/*
// @match *://*.arabalears.cat/*
// @match *://*.cartacapital.com.br/*
// @match *://*.clarin.com/*
// @match *://*.correiodopovo.com.br/*
// @match *://*.cronista.com/*
// @match *://*.crusoe.com.br/*
// @match *://*.diaridegirona.cat/*
// @match *://*.diariocordoba.com/*
// @match *://*.diariocorreo.pe/*
// @match *://*.diariovasco.com/*
// @match *://*.diplomatique.org.br/*
// @match *://*.dn.pt/*
// @match *://*.elcomercio.pe/*
// @match *://*.elconfidencial.com/*
// @match *://*.elcorreo.com/*
// @match *://*.elespanol.com/*
// @match *://*.elespectador.com/*
// @match *://*.elmercurio.com/*
// @match *://*.elobservador.com.uy/*
// @match *://*.elpais.com/*
// @match *://*.elperiodico.com/*
// @match *://*.elperiodicodearagon.com/*
// @match *://*.elperiodicoextremadura.com/*
// @match *://*.elperiodicomediterraneo.com/*
// @match *://*.eltiempo.com/*
// @match *://*.eltribuno.com/*
// @match *://*.eluniverso.com/*
// @match *://*.em.com.br/*
// @match *://*.emporda.info/*
// @match *://*.estadao.com.br/*
// @match *://*.exame.com/*
// @match *://*.expansion.com/*
// @match *://*.expresso.pt/*
// @match *://*.gauchazh.clicrbs.com.br/*
// @match *://*.gazetadopovo.com.br/*
// @match *://*.gestion.pe/*
// @match *://*.globo.com/*
// @match *://*.lanacion.com.ar/*
// @match *://*.lance.com.br/*
// @match *://*.larioja.com/*
// @match *://*.lasegunda.com/*
// @match *://*.latercera.com/*
// @match *://*.lavoz.com.ar/*
// @match *://*.levante-emv.com/*
// @match *://*.losandes.com.ar/*
// @match *://*.marca.com/*
// @match *://*.nsctotal.com.br/*
// @match *://*.observador.pt/*
// @match *://*.ole.com.ar/*
// @match *://*.politicaexterior.com/*
// @match *://*.regio7.cat/*
// @match *://*.revistaoeste.com/*
// @match *://*.sabado.pt/*
// @match *://*.semana.com/*
// @match *://*.uol.com.br/*
// @connect archive.fo
// @connect archive.is
// @connect archive.li
// @connect archive.md
// @connect archive.ph
// @connect archive.vn
// @grant GM.xmlHttpRequest
// @require https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=userscript/bpc_func.js
// ==/UserScript==
(function() {
//'use strict';
window.setTimeout(function () {
var ar_grupo_clarin_domains =['clarin.com', 'lavoz.com.ar', 'losandes.com.ar', 'ole.com.ar'];
var es_epiberica_domains = ['diariodemallorca.es', 'eldia.es', 'elperiodico.com', 'epe.es', 'farodevigo.es', 'informacion.es', 'laprovincia.es', 'levante-emv.com', 'lne.es', 'mallorcazeitung.es', 'superdeporte.es'];
var es_epiberica_custom_domains = ['diaridegirona.cat', 'diariocordoba.com', 'diariodeibiza.es', 'elcorreogallego.es', 'elcorreoweb.es', 'elperiodicodearagon.com', 'elperiodicoextremadura.com', 'elperiodicomediterraneo.com', 'emporda.info', 'laopinioncoruna.es', 'laopiniondemalaga.es', 'laopiniondemurcia.es', 'laopiniondezamora.es', 'regio7.cat'];
var es_grupo_vocento_domains = ['abc.es', 'canarias7.es', 'diariosur.es', 'diariovasco.com', 'elcomercio.es', 'elcorreo.com', 'eldiariomontanes.es', 'elnortedecastilla.es', 'hoy.es', 'ideal.es', 'larioja.com', 'lasprovincias.es', 'laverdad.es', 'lavozdigital.es'];
var es_unidad_domains = ['elmundo.es', 'expansion.com', 'marca.com'];
var pe_grupo_elcomercio_domains = ['diariocorreo.pe', 'elcomercio.pe', 'gestion.pe'];
if (window.location.hostname.match(/\.(es|pt|cat)$/) || matchDomain(['diariocordoba.com', 'diariovasco.com', 'elconfidencial.com', 'elcorreo.com', 'elespanol.com', 'elpais.com', 'elperiodico.com', 'elperiodicodearagon.com', 'elperiodicoextremadura.com', 'elperiodicomediterraneo.com', 'emporda.info', 'expansion.com', 'larioja.com', 'levante-emv.com', 'marca.com', 'politicaexterior.com'])) {//spain/portugal
if (matchDomain(['ara.cat', 'arabalears.cat'])) {
if (!window.location.pathname.endsWith('.amp.html')) {
amp_redirect('div.paywall');
let ads = 'div.advertising';
hideDOMStyle(ads);
}
}
else if (matchDomain('diariodenavarra.es')) {
let paywall = document.querySelector('div#paywall_message');
if (paywall) {
removeDOMElement(paywall);
let json_script = getArticleJsonScript();
if (json_script) {
let json = JSON.parse(json_script.text);
if (json) {
let json_text = json.articleBody;
let article = document.querySelector('div.free-html');
if (json_text && article)
article.innerText = parseHtmlEntities(json_text);
}
}
}
}
else if (matchDomain('dn.pt')) {
let paywall = document.querySelector('div#metered-paywall-banner');
if (paywall) {
removeDOMElement(paywall);
let article = document.querySelector('div.paywall');
if (article) {
let article_new = getArticleQuintype();
if (article_new && article.parentNode)
article.parentNode.replaceChild(article_new, article);
}
}
}
else if (matchDomain('elconfidencial.com')) {
let premium = document.querySelector('div.newsType__content--closed');
if (premium)
premium.classList.remove('newsType__content--closed');
let ads = 'div[id^="mega_"], div[id^="roba_"]';
hideDOMStyle(ads);
}
else if (matchDomain('eldiario.es')) {
if (window.location.pathname.endsWith('.amp.html')) {
amp_unhide_access_hide('^="access"', '="NOT access"');
} else {
amp_redirect('aside.paywall');
let ads = 'div.edi-advertising, div.header-ad, aside.news-sponsored-content, div.report__wrapper';
hideDOMStyle(ads);
}
}
else if (matchDomain('elespanol.com')) {
if (window.location.pathname.endsWith('.amp.html')) {
amp_unhide_subscr_section();
} else {
let paywall = document.querySelector('div.full-suscriptor-container');
if (paywall) {
removeDOMElement(paywall);
let content_hidden = document.querySelector('div.content-not-granted-paywall');
if (content_hidden)
content_hidden.classList.remove('content-not-granted-paywall');
}
let ads = '[id*="superior"], [class*="adv"]';
hideDOMStyle(ads);
}
}
else if (matchDomain(es_unidad_domains)) {
if (!window.location.hostname.startsWith('amp.')) {
let url = window.location.href;
if (!window.location.pathname.startsWith('/mejores-colegios')) {
amp_redirect('div[class^="ue-c-article__premium"]', '', url.replace('/www.', '/amp.'));
} else if (matchDomain('elmundo.es')) {
header_nofix('main p', 'div.ue-c-article__premium');
header_nofix('table', 'div.ue-c-paywall');
}
} else {
amp_unhide_access_hide('="authorized=true"', '="authorized!=true"');
amp_unhide_subscr_section('.advertising, .ue-c-ad');
}
}
else if (matchDomain('elpais.com')) {
if (window.location.pathname.endsWith('.amp.html') || window.location.search.match(/(\?|&)outputType=amp/)) {
amp_unhide_access_hide('="vip"], [amp-access="success"', '="NOT vip"], [amp-access="NOT success"', 'div._cf');
}
let ads = 'div.ad-giga, aside.outbrain';
hideDOMStyle(ads);
}
else if (matchDomain(es_grupo_vocento_domains)) {
let paywall_sel = 'div.voc-paywall, div.container-wall-exclusive__content-login, ev-engagement[group-name^="paywall-"]';
let paywall = document.querySelectorAll(paywall_sel);
if (!window.location.pathname.endsWith('_amp.html')) {
if (paywall.length) {
let span_break = document.querySelector('span.c-text');
removeDOMElement(...paywall, span_break);
let art_hidden = document.querySelectorAll('.paywall, div.wpb_column > span');
for (let elem of art_hidden) {
let attributes = [...elem.attributes];
for (let attrib of attributes)
elem.removeAttribute(attrib.name);
if (elem.tagName === 'DIV')
elem.className = 'paywall';
}
}
hideDOMStyle('figure.paywall2 img', 3);
let div_hidden = document.querySelectorAll('article div[hidden]');
for (let elem of div_hidden) {
elem.removeAttribute('hidden');
elem.style = 'display: block !important;';
}
if (window.location.pathname.match(/[-\/]directo-/) && !document.querySelector('div#firstPost'))
header_nofix('article h1');
let ads = '.voc-advertising, div.voc-ob-wrapper, div.voc-discounts, div.ev-em-modal, span.mega-superior, div.v-adv';
hideDOMStyle(ads, 2);
} else {
amp_unhide_access_hide('="result=\'ALLOW_ACCESS\'"', '="result!=\'ALLOW_ACCESS\'"', 'div.v-adv');
let body_top = document.querySelector('body#top');
if (body_top)
body_top.removeAttribute('id');
}
let banner = 'div.container-wall-exclusive';
hideDOMStyle(banner);
}
else if (matchDomain(es_epiberica_domains) || matchDomain(es_epiberica_custom_domains)) {
let paywall = document.querySelector('p.ft-helper-closenews');
if (paywall) {
paywall.classList.remove('ft-helper-closenews');
}
if (window.location.pathname.endsWith('.amp.html') || ['amp.elperiodico.com', 'amp.epe.es'].includes(window.location.hostname)) {
let amp_images = document.querySelectorAll('figure > amp-img[src]');
for (let amp_image of amp_images) {
let elem = document.createElement('img');
elem.src = amp_image.getAttribute('src');
elem.style = 'width: 75%; margin: 0px 50px;';
amp_image.parentNode.replaceChild(elem, amp_image);
}
document.querySelectorAll('div#the-most').forEach(e => e.removeAttribute('style'));
let ads = 'amp-next-page, span.ad-signature, div.wrap, .ft-ad';
hideDOMStyle(ads);
} else {
let ads = 'div.commercial-up-full__wrapper, .ft-ad, div[class^="_mo_recs"]';
hideDOMStyle(ads);
}
}
else if (matchDomain('expresso.pt')) {
if (!window.location.hostname.startsWith('amp.')) {
let article_sel = 'div.article-content';
let paywall = document.querySelector(article_sel + ' > div.g-premium-blocker');
if (paywall) {
removeDOMElement(paywall);
let article = document.querySelector(article_sel);
if (article) {
let url = window.location.href.split(/[#\?]/)[0];
fetch(url)
.then(response => {
if (response.ok) {
response.text().then(html => {
if (html.match(/window\.__INITIAL_DATA__\s?=\s?/)) {
try {
article.innerHTML = '';
let json = JSON.parse(html.split(/window\.__INITIAL_DATA__\s?=\s?/)[1].split(';window.')[0].replace(/":undefined([,}])/g, "\":\"undefined\"$1")).nodes;
let pars = [];
for (let elem in json) {
let item = json[elem];
if (item.type === 'Layout') {
for (let elem of item.nodes) {
if (elem.type === 'MainBody')
pars = elem.nodes[0].data.content.contents;
}
break;
}
}
let parser = new DOMParser();
for (let par of pars) {
let par_new;
if (par.html) {
let doc = parser.parseFromString('<div>' + par.html + '</div>', 'text/html');
par_new = doc.querySelector('div');
} else if (par.type === 'PICTURE') {
if (par.urlOriginal) {
par_new = makeFigure(par.urlOriginal, par.caption, {style: 'width:100%'});
}
} else if (par.link && par.title) {
if (par.contents) {
par_new = document.createElement('div');
for (let elem of par.contents) {
let elem_new;
if (elem.html) {
let doc = parser.parseFromString('<div>' + elem.html + '</div>', 'text/html');
elem_new = doc.querySelector('div');
} else if (elem.urlOriginal) {
elem_new = makeFigure(elem.urlOriginal, elem.caption, {style: 'width:100%'});
}
if (elem_new)
par_new.appendChild(elem_new);
}
} else {
par_new = document.createElement('p');
let art_link = document.createElement('a');
art_link.innerText = par.title;
art_link.href = par.link;
par_new.appendChild(art_link);
}
}
if (par_new)
article.appendChild(par_new);
else
console.log(par);
}
} catch (err) {
console.log(err);
}
}
});
}
}).catch(function (err) {
false;
});
}
}
} else
ampToHtml();
}
else if (matchDomain('infolibre.es')) {
if (window.location.pathname.endsWith('.amp.html')) {
amp_unhide_access_hide('^="access"', '="NOT access"');
} else {
amp_redirect('div.paywall__wrapper');
let ads = 'div.edi-advertising, div.header-ad';
hideDOMStyle(ads);
}
}
else if (matchDomain(['lavanguardia.com', 'mundodeportivo.com'])) {
let ads = 'span.content-ad, span.hidden-ad, span.ad-unit, div.ad-div';
hideDOMStyle(ads);
}
else if (matchDomain('observador.pt')) {
let ads = 'div.obs-ad-placeholder, obs-toaster-seats, obs-moa-btn-seats';
hideDOMStyle(ads);
}
else if (matchDomain('politicaexterior.com')) {
let paywall = document.querySelector('div[class^="paywall-"]');
if (paywall) {
let article = document.querySelector('div.entry-content-text');
let json = document.querySelector('script[type="application/ld+json"]:not([class])');
if (json) {
let json_text = JSON.parse(json.text).description.replace(/&amp;nbsp;/g, '');
let article_new = document.createElement('div');
article_new.setAttribute('class', 'entry-content-text');
article_new.innerText = '\r\n' + json_text;
article.parentNode.replaceChild(article_new, article);
}
removeDOMElement(paywall);
}
}
else if (matchDomain('publico.es')) {
let ads = 'div.pb-ads';
hideDOMStyle(ads);
}
else if (matchDomain('sabado.pt')) {
if (!window.location.pathname.includes('/amp/'))
amp_redirect('.bloqueio_exclusivos, .container_assinatura, .bloco_bloqueio', '', window.location.href.replace('/detalhe/', '/amp/'));
else
amp_unhide_access_hide('="subscriber"', '="NOT subscriber"', 'div.adbox, amp-consent, .detalheAds, .exclusivos_bar');
}
else if (window.location.hostname.endsWith('.es')) {// Sport Life Ibérica sites
if (document.querySelector('div > ul > li > a[href="https://www.sportlife.es/"]')) {
let paywall = document.querySelector('div.c-paywall');
if (paywall) {
let article = document.querySelector('div.c-mainarticle__body');
let json_script = getArticleJsonScript();
if (json_script) {
let json_text = JSON.parse(json_script.text).articleBody;
let article_new = document.createElement('div');
article_new.innerText = json_text;
article.parentNode.replaceChild(article_new, article);
}
removeDOMElement(paywall);
}
}
}
} else if (window.location.hostname.match(/\.(ar|br|cl|pe|uy)$/) || matchDomain(['abcmais.com', 'clarin.com', 'cronista.com', 'elespectador.com', 'elmercurio.com', 'eltiempo.com', 'eltribuno.com', 'eluniverso.com', 'exame.com', 'globo.com', 'lasegunda.com', 'latercera.com', 'revistaoeste.com', 'semana.com'])) {//south america
if (matchDomain('abcmais.com')) {
if (!window.location.pathname.endsWith('/amp/')) {
getJsonUrl('section#section-iframe-assinante', '', 'div.degressing-opacity');
} else {
let paywall = document.querySelector('div.b-vindo');
if (paywall) {
removeDOMElement(paywall);
let template = document.querySelector('template');
if (template) {
let article = document.querySelector('section > div.resumo');
if (article) {
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + template.innerHTML + '</div>', 'text/html');
let article_new = doc.querySelector('div');
article.parentNode.replaceChild(article_new, article);
}
}
}
}
}
else if (matchDomain('abril.com.br')) {
if (window.location.pathname.endsWith('/amp/')) {
let paywall = document.querySelector('.piano-modal');
removeDOMElement(paywall);
} else {
let ads = 'div.ads, div.ads-bilboards, div.MGID';
hideDOMStyle(ads);
}
}
else if (matchDomain(ar_grupo_clarin_domains)) {
let ads = 'div.ad-slot, div.box-adv, div.wrapperblock, div.banner, div[id^="div-gpt-ad-"], div.bannerTopHeader, div.sticky, div.SRA';
hideDOMStyle(ads);
}
else if (matchDomain('cartacapital.com.br')) {
if (!window.location.pathname.endsWith('/amp/')) {
let paywall = document.querySelector('aside.paywall');
if (paywall) {
removeDOMElement(paywall);
let json_script = getArticleJsonScript();
if (json_script) {
try {
let json = JSON.parse(json_script.text);
if (json) {
let json_text = json[1].articleBody.replace(/\s{2,}/g, '\r\n\r\n');
let content = document.querySelector('section.s-content__text');
if (json_text && content) {
content.innerHTML = '';
let article_new = document.createElement('p');
article_new.innerText = json_text;
content.appendChild(article_new);
}
}
} catch (err) {
console.log(err);
}
}
} else {
let content_soft = document.querySelector('div.contentSoft');
if (content_soft) {
content_soft.removeAttribute('class');
let freemium = document.querySelectorAll('div[class^="s-freemium"], div.maggazine-add');
removeDOMElement(...freemium);
}
}
let ads = 'div.div_ros_topo';
hideDOMStyle(ads);
} else
ampToHtml();
}
else if (matchDomain('cronista.com')) {
let paywall = document.querySelector('div.article-body--blurred');
if (paywall)
paywall.classList.remove('article-body--blurred');
let ads = 'div#ad-slot-header, div.ad-slot-intext, div#selectMediaNota, div.b-suscription-container, div.paywall-chain--show';
hideDOMStyle(ads);
}
else if (matchDomain('crusoe.com.br')) {
getJsonUrl('section.paywall', '', 'div#content_post', {art_append: 1});
let ads = 'div#gpt-leaderboard, div.ads_desktop, div[class^="container-banner-"], div.catchment-box';
hideDOMStyle(ads);
}
else if (matchDomain('diplomatique.org.br')) {
getJsonUrl('div.entry-content div.module_row', '', 'div.entry-content');
}
else if (matchDomain(pe_grupo_elcomercio_domains)) {
let paywall = document.querySelector('.paywall');
if (paywall) {
paywall.removeAttribute('class');
paywall.removeAttribute('style');
let fade = document.querySelector('p.story-contents--fade');
if (fade)
fade.classList.remove('story-contents--fade');
}
let ads = 'div[class^="content_gpt"]';
hideDOMStyle(ads);
}
else if (matchDomain('elespectador.com')) {
if (window.location.search.includes('outputType=amp')) {
amp_unhide_access_hide('="granted"', '="NOT granted"', '[class^="Widget"], amp-fx-flying-carpet, div[style*=";background:"]:has(amp-ad)', false);
let googledoc_iframes = document.querySelectorAll('div > amp-iframe[src^="https://docs.google.com/viewer"][class]');
for (let elem of googledoc_iframes) {
let a_link = document.createElement('a');
a_link.href = elem.getAttribute('src');
a_link.innerText = 'pdf-link';
a_link.target = '_blank';
elem.removeAttribute('class');
elem.parentNode.before(a_link);
}
} else {
amp_redirect('div.exclusive_validation');
let ads = 'div.Ads, div[class^="Ads_"]';
hideDOMStyle(ads);
}
}
else if (matchDomain('elmercurio.com')) {
if (window.location.hostname.startsWith('digital.')) {
window.setTimeout(function () {
let elem_hidden = document.querySelectorAll('[style="visibility:hidden"]');
for (let elem of elem_hidden)
elem.removeAttribute('style');
let page_pdf_content = document.querySelector('div.page_pdf_content');
let close_html = document.querySelector('div.close_html');
let cont_page_full = document.querySelector('div.cont_page_full');
removeDOMElement(page_pdf_content, close_html, cont_page_full);
}, 1000);
window.setTimeout(function () {
let cont_articlelight = document.querySelector('div.cont_articlelight');
if (cont_articlelight)
cont_articlelight.setAttribute('style', 'height: 100% !important; width: 90% !important');
}, 3000);
if (window.location.pathname.startsWith('/mobile')) {
let lessreadmore = document.querySelectorAll('article.lessreadmore');
for (let article of lessreadmore)
article.classList.remove('lessreadmore');
let bt_readmore = document.querySelectorAll('div[id*="bt_readmore_"]');
removeDOMElement(...bt_readmore);
}
} else if (window.location.pathname.endsWith('/Registro/Login.aspx')) {
header_nofix('body');
}
}
else if (matchDomain('elobservador.com.uy')) {
if (window.location.pathname.endsWith('/amp')) {
amp_unhide_access_hide('="observador.mostrarNota"');
let amp_images = document.querySelectorAll('div.fixed-container > amp-img.null');
for (let amp_image of amp_images) {
let elem = document.createElement('img');
Object.assign(elem, {
src: amp_image.getAttribute('src'),
alt: amp_image.getAttribute('alt'),
title: amp_image.getAttribute('title')
});
amp_image.parentNode.replaceChild(elem, amp_image);
}
} else {
amp_redirect('div.mensaje_member', '', window.location.pathname + '/amp');
}
}
else if (matchDomain('eltiempo.com')) {
let exclusivo = document.querySelector('div.c-articulo-exclusivo');
if (exclusivo)
exclusivo.classList.remove('c-articulo-exclusivo');
let modulos = document.querySelector('div.modulos');
if (modulos)
modulos.classList.remove('modulos');
let ads = '[class^="c-add"]';
hideDOMStyle(ads);
}
else if (matchDomain('eltribuno.com')) {
let ads = 'div.container-spot, div.anticipo-cont';
hideDOMStyle(ads);
}
else if (matchDomain('eluniverso.com')) {
let paywall = document.querySelectorAll('head > meta[name][content="premium"]');
let article = document.querySelector('section.article-body');
if (paywall.length && article) {
removeDOMElement(...paywall);
let fusion_script = document.querySelector('script#fusion-metadata');
if (fusion_script && fusion_script.text.includes('Fusion.globalContent=')) {
try {
let json = JSON.parse(fusion_script.text.split('Fusion.globalContent=')[1].split(';Fusion.')[0]);
if (json) {
article.innerHTML = '';
let parser = new DOMParser();
let pars = json.content_elements;
for (let par of pars) {
let par_new;
if (['header', 'text'].includes(par.type)) {
if (par.content) {
let doc = parser.parseFromString('<p class="prose-text">' + par.content + '</p>', 'text/html');
par_new = doc.querySelector('p');
}
} else if (par.type === 'interstitial_link') {
if (par.url && par.content) {
par_new = document.createElement('p');
int_link = document.createElement('a');
int_link.href = par.url;
int_link.innerText = par.content;
par_new.appendChild(int_link);
}
} else if (par.type === 'image') {
if (par.url) {
let caption_text = par.caption;
if (par.credits && par.credits.by && par.credits.by[0] && par.credits.by[0].name)
caption_text += ' - ' + par.credits.by[0].name;
par_new = makeFigure(par.url, caption_text);
}
} else if (par.type === 'raw_html') {
let doc = parser.parseFromString('<div>' + par.content + '</div>', 'text/html');
par_new = doc.querySelector('div');
} else if (par.raw_oembed) {
if (par.raw_oembed.html) {
let doc = parser.parseFromString('<div>' + par.raw_oembed.html + '</div>', 'text/html');
par_new = doc.querySelector('div');
}
} else if (par.type === 'list') {
if (par.items) {
par_new = document.createElement('ul');
for (let item of par.items) {
let li = document.createElement('li');
let doc = parser.parseFromString('<span>' + item.content + '</span>', 'text/html');
let span = doc.querySelector('span');
li.appendChild(span);
par_new.appendChild(li);
}
}
} else if (par.type === 'table') {
if (par.header && par.rows) {
par_new = document.createElement('table');
let h_row = document.createElement('tr');
for (let item of par.header) {
let th = document.createElement('th');
let doc = parser.parseFromString('<span>' + item.content + '</span>', 'text/html');
let span = doc.querySelector('span');
th.appendChild(span);
h_row.appendChild(th);
}
par_new.appendChild(h_row);
for (let row of par.rows) {
let tr = document.createElement('tr');
for (let item of row) {
let td = document.createElement('td');
let doc = parser.parseFromString('<span>' + item.content + '</span>', 'text/html');
let span = doc.querySelector('span');
td.appendChild(span);
tr.appendChild(td);
}
par_new.appendChild(tr);
}
}
} else if (!['quote'].includes(par.type)) {
console.log(par);
}
if (par_new)
article.appendChild(par_new);
}
}
} catch (err) {
console.log(err);
}
}
let banner = pageContains('div > span', /Contenido exclusivo para suscriptores/);
if (banner.length)
removeDOMElement(banner[0].parentNode);
}
let ads = 'div[id^="ad-"]';
hideDOMStyle(ads);
}
else if (matchDomain('em.com.br')) {
if (!window.location.pathname.endsWith('/amp.html')) {
amp_redirect('.news-blocked-content');
let ads = 'div.ads, div.containerads, div.edm-banner, div.publicidade-interna-container';
hideDOMStyle(ads);
} else {
amp_unhide_subscr_section('amp-fx-flying-carpet');
let compress_text = document.querySelector('div.compress-text');
if (compress_text)
compress_text.classList.remove('compress-text');
}
}
else if (matchDomain('estadao.com.br')) {
if (window.location.pathname.match(/(\.amp$|^\/amp\/)/) || window.location.search.startsWith('?amp')) {
amp_unhide_access_hide('="outputValue=\'hide_paywall\'"', '="outputValue=\'show_paywall\'"', 'amp-fx-flying-carpet, div[class^="pAd"], div.ads-container');
} else {
let paywall = document.getElementById('paywall-wrapper-iframe-estadao');
removeDOMElement(paywall);
let ads = 'div[class^="styles__Container-sc-"]';
hideDOMStyle(ads);
}
}
else if (matchDomain('exame.com')) {
let hidden_images = document.querySelectorAll('img[src^="data:image/"');
for (let elem of hidden_images) {
let noscript = elem.parentNode.querySelector('noscript');
if (noscript && noscript.innerText.includes('src="'))
elem.src = noscript.innerText.split('src="')[1].split('"')[0];
}
let ads = 'div[class*="ad-pos-"]';
hideDOMStyle(ads);
}
else if (matchDomain('uol.com.br')) {
if (matchDomain('piaui.uol.com.br')) {
let audio_cont = document.querySelector('div.audio-player-container:has(audio[src])');
if (audio_cont) {
let audio = audio_cont.querySelector('audio[src]');
if (audio) {
let audio_new = document.createElement('audio');
audio_new.src = audio.src;
audio_new.setAttribute('controls', '');
audio_cont.parentNode.replaceChild(audio_new, audio_cont);
}
}
let ads = 'div[class^="piaui-interna-"], div.main__advert';
hideDOMStyle(ads, 2);
} else if (matchDomain('folha.uol.com.br')) {
if (window.location.pathname.startsWith('/amp/')) {
amp_unhide_subscr_section('amp-sticky-ad');
} else {
let signup = document.querySelector('.c-top-signup');
removeDOMElement(signup);
}
}
let ads = 'div[class*="advertising"], div.jupiter-ads, div.up-floating, div[data-cp-id$="asfads"], div.ms-hapb, div.ms-apb, div.cardAd';
hideDOMStyle(ads);
}
else if (matchDomain('gauchazh.clicrbs.com.br')) {
let div_hidden = document.querySelector('div.m-paid-content > div.hidden');
if (div_hidden)
div_hidden.removeAttribute('class');
let ads = 'div.ad-banner, div.animate-pulse, div.overflow-hidden:has(div.bg-ad-placeholder), section.ads-section-area';
hideDOMStyle(ads);
let ads_rem = document.querySelectorAll('div[class^="superbaner"]');
removeDOMElement(...ads_rem);
}
else if (matchDomain('gazetadopovo.com.br')) {
if (window.location.pathname.endsWith('/amp/')) {
amp_unhide_subscr_section('div.ads-amp, div.tpl-wrapper', false);
} else {
let ads = 'div[class*="c-ads"]';
hideDOMStyle(ads);
}
}
else if (matchDomain('globo.com')) {
if (matchDomain('valor.globo.com')) {
if (!window.location.pathname.startsWith('/google/amp/')) {
amp_redirect('div.paywall');
} else {
amp_unhide_subscr_section();
amp_images_replace();
}
} else if (window.location.pathname.includes('/amp/'))
ampToHtml();
if (!window.location.pathname.includes('/amp/')) {
let ads = 'div[id^="ad-container"], div.content-ads, div[class^="block__advertising"], div#pub-in-text-wrapper, div.area_publicidade_container';
hideDOMStyle(ads);
}
}
else if (matchDomain('lanacion.com.ar')) {
setCookie(/^metering_arc/, '', 'lanacion.com.ar', '/', 0);
if (matchDomain('suscripciones.lanacion.com.ar')) {
let searchParams = new URLSearchParams(window.location.search);
if (searchParams.get('callback')) {
let article_sel = 'main.paywall-container';
let url = atob(searchParams.get('callback')).split('?')[0];
getArchive(url, article_sel + '> button', '', article_sel, '', 'div#fusion-app', 'div#wall');
}
}
let ads = 'div.ln-banner-container';
hideDOMStyle(ads);
}
else if (matchDomain('lance.com.br')) {
let paywall = document.querySelector('div.paywall-content[class*="h-\["]');
if (paywall)
removeClassesByPrefix(paywall, 'h-\[');
let banners = 'div[class*="backdrop-blur-"], div.shadow-sticky, div[style*="repeating-linear-gradient"], span.mx-2, span.h-px';
hideDOMStyle(banners);
}
else if (matchDomain('lasegunda.com')) {
if (window.location.pathname.endsWith('/Registro/Login.aspx') && window.location.search.startsWith('?urlBack=')) {
let intro = document.querySelector('body > div > article');
if (intro) {
intro.parentNode.removeAttribute('style');
intro.parentNode.parentNode.style = 'margin: 20px;';
let mh_new = document.createElement('div');
mh_new.style = 'font-size: 20px; font-weight: bold; text-align: center; margin: 20px;';
let main = document.createElement('a');
main.href = 'https://www.lasegunda.com';
main.innerText = 'la Segunda';
mh_new.appendChild(main);
intro.before(mh_new);
let page = document.querySelector('div#page');
if (page) {
let article_id_match = window.location.search.split('?urlBack=')[1].match(/\/(\d{6,})\//);
if (article_id_match) {
let article_id = article_id_match[1];
let url_src = 'https://newsapi.ecn.cl/NewsApi/lasegunda/noticia/' + article_id;
fetch(url_src)
.then(response => {
if (response.ok) {
response.json().then(json => {
try {
if (json._source) {
let art_source = json._source;
let author = document.createElement('span');
author.innerText = art_source.autor + (art_source.fechaPublicacion ? '\r\n' + art_source.fechaPublicacion.replace('T', ' ').replace(/:00$/, '') : '');
page.appendChild(author);
if (art_source.tablas && art_source.tablas.tablaMedios && art_source.tablas.tablaMedios[0]) {
let figure = makeFigure(art_source.tablas.tablaMedios[0].Url);
figure.style = 'margin: 15px;';
intro.firstChild.before(figure);
}
function make_fig(p1, p2 = '') {
let result = '<figure style="margin: 15px 0px"><img src="' + p1 + '"><figcaption>' + (p2 ? p2.replace(/^;\s?/, '') : '') + '</figcaption></figure>';
return result;
}
function make_imagen(match, p1, offset, string) {
return make_fig(p1);
}
function make_imagen_credito(match, p1, p2, offset, string) {
return make_fig(p1, p2);
}
function make_video(match, p1, offset, string) {
return '<video controls src="' + p1 + '" style="width: 100%; margin: 15px 0px;">';
}
function make_cifra(match, p1, p2, offset, string) {
return p1 + p2.replace(/^;\s?/, ' ');
}
let art_text = art_source.texto.replace(/&nbsp;/g, ' ').replace(/{IMAGEN?\s([^}]+)}/g, make_imagen);
art_text = art_text.replace(/{IMAGENCREDITO\s([^;]+)(;\s?[^}]+)}/g, make_imagen_credito);
art_text = art_text.replace(/{VIDEO?\s([^}]+)}/g, make_video);
art_text = art_text.replace(/{CIFRA\s([^;]+)(;\s?[^}]+)}/g, make_cifra);
art_text = art_text.replace(/{CITA[^}]+}/g, '').replace(/{DESTACAR\s/g, '').replace(/}/g, '');
if (!art_text.includes('{'))
art_text = art_text.replace(/}/g, '');
else
console.log('source still has macros');
let parser = new DOMParser();
let doc = parser.parseFromString('<div style="margin: 20px 0px;">' + art_text + '<br></div>', 'text/html');
let article_new = doc.querySelector('div');
page.append(article_new, document.createElement('br'));
}
} catch (err) {
console.log(err);
}
});
}
})
}
}
}
}
}
else if (matchDomain('latercera.com')) {
let ads = 'div.ads-block';
hideDOMStyle(ads);
}
else if (matchDomain('nsctotal.com.br')) {
let ads = 'div.ad, div[id^="floater"]';
hideDOMStyle(ads);
}
else if (matchDomain('revistaoeste.com')) {
if (window.location.pathname.startsWith('/revista/')) {
let loading_content = document.querySelector('div.loading_content');
if (loading_content)
loading_content.removeAttribute('class');
let spinner = document.querySelector('svg.spinner-eclipse');
removeDOMElement(spinner);
let lazy_images = document.querySelectorAll('img[src^="data:image/"][data-src]');
for (let elem of lazy_images)
elem.src = elem.getAttribute('data-src');
} else {
let div_expandable = document.querySelector('div.expandable');
if (div_expandable)
div_expandable.classList.remove('expandable');
let ads = 'section.ad-wrapper, div.autozep-outer';
hideDOMStyle(ads);
}
}
else if (matchDomain('semana.com')) {
if (!window.location.pathname.startsWith('/amp/'))
amp_redirect('div.paywall > div:not(.article-body)');
let ads = 'div.ads-cls, amp-fx-flying-carpet';
hideDOMStyle(ads);
}
}
ads_hide();
leaky_paywall_unhide();
}, 1000);
// General Functions
// import (see @require)
})();

View File

@@ -0,0 +1,185 @@
// ==UserScript==
// @name Bypass Paywalls Clean - fi/se
// @version 4.1.8.2
// @description Bypass Paywalls of news sites
// @author magnolia1234
// @downloadURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=userscript/bpc.fi.se.user.js
// @updateURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=userscript/bpc.fi.se.user.js
// @homepageURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters
// @supportURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters
// @license MIT; https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=LICENSE
// @noframes
// @match *://*.berlingske.dk/*
// @match *://*.dn.se/*
// @match *://*.etc.se/*
// @match *://*.suomensotilas.fi/*
// @match *://*.weekendavisen.dk/*
// @connect archive.fo
// @connect archive.is
// @connect archive.li
// @connect archive.md
// @connect archive.ph
// @connect archive.vn
// @grant GM.xmlHttpRequest
// @require https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=userscript/bpc_func.js
// ==/UserScript==
(function() {
//'use strict';
window.setTimeout(function () {
if (window.location.hostname.endsWith('.dk')) {
if (matchDomain(['berlingske.dk', 'weekendavisen.dk'])) {
let paywall = document.querySelector('div#paywall');
if (paywall) {
removeDOMElement(paywall);
let article = document.querySelector('div[itemprop="articleBody"');
if (article) {
let intro = article.querySelector('p');
let intro_class = intro ? intro.className : '';
let json_script = document.querySelector('script#__NEXT_DATA__');
if (json_script) {
try {
let json = JSON.parse(json_script.text);
if (json && json.props.pageProps.article.body) {
function getChildValue(child) {
let value;
if (child.children && child.children[0]) {
if (child.children[0].value)
value = child.children[0].value;
else if (child.children[0].children)
value = child.children[0].children[0].value;
}
return value;
}
article.innerHTML = '';
let parser = new DOMParser();
let pars = json.props.pageProps.article.body;
for (let par of pars) {
let elem = document.createElement('p');
if (['ParagraphNode', 'HeadingNode'].includes(par.type)) {
elem.className = intro_class;
if (par.children) {
for (let child of par.children) {
let sub_elem;
if (child.type === 'TextNode') {
sub_elem = document.createElement('span');
sub_elem.innerText = child.value;
if (par.type === 'HeadingNode')
sub_elem.style = 'font-weight: bold;';
} else if (child.type === 'HyperlinkNode') {
let value = getChildValue(child);
if (child.url && value) {
sub_elem = document.createElement('a');
sub_elem.href = child.url;
sub_elem.innerText = value;
} else
console.log(child)
} else if (child.type === 'LineBreakNode') {
let sub_elem = document.createElement('br');
} else
console.log(child);
if (sub_elem)
elem.appendChild(sub_elem);
}
}
} else if (par.type === 'FigureNode') {
if (par.asset && par.asset.image && par.asset.image.assets) {
let asset = par.asset.image.assets.pop();
if (asset && asset.url) {
let caption;
if (par.caption && par.caption[0]) {
caption = getChildValue(par.caption[0]);
if (par.byline && par.byline[0])
caption += ' ' + getChildValue(par.byline[0]);
}
let sub_elem = makeFigure(asset.url, caption, {style: 'width: 95%;'});
elem.appendChild(sub_elem);
}
}
} else if (par.type === 'ListNode') {
let sub_elem = document.createElement('ul');
if (par.children) {
for (let child of par.children) {
let value = getChildValue(child);
if (value) {
let li = document.createElement('li');
li.innerText = value;
sub_elem.appendChild(li);
}
}
elem.appendChild(sub_elem);
}
} else if (par.type === 'LineBreakNode') {
let sub_elem = document.createElement('br');
elem.appendChild(sub_elem);
} else if (par.type === 'CustomCodeNode') {
elem = document.createElement('div');
if (par.code && !par.code.includes('newsletterSignupWidget')) {
let doc = parser.parseFromString('<div>' + par.code + '</div>', 'text/html');
let sub_elem = doc.querySelector('div');
elem.appendChild(sub_elem);
}
} else
console.log(par);
if (elem.hasChildNodes())
article.appendChild(elem);
}
}
} catch (err) {
console.log(err);
}
}
}
}
let ads = 'div[data-ad-banner]';
hideDOMStyle(ads);
}
} else if (window.location.hostname.endsWith('.se')) {
if (matchDomain('dn.se')) {
let url = window.location.href;
getArchive(url, 'div.paywall-wrapper', '', 'article');
let ads = 'div.bad';
hideDOMStyle(ads);
}
else if (matchDomain('etc.se')) {
let paywall = document.querySelector('section.prose-feature > section.teaser-section');
if (paywall) {
paywall.classList.remove('teaser-section');
paywall.parentNode.querySelectorAll('.hidden').forEach(e => e.classList.remove('hidden'));
}
let ads = 'div[class$="-ad"], article section.font-sans';
hideDOMStyle(ads);
let video_iframes = document.querySelectorAll('div.embed-block > iframe[width][height]');
for (let elem of video_iframes) {
if (elem.width > 1000) {
let ratio = elem.width / (mobile ? 320 : 640);
elem.width = elem.width / ratio;
elem.height = elem.height / ratio;
}
}
}
}
else if (matchDomain('suomensotilas.fi')) {
let obscured = document.querySelector('div.epfl-pw-obscured');
if (obscured)
obscured.classList.remove('epfl-pw-obscured');
}
ads_hide();
leaky_paywall_unhide();
}, 1000);
// General Functions
// import (see @require)
})();

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,382 @@
// ==UserScript==
// @name Bypass Paywalls Clean - it
// @version 4.3.6.0
// @description Bypass Paywalls of news sites
// @author magnolia1234
// @downloadURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=userscript/bpc.it.user.js
// @updateURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=userscript/bpc.it.user.js
// @homepageURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters
// @supportURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters
// @license MIT; https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=LICENSE
// @noframes
// @match *://*.it/*
// @match *://*.eastwest.eu/*
// @match *://*.ilsole24ore.com/*
// @match *://*.italian.tech/*
// @match *://*.quotidiano.net/*
// @match *://*.tuttosport.com/*
// @grant GM.xmlHttpRequest
// @require https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=userscript/bpc_func.js
// ==/UserScript==
(function() {
//'use strict';
window.setTimeout(function () {
var it_gedi_domains = ['huffingtonpost.it', 'italian.tech', 'lastampa.it', 'lescienze.it', 'moda.it', 'repubblica.it'];
var it_ilmessaggero_domains = ['corriereadriatico.it', 'ilgazzettino.it', 'ilmattino.it', 'ilmessaggero.it', 'quotidianodipuglia.it'];
var it_quotidiano_domains = ['ilgiorno.it', 'ilrestodelcarlino.it', 'iltelegrafolivorno.it', 'lanazione.it', 'quotidiano.net'];
if (matchDomain('corriere.it')) {
if (window.location.pathname.endsWith('_amp.shtml')) {
amp_unhide_subscr_section('iframe[src^="https://ads."]');
} else {
if (window.location.pathname.includes('_preview.shtml') && !window.location.pathname.startsWith('/podcast/')) {
window.setTimeout(function () {
window.location.href = window.location.pathname.replace('_preview.shtml', '.shtml');
}, 500);
}
}
let ads = 'div.bck-adv, div.boxADVmanuale';
hideDOMStyle(ads);
}
else if (matchDomain('corrieredellosport.it')) {
if (!window.location.pathname.startsWith('/amp/')) {
amp_redirect('div[class^="MainTextTruncated_paragraph__"]');
let ads = 'div[class^="AdUnit_placeholder"]';
hideDOMStyle(ads);
}
}
else if (matchDomain('eastwest.eu')) {
let paywall = document.querySelector('.paywall');
if (paywall) {
paywall.removeAttribute('style');
paywall.classList.remove('paywall');
let intro = document.querySelectorAll('div#testo_articolo > p, div#testo_articolo > h3');
let offerta = document.querySelectorAll('div.offerta_abbonamenti');
removeDOMElement(...intro, ...offerta);
}
}
else if (matchDomain('editorialedomani.it')) {
let paywall = document.querySelector('div.paywallbox');
if (paywall) {
removeDOMElement(paywall);
let article = document.querySelector('div.article-preview');
if (article) {
article.classList.remove('article-faded');
let json_script = getArticleJsonScript();
if (json_script) {
let json = JSON.parse(json_script.text);
if (json) {
let json_text = json.articleBody;
let par = article.querySelector('p');
if (par)
par.innerText = json_text;
}
}
}
}
}
else if (matchDomain('gazzetta.it')) {
if (window.location.pathname.endsWith('_preview.shtml')) {
let paywall = document.querySelector('section.bck-freemium__wall');
if (paywall) {
removeDOMElement(paywall);
if (!window.location.search.startsWith('?reason=unauthenticated')) {
window.location.href = window.location.pathname.replace('_preview', '') + '?gaa_at=g';
} else {
let json_script = getArticleJsonScript();
let header = 'div.content > h2';
if (json_script) {
let json = JSON.parse(json_script.text);
if (json) {
let json_text = json.articleBody.replace(/(\s{3}|&nbsp;)/g, '\r\n\r\n');
let content = document.querySelector('div.content > p.has-first-letter');
if (json_text && content) {
let content_new = document.createElement('p');
content_new.innerText = json_text;
content.parentNode.replaceChild(content_new, content);
let article_body = document.querySelector('section.body-article');
if (article_body)
article_body.style = 'height: auto;';
} else
header_nofix(header);
}
} else
header_nofix(header);
}
}
} else if (window.location.pathname.endsWith('_amp.shtml'))
ampToHtml();
}
else if (matchDomain('ilfattoquotidiano.it')) {
if (window.location.pathname.endsWith('/amp/')) {
amp_unhide_subscr_section('div#_4sVideoContainer, div#post-consent-ui');
let logo = document.querySelector('a > amp-img[src$="/svg/logo-tablet.svg"]');
if (logo) {
let logo_new = document.createElement('img');
logo_new.src = logo.getAttribute('src').replace('/svg/logo-tablet.svg', '/fq-www/logo-ifq-it.svg');
logo_new.height = logo.getAttribute('height');
logo_new.width = logo.getAttribute('width');
logo.parentNode.replaceChild(logo_new, logo);
}
} else {
let paywall = document.querySelector('div#ifq-paywall-metered');
if (paywall) {
removeDOMElement(paywall);
let art_hidden = document.querySelector('article[id].cropped');
if (art_hidden)
art_hidden.classList.remove('cropped');
} else
header_nofix('div.ifq-post__content, div.article-content', 'div#ifq-paywall-hard, section.fqml-paywall');
}
let ads = 'div.adv, div.st-adunit, div[id^="ifq-adv-"], div.mgbox';
hideDOMStyle(ads);
let ad_units = document.querySelectorAll('div[id^="div-flx-"] > div[data-adunit]');
for (let elem of ad_units)
hideDOMElement(elem.parentNode);
}
else if (matchDomain('ilfoglio.it')) {
let paywall = document.querySelector('div.paywall');
if (paywall) {
removeDOMElement(paywall);
let div_hidden = document.querySelector('div.paywall-wrapper__story-content');
if (div_hidden)
div_hidden.removeAttribute('class');
}
let ads = '.advertisement';
hideDOMStyle(ads);
}
else if (matchDomain('ilmanifesto.it')) {
let paywall = document.querySelector('div[class*="before:bg-gradient-to-t"]');
if (paywall) {
removeDOMElement(paywall);
let url = window.location.href;
replaceDomElementExt(url, false, false, 'article div.prose');
}
}
else if (matchDomain('ilsole24ore.com')) {
header_nofix('div.paywalltext', 'div.lock');
waitDOMAttribute('body', 'BODY', 'style', node => node.removeAttribute('style'), true);
let ads = 'div.background-adv, div.abox, div.ob-smartfeed-wrapper, div.s24_adb';
hideDOMStyle(ads);
}
else if (domain = matchDomain(['iltirreno.it', 'lanuovasardegna.it']) || matchDomain(['gazzettadimodena.it', 'gazzettadireggio.it', 'lanuovaferrara.it'])) {
if (window.location.pathname.includes('/news/')) {
let paywall = document.querySelector('span > img[alt*="Paywall"]');
if (paywall) {
let header = paywall.parentNode.parentNode;
header_nofix(header);
removeDOMElement(paywall.parentNode);
}
window.setTimeout(function () {
let banners = document.querySelectorAll('div.MuiSnackbar-root, div.css-16cchgy');
removeDOMElement(...banners);
}, 1000);
}
setCookie(/__mtr$/, '', domain, '/', 0);
}
else if (matchDomain(it_ilmessaggero_domains)) {
if (window.location.pathname.toLowerCase().includes('/amp/')) {
amp_unhide_subscr_section();
} else {
let noscroll = document.querySelector('html[style]');
if (noscroll)
noscroll.removeAttribute('style');
let ads = 'div.adv_banner, div.inread_adv, div#outbrain';
hideDOMStyle(ads);
}
}
else if (matchDomain(it_quotidiano_domains)) {
if (window.location.pathname.endsWith('/amp') || window.location.search.startsWith('?amp')) {
amp_unhide_access_hide('="c.customGranted"', '="NOT c.customGranted"', 'amp-fx-flying-carpet, .watermark-adv, .amp__watermark');
} else {
amp_redirect('div[data-testid="paywall-container"], div[class^="Paywall_paywall_"]', '', window.location.pathname + '/amp');
let ads = 'div[id^="div-gpt-ad"]';
hideDOMStyle(ads);
}
}
else if (matchDomain('italiaoggi.it')) {
let paywall = document.querySelector('div.boxAbb');
if (paywall) {
let overlay = document.querySelector('div.article-locked-overlay');
removeDOMElement(paywall, overlay);
let article_locked = document.querySelector('div.article-locked');
if (article_locked) {
article_locked.classList.remove('article-locked');
let json_script = getArticleJsonScript();
if (json_script) {
let json = JSON.parse(json_script.text);
if (json) {
let json_text = json.articleBody;
let content = article_locked.querySelector('section');
if (json_text && content) {
let parser = new DOMParser();
json_text = json_text.replace(/&amp;apos;/g, "'").replace(/;/g, '');
let doc = parser.parseFromString('<div><section>' + json_text + '</section></div>', 'text/html');
let content_new = doc.querySelector('div');
content.parentNode.replaceChild(content_new, content);
}
}
}
}
}
}
else if (domain = matchDomain(it_gedi_domains)) {
let amp = window.location.pathname.match(/\/amp(\/)?$/);
if (matchDomain(['huffingtonpost.it', 'lastampa.it'])) {
if (window.location.pathname.includes('/news/')) {
if (!amp) {
let paywall = document.querySelector('iframe[id^="__limio_frame"]');
if (paywall) {
setCookie(/blaize_session/, '', domain, '/', 0);
removeDOMElement(paywall);
refreshCurrentTab(false);
}
let modal = document.querySelector('aside#widgetDP');
removeDOMElement(modal);
} else
ampToHtml();
}
} else if (matchDomain('repubblica.it')) {
if (!amp)
amp_redirect('iframe[id^="__limio_frame"]', '', window.location.pathname + 'amp/');
else {
amp_unhide_subscr_section();
if (!mobile)
addStyle('img.i-amphtml-fill-content {min-height: 50% !important; min-width: 50% !important;}');
let paywall = document.querySelector('div.not_granted__content');
if (paywall) {
removeDOMElement(paywall);
let article = document.querySelector('div.story__wrapper');
if (article) {
let url = window.location.href.split(/[#\?]/)[0].replace(/\/amp\/$/, '');
article.before(googleSearchToolLink(url));
}
}
}
} else {
if (!amp) {
let paywall = document.querySelector('div#ph-paywall');
removeDOMElement(paywall);
setCookie(/blaize_session/, '', domain, '/', 0);
} else
ampToHtml();
}
let ads = 'div[id^="adv"]';
hideDOMStyle(ads);
}
else if (matchDomain('milanofinanza.it')) {
let paywall = document.querySelector('div.paywall-content, section.payment');
if (paywall) {
removeDOMElement(paywall);
let json_script = getArticleJsonScript();
if (json_script) {
try {
let json = JSON.parse(json_script.text.replace(/!=/g, '').replace(/!function\(\){[^!]+(\(\);|0;[a-z])/g, ''));
if (json) {
let json_text = parseHtmlEntities(json.articleBody);
let article = document.querySelector('div.article-locked');
if (json_text && article) {
article.innerHTML = '';
let article_new = document.createElement('p');
article_new.innerText = json_text;
article.appendChild(article_new);
}
}
} catch (err) {
console.log(err);
header_nofix('div.article-locked', '', 'BPC > no fix (json-error)');
}
}
}
}
else if (matchDomain('nationalgeographic.it')) {
document.querySelectorAll('section[style]').forEach(e => e.removeAttribute('style'));
hideDOMStyle('section.paywall-container');
}
else if (matchDomain('sky.it')) {
let paywall = document.querySelector('div.c-paywall');
if (paywall && window.location.hostname.match(/^(sport|tg24)\./)) {
removeDOMElement(paywall);
let article = document.querySelector('div > div.c-article-abstract');
let json_script = getArticleJsonScript();
if (article && json_script) {
try {
let json = JSON.parse(json_script.text);
if (json) {
let json_text = json[0].articleBody;
if (json_text) {
let par_new = document.createElement('p');
par_new.innerText = json_text;
article.parentNode.appendChild(par_new);
}
}
} catch (err) {
console.log(err);
}
}
}
let ads = 'div.c-adv';
hideDOMStyle(ads);
}
else if (matchDomain('tuttosport.com')) {
if (!window.location.pathname.startsWith('/amp/')) {
let paywall = document.querySelector('div[class^="MainTextTruncated_premium"]');
if (paywall) {
removeDOMElement(paywall);
let article = document.querySelector('div > div[class^="MainTextTruncated_truncatedContent"]');
if (article) {
let json_script = document.querySelector('script#__NEXT_DATA__');
if (json_script) {
try {
let json = JSON.parse(json_script.text);
if (json && json.props.pageProps.news && json.props.pageProps.news.content) {
let url_next = json.props.pageProps.news.href;
if (url_next && !window.location.pathname.includes(url_next))
window.location.href = window.location.pathname;
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + json.props.pageProps.news.content + '</div>', 'text/html');
let article_new = doc.querySelector('div');
article.parentNode.replaceChild(article_new, article);
} else
refreshCurrentTab();
} catch (err) {
console.log(err);
}
}
}
}
let ads = 'div[class^="AdUnit_"]';
hideDOMStyle(ads);
}
}
ads_hide();
leaky_paywall_unhide();
}, 1000);
// General Functions
// import (see @require)
})();

View File

@@ -0,0 +1,924 @@
// ==UserScript==
// @name Bypass Paywalls Clean - nl/be
// @version 4.3.6.2
// @description Bypass Paywalls of news sites
// @author magnolia1234
// @downloadURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=userscript/bpc.nl.user.js
// @updateURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=userscript/bpc.nl.user.js
// @homepageURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters
// @supportURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters
// @license MIT; https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=LICENSE
// @noframes
// @match *://*.nl/*
// @match *://*.businessam.be/*
// @match *://*.demorgen.be/*
// @match *://*.doorbraak.be/*
// @match *://*.gva.be/*
// @match *://*.hbvl.be/*
// @match *://*.hln.be/*
// @match *://*.humo.be/*
// @match *://*.nieuwsblad.be/*
// @match *://*.projectcargojournal.com/*
// @match *://*.railfreight.cn/*
// @match *://*.railfreight.com/*
// @match *://*.railtech.be/*
// @match *://*.railtech.com/*
// @match *://*.standaard.be/*
// @match *://*.taxipro.be/*
// @match *://*.tijd.be/*
// @connect archive.fo
// @connect archive.is
// @connect archive.li
// @connect archive.md
// @connect archive.ph
// @connect archive.vn
// @connect mediafin.be
// @grant GM.xmlHttpRequest
// @require https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=userscript/bpc_func.js
// ==/UserScript==
(function() {
//'use strict';
window.setTimeout(function () {
var be_mediahuis_domains = ['gva.be', 'hbvl.be', 'nieuwsblad.be', 'standaard.be'];
var nl_dpg_adr_domains = ['ad.nl', 'bd.nl', 'bndestem.nl', 'destentor.nl', 'ed.nl', 'gelderlander.nl', 'pzc.nl', 'tubantia.nl'];
var nl_dpg_media_domains = ['demorgen.be', 'flair.nl', 'humo.be', 'libelle.nl', 'margriet.nl', 'parool.nl', 'trouw.nl', 'volkskrant.nl'];
var nl_mediahuis_region_domains = ['gooieneemlander.nl', 'haarlemsdagblad.nl', 'ijmuidercourant.nl', 'leidschdagblad.nl', 'limburger.nl', 'noordhollandsdagblad.nl'];
if (matchDomain('adformatie.nl')) {
document.querySelectorAll('iframe[uc-src]').forEach(e => e.src = e.getAttribute('uc-src'));
let ads = 'div.c-ad-slot';
hideDOMStyle(ads);
}
else if (matchDomain(be_mediahuis_domains)) {
window.setTimeout(function () {
let video = document.querySelector('div.video, div[data-testid="article-video"]');
func_post = function () {
let article = document.querySelector(article_sel);
if (article) {
if (video) {
if (matchDomain(['gva.be', 'nieuwsblad.be'])) {
let placeholder = video.querySelector('div[class^="Placeholder_placeholder"]');
if (placeholder)
placeholder.removeAttribute('class');
}
let video_new = article.querySelector('div[id$="-streamone"], div[id^="video-player-"], div[id^="player_"]');
if (video_new && video_new.parentNode)
video_new.parentNode.replaceChild(video, video_new);
else {
let header = article.querySelector('h1');
let br = document.createElement('br');
if (header)
header.after(br, video, br);
}
}
let gallery, img_width, captions, next, next_images, next_img_width;
let gallery_new = document.createElement('div');
let figure_nr = 0;
let gallery_figures = document.querySelectorAll('div > ul > li > figure');
for (let figure of gallery_figures) {
if (!figure_nr) {
gallery = figure.parentNode.parentNode.parentNode;
captions = Array.from(gallery.querySelectorAll('span')).filter(e => e.innerText.includes('©'));
next = gallery.nextSibling;
if (next)
next_images = next.querySelectorAll('img[currentsourceurl]');
}
let img = figure.querySelector('img[currentsourceurl]');
if (img && next_images) {
let img_src = img.getAttribute('currentsourceurl');
if (img_src) {
if (img_src.includes('/alternates/'))
img_width = img_src.split('/alternates/')[1].split('/')[0];
} else if (img_width && next_images[figure_nr]) {
img_src = next_images[figure_nr].getAttribute('currentsourceurl');
if (img_src && img_src.includes('/alternates/')) {
next_img_width = img_src.split('/alternates/')[1].split('/')[0];
img_src = img_src.replace(next_img_width, img_width);
}
}
let figure_new = makeFigure(img_src, captions && captions[figure_nr] ? captions[figure_nr].parentNode.innerText : '', {style: 'height: 500px;'});
figure_new.style = 'margin: 20px 0px;';
gallery_new.appendChild(figure_new);
}
figure_nr++;
}
if (gallery && next) {
next.after(gallery_new);
removeDOMElement(gallery, next);
}
let errors = document.querySelectorAll('div[height][old-src]:not([src]):has(div#__next_error__)');
for (let elem of errors) {
let iframe = document.createElement('iframe');
iframe.src = elem.getAttribute('old-src');
iframe.style = 'width: 100%; height: ' + elem.getAttribute('height') + 'px;';
elem.parentNode.replaceChild(iframe, elem);
}
if (mobile) {
if (article_main) {
let div_next = document.querySelector('div[id="__next"]');
if (div_next)
article.style.width = 0.8 * div_next.offsetWidth + 'px';
}
let lazy_images = article.querySelectorAll('figure img[loading="lazy"][style]');
for (let elem of lazy_images) {
elem.style = 'width: 95%;';
if (elem.parentNode.style && elem.parentNode.getAttribute('style').includes('min-height:'))
elem.parentNode.style['min-height'] = 'unset';
}
let figures = article.querySelectorAll('figure div');
for (let elem of figures) {
elem.removeAttribute('style');
let svg = elem.querySelector('svg');
removeDOMElement(svg);
}
}
let pars = article.querySelectorAll('section > div[style*="font-size:"]:not([id])');
if (pars.length < 5)
article.firstChild.before(googleSearchToolLink(url));
let ads = article_sel + ' div:empty:not([class])';
hideDOMStyle(ads, 2);
}
}
let url = window.location.href;
let paywall_sel = 'head > meta[name$="article_ispaidcontent"][content="true"], div[data-testid="paywall-position-inline-paywall"]:not(:empty)';
let article_sel = 'main > article';
let article_main = document.querySelector(article_sel);
if (!article_main)
article_sel = 'article[role="article"] div[id]';
getArchive(url, paywall_sel, '', article_sel);
let popup = document.querySelector('div[data-testid="close-popup-button"]');
if (popup)
popup.click();
}, 1500);
let ads = 'div[id^="ad_inline-"], div.mh-ad-label';
hideDOMStyle(ads);
}
else if (matchDomain('businessam.be')) {
let paywall = document.querySelector('div.paywall');
if (paywall) {
removeDOMElement(paywall);
let article = document.querySelector('div.text-gradient');
if (article) {
let filter = /window\.fullcontent64\s?=\s?"/;
let content_script = getSourceJsonScript(filter);
if (content_script) {
try {
let content = decode_utf8(atob(content_script.text.split(filter)[1].split('";')[0]));
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + content + '</div>', 'text/html');
let content_new = doc.querySelector('div');
article.parentNode.replaceChild(content_new, article);
} catch (err) {
console.log(err);
}
}
}
}
}
else if (matchDomain('businessinsider.nl')) {
getJsonUrl('div.piano-article__paywall', '', 'div.piano-article__content');
}
else if (matchDomain('doorbraak.be')) {
window.setTimeout(function () {
let plus = document.querySelector('h1 > svg');
let article = document.querySelector('div > div.prose');
if (plus && article) {
let paywall_sel = 'div.paywall';
let paywall = document.querySelector(paywall_sel);
let pars = article.querySelectorAll('p');
if (paywall || pars.length < 2) {
removeDOMElement(paywall);
waitDOMElement(paywall_sel, 'DIV', removeDOMElement, false);
let json_script = document.querySelector('script#__NUXT_DATA__');
if (json_script) {
try {
if (!json_script.text.substr(0, 500).includes(window.location.pathname))
refreshCurrentTab();
let json = JSON.parse(json_script.text);
json = json.filter(x => typeof x === 'string' && x.startsWith('<p>'));
let json_text = json[0];
if (json_text) {
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + json_text + '</div>', 'text/html');
let content_new = doc.querySelector('div');
article.appendChild(content_new);
}
} catch (err) {
console.log(err);
}
}
}
}
}, 1000);
}
else if (matchDomain('fd.nl')) {
if (window.location.hostname === 'specials.fd.nl') {
document.querySelectorAll('div[class^="Opening_contentContainer"], section[class^="ScrollyText_"]').forEach(e => e.style = 'color: white;');
} else {
func_post = function () {
if (mobile) {
let art_width = document.body.offsetWidth;
document.querySelectorAll('article:not([id])').forEach(e => e.style = 'width: ' + art_width * 0.90 + 'px; margin: 20px;');
document.querySelectorAll('figure img[loading="lazy"][style]').forEach(e => e.style = 'width: 95%;');
}
let paywall = pageContains('section > h1', 'Lees direct het artikel');
if (paywall.length) {
let div_empty = document.querySelectorAll('div:empty');
removeDOMElement(paywall[0].parentNode.parentNode, ...div_empty);
header_nofix('main header', '', 'BPC > no archive-fix');
}
}
let url = window.location.href;
getArchive(url, 'section.upsell, div.upsell-modal-background', '', 'main');
}
let header = document.querySelector('div.header-placeholder');
if (header)
header.style.top = 0;
let ads = 'div[data-id^="fd-message-"]';
hideDOMStyle(ads);
}
else if (matchDomain('ftm.nl')) {
let videos = document.querySelectorAll('div.body > div.video-pp');
for (let video of videos) {
let video_id_dom = video.querySelector('a.video[data-youtube-id]');
if (video_id_dom) {
video_new = document.createElement('iframe');
video_new.src = 'https://www.youtube.com/embed/' + video_id_dom.getAttribute('data-youtube-id');
video_new.style = 'width: 95%; height: 400px; margin: 0px 20px;';
video.parentNode.replaceChild(video_new, video);
}
}
let audio_controls = document.querySelectorAll('audio[controls][style]');
for (let elem of audio_controls)
elem.removeAttribute('style');
document.querySelectorAll('div.foldable').forEach(e => e.classList.remove('foldable'));
let banners = 'div.banner-pp';
hideDOMStyle(banners);
}
else if (matchDomain('groene.nl')) {
let url = window.location.href;
getArchive(url, 'div#closed-block', '', 'article');
let login = document.querySelector('header li > a[href*="/accounts/inloggen"]');
if (login) {
let pop = document.createElement('li');
let pop_link = document.createElement('a');
pop_link.href = '/populair';
pop_link.innerText = 'Populair';
pop.appendChild(pop_link);
login.parentNode.after(pop);
}
}
else if (matchDomain(['lc.nl', 'dvhn.nl']) || document.querySelector('head > link[href*=".ndcmediagroep.nl/"]')) {
let paywall = document.querySelector('div.signupPlus, div.pw-wrapper:not(.pw-none, .pw-pending');
if (paywall) {
if (window.location.pathname.match(/\/(live|sportblog)-/)) {
header_nofix(paywall, '', 'BPC > try to remove cookies for site');
removeDOMElement(paywall);
return;
}
let intro = document.querySelector('div.startPayWall');
let html = document.documentElement.outerHTML;
if (html.includes('window.__NUXT__=')) {
removeDOMElement(paywall, intro);
try {
let json = html.split('window.__NUXT__=')[1].split('</script>')[0].trim();
let json_match = json.includes('type:"article",');
if (json_match) {
let path_match = window.location.pathname.match(/-(\d+)\./);
if (path_match) {
let article_id = path_match[1];
json_match = json.includes(',id:"' + article_id + '",');
if (!json_match) {
let path_regex_str = '-' + article_id + '\\.';
if (json.match(/[(,]null,/)) {
let art_match = json.split(/[(,]null,/)[1].match(new RegExp(path_regex_str, 'g'));
json_match = art_match && art_match.length > 1;
}
if (!json_match) {
if (json.includes(',routePath:"')) {
json_match = json.split(',routePath:"')[1].split('"')[0].match(new RegExp(path_regex_str));
} else if (json.includes(',relativeUrl:"')) {
let json_split = json.split(',relativeUrl:"');
json_match = json_split.some(e => e.split(/[",]/)[0].match(new RegExp(path_regex_str)));
}
}
}
}
}
if (!json_match)
refreshCurrentTab();
else if (json.includes(',body:')) {
let nuxt_vars = json.split(/^\(function\(/)[1].split('){')[0].split(',');
let nuxt_values = json.split('}}(')[1].split('));')[0].replace(/(^|,)(true|false|\.?\d+|{}),/g, ',"$1$2",').replace(/(^|,)(null),/g, ',"$1$2",').replace(/,(void\s\d),/g, ',"$1",').split(/\\?",\\?"/);
function findNuxtText(str, attributes = false) {
if (nuxt_vars.length && nuxt_values.length && !(attributes && str.length === 1 && str === str.toUpperCase())) {
let index = nuxt_vars.indexOf(str);
if (nuxt_values[index])
str = nuxt_values[index].replace(/\\u002F/g, '/');
}
return str;
}
let intro;
let intro_match = json.match(/,leadtext_raw:"([^"]+)",/);
let intro_meta_dom = document.querySelector('head > meta[data-hid="description"][content]');
if (intro_match || intro_meta_dom) {
intro = document.createElement('p');
intro.innerText = intro_match ? intro_match[1].replace(/\\u002F/g, '/') : intro_meta_dom.content;
intro.style = 'font-weight: bold;';
}
let json_text = json.split(',body:')[1].split(/,(leadText|brand_key|tts|pianoKeywords):/)[0].replace(/([{,])(\w+)(?=:(["\{\[]|[\w$]{1,2}[,\}]))/g, "$1\"$2\"").replace(/(Image\\":)(\d)([,}])/g, '$1\\"$2\\"$3').replace(/\":(\[)?([\w\$\.]+)([\]},])/g, "\":$1\"$2\"$3");
let article = document.querySelector('div.content');
if (article) {
article.innerHTML = '';
if (intro)
article.appendChild(intro);
let pars = JSON.parse(json_text);
function addParText(elem, par_text, add_br = false, attributes = false, sup = false) {
if (par_text) {
if (par_text.length <= 2 && !sup)
par_text = findNuxtText(par_text, attributes);
let span = document.createElement(sup ? 'sup' : 'span');
span.innerText = par_text.replace(/\u00a0/g, ' '); //&nbsp;
elem.appendChild(span);
if (add_br)
elem.appendChild(document.createElement('br'));
}
}
function addLink(elem, link_text, href, add_br = false) {
let par_link = document.createElement('a');
par_link.href = href;
par_link.innerText = link_text.replace(/(\\n|\\t|\s)+$/g, '');
if (href.startsWith('http') && !href.startsWith(window.location.origin))
par_link.target = '_blank';
elem.appendChild(par_link);
if (add_br)
elem.appendChild(document.createElement('br'));
}
function addImage(elem, child) {
let figure = document.createElement('figure');
let img = document.createElement('img');
if (child.relation.href.length <= 2)
child.relation.href = findNuxtText(child.relation.href);
img.src = child.relation.href;
figure.appendChild(img);
if (child.relation.caption) {
if (child.relation.caption.length <= 2)
child.relation.caption = findNuxtText(child.relation.caption).replace(/\\"/g, '"').replace(/\\n/g, ' - ').replace(/\\u002F/g, '/');
if (child.relation.photographer) {
if (child.relation.photographer.length <= 2)
child.relation.photographer = findNuxtText(child.relation.photographer).replace(/\\u002F/g, '/');
child.relation.caption += ' ' + child.relation.photographer;
}
let caption = document.createElement('figcaption');
caption.innerText = child.relation.caption;
figure.appendChild(caption);
}
elem.appendChild(figure);
}
function addChildren(elem, children, add_br = false, attributes = false, sup = false) {
for (let child of children) {
if (child.text) {
addParText(elem, child.text, add_br, attributes, sup);
} else if (child.relation && (child.type === 'img' || child.relation.caption) && child.relation.href) {
let img_par = document.createElement('p');
addImage(img_par, child);
elem.appendChild(img_par);
} else if (child.relation && child.relation.link) {
if (child.relation.link.length <= 2)
child.relation.link = findNuxtText(child.relation.link).replace(/\\u002F/g, '/');
if (child.relation.title.length <= 2)
child.relation.title = findNuxtText(child.relation.title);
addLink(elem, child.relation.title, child.relation.link);
} else if (child.children) {
if (child.children.length) {
for (let item of child.children) {
if (item.text) {
if ((child.href && child.href.length > 2) || (child.relation && child.relation.follow && child.relation.follow.url)) {
if (item.text.length > 2) {
addLink(elem, item.text, child.href || child.relation.follow.url, add_br);
if (item.text.endsWith(' '))
elem.appendChild(document.createTextNode(' '));
}
} else
addParText(elem, item.text, add_br, child.attributes && child.attributes.length);
} else if (findNuxtText(item.type) === 'br') {
elem.appendChild(document.createElement('br'));
} else
addChildren(elem, item.children, false, item.attributes && item.attributes.length, item.type === 'sup');
}
} else
elem.appendChild(document.createElement('br'));
}
}
}
for (let par of pars) {
let par_type = par.type ? findNuxtText(par.type) : '';
let elem = document.createElement(par_type === 'h2' ? 'h2': 'p');
if (par.code) {
if (par.code.includes('flourish-embed') && par.code.includes(' data-src=\"')) {
elem = document.createElement('div');
let sub_elem = document.createElement('iframe');
sub_elem.src = 'https://public.flourish.studio/' + par.code.split(' data-src=\"')[1].split('"')[0];
sub_elem.style = 'width: 100%; height: 600px;';
elem.appendChild(sub_elem);
} else {
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + par.code + '</div>', 'text/html');
elem = doc.querySelector('div');
}
} else if (par.insertbox_head || par.insertbox_text) {
if (par.insertbox_head && par.insertbox_head.length > 2)
addParText(elem, par.insertbox_head, true);
if (par.insertbox_text) {
for (let item of par.insertbox_text) {
if (item.children)
addChildren(elem, item.children, true);
}
}
} else if (par.text) {
if (par_type !== 'streamer')
addParText(elem, par.text);
} else if (par.children) {
addChildren(elem, par.children);
} else if (par.typename.length > 2)
console.log(par);
if (elem.hasChildNodes()) {
article.appendChild(elem);
}
}
}
}
} catch (err) {
console.log(err);
}
}
}
let ads = 'div.top__ad, div.marketingblock-article';
hideDOMStyle(ads);
}
else if (matchDomain('linda.nl')) {
window.setTimeout(function () {
let premium_sel = 'div[class$="premiumlabel" i], article.premium-article_container';
let premium = window.location.pathname.startsWith('/premium/') || document.querySelector(premium_sel);
let article_sel = 'div.premium-article_main-content, div.article-content_htmlContent';
let article = document.querySelector(article_sel);
if (premium && article) {
let paywall_sel = cs_param.paywall_sel || 'div.premium-login-box_loginBox';
hideDOMStyle(paywall_sel);
let fade = document.querySelector('div[class*="_loginRequired"]');
if (fade)
fade.className = article.className.replace(/[-\w]+_loginRequired/, '');
let pars = article.querySelectorAll('p');
if (pars.length > 5)
return;
let filter = /^window\.__INITIAL_PROPS__\s?=\s?/;
let json_script = getSourceJsonScript(filter);
if (json_script) {
try {
let json = JSON.parse(json_script.text.split(filter)[1]);
if (json) {
let slug = json.slug;
if ((slug && !window.location.pathname.includes(slug)) || !json.viewData)
refreshCurrentTab();
if (json.viewData.article) {
function replace_also_read(str) {
return str.replace(/{also-read title="([^}]+)" url="([^}]+)" [^}]+"}/g, "<div style='margin: 15px 0px'><a href=\"$2\">Lees ook: $1</a></div>");
}
if (json.viewData.article.modules) {
let modules = json.viewData.article.modules;
article.innerHTML = '';
for (let elem of modules) {
let type = elem.acf_fc_layout;
if (type) {
let item = document.createElement('div');
if (['body_text', 'intro', 'quote'].includes(type)) {
if (elem.text) {
let parser = new DOMParser();
let doc = parser.parseFromString('<div style="margin: 20px;">' + replace_also_read((elem.title ? elem.title : '') + elem.text.replace(/\r\n/g, '<br>')) + '</div>', 'text/html');
item = doc.querySelector('div');
if (type === 'intro') {
let intro = item.querySelector('p');
if (intro)
intro.style = 'font-weight: bold; ';
} else if (type === 'quote')
item.style['text-align'] = 'center';
article.append(item);
}
} else if (type === 'image') {
let elem_images = elem.images_portrait || elem.images_landscape;
if (elem_images && elem_images.length) {
for (let img of elem_images) {
let url = img.image.sizes.large;
let caption_text = img.credits ? img.credits.replace(/(\n|<[^<]*>)/g, '') : '';
item = makeFigure(url, caption_text, {style: 'width: 100%;'});
article.append(item);
}
}
} else
console.log(elem);
}
}
} else if (json.viewData.article.body) {
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + replace_also_read(json.viewData.article.body) + '</div>', 'text/html');
let article_new = doc.querySelector('div');
if (article_new) {
article.innerHTML = '';
article.appendChild(article_new);
}
} else
header_nofix('div.article-content_base');
}
}
} catch (err) {
console.log(err);
}
}
}
}, 1000);
}
else if (matchDomain('nationalgeographic.nl')) {
let ads = 'div#gpt-leaderboard-ad, .breaker-ad:is(div, section)';
hideDOMStyle(ads);
}
else if (matchDomain(nl_dpg_adr_domains.concat(['hln.be']))) {
func_post = function () {
let article = document.querySelector(article_sel);
if (article) {
if (mobile) {
document.querySelectorAll('div[style*="grid-column-end:"]').forEach(e => e.style.width = article.offsetWidth + 'px');
}
article.querySelectorAll('div[style*="background-color:"][style*="width:"]:not(:has(> figure))').forEach(e => e.style.width = '85%'); //shades
let lazy_images = article.querySelectorAll('img[loading="lazy"][style]:not([style*=";width:100%;"])');
for (let elem of lazy_images) {
elem.style = 'width: 95%;';
if (elem.parentNode.style && elem.parentNode.getAttribute('style').includes('min-height:')) {
elem.parentNode.removeAttribute('style');
elem.parentNode.parentNode.removeAttribute('style');
}
if ((!elem.src || elem.src.startsWith('data:image/')) && elem.getAttribute('currentsourceurl'))
elem.src = elem.getAttribute('currentsourceurl');
}
let widgets = article.querySelectorAll('div > div > div[old-src]:not([src])');
for (let elem of widgets) {
let iframe = document.createElement('iframe');
iframe.src = elem.getAttribute('old-src');
iframe.style = 'width: 100%; border: none;';
if (iframe.src.includes('/widgets/') || iframe.src.includes('/playlists/'))
iframe.style.height = '400px';
elem.parentNode.replaceChild(iframe, elem);
}
let errors = article.querySelectorAll('div > div[old-src]:not([src]):has(div#main-frame-error)');
for (let elem of errors) {
let elem_new = document.createElement('iframe');
elem_new.src = elem.getAttribute('old-src');
elem_new.style = 'width: 100%; height: 400px; border: none;';
elem.parentNode.removeAttribute('style');
elem.parentNode.replaceChild(elem_new, elem);
}
let picture_divs = article.querySelectorAll('picture > div[style*="min-height:"]:has(svg)');
for (let elem of picture_divs) {
elem.parentNode.removeAttribute('style');
removeDOMElement(elem);
}
let video_buttons = article.querySelectorAll('button[type="button"]');
removeDOMElement(...video_buttons);
if (header_img && !article.querySelector('header figure, figure > div > svg'))
article.firstChild.before(header_img);
if (comments)
article.appendChild(comments);
if (readmore)
article.appendChild(readmore);
}
let article_divs = document.querySelectorAll(article_sel + ' > div:not(:empty)');
if (article_divs.length < 3)
article.before(googleSearchToolLink(url));
let ads = 'span[style*="background-color:"]:has(> span[style*="min-height:"]), span > br, ' + article_sel + ' div:empty:not([class])';
hideDOMStyle(ads, 2);
}
let header_img = document.querySelector('div[data-content-type="MEDIA_TOP"]');
let comments = document.querySelector('div[data-content-type="SHARE"]');
let readmore = document.querySelector('div[data-content-type="CROSS_PROMOTION"]');
let url = window.location.href;
let article_sel = 'article';
let paywall_sel = article_sel + ' svg.premium-indicator[class*="article-premium-indicator-"]';
let paywall_action = {rm_class: 'premium-indicator'};
if (window.location.pathname.includes('~') && !document.querySelector(paywall_sel)) { // regwall
let pars = document.querySelectorAll(article_sel + ' div[data-content-type="PARAGRAPH"]');
if (pars.length < 3) {
if (document.querySelector('div[data-content-type="MEDIA_TOP"] > div > figure'))
header_nofix('section.grid', '', 'BPC > regwall (use free account)');
getArchive(url, article_sel, {rm_attrib: 'none'}, article_sel);
}
} else
getArchive(url, paywall_sel, paywall_action, article_sel);
let ads = 'div.dfp-space';
hideDOMStyle(ads);
}
else if (matchDomain(nl_dpg_media_domains)) {
setCookie('TID_ID', '', '', '/', 0);
let banners = 'aside[data-temptation-position^="ARTICLE_"], div[data-temptation-position^="PAGE_"], div[class^="ad--"], div[id^="article_paragraph_"], div[data-advert-orig-id], div[class$="1-container"]';
hideDOMStyle(banners);
window.setTimeout(function () {
document.querySelectorAll('[class^="artstyle__"][style="display: none;"]').forEach(e => e.removeAttribute('style'));
}, 500);
}
else if (matchDomain(nl_mediahuis_region_domains)) {
let video = document.querySelector('div.video, div[data-testid="article-video"]');
func_post = function () {
let article = document.querySelector(article_sel);
if (article) {
if (video) {
let video_new = article.querySelector('div[id$="-streamone"], div[id^="video-player-"], div[id^="player_"]');
if (video_new && video_new.parentNode)
video_new.parentNode.replaceChild(video, video_new);
else {
let header = article.querySelector('h1');
let br = document.createElement('br');
if (header)
header.after(br, video, br);
}
}
article.querySelectorAll('hgroup, section:not(:empty)').forEach(e => e.style = 'width: 95%;');
if (mobile) {
let div_next = document.querySelector('div[id="__next"]');
if (div_next)
article.style.width = div_next.offsetWidth - 20 + 'px';
article.querySelectorAll('figure img[loading="lazy"][style]').forEach(e => e.style = 'width: 95%;');
let figures = article.querySelectorAll('figure div');
for (let elem of figures) {
elem.removeAttribute('style');
let svg = elem.querySelector('svg');
removeDOMElement(svg);
}
}
if (article.innerText.length < 1000) {
let header = article.querySelector('hgroup');
if (header)
header.before(googleSearchToolLink(url));
}
}
}
let paywall_sel = 'head > meta[name$="article_ispaidcontent"][content="true"]';
let article_sel = 'main > article';
let url = window.location.href;
getArchive(url, paywall_sel, '', article_sel);
window.setTimeout(function () {
let noscroll_sel = 'body[style*="popover-top-position:"]';
let noscroll = document.querySelector(noscroll_sel);
if (noscroll)
noscroll.style = 'position: static !important; overflow: visible !important';
}, 500);
let ads = 'div.mh-ad-label';
hideDOMStyle(ads);
}
else if (matchDomain('nrc.nl')) {
setCookie('counter', '', '', '/', 0, true);
let banners = 'div[id$="modal__overlay"], div.header__subscribe-bar, div.banner, dialog.dmt-login-modal';
hideDOMStyle(banners);
}
else if (matchDomain('telegraaf.nl')) {
func_post = function () {
let article = document.querySelector(article_sel);
if (article) {
if (mobile) {
let body = document.querySelector('body');
if (body) {
article.style.width = body.offsetWidth * 0.95 + 'px';
let lazy_images = document.querySelectorAll('button > img[loading="lazy"]');
for (let elem of lazy_images) {
elem.style = 'width: 100%;';
elem.parentNode.style['min-height'] = 'auto';
}
}
article.querySelectorAll('section[style*=";width:"]').forEach(e => e.removeAttribute('style'));
}
let gallery, img_width, captions, next, next_images, next_img_width;
let gallery_new = document.createElement('div');
let figure_nr = 0;
let gallery_figures = document.querySelectorAll('div > ul > li > figure');
for (let figure of gallery_figures) {
if (!figure_nr) {
gallery = figure.parentNode.parentNode.parentNode;
captions = Array.from(gallery.querySelectorAll('span')).filter(e => e.innerText.includes('©'));
next = gallery.nextSibling;
if (next)
next_images = next.querySelectorAll('img[currentsourceurl]');
}
let img = figure.querySelector('img[currentsourceurl]');
if (img && next_images) {
let img_src = img.getAttribute('currentsourceurl');
if (img_src) {
if (img_src.includes('/alternates/'))
img_width = img_src.split('/alternates/')[1].split('/')[0];
} else if (img_width && next_images[figure_nr]) {
img_src = next_images[figure_nr].getAttribute('currentsourceurl');
if (img_src && img_src.includes('/alternates/')) {
next_img_width = img_src.split('/alternates/')[1].split('/')[0];
img_src = img_src.replace(next_img_width, img_width);
}
}
let figure_new = makeFigure(img_src, captions && captions[figure_nr] ? captions[figure_nr].parentNode.innerText : '', {style: 'width: 100%;'});
figure_new.style = 'margin: 20px 0px;';
gallery_new.appendChild(figure_new);
}
figure_nr++;
}
if (gallery && next) {
next.after(gallery_new);
removeDOMElement(gallery, next);
}
let iframes = pageContains('div[style]', /^<iframe/);
if (iframes.length) {
let parser = new DOMParser();
for (let elem of iframes) {
let doc = parser.parseFromString('<div>' + elem.innerText.replace(/”/g, '"') + '</div>', 'text/html');
let elem_new = doc.querySelector('div');
elem.parentNode.replaceChild(elem_new, elem);
}
}
let social_media = article.querySelectorAll('div[style*="background-position:"] > button');
if (social_media.length) {
let json_script = document.querySelector('script#__NEXT_DATA__');
if (json_script) {
try {
let json = JSON.parse(json_script.text);
if (json) {
let embedcodes = getNestedKeys(json, 'props.pageProps.data.context.embedcodes');
if (embedcodes && embedcodes.length) {
let parser = new DOMParser();
for (let n = 0; n < social_media.length; n++) {
if (embedcodes[n] && embedcodes[n].html) {
let doc = parser.parseFromString('<div style="margin: 20px 0px;">' + embedcodes[n].html + '</div>', 'text/html');
let embed_new = doc.querySelector('div');
social_media[n].parentNode.parentNode.replaceChild(embed_new, social_media[n].parentNode);
}
}
}
}
} catch (err) {
console.log(err);
}
}
}
let errors = document.querySelectorAll('div[old-src]:not([src]):has(div#__next_error__)');
for (let elem of errors) {
let elem_new = document.createElement('iframe');
elem_new.src = elem.getAttribute('old-src');
elem_new.style = 'width: 100%; height: ' + elem.getAttribute('height') + 'px;';
elem.parentNode.replaceChild(elem_new, elem);
}
document.querySelectorAll('div > div[style^="min-height:"] > div[id^="player_"]').forEach(e => hideDOMElement(e.parentNode.parentNode));
let pars = document.querySelectorAll(article_sel + ' section > div[style*="font-family:"]:not(:empty)');
if (pars.length < 5)
article.after(googleSearchToolLink(url));
let ads = article_sel + ' div:empty';
hideDOMStyle(ads, 2);
}
}
let url = window.location.href.split(/[#\?]/)[0];
let article_sel = 'article';
window.setTimeout(function () {
let paywall_sel = 'div[data-testid="paywall-position-popover"]:not(:empty)';
let paywall = document.querySelector(paywall_sel);
if (paywall) {
if (window.location.pathname.startsWith('/video/') && document.querySelector('div[data-testid="article-video"]'))
removeDOMElement(paywall);
else
getArchive(url, paywall_sel, '', article_sel);
let noscroll = document.querySelector('body[class]');
if (noscroll)
noscroll.removeAttribute('class');
}
}, 1000);
let ads = 'div[id^="ad_"], div[class^="scrollable-ads"], iframe#ecommerce-ad-iframe, div[data-pym-src], div.mh-ad-label';
hideDOMStyle(ads);
}
else if (matchDomain('tijd.be')) {
let article_match = window.location.pathname.match(/\/(\d+)\.html$/);
if (article_match) {
let article_id = article_match[1];
let url = window.location.href;
let nofix_msg = 'BPC > no data yet (refresh page)';
if (matchDomain('belegger.tijd.be')) {
let paywall = document.querySelector('html.paywalled');
if (paywall) {
paywall.classList.remove('paywalled');
let article = document.querySelector('main div.row > div');
if (article) {
let authorization = mediafin_get_auth();
if (authorization) {
let url_src = 'https://api.mediafin.be/content/article/urn:article:' + article_id;
getExtFetch(url_src, '', {headers: {authorization: authorization}}, mediafin_main, [article]);
} else {
header_nofix(article, '', nofix_msg);
article.before(googleSearchToolLink(url));
}
}
}
addStyle('body {overflow: auto !important} ' + 'main div.row > div p {margin: 20px 0px}');
let banner = document.querySelector('div[data-id="react-paywall-auth0"]');
removeDOMElement(banner);
} else {
window.setTimeout(function () {
let close_button = document.querySelector('button.ds-modal__top-bar__closebutton');
if (close_button)
close_button.click();
}, 1000);
let paywall = document.querySelector('html.paywall-active');
if (paywall) {
paywall.classList.remove('paywall-active');
if (!(window.location.href.includes('/live-blog/') || document.querySelector('header.live-blog-header'))) {
let article = document.querySelector('div[itemprop="articleBody"]');
if (article) {
let authorization = mediafin_get_auth();
if (authorization) {
let url_src = 'https://api.mediafin.be/content/article/urn:article:' + article_id;
getExtFetch(url_src, '', {headers: {authorization: authorization}}, mediafin_main, [article]);
} else {
header_nofix(article, '', nofix_msg);
article.before(googleSearchToolLink(url));
}
}
} else {
let main = document.querySelector('main');
if (main)
main.after(googleSearchToolLink(url));
}
}
}
function clear_inert() {
document.querySelectorAll('[inert]').forEach(e => e.removeAttribute('inert'));
}
clear_inert();
}
}
else if (matchDomain('vn.nl')) {
let paywall = document.querySelectorAll('section[class^="c-paywall"]');
if (paywall.length) {
removeDOMElement(...paywall);
let article = document.querySelector('div.c-article-content__container');
if (article) {
let json_script = document.querySelector('script#__NEXT_DATA__');
if (json_script) {
try {
let json = JSON.parse(json_script.text);
if (json && json.props.pageProps.article && json.props.pageProps.article.content) {
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + json.props.pageProps.article.content + '</div>', 'text/html');
let content_new = doc.querySelector('div');
article.innerHTML = '';
article.appendChild(content_new);
let audio = document.querySelector('div.c-author-info__audio-player');
if (audio) {
if (json.props.pageProps.article.audioplayer.audioFile.node.mediaItemUrl) {
let audio_new = document.createElement('audio');
audio_new.src = json.props.pageProps.article.audioplayer.audioFile.node.mediaItemUrl;
audio_new.style = 'height: 50px; width: 60%;';
audio_new.setAttribute('controls', '');
audio.parentNode.replaceChild(audio_new, audio);
}
}
} else
refreshCurrentTab();
} catch (err) {
console.log(err);
}
}
}
let noscroll = document.querySelector('html[class]');
if (noscroll)
noscroll.removeAttribute('class');
}
}
ads_hide();
leaky_paywall_unhide();
}, 1000);
// General Functions
// import (see @require)
})();

View File

@@ -0,0 +1,118 @@
// ==UserScript==
// @name Bypass Paywalls Clean - pl
// @version 4.3.4.0
// @description Bypass Paywalls of news sites
// @author magnolia1234
// @downloadURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=userscript/bpc.pl.user.js
// @updateURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=userscript/bpc.pl.user.js
// @homepageURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters
// @supportURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters
// @license MIT; https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=LICENSE
// @noframes
// @match *://*.auto-swiat.pl/*
// @match *://*.businessinsider.com.pl/*
// @match *://*.forbes.pl/*
// @match *://*.komputerswiat.pl/*
// @match *://*.magazyn-kuchnia.pl/*
// @match *://*.newsweek.pl/*
// @match *://*.onet.pl/*
// @match *://*.parkiet.com/*
// @match *://*.pb.pl/*
// @match *://*.rp.pl/*
// @match *://*.wyborcza.biz/*
// @match *://*.wyborcza.pl/*
// @match *://*.wysokieobcasy.pl/*
// @connect archive.fo
// @connect archive.is
// @connect archive.li
// @connect archive.md
// @connect archive.ph
// @connect archive.vn
// @grant GM.xmlHttpRequest
// @require https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=userscript/bpc_func.js
// ==/UserScript==
(function() {
//'use strict';
window.setTimeout(function () {
var pl_ringier_domains = ['auto-swiat.pl', 'businessinsider.com.pl', 'forbes.pl', 'komputerswiat.pl', 'newsweek.pl', 'onet.pl'];
if (matchDomain('pb.pl')) {
let paywall = document.querySelector('div.paywall');
if (paywall) {
paywall.classList.remove('paywall');
let article_hidden = paywall.querySelector('section.o-article-content');
if (article_hidden)
article_hidden.removeAttribute('class');
let loader = document.querySelector('div.o-piano-template-loader-box');
removeDOMElement(loader);
}
}
else if (matchDomain(pl_ringier_domains)) {
let premium = document.querySelector('div.contentPremium[style]');
if (premium) {
premium.removeAttribute('class');
premium.removeAttribute('style');
premium.parentNode.removeAttribute('class');
}
if (matchDomain('newsweek.pl')) {
let audio_tts = document.querySelector('button.pw-ap__button[disabled]');
if (audio_tts)
audio_tts.removeAttribute('disabled');
let podcast_locked = document.querySelector('div.embed__podcastPlayer.contentPremium-locked');
if (podcast_locked)
podcast_locked.classList.remove('contentPremium-locked');
let podcast_video = document.querySelector('div.videoPremiumWrapper > div.embed__mainVideoWrapper');
if (podcast_video) {
podcast_video.removeAttribute('class');
podcast_video.parentNode.removeAttribute('class');
}
}
let ads = 'div.adPlaceholder , div[class^="Ad"][class*="Placeholder_"], div[data-placeholder-caption], div[data-run-module$=".floatingAd"], aside[data-ad-container], aside.adsContainer, [class^="pwAds"], .hide-for-paying, div.onet-ad, div.bottomBar, ad-default, ad-floating-group, aside.ods-ads__ad-space';
hideDOMStyle(ads);
}
else if (matchDomain(['rp.pl', 'parkiet.com'])) {
let paywall = document.querySelector('div.paywallComp');
if (paywall) {
removeDOMElement(paywall);
let article = document.querySelector('div.article--content');
if (article) {
let url = window.location.href;
article.firstChild.before(googleSearchToolLink(url));
}
}
}
else if (matchDomain(['wyborcza.biz', 'wyborcza.pl', 'wysokieobcasy.pl', 'magazyn-kuchnia.pl'])) {
func_post = function () {
let block_quotes = document.querySelectorAll('blockquote > a[href]');
for (let elem of block_quotes) {
if (!elem.innerText.trim())
elem.innerText = elem.href;
}
let empty_spans = document.querySelectorAll('figure > a > span:empty');
removeDOMElement(...empty_spans);
header_nofix('div.mrf-article-body', 'span[style*="linear-gradient"]', 'BPC > no archive-fix');
let ads = 'div[style^="min-height:"]';
hideDOMStyle(ads, 2);
}
let url = window.location.href;
getArchive(url, 'div.article--content-fadeout', {rm_attrib: 'class'}, 'div.container[class*="pt"]', '', 'div.body > div:not([style*="background-color:"]):not([old-position]):not([name]):not([id])');
let ads = 'div[id^="adUnit"], div[id^="ads-"]';
hideDOMStyle(ads);
}
ads_hide();
leaky_paywall_unhide();
}, 1000);
// General Functions
// import (see @require)
})();

File diff suppressed because it is too large Load Diff