Skip to content

Commit 347f3ce

Browse files
authored
Merge pull request #7 from TheGroundZero/main
Add Belgian sites
2 parents ba01290 + 808cc63 commit 347f3ce

File tree

5 files changed

+249
-71
lines changed

5 files changed

+249
-71
lines changed

.github/workflows/concat.yml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
name: Concatenate
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches:
67
- main
78

89
jobs:
910
build:
11+
if: "!contains(github.event.*.labels.*.name, 'automated-pr')"
1012
runs-on: ubuntu-latest
1113
steps:
1214
- name: Checkout code
1315
uses: actions/checkout@v4
1416
- id: listup-targets
1517
run: |
16-
files=$(find rulesets -type f -print)
18+
files=$(find rulesets/ -name "*.yaml" -type f -print)
1719
escaped_files="${files//$'\n'/\ }"
1820
echo "files=${escaped_files}" >> $GITHUB_OUTPUT
1921
- name: Clear concat file
@@ -24,13 +26,24 @@ jobs:
2426
with:
2527
sources: ${{ steps.listup-targets.outputs.files }}
2628
destination: ruleset.yaml
27-
- name: Commit files
28-
run: |
29-
git config --local user.email "2406013+github-actions[bot]@users.noreply.github.com"
30-
git config --local user.name "github-actions[bot]"
31-
git commit -a -m "Add changes"
32-
- name: Push changes
33-
uses: ad-m/github-push-action@master
29+
- name: Create Pull Request
30+
uses: peter-evans/create-pull-request@v6
31+
id: cpr
3432
with:
35-
github_token: ${{ secrets.GITHUB_TOKEN }}
36-
branch: ${{ github.ref }}
33+
commit-message: |
34+
Concatenate ruleset
35+
[skip ci]
36+
labels: |
37+
automated-pr
38+
delete-branch: true
39+
- name: Check outputs
40+
if: ${{ steps.cpr.outputs.pull-request-number }}
41+
run: |
42+
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
43+
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
44+
- name: Enable Pull Request Automerge
45+
if: ${{ steps.cpr.outputs.pull-request-number }}
46+
run: |
47+
gh pr merge --merge --auto "${{ steps.cpr.outputs.pull-request-number }}"
48+
env:
49+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/ruleset.yaml

ruleset.yaml

