universal-parcel-scraper 0.580.0-main.2721 → 0.580.1-main.2725
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 +1 -1
- package/dist/carriers/dhl-express/adapter.js +5 -2
- package/dist/carriers/dhl-express/mobile.d.ts +2 -0
- package/dist/carriers/dhl-express/mobile.js +6 -2
- package/dist/carriers/dhlink/status.js +1 -0
- package/dist/carriers/dhlink/statuses.json +1 -0
- package/dist/carriers/globalpost/status.d.ts +1 -1
- package/dist/carriers/globalpost/status.js +7 -2
- package/dist/carriers/globalpost/statuses.json +2 -0
- package/dist/carriers/imile/status.js +1 -0
- package/dist/carriers/imile/statuses.json +1 -0
- package/dist/carriers/mayiyinfu/statuses.json +3 -1
- package/dist/providers/parcelsapp/adapter.js +10 -3
- package/dist/providers/shared/result.js +4 -2
- package/dist/server/openapi.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -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 16,
|
|
158
|
+
The carrier folders record 16,195 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.
|
|
@@ -274,9 +274,12 @@ export class DhlExpressTracker {
|
|
|
274
274
|
return runSteps(run, [{ id: 'trawl', run: ({ signal, remainingMs }) => this.browserPiece(piece, { signal, budgetMs: remainingMs }) }]);
|
|
275
275
|
}
|
|
276
276
|
const number = normalizeNumber(raw);
|
|
277
|
+
const trawl = !!this.environment.trawl;
|
|
277
278
|
return runSteps(run, [
|
|
278
|
-
|
|
279
|
-
{ id: '
|
|
279
|
+
// While a CAPTCHA holds the app's API would fail without a request, so a browser service is asked at once.
|
|
280
|
+
{ id: 'direct', enabled: !(trawl && this.mobile.captchaHeld()),
|
|
281
|
+
run: ({ signal, remainingMs }) => this.direct(number, { signal, budgetMs: Math.min(remainingMs, 10_000) }) },
|
|
282
|
+
{ id: 'trawl', enabled: trawl, run: ({ signal, remainingMs }) => this.browser(number, { signal, budgetMs: remainingMs }) },
|
|
280
283
|
]);
|
|
281
284
|
}
|
|
282
285
|
}
|
|
@@ -29,6 +29,8 @@ export declare class DhlMobileApi {
|
|
|
29
29
|
* fail as a challenge without a request.
|
|
30
30
|
*/
|
|
31
31
|
tracking(number: string, budget: LookupBudget): Promise<unknown>;
|
|
32
|
+
/** Whether a CAPTCHA drawn through this transport may still hold, so tracking would fail without a request. */
|
|
33
|
+
captchaHeld(): boolean;
|
|
32
34
|
private checkSettings;
|
|
33
35
|
private request;
|
|
34
36
|
}
|
|
@@ -76,8 +76,7 @@ export class DhlMobileApi {
|
|
|
76
76
|
*/
|
|
77
77
|
async tracking(number, budget) {
|
|
78
78
|
const state = this.state;
|
|
79
|
-
|
|
80
|
-
if (captchaAt !== null && Date.now() - captchaAt < CAPTCHA_MEMORY_MS)
|
|
79
|
+
if (this.captchaHeld())
|
|
81
80
|
throw new ChallengeError(PROVIDER, 'DHL mobile tracking recently required verification');
|
|
82
81
|
let payload;
|
|
83
82
|
try {
|
|
@@ -98,6 +97,11 @@ export class DhlMobileApi {
|
|
|
98
97
|
}
|
|
99
98
|
return payload;
|
|
100
99
|
}
|
|
100
|
+
/** Whether a CAPTCHA drawn through this transport may still hold, so tracking would fail without a request. */
|
|
101
|
+
captchaHeld() {
|
|
102
|
+
const captchaAt = this.state.captchaAt;
|
|
103
|
+
return captchaAt !== null && Date.now() - captchaAt < CAPTCHA_MEMORY_MS;
|
|
104
|
+
}
|
|
101
105
|
async checkSettings(budget) {
|
|
102
106
|
this.state.settingsCheckedAt = null;
|
|
103
107
|
const checkedAt = Date.now();
|
|
@@ -40,6 +40,7 @@ const WORDINGS = new Map([
|
|
|
40
40
|
['arrive at the collection warehouse', 'accepted'],
|
|
41
41
|
['the collection warehouse has completed sorting', 'accepted'],
|
|
42
42
|
['package received & scanned at warehouse', 'accepted'],
|
|
43
|
+
['package received and scanned at warehouse', 'accepted'],
|
|
43
44
|
['parcel handed over to carrier,waiting for transportation', 'accepted'],
|
|
44
45
|
// China Post's receipt (中国邮政 已收取邮件).
|
|
45
46
|
['package received', 'accepted'],
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"carrier": "dhlink",
|
|
3
3
|
"entries": [
|
|
4
4
|
{"code": "WH001", "wording": "Package received & scanned at warehouse", "stage": "accepted", "language": "en", "confirmedBy": "live", "note": "Node Dispatched: DHLink's warehouse received the parcel."},
|
|
5
|
+
{"wording": "Package received and scanned at warehouse", "stage": "accepted", "language": "en", "confirmedBy": "live", "firstSeen": "2026-10-20", "note": "The same receipt spelled out, on a row without a node code."},
|
|
5
6
|
{"code": "WH011", "wording": "Package departed from the warehouse", "stage": "in_transit", "language": "en", "confirmedBy": "live", "note": "Node Outbound."},
|
|
6
7
|
{"code": "EUBJ007", "wording": "Parcel handed over to carrier,waiting for transportation", "stage": "accepted", "language": "en", "confirmedBy": "live", "note": "Node Dispatched on the ePacket line: the collection point received the parcel."},
|
|
7
8
|
{"code": "EUBJ009", "wording": "Shipment Departed From Original Country at …", "stage": "in_transit", "language": "en", "confirmedBy": "live", "note": "Node Origin leaving; the wording repeats the row's clock."},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ClassifiedWording, type Stage } from '../../core/status/index.js';
|
|
2
2
|
import { type CarrierStatusMap } from '../../core/status/statusMap.js';
|
|
3
|
-
/** The stage the map gives a wording, if it knows it. */
|
|
3
|
+
/** The stage the map gives a wording, if it knows it, with or without the tracker's note after it. */
|
|
4
4
|
export declare function globalpostMappedStage(wording: string): Stage | undefined;
|
|
5
5
|
/** A scan's stage from its wording, else the shared wording rules, else nothing, which keeps it visible for review. */
|
|
6
6
|
export declare function globalpostStage(wording: string): ClassifiedWording | null;
|
|
@@ -14,6 +14,7 @@ const WORDINGS = new Map([
|
|
|
14
14
|
// GlobalPost's own consolidation facility; a partner's inbound scans can come before it.
|
|
15
15
|
['Arrived at GlobalPost Facility', 'accepted'],
|
|
16
16
|
['Departed GlobalPost Facility', 'in_transit'],
|
|
17
|
+
['Departed from Origin Country', 'in_transit'],
|
|
17
18
|
['In Transit', 'in_transit'],
|
|
18
19
|
['In-Transit', 'in_transit'],
|
|
19
20
|
['Arrived in Destination Country', 'in_transit'],
|
|
@@ -22,11 +23,15 @@ const WORDINGS = new Map([
|
|
|
22
23
|
['Out for Delivery', 'out_for_delivery'],
|
|
23
24
|
['Attempted Delivery', 'failed_attempt'],
|
|
24
25
|
['Exception, No Action Required', 'exception'],
|
|
26
|
+
['Delayed, No Action Required', 'exception'],
|
|
25
27
|
['Delivered', 'delivered'],
|
|
26
28
|
].map(([wording, stage]) => [normalizeStatusWording(wording), stage]));
|
|
27
|
-
/** The
|
|
29
|
+
/** The tracker's reassurance that can follow a scan's wording in the same cell. */
|
|
30
|
+
const NOTE = /\s*tracking updates may take time\b.*$/;
|
|
31
|
+
/** The stage the map gives a wording, if it knows it, with or without the tracker's note after it. */
|
|
28
32
|
export function globalpostMappedStage(wording) {
|
|
29
|
-
|
|
33
|
+
const key = normalizeStatusWording(wording);
|
|
34
|
+
return WORDINGS.get(key) ?? WORDINGS.get(key.replace(NOTE, ''));
|
|
30
35
|
}
|
|
31
36
|
/** A scan's stage from its wording, else the shared wording rules, else nothing, which keeps it visible for review. */
|
|
32
37
|
export function globalpostStage(wording) {
|
|
@@ -9,12 +9,14 @@
|
|
|
9
9
|
{"wording": "Departed GlobalPost Facility", "stage": "in_transit", "language": "en", "confirmedBy": "portal"},
|
|
10
10
|
{"wording": "In Transit", "stage": "in_transit", "language": "en", "confirmedBy": "portal"},
|
|
11
11
|
{"wording": "In-Transit", "stage": "in_transit", "language": "en", "confirmedBy": "portal", "note": "Hyphenated variant of In Transit, shown alongside it in the same histories."},
|
|
12
|
+
{"wording": "Departed from Origin Country", "stage": "in_transit", "language": "en", "confirmedBy": "live", "firstSeen": "2026-10-20"},
|
|
12
13
|
{"wording": "Arrived in Destination Country", "stage": "in_transit", "language": "en", "confirmedBy": "portal"},
|
|
13
14
|
{"wording": "In Customs", "stage": "customs", "language": "en", "confirmedBy": "portal"},
|
|
14
15
|
{"wording": "Cleared Customs", "stage": "in_transit", "language": "en", "confirmedBy": "portal", "note": "Customs let the parcel go on, so it is moving again."},
|
|
15
16
|
{"wording": "Out for Delivery", "stage": "out_for_delivery", "language": "en", "confirmedBy": "portal"},
|
|
16
17
|
{"wording": "Attempted Delivery", "stage": "failed_attempt", "language": "en", "confirmedBy": "portal"},
|
|
17
18
|
{"wording": "Exception, No Action Required", "stage": "exception", "language": "en", "confirmedBy": "portal", "note": "Shown for a final-mile exception that the recipient does not need to act on."},
|
|
19
|
+
{"wording": "Delayed, No Action Required", "stage": "exception", "language": "en", "confirmedBy": "live", "firstSeen": "2026-10-20", "note": "The tracker's delay, in the same form as its exception the recipient need not act on."},
|
|
18
20
|
{"wording": "Delivered", "stage": "delivered", "language": "en", "confirmedBy": "portal", "note": "Also ends a return to the sender; the adapter reads a delivery scan at the sender's town as returned."}
|
|
19
21
|
]
|
|
20
22
|
}
|
|
@@ -54,6 +54,7 @@ const PHRASES = new Map([
|
|
|
54
54
|
['switch off', 'failed_attempt'],
|
|
55
55
|
['customer wants to change location', 'failed_attempt'],
|
|
56
56
|
['route not completed', 'failed_attempt'],
|
|
57
|
+
['traffic, strike, bad weather', 'failed_attempt'],
|
|
57
58
|
['user not at home', 'failed_attempt'],
|
|
58
59
|
['wrong address', 'failed_attempt'],
|
|
59
60
|
['<bad address>', 'failed_attempt'],
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
{"code": "1003", "wording": "The driver failed to deliver due to shop(building) closure, we will try to deliver again.", "stage": "failed_attempt", "language": "en", "confirmedBy": "live"},
|
|
35
35
|
{"code": "1003", "wording": "Customer Wants to Change Location", "stage": "failed_attempt", "language": "en", "confirmedBy": "live", "note": "A driver's reason, followed by the attempt's end."},
|
|
36
36
|
{"code": "1003", "wording": "Route not completed", "stage": "failed_attempt", "language": "en", "confirmedBy": "live", "note": "A driver's reason, followed by the attempt's end."},
|
|
37
|
+
{"code": "1003", "wording": "Traffic, Strike, Bad weather", "stage": "failed_attempt", "language": "en", "confirmedBy": "live", "firstSeen": "2026-10-20", "note": "A driver's reason on the delivery run, followed by the attempt's end and the return to the centre."},
|
|
37
38
|
{"code": "1003", "wording": "User not at home", "stage": "failed_attempt", "language": "en", "confirmedBy": "live", "note": "A driver's reason, followed by the attempt's end."},
|
|
38
39
|
{"code": "1003", "wording": "switch off", "stage": "failed_attempt", "language": "en", "confirmedBy": "live", "note": "A driver's reason, followed by the attempt's end."},
|
|
39
40
|
{"code": "1003", "wording": "wrong address", "stage": "failed_attempt", "language": "en", "confirmedBy": "live", "note": "A driver's reason, followed by the attempt's end."},
|
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
{"wording": "The instruction data for this shipment have been provided by the sender to DHL electronically", "language": "en", "stage": "registered", "confirmedBy": "live", "note": "Relayed from DHL: the label's data, on the day the order was created."},
|
|
28
28
|
{"wording": "The international shipment has been processed in the parcel center of origin", "language": "en", "stage": "in_transit", "confirmedBy": "live", "note": "Relayed from DHL in Germany after the hand-off."},
|
|
29
29
|
{"wording": "The international shipment has been processed in the export parcel center", "language": "en", "stage": "in_transit", "confirmedBy": "live", "note": "Relayed from DHL in Germany."},
|
|
30
|
-
{"wording": "The shipment has arrived in the destination country/destination area.", "language": "en", "stage": "in_transit", "confirmedBy": "live", "note": "Relayed from DHL, followed by the destination operator's tracking link in brackets; the map reads the wording without the link."}
|
|
30
|
+
{"wording": "The shipment has arrived in the destination country/destination area.", "language": "en", "stage": "in_transit", "confirmedBy": "live", "note": "Relayed from DHL, followed by the destination operator's tracking link in brackets; the map reads the wording without the link."},
|
|
31
|
+
{"wording": "The shipment has been loaded onto the delivery vehicle", "language": "en", "stage": "out_for_delivery", "confirmedBy": "live", "firstSeen": "2026-10-20", "note": "The last-mile carrier's delivery run, in Mayi Yinfu's English."},
|
|
32
|
+
{"wording": "The shipment has been successfully delivered", "language": "en", "stage": "delivered", "confirmedBy": "live", "firstSeen": "2026-10-20"}
|
|
31
33
|
]
|
|
32
34
|
}
|
|
@@ -689,6 +689,8 @@ function carrierClock(payload, state, number, status = '', destination = null) {
|
|
|
689
689
|
return null;
|
|
690
690
|
if (key === 'sunyousytrack' && SUNYOU_DESTINATION_LEG.test(status.trim()))
|
|
691
691
|
return countryTimeZone(destination) ?? undefined;
|
|
692
|
+
if (carrier === 'imile')
|
|
693
|
+
return countryTimeZone(destination);
|
|
692
694
|
// Cainiao's copies of Speedaf's scans keep Speedaf's digits, its arrival at the linehaul office too.
|
|
693
695
|
if (carrier === 'speedaf' || (key === 'cainiao' && speedafDeparture(payload)))
|
|
694
696
|
return speedafZone(payload, state.date, destination);
|
|
@@ -809,6 +811,10 @@ function readState(payload, raw, status, fallback, number, inNorthAmerica = fals
|
|
|
809
811
|
const wallClock = WALL_CLOCKS.has(nameKey(name)) && !offset;
|
|
810
812
|
const laterLeg = cttyexLaterLeg(name, status);
|
|
811
813
|
const own = laterLeg ? null : carrierClock(payload, raw, number, status, destination);
|
|
814
|
+
// iMile's page writes every scan on the recipient country's clock, wherever it happened, and
|
|
815
|
+
// ParcelsApp has its digits; read on iMile's catalog zone they came out early. A destination
|
|
816
|
+
// of one zone places them, and without one they keep their wall clock.
|
|
817
|
+
const imileWall = own === null && !offset && typeof name === 'string' && carrierIdFromName(name) === 'imile';
|
|
812
818
|
const sited = own === undefined ? siteZone(payload, raw, number, inNorthAmerica, status, destination) : undefined;
|
|
813
819
|
const placed = own !== undefined ? own : sited;
|
|
814
820
|
// A posting that only its office's capital places borrows first (`postingOffice`).
|
|
@@ -823,7 +829,7 @@ function readState(payload, raw, status, fallback, number, inNorthAmerica = fals
|
|
|
823
829
|
local: zone !== null && zone === regionScanZone(name, location, inNorthAmerica)?.zone,
|
|
824
830
|
fallback: wallClock || office ? fitsPlace(fallback, location) : null, known: known?.zone ?? null, arrival: known?.country ?? null,
|
|
825
831
|
// With no zone, a scan whose label nothing vouches for keeps its wall clock.
|
|
826
|
-
wallOnly: laterLeg || unknownNetwork(name) || militaryPostOffice(location) };
|
|
832
|
+
wallOnly: laterLeg || imileWall || unknownNetwork(name) || militaryPostOffice(location) };
|
|
827
833
|
}
|
|
828
834
|
/**
|
|
829
835
|
* The zone of each scan. One from a network that is not a wall clock keeps
|
|
@@ -1119,8 +1125,9 @@ function parseHistory(payload, trackingNumber, timezone = null) {
|
|
|
1119
1125
|
// A DHL Express scan whose facility the rule cannot place is a wall clock
|
|
1120
1126
|
// with no instant, and so is a UPS or FedEx scan with no location that
|
|
1121
1127
|
// nothing places. A scan at a US military post office, of a network no
|
|
1122
|
-
// table knows (`unknownNetwork`)
|
|
1123
|
-
//
|
|
1128
|
+
// table knows (`unknownNetwork`), of CTTYEX after China (`cttyexLaterLeg`)
|
|
1129
|
+
// or of iMile for a destination of several zones keeps its wall clock as
|
|
1130
|
+
// its local time. Any other scan with no zone
|
|
1124
1131
|
// keeps ParcelsApp's label.
|
|
1125
1132
|
const facility = !zone && relaysFacilityClock(name);
|
|
1126
1133
|
const unplaced = facility || (!zone && !entry.location && UNLOCATED_LOCAL_CLOCKS.has(nameKey(name)));
|
|
@@ -247,8 +247,10 @@ function providerWordingStage(description) {
|
|
|
247
247
|
// A shipment manifested, with a courier on the way to collect it from the sender: not in hand yet.
|
|
248
248
|
if (/^manifested(?: - out for pick-?up)?[.!]?$/i.test(value))
|
|
249
249
|
return 'registered';
|
|
250
|
-
// GZYL's destination processing centre taking the cleared parcel and sending it on, in GZYL's own spelling
|
|
251
|
-
|
|
250
|
+
// GZYL's destination processing centre taking the cleared parcel and sending it on, in GZYL's own spelling,
|
|
251
|
+
// and a line's scan leaving the named city's centre after import clearance.
|
|
252
|
+
if (/^internationall?i?y package received at processing cent(?:er|re)[.!]?$|^leave the (?:e?mail|[a-z][a-z .'-]{1,30}?) processing cent(?:er|re)[.!]?$/i.test(value)
|
|
253
|
+
&& !/^leave the return\b/i.test(value))
|
|
252
254
|
return 'in_transit';
|
|
253
255
|
// Mayi Yinfu's parcel booked out of its operations centre, and the flight booked for it, as its own map reads them.
|
|
254
256
|
if (/^已出库(?:[,,]货物离开操作中心)?$|^已排航班$/u.test(value))
|
package/dist/server/openapi.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "universal-parcel-scraper",
|
|
3
|
-
"version": "0.580.
|
|
3
|
+
"version": "0.580.1-main.2725",
|
|
4
4
|
"description": "Self-hosted parcel tracking: carrier detection, dedicated scrapers and optional universal providers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|