universal-parcel-scraper 0.1309.4-main.8821 → 0.1309.7-main.8829

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 CHANGED
@@ -164,7 +164,7 @@ the command line's `track --source ParcelsApp` does the same.
164
164
  <!-- GENERATED:stages -->
165
165
  <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">
166
166
 
167
- The carrier folders record 24,352 such statuses, each filed under one stage.
167
+ The carrier folders record 24,369 such statuses, each filed under one stage.
168
168
  <!-- /GENERATED:stages -->
169
169
 
170
170
  Wording nobody recorded yet goes through a classifier that reads seven European languages.
@@ -85,6 +85,8 @@ const EVENT_STATUS = {
85
85
  'E508700V': { status: 'in_transit', stage: 'customs' },
86
86
  'E134630V': { status: 'in_transit', stage: 'customs' },
87
87
  'E314004V': { status: 'in_transit', stage: 'customs' },
88
+ // Inspected ("Envío inspeccionado"), recorded at the minute its processing completed with charges.
89
+ 'E771180R': { status: 'in_transit', stage: 'customs' },
88
90
  'E190000V': { status: 'in_transit', stage: 'in_transit' },
89
91
  // Handed back to the sender, or on the way back: never a delivery to the recipient.
90
92
  'I020000V': { status: 'exception', stage: 'returned' },
@@ -64,6 +64,7 @@
64
64
  { "code": "E508700V", "wording": "Transit authorised", "language": "en", "stage": "customs", "confirmedBy": "live", "firstSeen": "2026-10-25", "note": "Customs authorised the parcel's transit, between the start and the end of its customs procedures." },
65
65
  { "code": "E134630V", "wording": "Transit cleared", "language": "en", "stage": "customs", "confirmedBy": "live", "firstSeen": "2026-10-25", "note": "The customs transit ended, seconds before the procedures finished." },
66
66
  { "code": "E314004V", "wording": "En tramitación aduanera", "language": "es", "stage": "customs", "confirmedBy": "live", "firstSeen": "2026-11-22", "note": "An import under customs transit in processing, at the minute its transit cleared and minutes before the procedures finished." },
67
+ { "code": "E771180R", "wording": "Envío inspeccionado", "language": "es", "stage": "customs", "confirmedBy": "live", "firstSeen": "2026-11-23", "note": "Customs inspected the parcel, recorded at the minute its processing completed with charges." },
67
68
  { "code": "E190000V", "wording": "Customs procedures finished", "language": "en", "stage": "in_transit", "confirmedBy": "live", "firstSeen": "2026-10-25", "note": "Customs processing completed; the parcel goes on in transit." },
68
69
  { "code": "B170000V", "wording": "En aduana de origen", "language": "es", "stage": "customs", "confirmedBy": "live", "firstSeen": "2026-10-20", "note": "In the origin country's customs." },
69
70
  { "code": "B180000V", "wording": "Finalizada tramitación aduanera", "language": "es", "stage": "in_transit", "confirmedBy": "live", "firstSeen": "2026-11-18", "note": "The origin customs' processing completed, after B170000V; the parcel goes on in transit." },
@@ -6,6 +6,8 @@ import { decodeText, fetchBounded, userAgentOf } from '../../core/transport/inde
6
6
  import { retryAfterMs } from '../../core/transport/retryAfter.js';
7
7
  import { TRAWL_TRANSPORT_ALLOWANCE_MS } from '../../core/transport/trawl.js';
8
8
  import { DPD_RO_MAX_BYTES, normalizeDpdRoNumber, parseDpdRoReply, PROVIDER } from './parser.js';
9
+ /** The least of the browser service's time in which the tracker page passes its Turnstile check and answers. */
10
+ const PAGE_MIN_MS = 10_000;
9
11
  // The endpoint MyDPD's public tracker reads a shipment from; the DPD app ships
10
12
  // the same path. It answers only a request carrying the token of the page's
11
13
  // Turnstile check. tracking.dpd.ro sits behind a Cloudflare challenge as well.
@@ -57,7 +59,9 @@ export class DpdRoTracker {
57
59
  #page(number, trawl) {
58
60
  return { id: 'trawl', enabled: Boolean(trawl), run: async ({ signal, remainingMs }) => {
59
61
  const timeoutMs = Math.floor(Math.min(45_000, remainingMs - TRAWL_TRANSPORT_ALLOWANCE_MS));
60
- if (timeoutMs < 1)
62
+ // The page passes its Turnstile check before it asks for the waybill: with less of the service's time it ends
63
+ // without the reply, so the read is not started and the lookup fails as its budget.
64
+ if (timeoutMs < PAGE_MIN_MS)
61
65
  throw new BudgetExceededError(PROVIDER, remainingMs);
62
66
  // The page gets its own Turnstile token and asks for the waybill in its route; the token stays in the browser.
63
67
  const page = await trawl.scrape({ url: dpdRoTrackingUrl(number), skipHttp: true, maxTier: 3, maxTimeout: timeoutMs,
@@ -66,6 +66,10 @@ export function classifyPosteItalianeStatus(rawWording) {
66
66
  return { status: 'exception', stage: 'failed_attempt' };
67
67
  if (value.startsWith('in restituzione al mittente'))
68
68
  return { status: 'exception', stage: 'returned' };
69
+ // Held for the sender's instructions, after the recipient refused the parcel or for another reason the line gives:
70
+ // it goes out again or back only on the sender's word.
71
+ if (value.startsWith('la spedizione è in attesa di istruzioni da parte del mittente'))
72
+ return { status: 'exception', stage: 'exception' };
69
73
  // Registered mail held at a post office from the date the line gives.
70
74
  if (value.startsWith('la spedizione sarà disponibile per il ritiro'))
71
75
  return { status: 'out_for_delivery', stage: 'ready_for_pickup' };
@@ -30,6 +30,7 @@
30
30
  { "wording": "consegna non andata a buon fine…", "language": "it", "stage": "failed_attempt", "confirmedBy": "live", "firstSeen": "2026-09-10", "note": "Prefix match; seen live with a wrong or incomplete recipient address." },
31
31
  { "wording": "non è stato possibile effettuare la consegna…", "language": "it", "stage": "failed_attempt", "confirmedBy": "live", "firstSeen": "2026-10-22", "note": "Prefix match: a failed round, with the working day the next round starts from." },
32
32
  { "wording": "sono in corso delle verifiche sulla spedizione. contatta assistenza", "language": "it", "stage": "failed_attempt", "confirmedBy": "prior-art", "firstSeen": "2026-09-10", "note": "Exact match." },
33
+ { "wording": "la spedizione è in attesa di istruzioni da parte del mittente…", "language": "it", "stage": "exception", "confirmedBy": "live", "firstSeen": "2026-11-23", "note": "Prefix match: held for the sender's instructions, seen after a recipient's refusal and before the return to the sender." },
33
34
  { "wording": "in restituzione al mittente…", "language": "it", "stage": "returned", "confirmedBy": "live", "firstSeen": "2026-09-10", "note": "Prefix match. Movements from here on carry the return flag, and the final delivery is the one to the sender." },
34
35
  { "code": "5", "language": "it", "stage": "delivered", "confirmedBy": "live", "firstSeen": "2026-09-10", "note": "Envelope-level `stato`, not an event code: it forces delivered regardless of the movement wording, or returned when that delivery carries the return flag." }
35
36
  ]
@@ -110,6 +110,70 @@
110
110
  "confirmedBy": "live",
111
111
  "firstSeen": "2026-11-23",
112
112
  "note": "The hand-over to the delivering carrier, after its preparation: that carrier's own scans come later."
113
+ },
114
+ {
115
+ "wording": "Shipment information received",
116
+ "language": "en",
117
+ "stage": "registered",
118
+ "confirmedBy": "live",
119
+ "firstSeen": "2026-11-23",
120
+ "note": "The parcel's details from the sender, before any scan of the parcel."
121
+ },
122
+ {
123
+ "wording": "The instruction data for this shipment have been provided by the sender to DHL electronically",
124
+ "language": "en",
125
+ "stage": "registered",
126
+ "confirmedBy": "live",
127
+ "firstSeen": "2026-11-23",
128
+ "note": "DHL's notice that the sender's data reached it, as Prime relays it before the parcel leaves China."
129
+ },
130
+ {
131
+ "wording": "Order Received",
132
+ "language": "en",
133
+ "stage": "registered",
134
+ "confirmedBy": "live",
135
+ "firstSeen": "2026-11-23",
136
+ "note": "After the parcel's details and DHL's notice of the sender's data, and a day before the first sorting centre's scan: the order, not yet the parcel."
137
+ },
138
+ {
139
+ "wording": "Arrived at origin facility",
140
+ "language": "en",
141
+ "stage": "in_transit",
142
+ "confirmedBy": "live",
143
+ "firstSeen": "2026-11-23",
144
+ "note": "The parcel at the origin's sorting centre."
145
+ },
146
+ {
147
+ "wording": "Departed from sort facility",
148
+ "language": "en",
149
+ "stage": "in_transit",
150
+ "confirmedBy": "live",
151
+ "firstSeen": "2026-11-23",
152
+ "note": "The parcel leaving the origin's sorting centre."
153
+ },
154
+ {
155
+ "wording": "Shipment is in transit to next facility",
156
+ "language": "en",
157
+ "stage": "in_transit",
158
+ "confirmedBy": "live",
159
+ "firstSeen": "2026-11-23",
160
+ "note": "Between the origin's sorting centre and the airport."
161
+ },
162
+ {
163
+ "wording": "Arrived at the origin international airport",
164
+ "language": "en",
165
+ "stage": "in_transit",
166
+ "confirmedBy": "live",
167
+ "firstSeen": "2026-11-23",
168
+ "note": "At the airport the flight leaves from."
169
+ },
170
+ {
171
+ "wording": "Waiting for the flight",
172
+ "language": "en",
173
+ "stage": "in_transit",
174
+ "confirmedBy": "live",
175
+ "firstSeen": "2026-11-23",
176
+ "note": "At the origin airport after its arrival there, before the flight."
113
177
  }
114
178
  ]
115
179
  }
@@ -6,6 +6,8 @@ import { decodeText, fetchBounded, userAgentOf } from '../../core/transport/inde
6
6
  import { retryAfterMs } from '../../core/transport/retryAfter.js';
7
7
  import { TRAWL_TRANSPORT_ALLOWANCE_MS } from '../../core/transport/trawl.js';
8
8
  import { normalizeSpeedyNumber, parseSpeedyReply, PROVIDER, SPEEDY_MAX_BYTES } from './parser.js';
9
+ /** The least of the browser service's time in which the tracker page passes its Turnstile check and answers. */
10
+ const PAGE_MIN_MS = 10_000;
9
11
  // The endpoint MySpeedy's public tracker reads a shipment from. It answers only
10
12
  // a request carrying the token of the page's Turnstile check.
11
13
  export const SPEEDY_ENDPOINT = 'https://myspeedy.speedy.bg/rest/public/track';
@@ -65,7 +67,9 @@ export class SpeedyTracker {
65
67
  #page(number, trawl) {
66
68
  return { id: 'trawl', enabled: Boolean(trawl), run: async ({ signal, remainingMs }) => {
67
69
  const timeoutMs = Math.floor(Math.min(45_000, remainingMs - TRAWL_TRANSPORT_ALLOWANCE_MS));
68
- if (timeoutMs < 1)
70
+ // The page passes its Turnstile check before it asks for the number: with less of the service's time it ends
71
+ // without the reply, so the read is not started and the lookup fails as its budget.
72
+ if (timeoutMs < PAGE_MIN_MS)
69
73
  throw new BudgetExceededError(PROVIDER, remainingMs);
70
74
  // The page gets its own Turnstile token and asks for the number in its route; the token stays in the browser.
71
75
  const page = await trawl.scrape({ url: speedyTrackingUrl(number), skipHttp: true, maxTier: 3, maxTimeout: timeoutMs,
@@ -2,6 +2,10 @@ import { type ClassifiedWording, type Stage } from '../../core/status/index.js';
2
2
  import { type CarrierStatusMap } from '../../core/status/statusMap.js';
3
3
  /** A wording without the signer it names, as the map and the stage read it. */
4
4
  export declare function stone3plUnsigned(wording: string): string;
5
+ /**
6
+ * A wording's stage by the map: the whole wording, else what follows the place it names first. A head
7
+ * the shared rules read, as "Returned, …", is no place, so the wording is not read without it.
8
+ */
5
9
  export declare function stone3plStage(wording: string): Stage | undefined;
6
10
  export declare function stone3plScanStage(text: string): ClassifiedWording | null;
7
11
  export declare const statusMap: CarrierStatusMap;
@@ -10,8 +10,20 @@ const SIGNER = /\s*[,;:.\-–]?\s*\b(?:signed(?: for)? by|signatory|received by)
10
10
  export function stone3plUnsigned(wording) {
11
11
  return wording.replace(SIGNER, '').replace(/^[\s,;:\-–]+|[\s,;:\-–]+$/g, '');
12
12
  }
13
+ // The place some scans name before their wording: "PLACE, Arrived at origin facility".
14
+ const PLACE_HEAD = /^([^,\d]{2,40}), (.+)$/;
15
+ /**
16
+ * A wording's stage by the map: the whole wording, else what follows the place it names first. A head
17
+ * the shared rules read, as "Returned, …", is no place, so the wording is not read without it.
18
+ */
13
19
  export function stone3plStage(wording) {
14
- return WORDINGS.get(normalizeStatusWording(wording));
20
+ const whole = WORDINGS.get(normalizeStatusWording(wording));
21
+ if (whole)
22
+ return whole;
23
+ const [, head, tail] = PLACE_HEAD.exec(wording) ?? [];
24
+ if (!head || !tail || head.trim().split(/\s+/).length > 3 || classifyWording(head).source !== 'none')
25
+ return undefined;
26
+ return WORDINGS.get(normalizeStatusWording(tail));
15
27
  }
16
28
  export function stone3plScanStage(text) {
17
29
  const wording = stone3plUnsigned(text);
@@ -91,6 +91,54 @@
91
91
  "confirmedBy": "live",
92
92
  "firstSeen": "2026-10-28",
93
93
  "note": "A batch handed on to the last-mile carrier, after its pickup at the destination port."
94
+ },
95
+ {
96
+ "wording": "Shipping inbound in sorting center",
97
+ "stage": "in_transit",
98
+ "language": "en",
99
+ "confirmedBy": "live",
100
+ "firstSeen": "2026-11-23",
101
+ "note": "The origin's sorting centre receiving the parcel, after the place it names."
102
+ },
103
+ {
104
+ "wording": "Arrived at origin facility",
105
+ "stage": "in_transit",
106
+ "language": "en",
107
+ "confirmedBy": "live",
108
+ "firstSeen": "2026-11-23",
109
+ "note": "The parcel at the origin's sorting centre, after the place it names."
110
+ },
111
+ {
112
+ "wording": "Departed from sort facility",
113
+ "stage": "in_transit",
114
+ "language": "en",
115
+ "confirmedBy": "live",
116
+ "firstSeen": "2026-11-23",
117
+ "note": "The parcel leaving the origin's sorting centre, after the place it names."
118
+ },
119
+ {
120
+ "wording": "Shipment is in transit to next facility",
121
+ "stage": "in_transit",
122
+ "language": "en",
123
+ "confirmedBy": "live",
124
+ "firstSeen": "2026-11-23",
125
+ "note": "Between the origin's sorting centre and the airport."
126
+ },
127
+ {
128
+ "wording": "Arrived at the origin international airport",
129
+ "stage": "in_transit",
130
+ "language": "en",
131
+ "confirmedBy": "live",
132
+ "firstSeen": "2026-11-23",
133
+ "note": "At the airport the flight leaves from."
134
+ },
135
+ {
136
+ "wording": "Waiting for the flight",
137
+ "stage": "in_transit",
138
+ "language": "en",
139
+ "confirmedBy": "live",
140
+ "firstSeen": "2026-11-23",
141
+ "note": "At the origin airport after its arrival there, before the flight."
94
142
  }
95
143
  ]
96
144
  }
@@ -62,6 +62,7 @@
62
62
  {"wording": "Departure Scan", "language": "en", "stage": "in_transit", "confirmedBy": "live", "firstSeen": "2026-11-20", "note": "The last-mile carrier's departure scan on a line to Cyprus, after the import clearance."},
63
63
  {"wording": "Arrival Scan", "language": "en", "stage": "in_transit", "confirmedBy": "live", "firstSeen": "2026-11-20", "note": "Its arrival scan an hour later on the same line."},
64
64
  {"wording": "sorted_at_terminal", "language": "en", "stage": "in_transit", "confirmedBy": "live", "firstSeen": "2026-11-20", "note": "A last-mile carrier's status token, as SXW copies it: sorted at its terminal."},
65
+ {"wording": "delivered_to_locker", "language": "en", "stage": "ready_for_pickup", "confirmedBy": "live", "firstSeen": "2026-11-23", "note": "The same last-mile carrier's token, after its sorted_at_terminal: Budbee's webhook documentation gives the pair, this one as the parcel delivered to the locker for the recipient to collect."},
65
66
  {"wording": "【…】【…】¡Recolección exitosa!. El mensajero de J&T asignado … recolectó tu envío.", "language": "es", "stage": "in_transit", "confirmedBy": "live", "firstSeen": "2026-11-23", "note": "Copied from J&T Express Mexico, which delivers the last leg on the line into Mexico: its courier collects the parcel two days after the import clearance. It is not the first acceptance. The town, the site, the courier and what follows the sentence are read as ellipses."},
66
67
  {"wording": "【…】Tu envío ha salido de【…】con destino a【…】", "language": "es", "stage": "in_transit", "confirmedBy": "live", "firstSeen": "2026-11-23", "note": "Copied from J&T Express Mexico: the parcel leaves one of its sites for the next. The towns and sites are read as ellipses."},
67
68
  {"wording": "【…】Tu envío ha llegado a【…】", "language": "es", "stage": "in_transit", "confirmedBy": "live", "firstSeen": "2026-11-23", "note": "Copied from J&T Express Mexico: the parcel reaches one of its sites."},
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "Universal Parcel Scraper",
5
- "version": "0.1309.4-main.8821"
5
+ "version": "0.1309.7-main.8829"
6
6
  },
7
7
  "paths": {
8
8
  "/health": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "universal-parcel-scraper",
3
- "version": "0.1309.4-main.8821",
3
+ "version": "0.1309.7-main.8829",
4
4
  "description": "Self-hosted parcel tracking: carrier detection, dedicated scrapers and optional universal providers.",
5
5
  "type": "module",
6
6
  "license": "PolyForm-Noncommercial-1.0.0",