Lines changed: 178 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,55 @@
1-
- domains:
2-
- www.thestar.com
3-
- www.niagarafallsreview.ca
4-
- www.stcatharinesstandard.ca
5-
- www.thepeterboroughexaminer.com
6-
- www.therecord.com
7-
- www.thespec.com
8-
- www.wellandtribune.ca
1+
- domain: theathletic.com
92
injections:
103
- position: head
114
append: |
125
<script>
13-
window.localStorage.clear();
146
document.addEventListener("DOMContentLoaded", () => {
15-
const paywall = document.querySelectorAll('div.subscriber-offers');
16-
paywall.forEach(el => { el.remove(); });
17-
const subscriber_only = document.querySelectorAll('div.subscriber-only');
18-
for (const elem of subscriber_only) {
19-
if (elem.classList.contains('encrypted-content') && dompurify_loaded) {
20-
const parser = new DOMParser();
21-
const doc = parser.parseFromString('<div>' + DOMPurify.sanitize(unscramble(elem.innerText)) + '</div>', 'text/html');
22-
const content_new = doc.querySelector('div');
23-
elem.parentNode.replaceChild(content_new, elem);
24-
}
25-
elem.removeAttribute('style');
26-
elem.removeAttribute('class');
27-
}
28-
const banners = document.querySelectorAll('div.subscription-required, div.redacted-overlay, div.subscriber-hide, div.tnt-ads-container');
29-
banners.forEach(el => { el.remove(); });
30-
const ads = document.querySelectorAll('div.tnt-ads-container, div[class*="adLabelWrapper"]');
31-
ads.forEach(el => { el.remove(); });
32-
const recommendations = document.querySelectorAll('div[id^="tncms-region-article"]');
33-
recommendations.forEach(el => { el.remove(); });
7+
let overlays = document.querySelectorAll('div[id*="overlay"], div:empty:not([data-rjs])');
8+
overlays.forEach(el => el.remove());
9+
10+
let slideup = document.querySelectorAll('div[id^=slideup-]');
11+
slideup.forEach(el => el.remove());
12+
13+
let apron = document.getElementById('free-apron-cta');
14+
apron.remove();
15+
16+
let body = document.querySelector('body');
17+
body.style.overflow = 'visible';
18+
body.style.position = 'relative';
3419
});
3520
</script>
36-
21+
tests:
22+
- url: https://theathletic.com/5097900/2023/11/29/corey-perry-blackhawks-nhl/
23+
test: document.querySelector('div[id*="overlay"], div:empty:not([data-rjs])') === null
24+
- url: https://theathletic.com/5097851/2023/11/29/mandel-mailbag-cfp-texas-alabama/
25+
test: document.getElementById('free-apron-cta') === null
3726
- domains:
38-
- www.nytimes.com
39-
- www.time.com
40-
headers:
41-
ueser-agent: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
42-
cookie: nyt-a=; nyt-gdpr=0; nyt-geo=DE; nyt-privacy=1
43-
referer: https://www.google.com/
27+
- www.foxbusiness.com
28+
- www.foxnews.com
4429
injections:
4530
- position: head
4631
append: |
4732
<script>
48-
window.localStorage.clear();
4933
document.addEventListener("DOMContentLoaded", () => {
50-
const banners = document.querySelectorAll('div[data-testid="inline-message"], div[id^="ad-"], div[id^="leaderboard-"], div.expanded-dock, div.pz-ad-box, div[id="top-wrapper"], div[id="bottom-wrapper"]');
34+
let featuredVideo = document.querySelector('.featured-video');
35+
featuredVideo.remove();
36+
37+
let relatedArticles = document.querySelectorAll('p a strong');
38+
relatedArticles.forEach(el => el.remove());
39+
});
40+
</script>
41+
tests:
42+
- url: https://www.foxbusiness.com/fox-news-tech/elon-musk-tells-advertisers-who-left-x-go-f-yourself
43+
test: document.querySelector('video') === null && document.querySelector('strong') === null
44+
- url: https://www.foxnews.com/media/mayim-bialik-calls-feminists-silence-hamas-rape-torture-october-7-terror-attacks
45+
test: document.querySelector('video') === null && document.querySelector('strong') === null
46+
- domain: www.usatoday.com
47+
injections:
48+
- position: head
49+
append: |
50+
<script>
51+
document.addEventListener("DOMContentLoaded", () => {
52+
const banners = document.querySelectorAll('div.roadblock-container, .gnt_nb, [aria-label="advertisement"], div[id="main-frame-error"]');
5153
banners.forEach(el => { el.remove(); });
5254
});
5355
</script>
@@ -88,6 +90,37 @@
8890
}
8991
});
9092
</script>
93+
tests:
94+
- url: https://www.americanbanker.com/news/how-foster-youth-become-financially-forgotten
95+
test: document.querySelector('.inline-gate') === null
96+
- domains:
97+
- www.nytimes.com
98+
- www.time.com
99+
headers:
100+
ueser-agent: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
101+
cookie: nyt-a=; nyt-gdpr=0; nyt-geo=DE; nyt-privacy=1
102+
referer: https://www.google.com/
103+
content-security-policy: "default-src * 'unsafe-inline' 'unsafe-eval' data: blob:;"
104+
injections:
105+
- position: head
106+
append: |
107+
<script>
108+
window.localStorage.clear();
109+
document.addEventListener("DOMContentLoaded", () => {
110+
const banners = document.querySelectorAll('div[data-testid="inline-message"], div[id^="ad-"], div[id^="leaderboard-"], div.expanded-dock, div.pz-ad-box, div[id="top-wrapper"], div[id="bottom-wrapper"]');
111+
banners.forEach(el => { el.remove(); });
112+
});
113+
</script>
114+
tests:
115+
- url: https://www.nytimes.com/2023/11/24/business/retail-workers-black-friday-shopping.html
116+
test: document.querySelector('div[data-testid="inline-message"]') === null
117+
- domain: medium.com
118+
headers:
119+
referer: https://t.co/x?amp=1
120+
x-forwarded-for: none
121+
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
122+
content-security-policy: script-src 'self';
123+
cookie:
91124

