@whotracksme/reporting 10.0.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/package.json +1 -1
- package/reporting/snapshots/0001/snapshot.json +13 -13
- package/reporting/snapshots/0003/snapshot.json +5 -5
- package/reporting/snapshots/0005/snapshot.json +13 -13
- package/reporting/src/request/config.js +1 -1
- package/reporting/src/request/index.js +7 -1
- package/reporting/src/request/page-store.js +18 -3
- package/reporting/src/url-analyzer.js +6 -0
- package/reporting/test/doublefetch-page-handler.spec.js +346 -0
- package/reporting/test/url-analyzer.spec.js +29 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
# v11.0.0 (Tue Jun 23 2026)
|
|
2
|
+
|
|
3
|
+
#### 💥 Breaking Change
|
|
4
|
+
|
|
5
|
+
- Analogous to wtm.popularity, attach information on the adblocker state to tp_events: [#214](https://github.com/whotracksme/webextension-packages/pull/214) ([@philipp-classen](https://github.com/philipp-classen))
|
|
6
|
+
|
|
7
|
+
#### 📝 Documentation
|
|
8
|
+
|
|
9
|
+
- Add some missing tests for the changed double-fetch logic [#213](https://github.com/whotracksme/webextension-packages/pull/213) ([@philipp-classen](https://github.com/philipp-classen))
|
|
10
|
+
|
|
11
|
+
#### Authors: 1
|
|
12
|
+
|
|
13
|
+
- Philipp Claßen ([@philipp-classen](https://github.com/philipp-classen))
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# v10.1.0 (Mon Jun 08 2026)
|
|
18
|
+
|
|
19
|
+
#### 🚀 Enhancement
|
|
20
|
+
|
|
21
|
+
- Add Qwant to the list of search engines [#212](https://github.com/whotracksme/webextension-packages/pull/212) ([@philipp-classen](https://github.com/philipp-classen))
|
|
22
|
+
|
|
23
|
+
#### Authors: 1
|
|
24
|
+
|
|
25
|
+
- Philipp Claßen ([@philipp-classen](https://github.com/philipp-classen))
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
1
29
|
# v10.0.0 (Wed Jun 03 2026)
|
|
2
30
|
|
|
3
31
|
#### 💥 Breaking Change
|
package/package.json
CHANGED
|
@@ -1627,7 +1627,7 @@
|
|
|
1627
1627
|
],
|
|
1628
1628
|
"day": "2018-10-11",
|
|
1629
1629
|
"ts": "",
|
|
1630
|
-
"ver": "0.
|
|
1630
|
+
"ver": "0.107"
|
|
1631
1631
|
},
|
|
1632
1632
|
"ts": "",
|
|
1633
1633
|
"type": "wtm.request",
|
|
@@ -3271,7 +3271,7 @@
|
|
|
3271
3271
|
],
|
|
3272
3272
|
"day": "2018-10-11",
|
|
3273
3273
|
"ts": "",
|
|
3274
|
-
"ver": "0.
|
|
3274
|
+
"ver": "0.107"
|
|
3275
3275
|
},
|
|
3276
3276
|
"ts": "",
|
|
3277
3277
|
"type": "wtm.request",
|
|
@@ -3292,7 +3292,7 @@
|
|
|
3292
3292
|
],
|
|
3293
3293
|
"day": "2018-10-11",
|
|
3294
3294
|
"ts": "",
|
|
3295
|
-
"ver": "0.
|
|
3295
|
+
"ver": "0.107"
|
|
3296
3296
|
},
|
|
3297
3297
|
"ts": "",
|
|
3298
3298
|
"type": "wtm.request",
|
|
@@ -3482,7 +3482,7 @@
|
|
|
3482
3482
|
],
|
|
3483
3483
|
"day": "2018-10-11",
|
|
3484
3484
|
"ts": "",
|
|
3485
|
-
"ver": "0.
|
|
3485
|
+
"ver": "0.107"
|
|
3486
3486
|
},
|
|
3487
3487
|
"ts": "",
|
|
3488
3488
|
"type": "wtm.request",
|
|
@@ -3672,7 +3672,7 @@
|
|
|
3672
3672
|
],
|
|
3673
3673
|
"day": "2018-10-11",
|
|
3674
3674
|
"ts": "",
|
|
3675
|
-
"ver": "0.
|
|
3675
|
+
"ver": "0.107"
|
|
3676
3676
|
},
|
|
3677
3677
|
"ts": "",
|
|
3678
3678
|
"type": "wtm.request",
|
|
@@ -3698,7 +3698,7 @@
|
|
|
3698
3698
|
],
|
|
3699
3699
|
"day": "2018-10-11",
|
|
3700
3700
|
"ts": "",
|
|
3701
|
-
"ver": "0.
|
|
3701
|
+
"ver": "0.107"
|
|
3702
3702
|
},
|
|
3703
3703
|
"ts": "",
|
|
3704
3704
|
"type": "wtm.request",
|
|
@@ -3724,7 +3724,7 @@
|
|
|
3724
3724
|
],
|
|
3725
3725
|
"day": "2018-10-11",
|
|
3726
3726
|
"ts": "",
|
|
3727
|
-
"ver": "0.
|
|
3727
|
+
"ver": "0.107"
|
|
3728
3728
|
},
|
|
3729
3729
|
"ts": "",
|
|
3730
3730
|
"type": "wtm.request",
|
|
@@ -3750,7 +3750,7 @@
|
|
|
3750
3750
|
],
|
|
3751
3751
|
"day": "2018-10-11",
|
|
3752
3752
|
"ts": "",
|
|
3753
|
-
"ver": "0.
|
|
3753
|
+
"ver": "0.107"
|
|
3754
3754
|
},
|
|
3755
3755
|
"ts": "",
|
|
3756
3756
|
"type": "wtm.request",
|
|
@@ -3776,7 +3776,7 @@
|
|
|
3776
3776
|
],
|
|
3777
3777
|
"day": "2018-10-11",
|
|
3778
3778
|
"ts": "",
|
|
3779
|
-
"ver": "0.
|
|
3779
|
+
"ver": "0.107"
|
|
3780
3780
|
},
|
|
3781
3781
|
"ts": "",
|
|
3782
3782
|
"type": "wtm.request",
|
|
@@ -3802,7 +3802,7 @@
|
|
|
3802
3802
|
],
|
|
3803
3803
|
"day": "2018-10-11",
|
|
3804
3804
|
"ts": "",
|
|
3805
|
-
"ver": "0.
|
|
3805
|
+
"ver": "0.107"
|
|
3806
3806
|
},
|
|
3807
3807
|
"ts": "",
|
|
3808
3808
|
"type": "wtm.request",
|
|
@@ -3828,7 +3828,7 @@
|
|
|
3828
3828
|
],
|
|
3829
3829
|
"day": "2018-10-11",
|
|
3830
3830
|
"ts": "",
|
|
3831
|
-
"ver": "0.
|
|
3831
|
+
"ver": "0.107"
|
|
3832
3832
|
},
|
|
3833
3833
|
"ts": "",
|
|
3834
3834
|
"type": "wtm.request",
|
|
@@ -3854,7 +3854,7 @@
|
|
|
3854
3854
|
],
|
|
3855
3855
|
"day": "2018-10-11",
|
|
3856
3856
|
"ts": "",
|
|
3857
|
-
"ver": "0.
|
|
3857
|
+
"ver": "0.107"
|
|
3858
3858
|
},
|
|
3859
3859
|
"ts": "",
|
|
3860
3860
|
"type": "wtm.request",
|
|
@@ -3880,7 +3880,7 @@
|
|
|
3880
3880
|
],
|
|
3881
3881
|
"day": "2018-10-11",
|
|
3882
3882
|
"ts": "",
|
|
3883
|
-
"ver": "0.
|
|
3883
|
+
"ver": "0.107"
|
|
3884
3884
|
},
|
|
3885
3885
|
"ts": "",
|
|
3886
3886
|
"type": "wtm.request",
|
|
@@ -192,7 +192,7 @@
|
|
|
192
192
|
],
|
|
193
193
|
"day": "2018-10-11",
|
|
194
194
|
"ts": "",
|
|
195
|
-
"ver": "0.
|
|
195
|
+
"ver": "0.107"
|
|
196
196
|
},
|
|
197
197
|
"ts": "",
|
|
198
198
|
"type": "wtm.request",
|
|
@@ -394,7 +394,7 @@
|
|
|
394
394
|
],
|
|
395
395
|
"day": "2018-10-11",
|
|
396
396
|
"ts": "",
|
|
397
|
-
"ver": "0.
|
|
397
|
+
"ver": "0.107"
|
|
398
398
|
},
|
|
399
399
|
"ts": "",
|
|
400
400
|
"type": "wtm.request",
|
|
@@ -415,7 +415,7 @@
|
|
|
415
415
|
],
|
|
416
416
|
"day": "2018-10-11",
|
|
417
417
|
"ts": "",
|
|
418
|
-
"ver": "0.
|
|
418
|
+
"ver": "0.107"
|
|
419
419
|
},
|
|
420
420
|
"ts": "",
|
|
421
421
|
"type": "wtm.request",
|
|
@@ -605,7 +605,7 @@
|
|
|
605
605
|
],
|
|
606
606
|
"day": "2018-10-11",
|
|
607
607
|
"ts": "",
|
|
608
|
-
"ver": "0.
|
|
608
|
+
"ver": "0.107"
|
|
609
609
|
},
|
|
610
610
|
"ts": "",
|
|
611
611
|
"type": "wtm.request",
|
|
@@ -795,7 +795,7 @@
|
|
|
795
795
|
],
|
|
796
796
|
"day": "2018-10-11",
|
|
797
797
|
"ts": "",
|
|
798
|
-
"ver": "0.
|
|
798
|
+
"ver": "0.107"
|
|
799
799
|
},
|
|
800
800
|
"ts": "",
|
|
801
801
|
"type": "wtm.request",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
],
|
|
127
127
|
"day": "2018-10-11",
|
|
128
128
|
"ts": "",
|
|
129
|
-
"ver": "0.
|
|
129
|
+
"ver": "0.107"
|
|
130
130
|
},
|
|
131
131
|
"ts": "",
|
|
132
132
|
"type": "wtm.request",
|
|
@@ -239,7 +239,7 @@
|
|
|
239
239
|
],
|
|
240
240
|
"day": "2018-10-11",
|
|
241
241
|
"ts": "",
|
|
242
|
-
"ver": "0.
|
|
242
|
+
"ver": "0.107"
|
|
243
243
|
},
|
|
244
244
|
"ts": "",
|
|
245
245
|
"type": "wtm.request",
|
|
@@ -680,7 +680,7 @@
|
|
|
680
680
|
],
|
|
681
681
|
"day": "2018-10-11",
|
|
682
682
|
"ts": "",
|
|
683
|
-
"ver": "0.
|
|
683
|
+
"ver": "0.107"
|
|
684
684
|
},
|
|
685
685
|
"ts": "",
|
|
686
686
|
"type": "wtm.request",
|
|
@@ -1142,7 +1142,7 @@
|
|
|
1142
1142
|
],
|
|
1143
1143
|
"day": "2018-10-11",
|
|
1144
1144
|
"ts": "",
|
|
1145
|
-
"ver": "0.
|
|
1145
|
+
"ver": "0.107"
|
|
1146
1146
|
},
|
|
1147
1147
|
"ts": "",
|
|
1148
1148
|
"type": "wtm.request",
|
|
@@ -1275,7 +1275,7 @@
|
|
|
1275
1275
|
],
|
|
1276
1276
|
"day": "2018-10-11",
|
|
1277
1277
|
"ts": "",
|
|
1278
|
-
"ver": "0.
|
|
1278
|
+
"ver": "0.107"
|
|
1279
1279
|
},
|
|
1280
1280
|
"ts": "",
|
|
1281
1281
|
"type": "wtm.request",
|
|
@@ -1388,7 +1388,7 @@
|
|
|
1388
1388
|
],
|
|
1389
1389
|
"day": "2018-10-11",
|
|
1390
1390
|
"ts": "",
|
|
1391
|
-
"ver": "0.
|
|
1391
|
+
"ver": "0.107"
|
|
1392
1392
|
},
|
|
1393
1393
|
"ts": "",
|
|
1394
1394
|
"type": "wtm.request",
|
|
@@ -1829,7 +1829,7 @@
|
|
|
1829
1829
|
],
|
|
1830
1830
|
"day": "2018-10-11",
|
|
1831
1831
|
"ts": "",
|
|
1832
|
-
"ver": "0.
|
|
1832
|
+
"ver": "0.107"
|
|
1833
1833
|
},
|
|
1834
1834
|
"ts": "",
|
|
1835
1835
|
"type": "wtm.request",
|
|
@@ -2291,7 +2291,7 @@
|
|
|
2291
2291
|
],
|
|
2292
2292
|
"day": "2018-10-11",
|
|
2293
2293
|
"ts": "",
|
|
2294
|
-
"ver": "0.
|
|
2294
|
+
"ver": "0.107"
|
|
2295
2295
|
},
|
|
2296
2296
|
"ts": "",
|
|
2297
2297
|
"type": "wtm.request",
|
|
@@ -2312,7 +2312,7 @@
|
|
|
2312
2312
|
],
|
|
2313
2313
|
"day": "2018-10-11",
|
|
2314
2314
|
"ts": "",
|
|
2315
|
-
"ver": "0.
|
|
2315
|
+
"ver": "0.107"
|
|
2316
2316
|
},
|
|
2317
2317
|
"ts": "",
|
|
2318
2318
|
"type": "wtm.request",
|
|
@@ -4598,7 +4598,7 @@
|
|
|
4598
4598
|
],
|
|
4599
4599
|
"day": "2018-10-11",
|
|
4600
4600
|
"ts": "",
|
|
4601
|
-
"ver": "0.
|
|
4601
|
+
"ver": "0.107"
|
|
4602
4602
|
},
|
|
4603
4603
|
"ts": "",
|
|
4604
4604
|
"type": "wtm.request",
|
|
@@ -6888,7 +6888,7 @@
|
|
|
6888
6888
|
],
|
|
6889
6889
|
"day": "2018-10-11",
|
|
6890
6890
|
"ts": "",
|
|
6891
|
-
"ver": "0.
|
|
6891
|
+
"ver": "0.107"
|
|
6892
6892
|
},
|
|
6893
6893
|
"ts": "",
|
|
6894
6894
|
"type": "wtm.request",
|
|
@@ -6914,7 +6914,7 @@
|
|
|
6914
6914
|
],
|
|
6915
6915
|
"day": "2018-10-11",
|
|
6916
6916
|
"ts": "",
|
|
6917
|
-
"ver": "0.
|
|
6917
|
+
"ver": "0.107"
|
|
6918
6918
|
},
|
|
6919
6919
|
"ts": "",
|
|
6920
6920
|
"type": "wtm.request",
|
|
@@ -6940,7 +6940,7 @@
|
|
|
6940
6940
|
],
|
|
6941
6941
|
"day": "2018-10-11",
|
|
6942
6942
|
"ts": "",
|
|
6943
|
-
"ver": "0.
|
|
6943
|
+
"ver": "0.107"
|
|
6944
6944
|
},
|
|
6945
6945
|
"ts": "",
|
|
6946
6946
|
"type": "wtm.request",
|
|
@@ -65,6 +65,7 @@ export default class RequestReporter {
|
|
|
65
65
|
},
|
|
66
66
|
isRequestAllowed = () => false,
|
|
67
67
|
dryRunMode = false,
|
|
68
|
+
pauseState, // see Reporting#constructor (../reporting.js)
|
|
68
69
|
},
|
|
69
70
|
) {
|
|
70
71
|
this.settings = settings;
|
|
@@ -88,6 +89,7 @@ export default class RequestReporter {
|
|
|
88
89
|
this.whitelistedRequestCache = new Set();
|
|
89
90
|
this.pageStore = new PageStore({
|
|
90
91
|
notifyPageStageListeners: this.onPageStaged.bind(this),
|
|
92
|
+
pauseState,
|
|
91
93
|
});
|
|
92
94
|
// Dedupe tp_events by root documentId so a SW restart that
|
|
93
95
|
// re-flushes a not-yet-persisted #pages.delete can't emit the
|
|
@@ -765,7 +767,7 @@ function truncatePath(path) {
|
|
|
765
767
|
function buildPageLoadObject(page) {
|
|
766
768
|
const urlParts = parse(page.url);
|
|
767
769
|
const tps = { ...page.requestStats };
|
|
768
|
-
|
|
770
|
+
const obj = {
|
|
769
771
|
hostname: truncatedHash(urlParts.hostname),
|
|
770
772
|
path: truncatedHash(truncatePath(urlParts.path)),
|
|
771
773
|
scheme: urlParts.scheme,
|
|
@@ -783,4 +785,8 @@ function buildPageLoadObject(page) {
|
|
|
783
785
|
tsv_id: false,
|
|
784
786
|
frames: {},
|
|
785
787
|
};
|
|
788
|
+
if (page.adblocker) {
|
|
789
|
+
obj.adblocker = page.adblocker;
|
|
790
|
+
}
|
|
791
|
+
return obj;
|
|
786
792
|
}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import logger from '../logger.js';
|
|
13
|
+
import { parse } from '../utils/url.js';
|
|
13
14
|
import ChromeStorageMap from './utils/chrome-storage-map.js';
|
|
14
15
|
|
|
15
16
|
const PAGE_TTL = 1000 * 60 * 60; // 1 hour
|
|
@@ -34,7 +35,7 @@ function makePageActive(page, active) {
|
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
function createPage({ tabId, documentId, url, isPrivate, active }) {
|
|
38
|
+
function createPage({ tabId, documentId, url, adblocker, isPrivate, active }) {
|
|
38
39
|
return {
|
|
39
40
|
id: tabId,
|
|
40
41
|
documentId,
|
|
@@ -55,6 +56,7 @@ function createPage({ tabId, documentId, url, isPrivate, active }) {
|
|
|
55
56
|
requestStats: {},
|
|
56
57
|
annotations: {},
|
|
57
58
|
counter: 0,
|
|
59
|
+
adblocker,
|
|
58
60
|
};
|
|
59
61
|
}
|
|
60
62
|
|
|
@@ -68,8 +70,10 @@ export default class PageStore {
|
|
|
68
70
|
// inherits the current tab's flags.
|
|
69
71
|
#tabContext;
|
|
70
72
|
#lastFlush = 0;
|
|
73
|
+
// analog to urlReporter (optional pause integration)
|
|
74
|
+
#pauseState;
|
|
71
75
|
|
|
72
|
-
constructor({ notifyPageStageListeners }) {
|
|
76
|
+
constructor({ notifyPageStageListeners, pauseState }) {
|
|
73
77
|
this.#pages = new ChromeStorageMap({
|
|
74
78
|
storageKey: 'wtm-request-reporting:page-store:pages',
|
|
75
79
|
ttlInMs: PAGE_TTL,
|
|
@@ -77,6 +81,16 @@ export default class PageStore {
|
|
|
77
81
|
this.#documentIndex = new Map();
|
|
78
82
|
this.#tabContext = new Map();
|
|
79
83
|
this.#notifyPageStageListeners = notifyPageStageListeners;
|
|
84
|
+
this.#pauseState = pauseState;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
#adblockerStateFor(url) {
|
|
88
|
+
if (!this.#pauseState) return undefined;
|
|
89
|
+
const { hostname } = parse(url);
|
|
90
|
+
return {
|
|
91
|
+
paused: this.#pauseState.isHostnamePaused(hostname),
|
|
92
|
+
mode: this.#pauseState.getFilteringMode(),
|
|
93
|
+
};
|
|
80
94
|
}
|
|
81
95
|
|
|
82
96
|
async init() {
|
|
@@ -287,7 +301,8 @@ export default class PageStore {
|
|
|
287
301
|
let page = this.#pages.get(documentId);
|
|
288
302
|
if (!page) {
|
|
289
303
|
const ctx = this.#tabContext.get(tabId) || {};
|
|
290
|
-
|
|
304
|
+
const adblocker = this.#adblockerStateFor(url);
|
|
305
|
+
page = createPage({ tabId, documentId, url, adblocker, ...ctx });
|
|
291
306
|
}
|
|
292
307
|
page.url = url;
|
|
293
308
|
page.stageAfter = null;
|
|
@@ -119,6 +119,12 @@ const URL_PATTERNS = [
|
|
|
119
119
|
/^https:[/][/]www[.]ecosia[.]org[/]search[?](?:method=index&)?q=[^&]+/,
|
|
120
120
|
prefix: 'search?q=',
|
|
121
121
|
},
|
|
122
|
+
{
|
|
123
|
+
category: 'search-qw',
|
|
124
|
+
regexp:
|
|
125
|
+
/^https:[/][/]www[.]qwant[.]com[/].*[?&]((q=[^&]+&([^&]+&)*t=web)|(t=web&([^&]+&)*q=[^&]+))/,
|
|
126
|
+
prefix: '?q=',
|
|
127
|
+
},
|
|
122
128
|
];
|
|
123
129
|
|
|
124
130
|
export default class UrlAnalyzer {
|
|
@@ -311,6 +311,352 @@ describe('DoublefetchPageHandler', function () {
|
|
|
311
311
|
},
|
|
312
312
|
});
|
|
313
313
|
});
|
|
314
|
+
|
|
315
|
+
describe('[youtube]', function () {
|
|
316
|
+
it('should work on the main youtube.com site (full reload)', async function () {
|
|
317
|
+
const page = {
|
|
318
|
+
aggregator: {
|
|
319
|
+
firstSeenAt: 1778516689605,
|
|
320
|
+
lastSeenAt: 1778516689609,
|
|
321
|
+
lastWrittenAt: 1778516782817,
|
|
322
|
+
activity: 0.08244583333333333,
|
|
323
|
+
},
|
|
324
|
+
url: 'https://www.youtube.com/',
|
|
325
|
+
status: 'complete',
|
|
326
|
+
pageLoadMethod: 'full-page-load',
|
|
327
|
+
title: 'YouTube',
|
|
328
|
+
preDoublefetch: {
|
|
329
|
+
meta: {
|
|
330
|
+
canonicalUrl: 'https://www.youtube.com/',
|
|
331
|
+
contentType: 'text/html',
|
|
332
|
+
language: 'en',
|
|
333
|
+
og: {
|
|
334
|
+
image: 'https://www.youtube.com/img/desktop/yt_1200.png',
|
|
335
|
+
title: 'YouTube',
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
noindex: false,
|
|
339
|
+
requestedIndex: false,
|
|
340
|
+
title: 'YouTube',
|
|
341
|
+
url: 'https://www.youtube.com/',
|
|
342
|
+
lastUpdatedAt: 1778516689604,
|
|
343
|
+
},
|
|
344
|
+
lastUpdatedAt: 1778516689606,
|
|
345
|
+
lang: 'en',
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
pageFetcherMock.reconfig({
|
|
349
|
+
'https://www.youtube.com/': {
|
|
350
|
+
title: 'YouTube',
|
|
351
|
+
meta: {
|
|
352
|
+
canonicalUrl: 'https://www.youtube.com/',
|
|
353
|
+
language: 'en',
|
|
354
|
+
contentType: null,
|
|
355
|
+
og: {
|
|
356
|
+
title: 'YouTube',
|
|
357
|
+
image: 'https://www.youtube.com/img/desktop/yt_1200.png',
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
noindex: false,
|
|
361
|
+
requestedIndex: false,
|
|
362
|
+
},
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
const { ok, safePage } = await uut.runJob(page);
|
|
366
|
+
|
|
367
|
+
expect(ok).to.be.true;
|
|
368
|
+
pageFetcherMock.expectAllFetchedOnce();
|
|
369
|
+
relaxedSafePageEqual(safePage, {
|
|
370
|
+
url: 'https://www.youtube.com/',
|
|
371
|
+
title: 'YouTube',
|
|
372
|
+
requestedIndex: false,
|
|
373
|
+
lang: {
|
|
374
|
+
html: 'en',
|
|
375
|
+
detect: 'en',
|
|
376
|
+
},
|
|
377
|
+
aggregator: {
|
|
378
|
+
activity: '0.0760',
|
|
379
|
+
},
|
|
380
|
+
canonicalUrl: 'https://www.youtube.com/',
|
|
381
|
+
});
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
it('should work when navigating to a YouTube video (history navigation)', async function () {
|
|
385
|
+
const page = {
|
|
386
|
+
aggregator: {
|
|
387
|
+
firstSeenAt: 1778516803897,
|
|
388
|
+
lastSeenAt: 1778516804977,
|
|
389
|
+
lastWrittenAt: 1778516818620,
|
|
390
|
+
activity: 0.0163625,
|
|
391
|
+
},
|
|
392
|
+
url: 'https://www.youtube.com/watch?v=5zIPXqRytRg',
|
|
393
|
+
status: 'complete',
|
|
394
|
+
pageLoadMethod: 'history-navigation',
|
|
395
|
+
title:
|
|
396
|
+
'Block Ads on Safari, iOS 18: Easy Ghostery Add-On Installation Guide 2025 - YouTube',
|
|
397
|
+
ref: 'https://www.youtube.com/results?search_query=ghostery',
|
|
398
|
+
preDoublefetch: {
|
|
399
|
+
meta: {
|
|
400
|
+
canonicalUrl: 'https://www.youtube.com/',
|
|
401
|
+
contentType: 'text/html',
|
|
402
|
+
language: 'en',
|
|
403
|
+
og: {
|
|
404
|
+
image: 'https://www.youtube.com/img/desktop/yt_1200.png',
|
|
405
|
+
title: 'YouTube',
|
|
406
|
+
},
|
|
407
|
+
},
|
|
408
|
+
noindex: false,
|
|
409
|
+
requestedIndex: false,
|
|
410
|
+
title: 'ghostery - YouTube',
|
|
411
|
+
url: 'https://www.youtube.com/watch?v=5zIPXqRytRg',
|
|
412
|
+
lastUpdatedAt: 1778516803897,
|
|
413
|
+
},
|
|
414
|
+
lastUpdatedAt: 1778516804977,
|
|
415
|
+
lang: 'en',
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
pageFetcherMock.reconfig({
|
|
419
|
+
'https://www.youtube.com/': {
|
|
420
|
+
title: 'YouTube',
|
|
421
|
+
meta: {
|
|
422
|
+
canonicalUrl: 'https://www.youtube.com/',
|
|
423
|
+
language: 'en',
|
|
424
|
+
contentType: null,
|
|
425
|
+
og: {
|
|
426
|
+
title: 'YouTube',
|
|
427
|
+
image: 'https://www.youtube.com/img/desktop/yt_1200.png',
|
|
428
|
+
},
|
|
429
|
+
},
|
|
430
|
+
noindex: false,
|
|
431
|
+
requestedIndex: false,
|
|
432
|
+
},
|
|
433
|
+
'https://www.youtube.com/watch?v=5zIPXqRytRg': {
|
|
434
|
+
title:
|
|
435
|
+
'Block Ads on Safari, iOS 18: Easy Ghostery Add-On Installation Guide 2025 - YouTube',
|
|
436
|
+
meta: {
|
|
437
|
+
canonicalUrl: 'https://www.youtube.com/watch?v=5zIPXqRytRg',
|
|
438
|
+
language: 'en',
|
|
439
|
+
contentType: null,
|
|
440
|
+
og: {
|
|
441
|
+
title:
|
|
442
|
+
'Block Ads on Safari, iOS 18: Easy Ghostery Add-On Installation Guide 2025',
|
|
443
|
+
url: 'https://www.youtube.com/watch?v=5zIPXqRytRg',
|
|
444
|
+
image:
|
|
445
|
+
'https://i.ytimg.com/vi/5zIPXqRytRg/maxresdefault.jpg?sqp=-oaymwEmCIAKENAF8quKqQMa8AEB-AH-CYAC0AWKAgwIABABGBEgXihyMA8=&rs=AOn4CLDOJbZPzcZ18B_lHkYO_aFbuNGeAA',
|
|
446
|
+
},
|
|
447
|
+
},
|
|
448
|
+
noindex: false,
|
|
449
|
+
requestedIndex: false,
|
|
450
|
+
},
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
const { ok, safePage } = await uut.runJob(page);
|
|
454
|
+
|
|
455
|
+
expect(ok).to.be.true;
|
|
456
|
+
pageFetcherMock.expectAllFetchedOnce();
|
|
457
|
+
relaxedSafePageEqual(safePage, {
|
|
458
|
+
url: 'https://www.youtube.com/watch?v=5zIPXqRytRg',
|
|
459
|
+
title:
|
|
460
|
+
'Block Ads on Safari, iOS 18: Easy Ghostery Add-On Installation Guide 2025 - YouTube',
|
|
461
|
+
requestedIndex: false,
|
|
462
|
+
lang: {
|
|
463
|
+
html: 'en',
|
|
464
|
+
detect: 'en',
|
|
465
|
+
},
|
|
466
|
+
aggregator: {
|
|
467
|
+
activity: '0.0149',
|
|
468
|
+
},
|
|
469
|
+
canonicalUrl: 'https://www.youtube.com/watch?v=5zIPXqRytRg',
|
|
470
|
+
ref: 'https://www.youtube.com/results?search_query=ghostery',
|
|
471
|
+
});
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
it('should work when navigating playlists', async function () {
|
|
475
|
+
const page = {
|
|
476
|
+
aggregator: {
|
|
477
|
+
firstSeenAt: 1781012426720,
|
|
478
|
+
lastSeenAt: 1781012428391,
|
|
479
|
+
lastWrittenAt: 1781012437446,
|
|
480
|
+
activity: 0.0131025,
|
|
481
|
+
},
|
|
482
|
+
url: 'https://www.youtube.com/watch?v=9nFlPviWyf8&list=RD9nFlPviWyf8&start_radio=1',
|
|
483
|
+
status: 'complete',
|
|
484
|
+
pageLoadMethod: 'history-navigation',
|
|
485
|
+
title:
|
|
486
|
+
'EPICA - Cry for the Moon (Live At The Symphonic Synergy) - YouTube',
|
|
487
|
+
ref: 'https://www.youtube.com/watch?v=1PXKYeAueUI&list=RD1PXKYeAueUI&start_radio=1',
|
|
488
|
+
preDoublefetch: {
|
|
489
|
+
meta: {
|
|
490
|
+
canonicalUrl: 'https://www.youtube.com/watch?v=1PXKYeAueUI',
|
|
491
|
+
contentType: 'text/html',
|
|
492
|
+
jsonld: [
|
|
493
|
+
{
|
|
494
|
+
'@context': 'https://schema.org',
|
|
495
|
+
'@id': 'https://www.youtube.com/watch?v=1PXKYeAueUI',
|
|
496
|
+
'@type': 'VideoObject',
|
|
497
|
+
duration: 'PT366S',
|
|
498
|
+
name: 'EPICA - Unleashed (Live At The Symphonic Synergy)',
|
|
499
|
+
uploadDate: '2025-07-31T09:00:02-07:00',
|
|
500
|
+
},
|
|
501
|
+
],
|
|
502
|
+
language: 'en',
|
|
503
|
+
og: {
|
|
504
|
+
image: 'https://www.youtube.com/img/desktop/yt_1200.png',
|
|
505
|
+
title: 'YouTube',
|
|
506
|
+
},
|
|
507
|
+
},
|
|
508
|
+
noindex: false,
|
|
509
|
+
requestedIndex: false,
|
|
510
|
+
title:
|
|
511
|
+
'EPICA - Unleashed (Live At The Symphonic Synergy) - YouTube',
|
|
512
|
+
url: 'https://www.youtube.com/watch?v=9nFlPviWyf8&list=RD9nFlPviWyf8&start_radio=1',
|
|
513
|
+
lastUpdatedAt: 1781012426720,
|
|
514
|
+
},
|
|
515
|
+
lastUpdatedAt: 1781012428390,
|
|
516
|
+
lang: 'en',
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
pageFetcherMock.reconfig({
|
|
520
|
+
// 1) original canonical URL (Note: this is a stale one)
|
|
521
|
+
'https://www.youtube.com/watch?v=1PXKYeAueUI': {
|
|
522
|
+
title:
|
|
523
|
+
'EPICA - Unleashed (Live At The Symphonic Synergy) - YouTube',
|
|
524
|
+
meta: {
|
|
525
|
+
canonicalUrl: 'https://www.youtube.com/watch?v=1PXKYeAueUI',
|
|
526
|
+
language: 'en',
|
|
527
|
+
contentType: null,
|
|
528
|
+
og: {
|
|
529
|
+
title: 'EPICA - Unleashed (Live At The Symphonic Synergy)',
|
|
530
|
+
url: 'https://www.youtube.com/watch?v=1PXKYeAueUI',
|
|
531
|
+
image: 'https://i.ytimg.com/vi/1PXKYeAueUI/maxresdefault.jpg',
|
|
532
|
+
},
|
|
533
|
+
jsonld: [
|
|
534
|
+
{
|
|
535
|
+
'@context': 'https://schema.org',
|
|
536
|
+
'@type': 'VideoObject',
|
|
537
|
+
'@id': 'https://www.youtube.com/watch?v=1PXKYeAueUI',
|
|
538
|
+
name: 'EPICA - Unleashed (Live At The Symphonic Synergy)',
|
|
539
|
+
uploadDate: '2025-07-31T09:00:02-07:00',
|
|
540
|
+
},
|
|
541
|
+
],
|
|
542
|
+
},
|
|
543
|
+
noindex: false,
|
|
544
|
+
requestedIndex: false,
|
|
545
|
+
},
|
|
546
|
+
|
|
547
|
+
// 2) original URL
|
|
548
|
+
'https://www.youtube.com/watch?v=9nFlPviWyf8&list=RD9nFlPviWyf8&start_radio=1':
|
|
549
|
+
{
|
|
550
|
+
title:
|
|
551
|
+
'EPICA - Cry for the Moon (Live At The Symphonic Synergy) - YouTube',
|
|
552
|
+
meta: {
|
|
553
|
+
canonicalUrl:
|
|
554
|
+
'https://www.youtube.com/watch?v=9nFlPviWyf8&list=RD9nFlPviWyf8',
|
|
555
|
+
language: 'en',
|
|
556
|
+
contentType: null,
|
|
557
|
+
og: {
|
|
558
|
+
title:
|
|
559
|
+
'EPICA - Cry for the Moon (Live At The Symphonic Synergy)',
|
|
560
|
+
url: 'https://www.youtube.com/watch?v=9nFlPviWyf8&list=RD9nFlPviWyf8',
|
|
561
|
+
image: 'https://i.ytimg.com/vi/9nFlPviWyf8/maxresdefault.jpg',
|
|
562
|
+
},
|
|
563
|
+
jsonld: [
|
|
564
|
+
{
|
|
565
|
+
'@context': 'https://schema.org',
|
|
566
|
+
'@type': 'VideoObject',
|
|
567
|
+
'@id': 'https://www.youtube.com/watch?v=9nFlPviWyf8',
|
|
568
|
+
name: 'EPICA - Cry for the Moon (Live At The Symphonic Synergy)',
|
|
569
|
+
uploadDate: '2025-08-26T08:00:27-07:00',
|
|
570
|
+
},
|
|
571
|
+
],
|
|
572
|
+
},
|
|
573
|
+
noindex: true,
|
|
574
|
+
requestedIndex: false,
|
|
575
|
+
},
|
|
576
|
+
|
|
577
|
+
// 3) canonical URL found on the HTML of the double-fetched original URL (step 2)
|
|
578
|
+
'https://www.youtube.com/watch?v=9nFlPviWyf8&list=RD9nFlPviWyf8': {
|
|
579
|
+
title:
|
|
580
|
+
'EPICA - Cry for the Moon (Live At The Symphonic Synergy) - YouTube',
|
|
581
|
+
meta: {
|
|
582
|
+
canonicalUrl:
|
|
583
|
+
'https://www.youtube.com/watch?v=9nFlPviWyf8&list=RD9nFlPviWyf8',
|
|
584
|
+
language: 'en',
|
|
585
|
+
contentType: null,
|
|
586
|
+
og: {
|
|
587
|
+
title:
|
|
588
|
+
'EPICA - Cry for the Moon (Live At The Symphonic Synergy)',
|
|
589
|
+
url: 'https://www.youtube.com/watch?v=9nFlPviWyf8&list=RD9nFlPviWyf8',
|
|
590
|
+
image: 'https://i.ytimg.com/vi/9nFlPviWyf8/maxresdefault.jpg',
|
|
591
|
+
},
|
|
592
|
+
jsonld: [
|
|
593
|
+
{
|
|
594
|
+
'@context': 'https://schema.org',
|
|
595
|
+
'@type': 'VideoObject',
|
|
596
|
+
'@id': 'https://www.youtube.com/watch?v=9nFlPviWyf8',
|
|
597
|
+
name: 'EPICA - Cry for the Moon (Live At The Symphonic Synergy)',
|
|
598
|
+
uploadDate: '2025-08-26T08:00:27-07:00',
|
|
599
|
+
},
|
|
600
|
+
],
|
|
601
|
+
},
|
|
602
|
+
noindex: true,
|
|
603
|
+
requestedIndex: false,
|
|
604
|
+
},
|
|
605
|
+
|
|
606
|
+
// 4) JSON-LD URL found on the HML of the double-fetched canonical URL of the original page (from step 3)
|
|
607
|
+
'https://www.youtube.com/watch?v=9nFlPviWyf8': {
|
|
608
|
+
title:
|
|
609
|
+
'EPICA - Cry for the Moon (Live At The Symphonic Synergy) - YouTube',
|
|
610
|
+
meta: {
|
|
611
|
+
canonicalUrl: 'https://www.youtube.com/watch?v=9nFlPviWyf8',
|
|
612
|
+
language: 'en',
|
|
613
|
+
contentType: null,
|
|
614
|
+
og: {
|
|
615
|
+
title:
|
|
616
|
+
'EPICA - Cry for the Moon (Live At The Symphonic Synergy)',
|
|
617
|
+
url: 'https://www.youtube.com/watch?v=9nFlPviWyf8',
|
|
618
|
+
image: 'https://i.ytimg.com/vi/9nFlPviWyf8/maxresdefault.jpg',
|
|
619
|
+
},
|
|
620
|
+
jsonld: [
|
|
621
|
+
{
|
|
622
|
+
'@context': 'https://schema.org',
|
|
623
|
+
'@type': 'VideoObject',
|
|
624
|
+
'@id': 'https://www.youtube.com/watch?v=9nFlPviWyf8',
|
|
625
|
+
name: 'EPICA - Cry for the Moon (Live At The Symphonic Synergy)',
|
|
626
|
+
uploadDate: '2025-08-26T08:00:27-07:00',
|
|
627
|
+
},
|
|
628
|
+
],
|
|
629
|
+
},
|
|
630
|
+
noindex: false,
|
|
631
|
+
requestedIndex: false,
|
|
632
|
+
},
|
|
633
|
+
});
|
|
634
|
+
|
|
635
|
+
const { ok, safePage } = await uut.runJob(page);
|
|
636
|
+
|
|
637
|
+
expect(ok).to.be.true;
|
|
638
|
+
pageFetcherMock.expectAllFetchedOnce();
|
|
639
|
+
relaxedSafePageEqual(safePage, {
|
|
640
|
+
url: 'https://www.youtube.com/watch?v=9nFlPviWyf8',
|
|
641
|
+
title:
|
|
642
|
+
'EPICA - Cry for the Moon (Live At The Symphonic Synergy) - YouTube',
|
|
643
|
+
requestedIndex: false,
|
|
644
|
+
lang: {
|
|
645
|
+
html: 'en',
|
|
646
|
+
detect: 'en',
|
|
647
|
+
},
|
|
648
|
+
aggregator: {
|
|
649
|
+
activity: '0.0131',
|
|
650
|
+
},
|
|
651
|
+
canonicalUrl: 'https://www.youtube.com/watch?v=9nFlPviWyf8',
|
|
652
|
+
ref: 'https://www.youtube.com/ (PROTECTED)',
|
|
653
|
+
jsonld: {
|
|
654
|
+
type: 'VideoObject',
|
|
655
|
+
uploadDate: '2025-08-26T08:00:27-07:00',
|
|
656
|
+
},
|
|
657
|
+
});
|
|
658
|
+
});
|
|
659
|
+
});
|
|
314
660
|
});
|
|
315
661
|
|
|
316
662
|
describe('when given a website with canonical URL', function () {
|
|
@@ -246,6 +246,30 @@ describe('#UrlAnalyzer', function () {
|
|
|
246
246
|
doublefetchUrl: 'https://html.duckduckgo.com/html?q=eiffel+tower',
|
|
247
247
|
},
|
|
248
248
|
},
|
|
249
|
+
'search-ec': {
|
|
250
|
+
'https://www.ecosia.org/search?method=index&q=eiffel+tower': {
|
|
251
|
+
query: 'eiffel tower',
|
|
252
|
+
doublefetchUrl: 'https://www.ecosia.org/search?q=eiffel+tower',
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
'search-qw': {
|
|
256
|
+
'https://www.qwant.com/?l=de%2F&q=eiffel+tower&t=web': {
|
|
257
|
+
query: 'eiffel tower',
|
|
258
|
+
doublefetchUrl: 'https://www.qwant.com/?q=eiffel+tower',
|
|
259
|
+
},
|
|
260
|
+
'https://www.qwant.com/?l=fr&sr=fr%2F&r=FR&q=eiffel+tower&t=web': {
|
|
261
|
+
query: 'eiffel tower',
|
|
262
|
+
doublefetchUrl: 'https://www.qwant.com/?q=eiffel+tower',
|
|
263
|
+
},
|
|
264
|
+
'https://www.qwant.com/?t=web&l=fr&sr=fr%2F&r=FR&q=eiffel+tower': {
|
|
265
|
+
query: 'eiffel tower',
|
|
266
|
+
doublefetchUrl: 'https://www.qwant.com/?q=eiffel+tower',
|
|
267
|
+
},
|
|
268
|
+
'https://www.qwant.com/?q=m%C3%BCnchen&client=opensearch&t=web': {
|
|
269
|
+
query: 'münchen',
|
|
270
|
+
doublefetchUrl: 'https://www.qwant.com/?q=m%C3%BCnchen',
|
|
271
|
+
},
|
|
272
|
+
},
|
|
249
273
|
})) {
|
|
250
274
|
describe(`and examples for category: ${expectedType}`, function () {
|
|
251
275
|
for (const [
|
|
@@ -289,6 +313,11 @@ describe('#UrlAnalyzer', function () {
|
|
|
289
313
|
'https://duckduckgo.com/?t=ffab&q=eiffel+tower&iax=videos&ia=videos',
|
|
290
314
|
'https://duckduckgo.com/?t=ffab&q=eiffel+tower&iar=news&ia=news',
|
|
291
315
|
'https://duckduckgo.com/?t=ffab&q=eiffel+tower&ia=news&iaxm=about',
|
|
316
|
+
'https://www.ecosia.org/images?q=eiffel%20tower',
|
|
317
|
+
'https://www.ecosia.org/ai-chat?q=eiffel+tower',
|
|
318
|
+
'https://www.qwant.com/?l=fr&sr=fr%2F&r=FR&t=images&q=eiffel+tower',
|
|
319
|
+
'https://www.qwant.com/?l=fr&sr=fr%2F&r=FR&t=videos&q=eiffel+tower',
|
|
320
|
+
'https://www.qwant.com/?l=fr&sr=fr%2F&r=FR&t=news&q=eiffel+tower',
|
|
292
321
|
]) {
|
|
293
322
|
it(`should not match ${url}`, function () {
|
|
294
323
|
const { isSupported, category, query } =
|