universal-parcel-scraper 0.368.0-main.2003 → 0.373.0-main.2014
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/README.md +2 -2
- package/data/catalog.json +32 -10
- package/data/coverage-summary.json +1 -1
- package/data/detection-golden.json +21 -0
- package/dist/browser/scraper.js +34 -12
- package/dist/carriers/atlantic-courier/carrier.json +1 -1
- package/dist/carriers/connect-couriers/adapter.d.ts +17 -0
- package/dist/carriers/connect-couriers/adapter.js +63 -0
- package/dist/carriers/connect-couriers/carrier.json +52 -7
- package/dist/carriers/connect-couriers/numbers.json +2 -2
- package/dist/carriers/connect-couriers/parser.d.ts +15 -0
- package/dist/carriers/connect-couriers/parser.js +188 -0
- package/dist/carriers/connect-couriers/status.d.ts +8 -0
- package/dist/carriers/connect-couriers/status.js +33 -0
- package/dist/carriers/connect-couriers/statuses.json +8 -1
- package/dist/carriers/jersey-post/adapter.d.ts +15 -0
- package/dist/carriers/jersey-post/adapter.js +55 -0
- package/dist/carriers/jersey-post/carrier.json +50 -8
- package/dist/carriers/jersey-post/numbers.json +2 -2
- package/dist/carriers/jersey-post/parser.d.ts +15 -0
- package/dist/carriers/jersey-post/parser.js +147 -0
- package/dist/carriers/jersey-post/status.d.ts +7 -0
- package/dist/carriers/jersey-post/status.js +44 -0
- package/dist/carriers/jersey-post/statuses.json +10 -2
- package/dist/carriers/ocs-ana/carrier.json +1 -1
- package/dist/carriers/posta-shqiptare/adapter.d.ts +15 -0
- package/dist/carriers/posta-shqiptare/adapter.js +73 -0
- package/dist/carriers/posta-shqiptare/carrier.json +42 -8
- package/dist/carriers/posta-shqiptare/numbers.json +32 -12
- package/dist/carriers/posta-shqiptare/parser.d.ts +14 -0
- package/dist/carriers/posta-shqiptare/parser.js +150 -0
- package/dist/carriers/posta-shqiptare/status.d.ts +11 -0
- package/dist/carriers/posta-shqiptare/status.js +53 -0
- package/dist/carriers/posta-shqiptare/statuses.json +15 -1
- package/dist/carriers/shipentegra/adapter.d.ts +15 -0
- package/dist/carriers/shipentegra/adapter.js +65 -0
- package/dist/carriers/shipentegra/carrier.json +44 -7
- package/dist/carriers/shipentegra/numbers.json +8 -8
- package/dist/carriers/shipentegra/parser.d.ts +21 -0
- package/dist/carriers/shipentegra/parser.js +172 -0
- package/dist/carriers/shipentegra/status.d.ts +9 -0
- package/dist/carriers/shipentegra/status.js +67 -0
- package/dist/carriers/shipentegra/statuses.json +36 -15
- package/dist/carriers/veloces/adapter.d.ts +15 -0
- package/dist/carriers/veloces/adapter.js +78 -0
- package/dist/carriers/veloces/carrier.json +52 -7
- package/dist/carriers/veloces/numbers.json +6 -6
- package/dist/carriers/veloces/parser.d.ts +12 -0
- package/dist/carriers/veloces/parser.js +133 -0
- package/dist/carriers/veloces/status.d.ts +7 -0
- package/dist/carriers/veloces/status.js +36 -0
- package/dist/carriers/veloces/statuses.json +20 -11
- package/dist/core/catalog/statusMaps.js +11 -4
- package/dist/data/catalog.json +32 -10
- package/dist/generated/catalog.d.ts +28 -10
- package/dist/generated/catalog.js +34 -12
- package/dist/generated/recognition.js +4 -0
- package/dist/generated/registry.js +15 -5
- package/dist/server/openapi.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ The engine behind [Peek](https://peektracker.com) ([GitHub](https://github.com/p
|
|
|
13
13
|
[](LICENSE)
|
|
14
14
|
|
|
15
15
|
<!-- GENERATED:summary -->
|
|
16
|
-
**3,500+ carriers** through **
|
|
16
|
+
**3,500+ carriers** through **403 dedicated adapters** and **5 universal fallbacks**
|
|
17
17
|
|
|
18
18
|
<sub>727 catalog entries · 133 countries represented</sub>
|
|
19
19
|
<!-- /GENERATED:summary -->
|
|
@@ -155,7 +155,7 @@ createTracker({ providers: ['ParcelsApp', 'Ship24', '17TRACK', 'Postal Ninja', '
|
|
|
155
155
|
<!-- GENERATED:stages -->
|
|
156
156
|
<img src="docs/assets/stages.svg" alt="DHL: Die Sendung wurde in das Zustellfahrzeug geladen.; Mondial Relay: En cours de livraison; Correios Brazil: Objeto saiu para entrega ao destinatário; Correos Express: EN REPARTO; Yamato Transport: 配達中; La Poste / Colissimo: DISTOU. All are filed under out_for_delivery." width="760">
|
|
157
157
|
|
|
158
|
-
The carrier folders record 13,
|
|
158
|
+
The carrier folders record 13,597 such statuses, each filed under one stage.
|
|
159
159
|
<!-- /GENERATED:stages -->
|
|
160
160
|
|
|
161
161
|
Wording nobody recorded yet goes through a classifier that reads seven European languages.
|
package/data/catalog.json
CHANGED
|
@@ -6581,7 +6581,7 @@
|
|
|
6581
6581
|
},
|
|
6582
6582
|
"atlantic-courier": {
|
|
6583
6583
|
"displayName": "Atlantic International Express",
|
|
6584
|
-
"color": "#
|
|
6584
|
+
"color": "#e31e24",
|
|
6585
6585
|
"aliases": [
|
|
6586
6586
|
"Atlantic International Express Courier"
|
|
6587
6587
|
],
|
|
@@ -8881,7 +8881,9 @@
|
|
|
8881
8881
|
"timezone": "Europe/Malta",
|
|
8882
8882
|
"tracking": {
|
|
8883
8883
|
"mode": "automatic",
|
|
8884
|
-
"adapter": "
|
|
8884
|
+
"adapter": "connect-couriers",
|
|
8885
|
+
"recognitionRank": 831,
|
|
8886
|
+
"localClocks": true
|
|
8885
8887
|
},
|
|
8886
8888
|
"canaryUrl": "https://www.connectcouriers.eu/tracking/",
|
|
8887
8889
|
"trackingUrlTemplate": "https://www.connectcouriers.eu/tracking/?tracking_number={trackingNumber}",
|
|
@@ -16391,7 +16393,9 @@
|
|
|
16391
16393
|
"timezone": "Europe/Jersey",
|
|
16392
16394
|
"tracking": {
|
|
16393
16395
|
"mode": "automatic",
|
|
16394
|
-
"adapter": "
|
|
16396
|
+
"adapter": "jersey-post",
|
|
16397
|
+
"recognitionRank": 832,
|
|
16398
|
+
"localClocks": true
|
|
16395
16399
|
},
|
|
16396
16400
|
"canaryUrl": "https://www.jerseypost.com/tools/track-trace/",
|
|
16397
16401
|
"trackingUrlTemplate": "https://www.jerseypost.com/tools/track-trace/?tq={trackingNumber}",
|
|
@@ -16407,7 +16411,14 @@
|
|
|
16407
16411
|
]
|
|
16408
16412
|
}
|
|
16409
16413
|
],
|
|
16410
|
-
"detectionRules": [
|
|
16414
|
+
"detectionRules": [
|
|
16415
|
+
{
|
|
16416
|
+
"pattern": "^[A-Z]{2}\\d{9}JE$",
|
|
16417
|
+
"confidence": "low",
|
|
16418
|
+
"checksum": "s10",
|
|
16419
|
+
"preferred": true
|
|
16420
|
+
}
|
|
16421
|
+
]
|
|
16411
16422
|
},
|
|
16412
16423
|
"jet-logistic": {
|
|
16413
16424
|
"displayName": "Jet Logistic",
|
|
@@ -19892,7 +19903,7 @@
|
|
|
19892
19903
|
},
|
|
19893
19904
|
"ocs-ana": {
|
|
19894
19905
|
"displayName": "OCS ANA Group",
|
|
19895
|
-
"color": "#
|
|
19906
|
+
"color": "#0a3382",
|
|
19896
19907
|
"aliases": [
|
|
19897
19908
|
"OCS",
|
|
19898
19909
|
"Overseas Courier Service",
|
|
@@ -22106,9 +22117,11 @@
|
|
|
22106
22117
|
"timezone": "Europe/Tirane",
|
|
22107
22118
|
"tracking": {
|
|
22108
22119
|
"mode": "automatic",
|
|
22109
|
-
"adapter": "
|
|
22120
|
+
"adapter": "posta-shqiptare",
|
|
22121
|
+
"recognitionRank": 829,
|
|
22122
|
+
"localClocks": true
|
|
22110
22123
|
},
|
|
22111
|
-
"canaryUrl": "https://
|
|
22124
|
+
"canaryUrl": "https://eposta.postashqiptare.al/tracking",
|
|
22112
22125
|
"trackingUrlTemplate": "https://eposta.postashqiptare.al/tracking/{trackingNumber}",
|
|
22113
22126
|
"trackingSearchUrl": "https://www.postashqiptare.al/c/207/tracked",
|
|
22114
22127
|
"linkRules": [
|
|
@@ -22119,7 +22132,14 @@
|
|
|
22119
22132
|
"path": "^/tracking/([^/?#]+)/?$"
|
|
22120
22133
|
}
|
|
22121
22134
|
],
|
|
22122
|
-
"detectionRules": [
|
|
22135
|
+
"detectionRules": [
|
|
22136
|
+
{
|
|
22137
|
+
"pattern": "^[A-Z]{2}\\d{9}AL$",
|
|
22138
|
+
"confidence": "low",
|
|
22139
|
+
"checksum": "s10",
|
|
22140
|
+
"preferred": true
|
|
22141
|
+
}
|
|
22142
|
+
]
|
|
22123
22143
|
},
|
|
22124
22144
|
"posta-slovenije": {
|
|
22125
22145
|
"displayName": "Pošta Slovenije",
|
|
@@ -24198,7 +24218,9 @@
|
|
|
24198
24218
|
"timezone": "Europe/Istanbul",
|
|
24199
24219
|
"tracking": {
|
|
24200
24220
|
"mode": "automatic",
|
|
24201
|
-
"adapter": "
|
|
24221
|
+
"adapter": "shipentegra",
|
|
24222
|
+
"recognitionRank": 833,
|
|
24223
|
+
"localClocks": true
|
|
24202
24224
|
},
|
|
24203
24225
|
"canaryUrl": "https://track.shipentegra.com/",
|
|
24204
24226
|
"trackingUrlTemplate": "https://track.shipentegra.com/?trackno={trackingNumber}",
|
|
@@ -27747,7 +27769,7 @@
|
|
|
27747
27769
|
"timezone": "America/Bogota",
|
|
27748
27770
|
"tracking": {
|
|
27749
27771
|
"mode": "automatic",
|
|
27750
|
-
"adapter": "
|
|
27772
|
+
"adapter": "veloces"
|
|
27751
27773
|
},
|
|
27752
27774
|
"canaryUrl": "https://tracking.veloces.app/",
|
|
27753
27775
|
"trackingUrlTemplate": "https://tracking.veloces.app/tracking-client/{trackingNumber}",
|
|
@@ -64492,6 +64492,7 @@
|
|
|
64492
64492
|
"intl-post"
|
|
64493
64493
|
],
|
|
64494
64494
|
"asked": [
|
|
64495
|
+
"posta-shqiptare",
|
|
64495
64496
|
"chronopost"
|
|
64496
64497
|
]
|
|
64497
64498
|
},
|
|
@@ -64562,6 +64563,7 @@
|
|
|
64562
64563
|
"intl-post"
|
|
64563
64564
|
],
|
|
64564
64565
|
"asked": [
|
|
64566
|
+
"posta-shqiptare",
|
|
64565
64567
|
"chronopost"
|
|
64566
64568
|
]
|
|
64567
64569
|
},
|
|
@@ -67006,6 +67008,19 @@
|
|
|
67006
67008
|
"intl-post"
|
|
67007
67009
|
],
|
|
67008
67010
|
"asked": [
|
|
67011
|
+
"posta-shqiptare",
|
|
67012
|
+
"chronopost"
|
|
67013
|
+
]
|
|
67014
|
+
},
|
|
67015
|
+
{
|
|
67016
|
+
"input": "EE200190512AL",
|
|
67017
|
+
"carrier": "intl-post",
|
|
67018
|
+
"confidence": "high",
|
|
67019
|
+
"candidates": [
|
|
67020
|
+
"intl-post"
|
|
67021
|
+
],
|
|
67022
|
+
"asked": [
|
|
67023
|
+
"posta-shqiptare",
|
|
67009
67024
|
"chronopost"
|
|
67010
67025
|
]
|
|
67011
67026
|
},
|
|
@@ -73651,6 +73666,7 @@
|
|
|
73651
73666
|
"intl-post"
|
|
73652
73667
|
],
|
|
73653
73668
|
"asked": [
|
|
73669
|
+
"posta-shqiptare",
|
|
73654
73670
|
"chronopost"
|
|
73655
73671
|
]
|
|
73656
73672
|
},
|
|
@@ -73662,6 +73678,7 @@
|
|
|
73662
73678
|
"intl-post"
|
|
73663
73679
|
],
|
|
73664
73680
|
"asked": [
|
|
73681
|
+
"posta-shqiptare",
|
|
73665
73682
|
"chronopost"
|
|
73666
73683
|
]
|
|
73667
73684
|
},
|
|
@@ -73673,6 +73690,7 @@
|
|
|
73673
73690
|
"intl-post"
|
|
73674
73691
|
],
|
|
73675
73692
|
"asked": [
|
|
73693
|
+
"posta-shqiptare",
|
|
73676
73694
|
"chronopost"
|
|
73677
73695
|
]
|
|
73678
73696
|
},
|
|
@@ -74750,6 +74768,7 @@
|
|
|
74750
74768
|
"intl-post"
|
|
74751
74769
|
],
|
|
74752
74770
|
"asked": [
|
|
74771
|
+
"jersey-post",
|
|
74753
74772
|
"chronopost"
|
|
74754
74773
|
]
|
|
74755
74774
|
},
|
|
@@ -74788,6 +74807,7 @@
|
|
|
74788
74807
|
"intl-post"
|
|
74789
74808
|
],
|
|
74790
74809
|
"asked": [
|
|
74810
|
+
"jersey-post",
|
|
74791
74811
|
"chronopost"
|
|
74792
74812
|
]
|
|
74793
74813
|
},
|
|
@@ -84900,6 +84920,7 @@
|
|
|
84900
84920
|
"intl-post"
|
|
84901
84921
|
],
|
|
84902
84922
|
"asked": [
|
|
84923
|
+
"jersey-post",
|
|
84903
84924
|
"chronopost"
|
|
84904
84925
|
]
|
|
84905
84926
|
},
|
package/dist/browser/scraper.js
CHANGED
|
@@ -5376,7 +5376,7 @@ var Pe = {
|
|
|
5376
5376
|
},
|
|
5377
5377
|
"atlantic-courier": {
|
|
5378
5378
|
displayName: "Atlantic International Express",
|
|
5379
|
-
color: "#
|
|
5379
|
+
color: "#e31e24",
|
|
5380
5380
|
aliases: ["Atlantic International Express Courier"],
|
|
5381
5381
|
countries: ["IN"],
|
|
5382
5382
|
selectable: !0,
|
|
@@ -7015,7 +7015,9 @@ var Pe = {
|
|
|
7015
7015
|
timezone: "Europe/Malta",
|
|
7016
7016
|
tracking: {
|
|
7017
7017
|
mode: "automatic",
|
|
7018
|
-
adapter: "
|
|
7018
|
+
adapter: "connect-couriers",
|
|
7019
|
+
recognitionRank: 831,
|
|
7020
|
+
localClocks: !0
|
|
7019
7021
|
},
|
|
7020
7022
|
canaryUrl: "https://www.connectcouriers.eu/tracking/",
|
|
7021
7023
|
trackingUrlTemplate: "https://www.connectcouriers.eu/tracking/?tracking_number={trackingNumber}",
|
|
@@ -12556,7 +12558,9 @@ var Pe = {
|
|
|
12556
12558
|
timezone: "Europe/Jersey",
|
|
12557
12559
|
tracking: {
|
|
12558
12560
|
mode: "automatic",
|
|
12559
|
-
adapter: "
|
|
12561
|
+
adapter: "jersey-post",
|
|
12562
|
+
recognitionRank: 832,
|
|
12563
|
+
localClocks: !0
|
|
12560
12564
|
},
|
|
12561
12565
|
canaryUrl: "https://www.jerseypost.com/tools/track-trace/",
|
|
12562
12566
|
trackingUrlTemplate: "https://www.jerseypost.com/tools/track-trace/?tq={trackingNumber}",
|
|
@@ -12566,7 +12570,12 @@ var Pe = {
|
|
|
12566
12570
|
pathPattern: "^/tools/track-trace/?$",
|
|
12567
12571
|
params: ["tq"]
|
|
12568
12572
|
}],
|
|
12569
|
-
detectionRules: [
|
|
12573
|
+
detectionRules: [{
|
|
12574
|
+
pattern: "^[A-Z]{2}\\d{9}JE$",
|
|
12575
|
+
confidence: "low",
|
|
12576
|
+
checksum: "s10",
|
|
12577
|
+
preferred: !0
|
|
12578
|
+
}]
|
|
12570
12579
|
},
|
|
12571
12580
|
"jet-logistic": {
|
|
12572
12581
|
displayName: "Jet Logistic",
|
|
@@ -15162,7 +15171,7 @@ var Pe = {
|
|
|
15162
15171
|
},
|
|
15163
15172
|
"ocs-ana": {
|
|
15164
15173
|
displayName: "OCS ANA Group",
|
|
15165
|
-
color: "#
|
|
15174
|
+
color: "#0a3382",
|
|
15166
15175
|
aliases: [
|
|
15167
15176
|
"OCS",
|
|
15168
15177
|
"Overseas Courier Service",
|
|
@@ -16769,16 +16778,23 @@ var Pe = {
|
|
|
16769
16778
|
timezone: "Europe/Tirane",
|
|
16770
16779
|
tracking: {
|
|
16771
16780
|
mode: "automatic",
|
|
16772
|
-
adapter: "
|
|
16781
|
+
adapter: "posta-shqiptare",
|
|
16782
|
+
recognitionRank: 829,
|
|
16783
|
+
localClocks: !0
|
|
16773
16784
|
},
|
|
16774
|
-
canaryUrl: "https://
|
|
16785
|
+
canaryUrl: "https://eposta.postashqiptare.al/tracking",
|
|
16775
16786
|
trackingUrlTemplate: "https://eposta.postashqiptare.al/tracking/{trackingNumber}",
|
|
16776
16787
|
trackingSearchUrl: "https://www.postashqiptare.al/c/207/tracked",
|
|
16777
16788
|
linkRules: [{
|
|
16778
16789
|
domains: ["eposta.postashqiptare.al"],
|
|
16779
16790
|
path: "^/tracking/([^/?#]+)/?$"
|
|
16780
16791
|
}],
|
|
16781
|
-
detectionRules: [
|
|
16792
|
+
detectionRules: [{
|
|
16793
|
+
pattern: "^[A-Z]{2}\\d{9}AL$",
|
|
16794
|
+
confidence: "low",
|
|
16795
|
+
checksum: "s10",
|
|
16796
|
+
preferred: !0
|
|
16797
|
+
}]
|
|
16782
16798
|
},
|
|
16783
16799
|
"posta-slovenije": {
|
|
16784
16800
|
displayName: "Pošta Slovenije",
|
|
@@ -18319,7 +18335,9 @@ var Pe = {
|
|
|
18319
18335
|
timezone: "Europe/Istanbul",
|
|
18320
18336
|
tracking: {
|
|
18321
18337
|
mode: "automatic",
|
|
18322
|
-
adapter: "
|
|
18338
|
+
adapter: "shipentegra",
|
|
18339
|
+
recognitionRank: 833,
|
|
18340
|
+
localClocks: !0
|
|
18323
18341
|
},
|
|
18324
18342
|
canaryUrl: "https://track.shipentegra.com/",
|
|
18325
18343
|
trackingUrlTemplate: "https://track.shipentegra.com/?trackno={trackingNumber}",
|
|
@@ -20875,7 +20893,7 @@ var Pe = {
|
|
|
20875
20893
|
timezone: "America/Bogota",
|
|
20876
20894
|
tracking: {
|
|
20877
20895
|
mode: "automatic",
|
|
20878
|
-
adapter: "
|
|
20896
|
+
adapter: "veloces"
|
|
20879
20897
|
},
|
|
20880
20898
|
canaryUrl: "https://tracking.veloces.app/",
|
|
20881
20899
|
trackingUrlTemplate: "https://tracking.veloces.app/tracking-client/{trackingNumber}",
|
|
@@ -22467,7 +22485,7 @@ var Pe = {
|
|
|
22467
22485
|
"jamaica-post": [],
|
|
22468
22486
|
janio: ["janio-1"],
|
|
22469
22487
|
jeebly: ["jeebly-1"],
|
|
22470
|
-
"jersey-post": [],
|
|
22488
|
+
"jersey-post": ["jersey-post-s10"],
|
|
22471
22489
|
"jet-logistic": [],
|
|
22472
22490
|
"jetline-couriers": [],
|
|
22473
22491
|
jhgj: ["jhgj-1"],
|
|
@@ -22627,7 +22645,7 @@ var Pe = {
|
|
|
22627
22645
|
"posta-moldovei": ["posta-moldovei-1"],
|
|
22628
22646
|
"posta-north-macedonia": ["posta-north-macedonia-s10"],
|
|
22629
22647
|
"posta-romana": ["posta-romana-s10"],
|
|
22630
|
-
"posta-shqiptare": [],
|
|
22648
|
+
"posta-shqiptare": ["posta-shqiptare-s10"],
|
|
22631
22649
|
"posta-slovenije": ["posta-slovenije-s10"],
|
|
22632
22650
|
"posta-srbije": ["posta-srbije-s10"],
|
|
22633
22651
|
postaplus: [],
|
|
@@ -27989,6 +28007,7 @@ var pl = {
|
|
|
27989
28007
|
"cj-packet": 956,
|
|
27990
28008
|
"closer-logistics": 849,
|
|
27991
28009
|
"colis-prive": 740,
|
|
28010
|
+
"connect-couriers": 831,
|
|
27992
28011
|
coordinadora: 973,
|
|
27993
28012
|
"correo-argentino": 978,
|
|
27994
28013
|
"correos-de-mexico": 30,
|
|
@@ -28086,6 +28105,7 @@ var pl = {
|
|
|
28086
28105
|
"israel-post": 81,
|
|
28087
28106
|
"j-and-t": 530,
|
|
28088
28107
|
"j-and-t-cargo": 910,
|
|
28108
|
+
"jersey-post": 832,
|
|
28089
28109
|
jhgj: 907,
|
|
28090
28110
|
jitsu: 85,
|
|
28091
28111
|
"jordan-post": 881,
|
|
@@ -28145,6 +28165,7 @@ var pl = {
|
|
|
28145
28165
|
"post-luxembourg": 80,
|
|
28146
28166
|
"posta-north-macedonia": 899,
|
|
28147
28167
|
"posta-romana": 948,
|
|
28168
|
+
"posta-shqiptare": 829,
|
|
28148
28169
|
"posta-slovenije": 130,
|
|
28149
28170
|
"posta-srbije": 110,
|
|
28150
28171
|
"poste-italiane": 900,
|
|
@@ -28174,6 +28195,7 @@ var pl = {
|
|
|
28174
28195
|
seur: 870,
|
|
28175
28196
|
sfc: 955,
|
|
28176
28197
|
shadowfax: 595,
|
|
28198
|
+
shipentegra: 833,
|
|
28177
28199
|
"skroutz-last-mile": 913,
|
|
28178
28200
|
"slovak-parcel-service": 180,
|
|
28179
28201
|
"slovenska-posta": 170,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type AdapterFactory, type TrackingContext } from '../../core/adapter/index.js';
|
|
2
|
+
import type { CarrierResult } from '../../core/result/index.js';
|
|
3
|
+
import { type StepRecorder } from '../../core/telemetry/index.js';
|
|
4
|
+
/** The WordPress endpoint the tracking page on connectcouriers.eu posts the number to. */
|
|
5
|
+
export declare const CONNECT_COURIERS_API = "https://www.connectcouriers.eu/wp-admin/admin-ajax.php";
|
|
6
|
+
/** The tracking plugin's action. */
|
|
7
|
+
export declare const CONNECT_COURIERS_ACTION = "public_connect_tracking_tracking_action";
|
|
8
|
+
export declare class ConnectCouriersTracker {
|
|
9
|
+
private readonly options;
|
|
10
|
+
constructor(options?: {
|
|
11
|
+
fetcher?: typeof fetch;
|
|
12
|
+
recorder?: StepRecorder;
|
|
13
|
+
userAgent?: string;
|
|
14
|
+
});
|
|
15
|
+
fetch(raw: string, context?: TrackingContext): Promise<CarrierResult>;
|
|
16
|
+
}
|
|
17
|
+
export declare const adapter: AdapterFactory;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { accepted, recognizeFromLookup } from '../../core/adapter/index.js';
|
|
2
|
+
import { ChallengeError, SchemaError, TransportError } from '../../core/errors/index.js';
|
|
3
|
+
import { runSteps } from '../../core/runner/index.js';
|
|
4
|
+
import { firstAttemptMs, networkRetryStep } from '../../core/runner/networkRetry.js';
|
|
5
|
+
import { NOOP_RECORDER } from '../../core/telemetry/index.js';
|
|
6
|
+
import { decodeText, fetchBounded, userAgentOf } from '../../core/transport/index.js';
|
|
7
|
+
import { CONNECT_COURIERS_MAX_BYTES, normalizeConnectCouriersNumber, parseConnectCouriers, PROVIDER } from './parser.js';
|
|
8
|
+
/** The WordPress endpoint the tracking page on connectcouriers.eu posts the number to. */
|
|
9
|
+
export const CONNECT_COURIERS_API = 'https://www.connectcouriers.eu/wp-admin/admin-ajax.php';
|
|
10
|
+
/** The tracking plugin's action. */
|
|
11
|
+
export const CONNECT_COURIERS_ACTION = 'public_connect_tracking_tracking_action';
|
|
12
|
+
const REDIRECTS = [301, 302, 303, 307, 308];
|
|
13
|
+
// Bot checks Cloudflare, in front of the site, could put in place of the reply.
|
|
14
|
+
const CHALLENGE = /_cf_chl_opt|cf-turnstile|challenge-platform|<title>\s*Just a moment|<title>\s*Attention Required/i;
|
|
15
|
+
function json(body) {
|
|
16
|
+
try {
|
|
17
|
+
return JSON.parse(body);
|
|
18
|
+
}
|
|
19
|
+
catch (cause) {
|
|
20
|
+
if (CHALLENGE.test(body.slice(0, 64_000)))
|
|
21
|
+
throw new ChallengeError(PROVIDER, 'Connect Couriers answered with a browser check', { cause });
|
|
22
|
+
throw new SchemaError(PROVIDER, 'Connect Couriers returned a reply that is not JSON', { cause });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export class ConnectCouriersTracker {
|
|
26
|
+
options;
|
|
27
|
+
constructor(options = {}) {
|
|
28
|
+
this.options = options;
|
|
29
|
+
}
|
|
30
|
+
async fetch(raw, context = {}) {
|
|
31
|
+
const number = normalizeConnectCouriersNumber(raw);
|
|
32
|
+
const read = async (signal, timeoutMs) => {
|
|
33
|
+
const { response, bytes } = await fetchBounded(CONNECT_COURIERS_API, { method: 'POST', signal, headers: {
|
|
34
|
+
Accept: 'application/json', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'User-Agent': userAgentOf(this.options.userAgent),
|
|
35
|
+
}, body: new URLSearchParams({ action: CONNECT_COURIERS_ACTION, tracking_number: number }).toString() }, { provider: PROVIDER,
|
|
36
|
+
timeoutMs: Math.max(1, Math.floor(timeoutMs)), maxBytes: CONNECT_COURIERS_MAX_BYTES, redirect: 'manual', fetcher: this.options.fetcher,
|
|
37
|
+
allowHttpStatuses: [...REDIRECTS, 400, 404, 410] });
|
|
38
|
+
if (REDIRECTS.includes(response.status))
|
|
39
|
+
throw new TransportError(PROVIDER, 'Connect Couriers redirected its tracking lookup');
|
|
40
|
+
// The tracker answers every number with HTTP 200. WordPress answers an
|
|
41
|
+
// action no plugin registers with HTTP 400 and `0`; a 404 is a moved route.
|
|
42
|
+
if (response.status === 400 || response.status === 404 || response.status === 410) {
|
|
43
|
+
throw new TransportError(PROVIDER, 'Connect Couriers tracking lookup is unavailable');
|
|
44
|
+
}
|
|
45
|
+
return parseConnectCouriers(json(decodeText(bytes)), number);
|
|
46
|
+
};
|
|
47
|
+
// A request that fails to reach the site, or hangs, gets one more try: the
|
|
48
|
+
// first gets half of the budget, so the retry fits in the rest.
|
|
49
|
+
return runSteps({ carrier: 'connect-couriers', budgetMs: context.budgetMs ?? 15_000, signal: context.signal,
|
|
50
|
+
recorder: this.options.recorder ?? NOOP_RECORDER }, [
|
|
51
|
+
{ id: 'direct', run: ({ signal, remainingMs }) => read(signal, firstAttemptMs(remainingMs)) },
|
|
52
|
+
networkRetryStep(({ signal, remainingMs }) => read(signal, remainingMs)),
|
|
53
|
+
]);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export const adapter = (environment) => {
|
|
57
|
+
const tracker = new ConnectCouriersTracker({ fetcher: environment.fetcher, recorder: environment.recorder, userAgent: environment.userAgent });
|
|
58
|
+
return {
|
|
59
|
+
id: 'connect-couriers', recordsSteps: true, steps: ['direct', 'retry'],
|
|
60
|
+
track: (input, context) => tracker.fetch(input.number, context),
|
|
61
|
+
recognize: (number, context) => recognizeFromLookup(() => tracker.fetch(number, context), () => accepted(() => normalizeConnectCouriersNumber(number))),
|
|
62
|
+
};
|
|
63
|
+
};
|
|
@@ -18,18 +18,63 @@
|
|
|
18
18
|
"timezone": "Europe/Malta",
|
|
19
19
|
"tracking": {
|
|
20
20
|
"mode": "automatic",
|
|
21
|
-
"adapter": "
|
|
22
|
-
"steps": [
|
|
21
|
+
"adapter": "connect-couriers",
|
|
22
|
+
"steps": [
|
|
23
|
+
"direct",
|
|
24
|
+
"retry"
|
|
25
|
+
],
|
|
26
|
+
"recognition": {
|
|
27
|
+
"rank": 831
|
|
28
|
+
},
|
|
29
|
+
"localClocks": true
|
|
23
30
|
},
|
|
24
|
-
"capabilities": [
|
|
31
|
+
"capabilities": [
|
|
32
|
+
"history",
|
|
33
|
+
"destination_country"
|
|
34
|
+
],
|
|
25
35
|
"portal": {
|
|
26
36
|
"url": "https://www.connectcouriers.eu/tracking/?tracking_number={trackingNumber}",
|
|
27
37
|
"searchUrl": "https://www.connectcouriers.eu/tracking/",
|
|
28
38
|
"canaryUrl": "https://www.connectcouriers.eu/tracking/",
|
|
29
|
-
"shows": [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
39
|
+
"shows": [
|
|
40
|
+
"status",
|
|
41
|
+
"history",
|
|
42
|
+
"progress_rail",
|
|
43
|
+
"origin",
|
|
44
|
+
"destination",
|
|
45
|
+
"destination_country",
|
|
46
|
+
"parcel_count",
|
|
47
|
+
"departure_date",
|
|
48
|
+
"weight",
|
|
49
|
+
"dimensions"
|
|
50
|
+
],
|
|
51
|
+
"scraped": [
|
|
52
|
+
"status",
|
|
53
|
+
"history",
|
|
54
|
+
"destination_country"
|
|
55
|
+
],
|
|
56
|
+
"discarded": [
|
|
57
|
+
"progress_rail",
|
|
58
|
+
"origin",
|
|
59
|
+
"destination",
|
|
60
|
+
"parcel_count",
|
|
61
|
+
"departure_date",
|
|
62
|
+
"weight",
|
|
63
|
+
"dimensions"
|
|
64
|
+
],
|
|
65
|
+
"unavailable": [
|
|
66
|
+
"location",
|
|
67
|
+
"provider_code",
|
|
68
|
+
"eta",
|
|
69
|
+
"delivered_at",
|
|
70
|
+
"offset_timestamps",
|
|
71
|
+
"service_name",
|
|
72
|
+
"pickup_point",
|
|
73
|
+
"sender_name",
|
|
74
|
+
"recipient_name",
|
|
75
|
+
"recipient_address",
|
|
76
|
+
"proof_of_delivery"
|
|
77
|
+
]
|
|
33
78
|
},
|
|
34
79
|
"links": [
|
|
35
80
|
{
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"access": "full_page"
|
|
13
13
|
},
|
|
14
14
|
"context": {
|
|
15
|
-
"assessment": "
|
|
15
|
+
"assessment": "confirmed"
|
|
16
16
|
},
|
|
17
17
|
"expect": {
|
|
18
18
|
"carrier": "unknown",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"ppl"
|
|
29
29
|
]
|
|
30
30
|
},
|
|
31
|
-
"note": "An archived lookup on Connect Couriers' own tracker; the capture
|
|
31
|
+
"note": "An archived lookup on Connect Couriers' own tracker address; the capture shows only the page shell, and Connect Couriers' tracker returns a delivered history for it."
|
|
32
32
|
}
|
|
33
33
|
]
|
|
34
34
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CarrierResult } from '../../core/result/index.js';
|
|
2
|
+
export declare const PROVIDER = "Connect Couriers";
|
|
3
|
+
export declare const CONNECT_COURIERS_MAX_BYTES: number;
|
|
4
|
+
/** A number for Connect Couriers' tracker, digits only; anything else is not one it issues. */
|
|
5
|
+
export declare function normalizeConnectCouriersNumber(raw: string): string;
|
|
6
|
+
/** A scan's wording without a signatory or phone numbers. */
|
|
7
|
+
export declare function connectCouriersWording(raw: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* The reply of the tracking page's WordPress action for one number. It
|
|
10
|
+
* answers HTTP 200 with `{"success":false}` for a number it does not know,
|
|
11
|
+
* which the page reports as an invalid tracking number. A found reply has
|
|
12
|
+
* the consignment's pieces, a progress rail and the scans grouped by day;
|
|
13
|
+
* the reply and the piece must both name the number asked.
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseConnectCouriers(payload: unknown, raw: string): CarrierResult;
|