92125
- domain: www.washingtonpost.com
93126
injections:
@@ -103,25 +136,47 @@
103136
headimage.forEach(image => { image.style.filter = ''; });
104137
});
105138
</script>
106-
107-
- domain: www.usatoday.com
139+
tests:
140+
- url: https://www.washingtonpost.com/world/2023/11/24/russia-crimea-tunnel-china/
141+
test: document.querySelector('div[data-qa="subscribe-promo"]') === null
142+
- domains:
143+
- www.thestar.com
144+
- www.niagarafallsreview.ca
145+
- www.stcatharinesstandard.ca
146+
- www.thepeterboroughexaminer.com
147+
- www.therecord.com
148+
- www.thespec.com
149+
- www.wellandtribune.ca
108150
injections:
109151
- position: head
110152
append: |
111153
<script>
154+
window.localStorage.clear();
112155
document.addEventListener("DOMContentLoaded", () => {
113-
const banners = document.querySelectorAll('div.roadblock-container, .gnt_nb, [aria-label="advertisement"], div[id="main-frame-error"]');
156+
const paywall = document.querySelectorAll('div.subscriber-offers');
157+
paywall.forEach(el => { el.remove(); });
158+
const subscriber_only = document.querySelectorAll('div.subscriber-only');
159+
for (const elem of subscriber_only) {
160+
if (elem.classList.contains('encrypted-content') && dompurify_loaded) {
161+
const parser = new DOMParser();
162+
const doc = parser.parseFromString('<div>' + DOMPurify.sanitize(unscramble(elem.innerText)) + '</div>', 'text/html');
163+
const content_new = doc.querySelector('div');
164+
elem.parentNode.replaceChild(content_new, elem);
165+
}
166+
elem.removeAttribute('style');
167+
elem.removeAttribute('class');
168+
}
169+
const banners = document.querySelectorAll('div.subscription-required, div.redacted-overlay, div.subscriber-hide, div.tnt-ads-container');
114170
banners.forEach(el => { el.remove(); });
171+
const ads = document.querySelectorAll('div.tnt-ads-container, div[class*="adLabelWrapper"]');
172+
ads.forEach(el => { el.remove(); });
173+
const recommendations = document.querySelectorAll('div[id^="tncms-region-article"]');
174+
recommendations.forEach(el => { el.remove(); });
115175
});
116176
</script>
117-
118-
- domain: medium.com
119-
headers:
120-
referer: https://t.co/x?amp=1
121-
x-forwarded-for: none
122-
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
123-
content-security-policy: script-src 'self';
124-
cookie:
177+
tests:
178+
- url: https://www.wellandtribune.ca/news/niagara-region/niagara-transit-commission-rejects-council-request-to-reduce-its-budget-increase/article_e9fb424c-8df5-58ae-a6c3-3648e2a9df66.html
179+
test: document.querySelector('div.subscriber-offers') === null
125180

126181
# loads amp version of page
127182
- domain: tagesspiegel.de
@@ -132,6 +187,9 @@
132187
query:
133188
- key: amp
134189
value: 1
190+
tests:
191+
url: https://www.tagesspiegel.de/politik/impfungen-in-deutschland-und-der-welt-der-aktuelle-stand-der-impfkampagne/26809888.html
192+
test: document.querySelector('html').classList.contains('amp-mode')
135193

136194
- domain: www.nzz.ch
137195
paths:
@@ -157,7 +215,34 @@
157215
removeDOMElement(paywall)
158216
});
159217
</script>
218+
tests:
219+
- url: https://www.nzz.ch/feuilleton/edward-w-said-der-ideologe-des-palaestinensischen-terrors-ld.1766658
220+
test: document.querySelector('.dynamic-regwall') === null
160221

222+
- domain: ft.com
223+
headers:
224+
referer: https://t.co/x?amp=1
225+
content-security-policy: "default-src * 'unsafe-inline' 'unsafe-eval' data: blob:;"
226+
injections:
227+
- position: head
228+
append: |
229+
<script>
230+
document.addEventListener("DOMContentLoaded", () => {
231+
const styleTags = document.querySelectorAll('link[rel="stylesheet"]');
232+
styleTags.forEach(el => {
233+
const href = el.getAttribute('href').substring(1);
234+
const updatedHref = href.replace(/(https?:\/\/.+?)\/{2,}/, '$1/');
235+
el.setAttribute('href', updatedHref);
236+
});
237+
setTimeout(() => {
238+
const cookie = document.querySelectorAll('.o-cookie-message, .js-article-ribbon, .o-ads, .o-banner, .o-message, .article__content-sign-up');
239+
cookie.forEach(el => { el.remove(); });
240+
}, 1000);
241+
})
242+
</script>
243+
tests:
244+
- url: https://www.ft.com/content/5348ec64-010e-40f4-a27e-6d1252a0c537
245+
test: document.querySelector('.o-cookie-message') === null
161246
- domains:
162247
- myprivacy.dpgmedia.be
163248
- myprivacy.dpgmedia.nl
@@ -172,6 +257,7 @@
172257
user-agent: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; Googlebot-News; +http://www.google.com/bot.html) Chrome/121.0.6140.0 Safari/537.36
173258
x-forwarded-for: none
174259
referer: https://news.google.com
260+
content-security-policy: "default-src * 'unsafe-inline' 'unsafe-eval' data: blob:;"
175261
regexRules:
176262
- match: (\s&&\s)?window\.temptation(\s&&\s)?(\.init)?(\s&&\s)?(\(([^)]\s*)*\);)?
177263
replace: true
@@ -187,25 +273,56 @@
187273
document.querySelector('div[data-advert-placeholder-collapses]').remove();
188274
});
189275
</script>
276+
tests:
277+
- url: https://www.demorgen.be/nieuws/verkiezingen-2024-zullen-uitdraaien-op-een-strijd-tussen-vivaldi-en-bourgeois-blok~b0f7b8a9/
278+
test: document.querySelector('div[data-temptation-position="ARTICLE_BOTTOM"]') === null
190279

