Remove Iltalehti.fi (fix obsolete)

This commit is contained in:
magnolia1234 2023-03-15 17:35:17 +01:00
parent 64b0fde530
commit f35f017dee
5 changed files with 3 additions and 139 deletions

View file

@ -429,8 +429,7 @@ Grouped in options:\
[Berlingske](https://www.berlingske.dk)
##### Finland
[Suomen Sotilas](https://suomensotilas.fi) -
[Iltalehti](https://www.iltalehti.fi)
[Suomen Sotilas](https://suomensotilas.fi)
##### France/Wallonia
[60 Millions de consommateurs](https://www.60millions-mag.com) -

View file

@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Firefox
Updates: https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/releases
Post-release
Remove Iltalehti.fi (fix obsolete)
Fix Sciences et Avenir.fr
* v3.0.9.0 (2023-03-12)

View file

@ -1022,137 +1022,6 @@ else if (matchDomain('etc.se')) {
}
}
else if (matchDomain('iltalehti.fi')) {
let ads = document.querySelectorAll('div[class^="p2m385-"], div#anop-container, .ad, div.iZivCJ');
hideDOMElement(...ads);
if (true) {
let paywall = document.querySelector('div.faded-text');
if (paywall) {
let scripts = document.querySelectorAll('script');
let json_script;
for (let script of scripts) {
if (script.text.includes('window.App=')) {
json_script = script;
break;
}
}
if (json_script) {
let json = json_script.text.split('window.App=')[1].split('</script')[0];
json = json.replace(/undefined/g, '"undefined"');
let json_article = JSON.parse(json).state.articles;
if (!Object.keys(json_article).length)
refreshCurrentTab();
if (Object.keys(json_article).length) {
paywall.remove();
let url_loaded = Object.keys(json_article)[0];
if (url_loaded && !window.location.pathname.includes(url_loaded))
refreshCurrentTab();
let pars = Object.values(json_article)[0].items.body;
let content = document.querySelector('div.article-body');
if (content && pars) {
function ilta_par_text(items) {
let par_text = '';
for (let item of items) {
if (item.text)
par_text += item.text;
else if (item.name)
par_text += '<a href="/henkilot/' + item.name + '">' + item.name + '</a>';
else if (item.type === 'link')
par_text += '<a href="' + item.url + '" target="_blank">' + item.items[0].text + '</a>';
else if (item.type) {
let item_type = '<' + item.type[0] + '>';
par_text += item.items.map(i => item_type + i.text + item_type.replace('<', '</')).join('');
} else if (item[0]) { //aside-list
par_text += item[0].text;
}
}
return par_text;
}
function ilta_wrap_list(elem, par_text) {
if (par_text) {
elem += '<div class="article-bullets"><ul>';
elem += par_text;
elem += '</ul></div>';
}
return elem;
}
content.innerHTML = '';
let article_new = '';
for (let par of pars) {
let elem = '';
let par_text = '';
let par_ignore = false;
if (par.type === 'paragraph') {
par_text = ilta_par_text(par.items);
if (par_text)
elem = '<p class="paragraph">' + par_text + '</p>';
} else if (par.type === 'subheadline') {
if (par.text)
elem = '<h3 class="subheadline" style="margin:20px;">' + par.text + '</h3>';
} else if (par.type === 'aside') {
elem = '<div class="aside-container"><div class="aside">';
for (let item of par.items) {
if (item.text || (item.type === 'paragraph' && item.items)) {
if (par_text) {
elem = ilta_wrap_list(elem, par_text);
par_text = '';
}
if (item.text)
elem += '<h3 class="subheadline" style="margin:20px;">' + item.text + '</h3>';
else {
let par_text_sub = ilta_par_text(item.items);
if (par_text_sub)
elem += '<p class="paragraph">' + par_text_sub + '</p>';
}
} else if (item.type === 'list') {
let par_text_sub = ilta_par_text(item.items);
if (par_text_sub) {
par_text += '<li>';
par_text += par_text_sub;
par_text += '</li>';
}
}
}
if (par_text)
elem = ilta_wrap_list(elem, par_text);
elem += '</div></div>';
} else if (par.type === 'blockquote') {
elem = '<p style="font-size: 1.2em; margin:20px;"><i>&quot;' + par.items.map(i => i.text).join('') + '&quot;</i></p>';
} else if (par.type === 'divider') {
elem = '<div class="article-divider"><div class="article-divider-content"></div></div>';
} else if (par.type.toLowerCase() === 'list') {
elem = '<div class="article-bullets"><ul>';
for (let item of par.items)
elem += '<li>' + item.map(i => i.text).join('') + '</li>';
elem += '</ul></div>';
} else if (par.type === 'related-article') {
elem = '<div class="related-articles related-articles-within-text"><h3>Lue myös</h3><a href="/' + par.article.category.category_name + '/a/' + par.article.article_id + '">' + par.article.title + '</a></div>';
} else if (par.type === 'image') {
if (par.urls.default) {
let caption = par.properties.caption ? par.properties.caption : '';
let source = par.properties.source ? par.properties.source : '';
elem = '<p><div><div style="text-align: center;"><img src="' + par.urls.default + '" alt="' + caption + '"></div><div class="media-caption"><span class="caption-text">' + caption + '</span><span class="media-source">' + source + '</span></div></div></p>';
}
} else if (par.type === 'embed') {
elem = par.embed_html;
} else if (par.type === 'advertisement') {
par_ignore = true;
}
if (elem)
article_new += elem;
else if (!par_ignore)
console.log(par);
}
let parser = new DOMParser();
let par_html = parser.parseFromString('<div>' + article_new + '</div>', 'text/html');
content.appendChild(par_html.querySelector('div'));
}
}
}
}
}
}
else if (matchDomain('nyteknik.se')) {
let locked_article = document.querySelector('div.locked-article');
if (locked_article)

View file

@ -299,7 +299,6 @@
"*://*.ilmattino.it/*",
"*://*.ilmessaggero.it/*",
"*://*.ilrestodelcarlino.it/*",
"*://*.iltalehti.fi/*",
"*://*.iltelegrafolivorno.it/*",
"*://*.iltirreno.it/*",
"*://*.inc.com/*",

View file

@ -937,10 +937,6 @@ var defaultSites = {
"Il Tirreno": {
domain: "iltirreno.it"
},
"Iltalehti": {
domain: "iltalehti.fi",
allow_cookies: 1
},
"Inc.com": {
domain: "inc.com",
block_regex: /\.tinypass\.com\//
@ -2455,4 +2451,4 @@ var au_news_corp_nofix_domains = ['cairnspost.com.au', 'geelongadvertiser.com.au
var be_mediahuis_nofix_domains = ['gva.be', 'hbvl.be', 'nieuwsblad.be', 'standaard.be'];
var de_rp_medien_nofix_domains = ['ga.de', 'rp-online.de', 'saarbruecker-zeitung.de', 'volksfreund.de'];
var it_gedi_nofix_domains = ['gelocal.it', 'huffingtonpost.it', 'ilsecoloxix.it', 'lastampa.it', 'limesonline.com', 'repubblica.it'];
var nofix_sites = ['aamulehti.fi', 'africaintelligence.com', 'africaintelligence.fr', 'aftenposten.no', 'asiatimes.com', 'badische-zeitung.de', 'bild.de', 'borsen.dk', 'businesstimes.com.sg', 'caixin.com', 'caixinglobal.com', 'caravanmagazine.in', 'catalyst-journal.com', 'courrierinternational.com', 'diepresse.com', 'dn.se', 'elordenmundial.com', 'epw.in', 'expresso.pt', 'finance.si', 'ftchinese.com', 'golem.de', 'handelsblatt.com', 'heise.de', 'hln.be', 'hs.fi', 'ilsole24ore.com', 'jacobinmag.com', 'jeuneafrique.com', 'kleinezeitung.at', 'lavie.fr', 'lavozdegalicia.es', 'law360.com', 'le1hebdo.fr', 'leconomiste.com', 'lefigaro.fr', 'lemonde.fr', 'lequipe.fr', 'letemps.ch', 'liberation.fr', 'lopinion.fr', 'medianama.com', 'mediapart.fr', 'milanofinanza.it', 'mittelbayerische.de', 'mondediplo.com', 'moneycontrol.com', 'nationaljournal.com', 'nature.com', 'nbr.co.nz', 'nn.de', 'nwzonline.de', 'ouest-france.fr', 'philonomist.com', 'politicopro.com', 'politiken.dk', 'pressreader.com', 'publico.pt', 'republic.ru', 'rheinpfalz.de', 'ruhrnachrichten.de', 'saechsische.de', 'schwarzwaelder-bote.de', 'statnews.com', 'stern.de', 'stimme.de', 'straitstimes.com', 'stuttgarter-nachrichten.de', 'stuttgarter-zeitung.de', 'substack.com', 'suedkurier.de', 'swp.de', 'techcrunch.com', 'the-ken.com', 'theinformation.com', 'themorningcontext.com', 'theparisreview.org', 'thewirechina.com', 'welt.de', 'weser-kurier.de', 'wiwo.de', 'worldpoliticsreview.com', 'ynet.co.il'].concat(au_news_corp_nofix_domains, be_mediahuis_nofix_domains, de_rp_medien_nofix_domains, it_gedi_nofix_domains);
var nofix_sites = ['aamulehti.fi', 'africaintelligence.com', 'africaintelligence.fr', 'aftenposten.no', 'asiatimes.com', 'badische-zeitung.de', 'bild.de', 'borsen.dk', 'businesstimes.com.sg', 'caixin.com', 'caixinglobal.com', 'caravanmagazine.in', 'catalyst-journal.com', 'courrierinternational.com', 'diepresse.com', 'dn.se', 'elordenmundial.com', 'epw.in', 'expresso.pt', 'finance.si', 'ftchinese.com', 'golem.de', 'handelsblatt.com', 'heise.de', 'hln.be', 'hs.fi', 'ilsole24ore.com', 'iltalehti.fi', 'jacobinmag.com', 'jeuneafrique.com', 'kleinezeitung.at', 'lavie.fr', 'lavozdegalicia.es', 'law360.com', 'le1hebdo.fr', 'leconomiste.com', 'lefigaro.fr', 'lemonde.fr', 'lequipe.fr', 'letemps.ch', 'liberation.fr', 'lopinion.fr', 'medianama.com', 'mediapart.fr', 'milanofinanza.it', 'mittelbayerische.de', 'mondediplo.com', 'moneycontrol.com', 'nationaljournal.com', 'nature.com', 'nbr.co.nz', 'nn.de', 'nwzonline.de', 'ouest-france.fr', 'philonomist.com', 'politicopro.com', 'politiken.dk', 'pressreader.com', 'publico.pt', 'republic.ru', 'rheinpfalz.de', 'ruhrnachrichten.de', 'saechsische.de', 'schwarzwaelder-bote.de', 'statnews.com', 'stern.de', 'stimme.de', 'straitstimes.com', 'stuttgarter-nachrichten.de', 'stuttgarter-zeitung.de', 'substack.com', 'suedkurier.de', 'swp.de', 'techcrunch.com', 'the-ken.com', 'theinformation.com', 'themorningcontext.com', 'theparisreview.org', 'thewirechina.com', 'welt.de', 'weser-kurier.de', 'wiwo.de', 'worldpoliticsreview.com', 'ynet.co.il'].concat(au_news_corp_nofix_domains, be_mediahuis_nofix_domains, de_rp_medien_nofix_domains, it_gedi_nofix_domains);