universal-parcel-scraper 0.829.0-main.4445 → 0.829.2-main.4450
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/bpost/status.js +2 -0
- package/dist/carriers/bpost/statuses.json +8 -0
- package/dist/carriers/four-px/status.js +3 -2
- package/dist/carriers/four-px/statuses.json +9 -0
- package/dist/carriers/postnord/status.js +14 -11
- package/dist/carriers/ups/status.js +2 -2
- package/dist/carriers/ups/statuses.json +1 -0
- package/dist/carriers/usps/adapter.js +7 -1
- package/dist/carriers/yanwen/status.js +2 -0
- package/dist/carriers/yanwen/statuses.json +8 -0
- package/dist/providers/shared/result.js +3 -0
- package/dist/server/openapi.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -163,7 +163,7 @@ the command line's `track --source ParcelsApp` does the same.
|
|
|
163
163
|
<!-- GENERATED:stages -->
|
|
164
164
|
<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">
|
|
165
165
|
|
|
166
|
-
The carrier folders record 17,
|
|
166
|
+
The carrier folders record 17,711 such statuses, each filed under one stage.
|
|
167
167
|
<!-- /GENERATED:stages -->
|
|
168
168
|
|
|
169
169
|
Wording nobody recorded yet goes through a classifier that reads seven European languages.
|
|
@@ -4,6 +4,8 @@ const WORDINGS = {
|
|
|
4
4
|
'Item delivered in mailbox': { status: 'delivered', stage: 'delivered' },
|
|
5
5
|
// Left at the safe place the recipient chose.
|
|
6
6
|
'Item delivered at safeplace': { status: 'delivered', stage: 'delivered' },
|
|
7
|
+
// Left with a neighbour, whose name and address the notice in the mailbox gives.
|
|
8
|
+
'Your parcel was delivered at one of your neighbours. You can find all delivery details in your mailbox.': { status: 'delivered', stage: 'delivered' },
|
|
7
9
|
'Item available at Pick-up point': { status: 'in_transit', stage: 'ready_for_pickup' },
|
|
8
10
|
// On its way to a locker, then waiting in it, with the brand the parser puts in place of
|
|
9
11
|
// bpost's placeholder.
|
|
@@ -217,6 +217,14 @@
|
|
|
217
217
|
"confirmedBy": "live",
|
|
218
218
|
"firstSeen": "2026-10-29"
|
|
219
219
|
},
|
|
220
|
+
{
|
|
221
|
+
"wording": "Your parcel was delivered at one of your neighbours. You can find all delivery details in your mailbox.",
|
|
222
|
+
"language": "en",
|
|
223
|
+
"stage": "delivered",
|
|
224
|
+
"confirmedBy": "live",
|
|
225
|
+
"firstSeen": "2026-10-30",
|
|
226
|
+
"note": "Left with a neighbour; the notice in the mailbox names them."
|
|
227
|
+
},
|
|
220
228
|
{
|
|
221
229
|
"wording": "Awaiting presentation to Customs",
|
|
222
230
|
"language": "en",
|
|
@@ -40,9 +40,10 @@ const WORDED = new Set(['FPX_O_IR', 'FPX_O_IRI']);
|
|
|
40
40
|
// waybill: "Waybill generated for …", as Emile words it, and its order data
|
|
41
41
|
// the partner it went to: "Order information has been transmitted to DPD."
|
|
42
42
|
// Asendia Hong Kong, which flies parcels for 4PX, relays its label, then the
|
|
43
|
-
// manifest it makes once the parcel has left 4PX's facility.
|
|
43
|
+
// manifest it makes once the parcel has left 4PX's facility. Helthjem's notice that
|
|
44
|
+
// the shop announced the parcel is relayed as "Parcel arrival notified".
|
|
44
45
|
const WORDING = new Map([['waybill generated', 'registered'], ['order data transmitted', 'registered'],
|
|
45
|
-
['label creation', 'registered'], ['manifest created', 'in_transit']]);
|
|
46
|
+
['label creation', 'registered'], ['manifest created', 'in_transit'], ['parcel arrival notified', 'registered']]);
|
|
46
47
|
const LABEL_FOR = /^waybill generated for [a-z0-9]+$|^order information has been transmitted to [a-z][a-z .-]{0,30}$/;
|
|
47
48
|
// Scans a partner relays without a code, by `normalizeStatusWording` wording.
|
|
48
49
|
// A partner's order made before it has the parcel is a label, not a receipt.
|
|
@@ -310,6 +310,15 @@
|
|
|
310
310
|
"firstSeen": "2026-10-20",
|
|
311
311
|
"note": "A partner's order-data step naming the partner, relayed; other partners' names are staged the same."
|
|
312
312
|
},
|
|
313
|
+
{
|
|
314
|
+
"code": "FPX_O_IR",
|
|
315
|
+
"wording": "Parcel arrival notified",
|
|
316
|
+
"language": "en",
|
|
317
|
+
"stage": "registered",
|
|
318
|
+
"confirmedBy": "live",
|
|
319
|
+
"firstSeen": "2026-10-30",
|
|
320
|
+
"note": "Helthjem's notice that the shop announced the parcel, relayed in English once 4PX hands it over; the shared rules read the arrival as transit."
|
|
321
|
+
},
|
|
313
322
|
{
|
|
314
323
|
"code": "FPX_D_DDRH",
|
|
315
324
|
"wording": "Unfortunately, consignee not present. notification was left._nabn",
|
|
@@ -41,17 +41,19 @@ const holds = byWording({
|
|
|
41
41
|
'The shipment item is being customs cleared by us.': customs,
|
|
42
42
|
'The shipment item is being held at a distribution terminal awaiting the booked delivery date or, awaiting an agreement of delivery with the recipient.': moving,
|
|
43
43
|
});
|
|
44
|
+
/** OTHER wordings for a notice to the recipient or the driver rather than a scan. */
|
|
45
|
+
const ADMINISTRATIVE = [
|
|
46
|
+
'Suggested delivery time.',
|
|
47
|
+
'Information to the driver added by the recipient.',
|
|
48
|
+
'A text message notification has been delivered to the recipient.',
|
|
49
|
+
'A text message notification has been sent to the recipient.',
|
|
50
|
+
'A letter notification has been sent to the recipient.',
|
|
51
|
+
'E-mail notification has been sent to the recipient.',
|
|
52
|
+
'Notification sent via APP.',
|
|
53
|
+
'Pick-up at servicepoint, selected by the receiver.',
|
|
54
|
+
];
|
|
44
55
|
export function isPostnordAdministrativeEvent(code, description) {
|
|
45
|
-
return code === 'OTHER' &&
|
|
46
|
-
'Suggested delivery time.',
|
|
47
|
-
'Information to the driver added by the recipient.',
|
|
48
|
-
'A text message notification has been delivered to the recipient.',
|
|
49
|
-
'A text message notification has been sent to the recipient.',
|
|
50
|
-
'A letter notification has been sent to the recipient.',
|
|
51
|
-
'E-mail notification has been sent to the recipient.',
|
|
52
|
-
'Notification sent via APP.',
|
|
53
|
-
'Pick-up at servicepoint, selected by the receiver.',
|
|
54
|
-
].includes(description);
|
|
56
|
+
return code === 'OTHER' && ADMINISTRATIVE.includes(description);
|
|
55
57
|
}
|
|
56
58
|
export function classifyPostnordStatus(code, description = '') {
|
|
57
59
|
const wording = normalizeStatusWording(description);
|
|
@@ -68,5 +70,6 @@ export function classifyPostnordStatus(code, description = '') {
|
|
|
68
70
|
*/
|
|
69
71
|
export const statusMap = {
|
|
70
72
|
stage: (code, wording) => (code ? classifyPostnordStatus(code, wording) : milestones.get(wording) ?? holds.get(wording))?.stage,
|
|
71
|
-
gaps:
|
|
73
|
+
gaps: ADMINISTRATIVE.map((wording) => ({ code: 'OTHER', wording: normalizeStatusWording(wording),
|
|
74
|
+
note: 'A notice to the recipient or the driver, not a scan: the parser drops it, and a stored copy keeps the stage of the scan before it.' })),
|
|
72
75
|
};
|
|
@@ -70,8 +70,8 @@ const ACTIVITY_STAGES = new Map([
|
|
|
70
70
|
// A notice that the package is on its way, without a facility.
|
|
71
71
|
['DA', 'in_transit'],
|
|
72
72
|
// Delays and new delivery plans: a late flight, a possible delay, a new
|
|
73
|
-
// plan, a delivery a day early.
|
|
74
|
-
['18', 'in_transit'], ['Q5', 'in_transit'], ['E3', 'in_transit'], ['2U', 'in_transit'],
|
|
73
|
+
// plan, a delivery a day early, a Saturday delivery requested.
|
|
74
|
+
['18', 'in_transit'], ['Q5', 'in_transit'], ['E3', 'in_transit'], ['2U', 'in_transit'], ['RF', 'in_transit'],
|
|
75
75
|
// Address corrections, redirects and receiver requests, including a
|
|
76
76
|
// delivery to an access point that is still pending or only confirmed, and
|
|
77
77
|
// one to the receiver's address instead of the access point.
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
{ "code": "Q5", "language": "en", "stage": "in_transit", "confirmedBy": "live", "firstSeen": "2026-10-07", "note": "actCode: \"We're sorry this package may experience a temporary delay.\"" },
|
|
27
27
|
{ "code": "E3", "language": "en", "stage": "in_transit", "confirmedBy": "live", "firstSeen": "2026-10-07", "note": "actCode: \"We’re sorry your package was delayed. We are adjusting delivery plans as quickly as possible.\"" },
|
|
28
28
|
{ "code": "2U", "language": "en", "stage": "in_transit", "confirmedBy": "live", "firstSeen": "2026-10-09", "note": "actCode: \"UPS will be in your area and will deliver your package a day early.\"" },
|
|
29
|
+
{ "code": "RF", "language": "en", "stage": "in_transit", "confirmedBy": "live", "firstSeen": "2026-10-30", "note": "actCode: \"Saturday Delivery has been requested. / Delivery will be rescheduled for Saturday.\" A new delivery plan; the parcel continues." },
|
|
29
30
|
{ "code": "AL", "language": "en", "stage": "in_transit", "confirmedBy": "live", "firstSeen": "2026-10-07", "note": "actCode: UPS corrected the postal code and the parcel continues." },
|
|
30
31
|
{ "code": "HM", "language": "en", "stage": "in_transit", "confirmedBy": "live", "firstSeen": "2026-10-07", "note": "actCode: \"The package has been redirected and forwarded to the delivery center.\"" },
|
|
31
32
|
{ "code": "H6", "language": "en", "stage": "in_transit", "confirmedBy": "live", "firstSeen": "2026-10-07", "note": "actCode: a delivery change request, processed once the parcel is back at the facility." },
|
|
@@ -54,6 +54,10 @@ export function uspsTrackingUrl(trackingNumber) {
|
|
|
54
54
|
const MONTHS = '(January|February|March|April|May|June|July|August|September|October|November|December)';
|
|
55
55
|
const DATE_PATTERN = new RegExp(`${MONTHS}\\s+\\d{1,2},?\\s+\\d{4}`, 'i');
|
|
56
56
|
const TIME_PATTERN = /\d{1,2}:\d{2}(?::\d{2})?\s*[ap]\.?m\.?/i;
|
|
57
|
+
// Incoming international mail shows this undated from the origin post's electronic notice
|
|
58
|
+
// until USPS scans the item, past the origin post's later scans abroad and sometimes after
|
|
59
|
+
// the item arrives, so it cannot stand for the item's status while a scan is dated.
|
|
60
|
+
const ORIGIN_POST_NOTICE = /^origin post is preparing shipment\b/i;
|
|
57
61
|
function eventTime(dateText, timeText, location) {
|
|
58
62
|
const dateMatch = DATE_PATTERN.exec(dateText);
|
|
59
63
|
const timeMatch = TIME_PATTERN.exec(timeText);
|
|
@@ -222,7 +226,9 @@ export function parseUSPSTrackingHtml(page, trackingNumber) {
|
|
|
222
226
|
// have no resolvable timezone; sorting those behind dated scans loses meaning.
|
|
223
227
|
const events = handoffsInTransit(timeline.length ? timeline.slice(0, MAX_EVENTS_TO_RETURN)
|
|
224
228
|
: rows.slice(0, MAX_EVENTS_TO_RETURN).map(({ event }) => event));
|
|
225
|
-
const
|
|
229
|
+
const summary = statusArea || banner;
|
|
230
|
+
const statusText = (ORIGIN_POST_NOTICE.test(summary) ? events[0]?.description : undefined) || summary
|
|
231
|
+
|| events[0]?.description || 'Tracking information received';
|
|
226
232
|
const reported = uspsStage(`${statusText} ${banner}`)
|
|
227
233
|
?? events.map((event) => event.stage).find((value) => value !== undefined);
|
|
228
234
|
const stage = reported === 'accepted' && events.some((event) => event.stage === 'in_transit') ? 'in_transit' : reported;
|
|
@@ -52,6 +52,8 @@ const WORDING = new Map([
|
|
|
52
52
|
['Out customs authorities', { status: 'in_transit', stage: 'in_transit' }],
|
|
53
53
|
['Arrived at destination', { status: 'in_transit', stage: 'in_transit' }],
|
|
54
54
|
['Handled by local carrier', { status: 'in_transit', stage: 'in_transit' }],
|
|
55
|
+
// The destination partner's departure from its hub after the batch handover, as DPD Romania words it.
|
|
56
|
+
['Departure Scan', { status: 'in_transit', stage: 'in_transit' }],
|
|
55
57
|
['Transport to delivery centre', { status: 'in_transit', stage: 'in_transit' }],
|
|
56
58
|
['Arrived at delivery centre', { status: 'in_transit', stage: 'in_transit' }],
|
|
57
59
|
['Your shipment has been processed at sorting center and ready for shipping', { status: 'in_transit', stage: 'in_transit' }],
|
|
@@ -341,6 +341,14 @@
|
|
|
341
341
|
"firstSeen": "2026-10-21",
|
|
342
342
|
"note": "The destination post's intake after the release from customs."
|
|
343
343
|
},
|
|
344
|
+
{
|
|
345
|
+
"wording": "Departure Scan",
|
|
346
|
+
"language": "en",
|
|
347
|
+
"stage": "in_transit",
|
|
348
|
+
"confirmedBy": "live",
|
|
349
|
+
"firstSeen": "2026-10-30",
|
|
350
|
+
"note": "The destination partner's departure from its hub, minutes after Yanwen's batch handover, as DPD Romania words it."
|
|
351
|
+
},
|
|
344
352
|
{
|
|
345
353
|
"wording": "Transport to delivery centre",
|
|
346
354
|
"language": "en",
|
|
@@ -460,6 +460,9 @@ function providerWordingStage(description) {
|
|
|
460
460
|
// ECMS's pre-alert, in English then Chinese: the parcel has yet to reach its origin warehouse.
|
|
461
461
|
if (/^virtual manifest has been received[.!]?(?:\s*发货预报已收到[,,]?\s*正在等待货物到达我们的始发站仓库[。.]?)?$/iu.test(value))
|
|
462
462
|
return 'registered';
|
|
463
|
+
// DHL's arrival in the destination country, relayed in German, as DHL's own map reads it.
|
|
464
|
+
if (/^die sendung ist im zielland\/zielgebiet eingetroffen[.!]?$/i.test(value))
|
|
465
|
+
return 'in_transit';
|
|
463
466
|
// InPost's refusal at the door (LMD.9006), as InPost's own map reads it.
|
|
464
467
|
if (/^acceptance refusal[.!]?$/i.test(value))
|
|
465
468
|
return 'failed_attempt';
|
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.829.
|
|
3
|
+
"version": "0.829.2-main.4450",
|
|
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",
|