191-
- domain: www.ft.com
280+
- domains:
281+
- apache.be
192282
headers:
193-
referer: https://t.co/x?amp=1
283+
x-forwarded-for: none
284+
cookie: cookiesjsr=%7B%22base%22%3Afalse%2C%22functional%22%3Afalse%2C%22video%22%3Afalse%7D
194285
injections:
195286
- position: head
196287
append: |
197288
<script>
198289
document.addEventListener("DOMContentLoaded", () => {
199-
const styleTags = document.querySelectorAll('link[rel="stylesheet"]');
200-
styleTags.forEach(el => {
201-
const href = el.getAttribute('href').substring(1);
202-
const updatedHref = href.replace(/(https?:\/\/.+?)\/{2,}/, '$1/');
203-
el.setAttribute('href', updatedHref);
204-
});
205-
setTimeout(() => {
206-
const cookie = document.querySelectorAll('.o-cookie-message, .js-article-ribbon, .o-ads, .o-banner, .o-message, .article__content-sign-up');
207-
cookie.forEach(el => { el.remove(); });
208-
}, 1000);
209-
})
290+
// remove paywall
291+
document.querySelector("#spb-block-apachepopupblock").remove();
292+
// restore scrolling
293+
document.body.style.overflow = "auto";
294+
});
295+
</script>
296+
tests:
297+
- url: https://apache.be/2024/03/25/chinese-spionkop-van-vlaams-belang
298+
test: document.querySelector('#spb-block-apachepopupblock') === null
299+
300+
- domains:
301+
- kw.be
302+
headers:
303+
x-forwarded-for: none
304+
referer: https://news.google.com
305+
user-agent: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; Googlebot-News; +http://www.google.com/bot.html) Chrome/121.0.6140.0 Safari/537.36
306+
injections:
307+
- position: head
308+
append: |
309+
<script>
310+
document.addEventListener("DOMContentLoaded", () => {
311+
// remove paywall
312+
document.querySelector("#paywall-modal").remove();
313+
});
314+
</script>
315+
- position: head
316+
append: |
317+
<script>
318+
document.addEventListener("scroll", () => {
319+
// reset overflow
320+
let htmlObject = document.getElementsByTagName("html")[0];
321+
htmlObject.classList.remove("is-locked", "has-paywall");
322+
htmlObject.style.overflow = "auto";
323+
});
210324
</script>
325+
tests:
326+
- url: https://kw.be/nieuws/criminaliteit/geweld/in-40-jaar-nog-nooit-meegemaakt-chauffeur-meense-touroperator-krijgt-slag-in-gezicht-na-aanrijding-in-frankrijk/
327+
test: document.querySelector('#paywall-modal') === null
211328

rulesets/be/apache.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
- domains:
2+
- apache.be
3+
headers:
4+
x-forwarded-for: none
5+
cookie: cookiesjsr=%7B%22base%22%3Afalse%2C%22functional%22%3Afalse%2C%22video%22%3Afalse%7D
6+
injections:
7+
- position: head
8+
append: |
9+
<script>
10+
document.addEventListener("DOMContentLoaded", () => {
11+
// remove paywall
12+
document.querySelector("#spb-block-apachepopupblock").remove();
13+
// restore scrolling
14+
document.body.style.overflow = "auto";
15+
});
16+
</script>
17+
tests:
18+
- url: https://apache.be/2024/03/25/chinese-spionkop-van-vlaams-belang
19+
test: document.querySelector('#spb-block-apachepopupblock') === null

0 commit comments

Comments
 (0)