universal-parcel-scraper 0.960.4-main.5215 → 0.960.6-main.5220
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/browser/scraper.js +1 -1
- package/dist/carriers/chunghwa-post/status.d.ts +7 -1
- package/dist/carriers/chunghwa-post/status.js +14 -0
- package/dist/carriers/dhl/adapter.js +5 -5
- package/dist/carriers/dhl/status.d.ts +9 -0
- package/dist/carriers/dhl/status.js +14 -2
- package/dist/carriers/dhl/statuses.json +1 -0
- package/dist/carriers/jrt/statuses.json +8 -0
- package/dist/carriers/yunexpress/adapter.d.ts +0 -1
- package/dist/carriers/yunexpress/adapter.js +26 -7
- package/dist/core/status/language.js +1 -1
- package/dist/core/transport/trawl.d.ts +1 -1
- package/dist/providers/parcelsapp/adapter.js +3 -1
- package/dist/providers/shared/result.js +3 -1
- package/dist/providers/shared/scans.d.ts +1 -0
- package/dist/providers/shared/scans.js +2 -0
- package/dist/providers/status.js +1 -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 18,
|
|
166
|
+
The carrier folders record 18,772 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.
|
package/dist/browser/scraper.js
CHANGED
|
@@ -45456,7 +45456,7 @@ function ru(e) {
|
|
|
45456
45456
|
if (/^(?:posting\/collection|posted|origin scan)$|received at (?:our |the )?(?:[a-z]+ )?origin (?:office|facility|hub)|dropped off (?:after|before) (?:the )?latest drop ?off time/.test(t)) return "accepted";
|
|
45457
45457
|
if (/(?:\b(?:not|never)|n't)(?: (?:be|been|being))? accepted\b/.test(t)) return "exception";
|
|
45458
45458
|
if ($l.test(t)) return /\b(?:if|unless|wenn|falls|si|qualora|caso)\b/.test(t) ? void 0 : /\b(?:yet|noch|encore|ancora|todavia|aun|ainda|jeszcze)\b/.test(t) ? eu.test(t) ? "registered" : new RegExp(ql).test(t) ? "ready_for_pickup" : void 0 : "exception";
|
|
45459
|
-
if (/accepted|(?<!\b(?:be|being) )picked up|pick up was successful|^drop off$|pick ?up scan|prepared the package for return to ups or pickup by ups|handed (?:over )?to (?:dpd|gls)|package received at dhl|item booked|consignment was mailed|posted at a postal point|pris en charge|prise en charge|collecte.*(?:reussi|effectue)|recupere.*boite aux lettres|depose.*point postal|remis a (?:dpd|gls)|envoi.*depose|abholung.*erfolgreich|^(?:die sendung wurde )?erfolgreich abgeholt$|eingeliefert|an (?:dpd|gls) ubergeben|paket.*(?:angenommen|ubernommen)|ritiro.*(?:riuscito|effettuato)|pres[oa] in carico|affidat[oa] a (?:dpd|gls)|depositat.*punto postale|spedizione.*impostata/.test(t) || /^到达收货点|^item received by royal mail$|\btaken over by one of our operators\b|\bwe've received your (?:parcel|package|item) at the parcel ?shop\b|^(?:(?:the |your )?(?:item|parcel|package|shipment) )?(?:was|has been) dropped off at (?:the |a )?parcel ?shop$|^(?![^,]*\b(?:recipient|consignee|receiver|customer|addressee|buyer|pick ?up point|parcel ?shop|locker|destination)\b)[a-z][\w&' -]{0,40} has received the goods(?:, [^,]{1,40}){0,2}\.?$|^the shipment has been deposited at a seur pickup point$|^(?:the |your )?collection (?:has been |was )?(?:carried out|completed)$|^已入库|^(?:(?:the |your )?(?:item|parcel|package|shipment) )?(?:has been |was )?put into storage$/.test(t) || /^sender advised item dropped off at parcel locker$|^dropped off at postbox$/.test(t) || /^(?:the )?shipment has been taken over at the post (?:office|locker) point$/.test(t) || /^spedizione affidata a una fedex location\b/.test(t) || /^die sendung wurde vom absender (?:im|in der|in einem|in einer) (?:[\w-]+ )?(?:paketshop|parcelshop|filiale)\b(?!.*\bnicht\b).*\babgegeben$/.test(t) || /^(?:the |your )?(?:package|parcel|shipment) (?:was|has been) dropped off by the sender at (?:the |a )?(?:hermes )?(?:paketshop|parcel ?shop)\b/.test(t) || /^sending the (?:package|parcel) at the pick ?up point$|^handing over the (?:package|parcel) to the courier$/.test(t)) return "accepted";
|
|
45459
|
+
if (/accepted|(?<!\b(?:be|being) )picked up|pick up was successful|^drop off$|pick ?up scan|prepared the package for return to ups or pickup by ups|handed (?:over )?to (?:dpd|gls)|package received at dhl|item booked|consignment was mailed|posted at (?:a |the )?(?:postal point|post office)|pris en charge|prise en charge|collecte.*(?:reussi|effectue)|recupere.*boite aux lettres|depose.*point postal|remis a (?:dpd|gls)|envoi.*depose|abholung.*erfolgreich|^(?:die sendung wurde )?erfolgreich abgeholt$|eingeliefert|an (?:dpd|gls) ubergeben|paket.*(?:angenommen|ubernommen)|ritiro.*(?:riuscito|effettuato)|pres[oa] in carico|affidat[oa] a (?:dpd|gls)|depositat.*punto postale|spedizione.*impostata/.test(t) || /^到达收货点|^item received by royal mail$|\btaken over by one of our operators\b|\bwe've received your (?:parcel|package|item) at the parcel ?shop\b|^(?:(?:the |your )?(?:item|parcel|package|shipment) )?(?:was|has been) dropped off at (?:the |a )?parcel ?shop$|^(?![^,]*\b(?:recipient|consignee|receiver|customer|addressee|buyer|pick ?up point|parcel ?shop|locker|destination)\b)[a-z][\w&' -]{0,40} has received the goods(?:, [^,]{1,40}){0,2}\.?$|^the shipment has been deposited at a seur pickup point$|^(?:the |your )?collection (?:has been |was )?(?:carried out|completed)$|^已入库|^(?:(?:the |your )?(?:item|parcel|package|shipment) )?(?:has been |was )?put into storage$/.test(t) || /^sender advised item dropped off at parcel locker$|^dropped off at postbox$/.test(t) || /^(?:the )?shipment has been taken over at the post (?:office|locker) point$/.test(t) || /^spedizione affidata a una fedex location\b/.test(t) || /^die sendung wurde vom absender (?:im|in der|in einem|in einer) (?:[\w-]+ )?(?:paketshop|parcelshop|filiale)\b(?!.*\bnicht\b).*\babgegeben$/.test(t) || /^(?:the |your )?(?:package|parcel|shipment) (?:was|has been) dropped off by the sender at (?:the |a )?(?:hermes )?(?:paketshop|parcel ?shop)\b/.test(t) || /^sending the (?:package|parcel) at the pick ?up point$|^handing over the (?:package|parcel) to the courier$/.test(t)) return "accepted";
|
|
45460
45460
|
if (/^acceptance of the (?:package|parcel) at the delivery branch abroad$/.test(t)) return "in_transit";
|
|
45461
45461
|
if (/^acceptance of the (?:package|parcel) at the pick ?up point$/.test(t)) return "ready_for_pickup";
|
|
45462
45462
|
if (/^(?:package|parcel) received (?:&|and) scanned at (?:the )?carrier's domestic warehouse$/.test(t) || /^(?:the )?goods (?:arrive|arrived|have arrived) at (?:the )?receiving point$/.test(t) || /(?<!\b(?:no|nao) )\badmitid[oa]s?\b|\badmision (?:en origen|pais de origen)\b/.test(t) || /^aceite(?:\.|$)|\b(?:envio|objeto|objecto|encomenda|remessa) foi aceite\b/.test(t)) return "accepted";
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import { type ClassifiedWording } from '../../core/status/index.js';
|
|
1
|
+
import { type ClassifiedWording, type Stage } from '../../core/status/index.js';
|
|
2
2
|
import type { CarrierStatusMap } from '../../core/status/statusMap.js';
|
|
3
3
|
export declare function chunghwaPostStage(wording: string): ClassifiedWording | null;
|
|
4
|
+
/** A label an aggregator relays from the tracker, staged by the map, with the office it names as its place. */
|
|
5
|
+
export declare function chunghwaPostScan(label: string): {
|
|
6
|
+
stage: Stage;
|
|
7
|
+
wording: string;
|
|
8
|
+
location?: string;
|
|
9
|
+
} | undefined;
|
|
4
10
|
export declare const statusMap: CarrierStatusMap;
|
|
@@ -12,4 +12,18 @@ export function chunghwaPostStage(wording) {
|
|
|
12
12
|
const classified = classifyWording(wording, 'in_transit');
|
|
13
13
|
return classified.source === 'none' ? null : classified;
|
|
14
14
|
}
|
|
15
|
+
// ParcelsApp relays a scan as the office and the status in one label, sometimes followed by the
|
|
16
|
+
// tracker's follow-up column left empty ("<office>, 到達出口互換局, 後續處理方式:"). A follow-up with
|
|
17
|
+
// words in it is not read: it can send the item somewhere else.
|
|
18
|
+
const RELAYED = /^([^,,]{1,60}), ([^,,]{1,60})(?:, 後續處理方式[::])?$/u;
|
|
19
|
+
/** A label an aggregator relays from the tracker, staged by the map, with the office it names as its place. */
|
|
20
|
+
export function chunghwaPostScan(label) {
|
|
21
|
+
const text = label.trim();
|
|
22
|
+
const whole = WORDING.get(text);
|
|
23
|
+
if (whole)
|
|
24
|
+
return { stage: whole, wording: text };
|
|
25
|
+
const [, office, status] = RELAYED.exec(text) ?? [];
|
|
26
|
+
const stage = status ? WORDING.get(status.trim()) : undefined;
|
|
27
|
+
return stage ? { stage, wording: status.trim(), location: office.trim() } : undefined;
|
|
28
|
+
}
|
|
15
29
|
export const statusMap = { stage: (_code, wording) => WORDING.get(wording), gaps: [] };
|
|
@@ -30,7 +30,7 @@ import { countryCode, explicitOffsetTime, isoTime } from '../../core/time/index.
|
|
|
30
30
|
import { clean as cleanText, fetchBounded, parseJsonBytes, UpstreamHttpError, UpstreamNetworkError, } from '../../core/transport/index.js';
|
|
31
31
|
import { isRecord } from '../../core/types.js';
|
|
32
32
|
import { withoutPartnerLink } from './identity.js';
|
|
33
|
-
import { BOOKED_OPTION, movedParcel, preAdvice,
|
|
33
|
+
import { BOOKED_OPTION, keepsStage, movedParcel, preAdvice, stageForText, statusForStage } from './status.js';
|
|
34
34
|
const PROVIDER = 'DHL';
|
|
35
35
|
const TIMEZONE = 'Europe/Berlin';
|
|
36
36
|
const ORIGIN = 'https://www.dhl.de';
|
|
@@ -210,10 +210,10 @@ export function parseDHLTrackingResponse(payload, trackingNumber) {
|
|
|
210
210
|
const events = scans.filter((scan) => !(scan.time && preAdvice(scan.description) && millis(scan.time) > firstMove))
|
|
211
211
|
.sort((left, right) => millis(right.time) - millis(left.time)).slice(0, 100)
|
|
212
212
|
.map(({ time, ...event }) => ({ ...event, ...clock(time, event.location) }));
|
|
213
|
-
// A refused redirect is a notice: it keeps the stage of the scan before it.
|
|
213
|
+
// A refused redirect or a Packstation as the address is a notice: it keeps the stage of the scan before it.
|
|
214
214
|
events.forEach((event, index) => {
|
|
215
|
-
if (
|
|
216
|
-
Object.assign(event, { stage: events.slice(index + 1).find((older) => !
|
|
215
|
+
if (keepsStage(event.description ?? '')) {
|
|
216
|
+
Object.assign(event, { stage: events.slice(index + 1).find((older) => !keepsStage(older.description ?? ''))?.stage ?? 'registered', stage_source: 'none' });
|
|
217
217
|
}
|
|
218
218
|
});
|
|
219
219
|
const summary = withoutPartnerLink(clean(timeline.status));
|
|
@@ -227,7 +227,7 @@ export function parseDHLTrackingResponse(payload, trackingNumber) {
|
|
|
227
227
|
const fallback = Number(timeline.fortschritt) <= 1 ? 'registered' : String(events[0]?.stage || 'in_transit');
|
|
228
228
|
const stage = details.istZugestellt === true
|
|
229
229
|
? details.ruecksendung === true ? 'returned' : 'delivered'
|
|
230
|
-
:
|
|
230
|
+
: keepsStage(currentText) ? fallback : stageForText(currentText, fallback);
|
|
231
231
|
const delivery = isRecord(details.zustellung) ? details.zustellung : {};
|
|
232
232
|
const window = ['delivered', 'returned'].includes(stage) ? {} : deliveryWindow(delivery);
|
|
233
233
|
const stated = date(timeline.datumAktuellerStatus);
|
|
@@ -25,6 +25,15 @@ export declare const BOOKED_OPTION: RegExp;
|
|
|
25
25
|
* attempt, so the parcel keeps the stage it had.
|
|
26
26
|
*/
|
|
27
27
|
export declare const REFUSED_REDIRECT: RegExp;
|
|
28
|
+
/**
|
|
29
|
+
* A Packstation as the parcel's address ("Sendung auf dem Weg zur Packstation."): DHL writes it
|
|
30
|
+
* beside the loading onto the delivery vehicle, and also when a redirect sends the parcel to a
|
|
31
|
+
* Packstation, which can take another day. It says where the parcel goes, not how far it got, so
|
|
32
|
+
* it keeps the stage of the scan before it: read as transit, it undid an out-for-delivery scan.
|
|
33
|
+
*/
|
|
34
|
+
export declare const PACKSTATION_ADDRESS: RegExp;
|
|
35
|
+
/** A notice that keeps the stage of the scan before it. */
|
|
36
|
+
export declare function keepsStage(text: string): boolean;
|
|
28
37
|
/**
|
|
29
38
|
* DHL's pre-advice: the sender's electronic data ("Die Sendung wurde elektronisch angekündigt.",
|
|
30
39
|
* "The instruction data … provided … electronically"). Listed after a scan that moved the parcel,
|
|
@@ -12,6 +12,17 @@ export const BOOKED_OPTION = /\bals empfangsoption vorgemerkt\b/i;
|
|
|
12
12
|
* attempt, so the parcel keeps the stage it had.
|
|
13
13
|
*/
|
|
14
14
|
export const REFUSED_REDIRECT = /\bpaketumleitung wurde\b[^.]*\bstorniert\b/i;
|
|
15
|
+
/**
|
|
16
|
+
* A Packstation as the parcel's address ("Sendung auf dem Weg zur Packstation."): DHL writes it
|
|
17
|
+
* beside the loading onto the delivery vehicle, and also when a redirect sends the parcel to a
|
|
18
|
+
* Packstation, which can take another day. It says where the parcel goes, not how far it got, so
|
|
19
|
+
* it keeps the stage of the scan before it: read as transit, it undid an out-for-delivery scan.
|
|
20
|
+
*/
|
|
21
|
+
export const PACKSTATION_ADDRESS = /\bauf dem weg zur packstation\b/i;
|
|
22
|
+
/** A notice that keeps the stage of the scan before it. */
|
|
23
|
+
export function keepsStage(text) {
|
|
24
|
+
return REFUSED_REDIRECT.test(text) || PACKSTATION_ADDRESS.test(text);
|
|
25
|
+
}
|
|
15
26
|
/**
|
|
16
27
|
* DHL's pre-advice: the sender's electronic data ("Die Sendung wurde elektronisch angekündigt.",
|
|
17
28
|
* "The instruction data … provided … electronically"). Listed after a scan that moved the parcel,
|
|
@@ -87,9 +98,10 @@ export function statusForStage(stage) {
|
|
|
87
98
|
* keeps the progress before it.
|
|
88
99
|
*/
|
|
89
100
|
export const statusMap = {
|
|
90
|
-
stage: (_code, wording) =>
|
|
101
|
+
stage: (_code, wording) => keepsStage(wording) ? undefined : (stageForText(wording, '') || undefined),
|
|
91
102
|
gaps: [],
|
|
92
103
|
gapNote: (_code, wording) => BOOKED_OPTION.test(wording)
|
|
93
104
|
? 'The recipient\'s booked receiving option, left out of the history: a wish, not a movement.'
|
|
94
|
-
: REFUSED_REDIRECT.test(wording) ? 'A redirect DHL refused, a notice and not a delivery attempt: the parcel keeps the stage it had.'
|
|
105
|
+
: REFUSED_REDIRECT.test(wording) ? 'A redirect DHL refused, a notice and not a delivery attempt: the parcel keeps the stage it had.'
|
|
106
|
+
: PACKSTATION_ADDRESS.test(wording) ? 'A Packstation as the delivery address, a notice and not a movement: the parcel keeps the stage it had.' : undefined,
|
|
95
107
|
};
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
{ "wording": "Die Sendung wurde elektronisch angekündigt. Sobald die Sendung von uns bearbeitet wurde, erhalten Sie weitere Informationen.", "language": "de", "stage": "registered", "confirmedBy": "live", "firstSeen": "2026-11-03", "note": "Pre-advice. Seen after a processing scan; dated after a scan that moved the parcel, it is left out of the history." },
|
|
7
7
|
{ "wording": "Für diese Sendung wurde ein Liefertag als Empfangsoption vorgemerkt.", "language": "de", "confirmedBy": "live", "firstSeen": "2026-11-03", "note": "The recipient booked a delivery day; deliberately not mapped and left out of the history, like Hermes Germany's booked day, so it is not read as transit." },
|
|
8
8
|
{ "wording": "Die Paketumleitung wurde aufgrund Produkt/Service- Kombination nicht erlaubt storniert. Die Sendung wird an die Hausadresse zugestellt.", "language": "de", "confirmedBy": "live", "firstSeen": "2026-11-03", "note": "A redirect DHL refused, the parcel going to the home address; deliberately not mapped: a notice that keeps the stage of the scan before it, not a delivery attempt." },
|
|
9
|
+
{ "wording": "Sendung auf dem Weg zur Packstation.", "language": "de", "confirmedBy": "live", "firstSeen": "2026-11-04", "note": "A Packstation as the delivery address, written beside the loading onto the delivery vehicle or on a redirect to a Packstation; deliberately not mapped: a notice that keeps the stage of the scan before it. Read as transit, it undid an out-for-delivery scan." },
|
|
9
10
|
{ "wording": "Pick-up has been scheduled for the next working day and the information has been sent to the delivery person", "language": "en", "stage": "registered", "confirmedBy": "live", "firstSeen": "2026-10-19", "note": "A booked collection, before \"Pick-up was successful.\"." },
|
|
10
11
|
{ "wording": "Pick-up was successful.", "language": "en", "stage": "accepted", "confirmedBy": "live", "firstSeen": "2026-10-19", "note": "" },
|
|
11
12
|
{ "wording": "The shipment has been posted by the sender at the retail outlet", "language": "en", "stage": "accepted", "confirmedBy": "live", "firstSeen": "2026-10-19", "note": "Deutsche Post's posting at a retail outlet, \"in der Filiale eingeliefert\" in German." },
|
|
@@ -870,6 +870,14 @@
|
|
|
870
870
|
"confirmedBy": "live",
|
|
871
871
|
"firstSeen": "2026-11-04",
|
|
872
872
|
"note": "Copied from FedEx, which delivers the last leg: at its station before the delivery run."
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
"wording": "On the way, A trusted third-party vendor is on the way with your package.",
|
|
876
|
+
"language": "en",
|
|
877
|
+
"stage": "in_transit",
|
|
878
|
+
"confirmedBy": "live",
|
|
879
|
+
"firstSeen": "2026-11-03",
|
|
880
|
+
"note": "Copied from FedEx's in-transit scan (code IT): a contractor carries the parcel between FedEx's facilities, a day before the local station's scan and the delivery run."
|
|
873
881
|
}
|
|
874
882
|
]
|
|
875
883
|
}
|
|
@@ -5,7 +5,6 @@ import { type TrawlClient, type TrawlScrapeResponse } from '../../core/transport
|
|
|
5
5
|
export declare function normalizeYunExpressNumber(raw: string): string;
|
|
6
6
|
export declare function yunExpressTrackingUrl(raw: string): string;
|
|
7
7
|
export declare function parse(payload: unknown, trackingNumber: string): CarrierResult;
|
|
8
|
-
/** A later captured reply is final; never silently reuse an earlier success. */
|
|
9
8
|
export declare function parseCaptured(page: TrawlScrapeResponse, number: string): CarrierResult;
|
|
10
9
|
export declare class YunExpressTracker {
|
|
11
10
|
private readonly options;
|
|
@@ -325,6 +325,8 @@ export function parse(payload, trackingNumber) {
|
|
|
325
325
|
...(/^[A-Z]{2}$/.test(country) ? { destination_country: country } : {}), events: dated.slice(0, 100) };
|
|
326
326
|
}
|
|
327
327
|
/** A later captured reply is final; never silently reuse an earlier success. */
|
|
328
|
+
/** Time a retry needs for tier 2 to replay the session a refused tier 3 page saved. */
|
|
329
|
+
const TRAWL_RETRY_MS = 8_000;
|
|
328
330
|
export function parseCaptured(page, number) {
|
|
329
331
|
const capture = page.capturedResponses.filter((entry) => entry.url === API).at(-1);
|
|
330
332
|
if (!capture)
|
|
@@ -414,14 +416,31 @@ export class YunExpressTracker {
|
|
|
414
416
|
// The shared launcher serves a lookup for at most 60 s; a longer budget gives the browser that much.
|
|
415
417
|
{ id: 'browser', enabled: Boolean(this.options.executablePath), run: ({ signal, remainingMs }) => localBrowser(number, this.options.executablePath, signal, Math.min(60_000, Math.max(1, Math.floor(remainingMs)))) },
|
|
416
418
|
// Keep the local runtime primary. Service capture needs the matching
|
|
417
|
-
// decoded-response hook and is used only without local Chromium.
|
|
419
|
+
// decoded-response hook and is used only without local Chromium. The
|
|
420
|
+
// service skips tier 2 until it holds a session for the site, which only
|
|
421
|
+
// a tier 3 page saves, so tier 3 is allowed.
|
|
418
422
|
{ id: 'trawl', enabled: !this.options.executablePath && Boolean(this.options.trawl), run: async ({ signal, remainingMs }) => {
|
|
419
|
-
const
|
|
420
|
-
const
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
423
|
+
const started = Date.now();
|
|
424
|
+
const read = (budgetMs) => {
|
|
425
|
+
const timeoutMs = Math.max(1, Math.min(25_000, Math.floor(budgetMs)));
|
|
426
|
+
return this.options.trawl.scrape({ url: yunExpressTrackingUrl(number), skipHttp: true, maxTier: 3,
|
|
427
|
+
maxTimeout: timeoutMs, captureResponses: [API], settleTimeout: 5_000 }, {
|
|
428
|
+
provider: 'TRAWL while fetching YunExpress', timeoutMs, maxBytes: 2_000_000, fetcher: this.options.fetcher, signal
|
|
429
|
+
});
|
|
430
|
+
};
|
|
431
|
+
const page = await read(remainingMs);
|
|
432
|
+
try {
|
|
433
|
+
return parseCaptured(page, number);
|
|
434
|
+
}
|
|
435
|
+
catch (error) {
|
|
436
|
+
// YunExpress's firewall often refuses the API call of a fresh tier 3 page. The page
|
|
437
|
+
// still leaves the service the site's session, and tier 2 replays it with that call.
|
|
438
|
+
const left = remainingMs - (Date.now() - started);
|
|
439
|
+
if (!(error instanceof ChallengeError) || page.tier !== 3 || left < TRAWL_RETRY_MS)
|
|
440
|
+
throw error;
|
|
441
|
+
signal.throwIfAborted();
|
|
442
|
+
return parseCaptured(await read(left), number);
|
|
443
|
+
}
|
|
425
444
|
} },
|
|
426
445
|
]);
|
|
427
446
|
}
|
|
@@ -654,7 +654,7 @@ export function trackingLanguageStage(description) {
|
|
|
654
654
|
return COLLECTED_BY_CARRIER.test(text) ? 'registered' : new RegExp(RECIPIENT).test(text) ? 'ready_for_pickup' : undefined;
|
|
655
655
|
}
|
|
656
656
|
// A pickup still to come ("will be picked up") is not one either.
|
|
657
|
-
if (/accepted|(?<!\b(?:be|being) )picked up|pick up was successful|^drop off$|pick ?up scan|prepared the package for return to ups or pickup by ups|handed (?:over )?to (?:dpd|gls)|package received at dhl|item booked|consignment was mailed|posted at a postal point|pris en charge|prise en charge|collecte.*(?:reussi|effectue)|recupere.*boite aux lettres|depose.*point postal|remis a (?:dpd|gls)|envoi.*depose|abholung.*erfolgreich|^(?:die sendung wurde )?erfolgreich abgeholt$|eingeliefert|an (?:dpd|gls) ubergeben|paket.*(?:angenommen|ubernommen)|ritiro.*(?:riuscito|effettuato)|pres[oa] in carico|affidat[oa] a (?:dpd|gls)|depositat.*punto postale|spedizione.*impostata/.test(text))
|
|
657
|
+
if (/accepted|(?<!\b(?:be|being) )picked up|pick up was successful|^drop off$|pick ?up scan|prepared the package for return to ups or pickup by ups|handed (?:over )?to (?:dpd|gls)|package received at dhl|item booked|consignment was mailed|posted at (?:a |the )?(?:postal point|post office)|pris en charge|prise en charge|collecte.*(?:reussi|effectue)|recupere.*boite aux lettres|depose.*point postal|remis a (?:dpd|gls)|envoi.*depose|abholung.*erfolgreich|^(?:die sendung wurde )?erfolgreich abgeholt$|eingeliefert|an (?:dpd|gls) ubergeben|paket.*(?:angenommen|ubernommen)|ritiro.*(?:riuscito|effettuato)|pres[oa] in carico|affidat[oa] a (?:dpd|gls)|depositat.*punto postale|spedizione.*impostata/.test(text))
|
|
658
658
|
return 'accepted';
|
|
659
659
|
// Taken in by the carrier: Royal Mail's "Item received by Royal Mail", a parcel shop's or a warehouse's
|
|
660
660
|
// receipt, a forwarder's ("<company> has received the goods, <town>, <country>."), the sender's drop-off at a
|
|
@@ -14,7 +14,7 @@ export interface TrawlScrapeRequest extends JsonObject {
|
|
|
14
14
|
url: string;
|
|
15
15
|
/** Skip the plain HTTP tier and go straight to a browser. */
|
|
16
16
|
skipHttp?: boolean;
|
|
17
|
-
/** 1 = HTTP client, 2 =
|
|
17
|
+
/** 1 = HTTP client, 2 = browser replaying a session an earlier tier 3 page saved for the site (skipped without one), 3 = full browser with challenge solving. */
|
|
18
18
|
maxTier?: 1 | 2 | 3;
|
|
19
19
|
/** Milliseconds the service may spend before answering. */
|
|
20
20
|
maxTimeout?: number;
|
|
@@ -1744,7 +1744,7 @@ function parseHistory(payload, trackingNumber, timezone = null, readAt = Date.no
|
|
|
1744
1744
|
continue;
|
|
1745
1745
|
if (parsed) {
|
|
1746
1746
|
// Some Chronopost rows put the service label in the location field.
|
|
1747
|
-
const location = reportedPlace(raw.location);
|
|
1747
|
+
const location = scan?.location ?? reportedPlace(raw.location);
|
|
1748
1748
|
if (location && !/^Type de livraison\s*:/i.test(location))
|
|
1749
1749
|
parsed.location = location;
|
|
1750
1750
|
events.push(parsed);
|
|
@@ -1908,6 +1908,8 @@ export function parseParcelsAppHtml(html, trackingNumber, timezone = null, readA
|
|
|
1908
1908
|
: event((zone ? mislabeledLocalTime(state.date, zone)?.iso : undefined) ?? state.date, scan?.wording ?? description);
|
|
1909
1909
|
if (parsed && guessedAhead(parsed, '', zone, timezone, readAt))
|
|
1910
1910
|
continue;
|
|
1911
|
+
if (parsed && scan?.location)
|
|
1912
|
+
parsed.location = scan.location;
|
|
1911
1913
|
if (parsed)
|
|
1912
1914
|
events.push(parsed);
|
|
1913
1915
|
if (parsed)
|
|
@@ -42,10 +42,12 @@ export function text(value) {
|
|
|
42
42
|
}
|
|
43
43
|
// Universal sites mix carrier events with UI notices and data updates. Notices must not
|
|
44
44
|
// manufacture a shipment timestamp or make an electronic announcement look like movement.
|
|
45
|
+
// The drop-off place or delivery day a recipient books with Hermes, which Hermes keeps out of
|
|
46
|
+
// its own history, is a notice too.
|
|
45
47
|
// DHL's detail line "Keine weiteren Details erforderlich" ("no further details required"),
|
|
46
48
|
// which ParcelsApp relays as a row of its own beside DHL's scans, says nothing either.
|
|
47
49
|
export function isNotice(description) {
|
|
48
|
-
return /enter .*?(?:postal|post|zip|phone)|select (?:a |the )?(?:carrier|destination country)|no information about your (?:package|parcel|shipment)|tracking (?:is |temporarily )?unavailable|tracking number (?:not found|is incorrect|must (?:only )?(?:contain|consist|be)\b)|check that (?:the |your )?tracking number is correct|no tracking (?:information|data)|delivery preference|captcha|verify (?:you|your)|enable javascript|try again later|by tapping the button|^(?:shipment parameters|recipient information) updated[.!]?$|^a preferred drop-off location was booked\b|^keine weiteren details erforderlich[.!]?$/i.test(description);
|
|
50
|
+
return /enter .*?(?:postal|post|zip|phone)|select (?:a |the )?(?:carrier|destination country)|no information about your (?:package|parcel|shipment)|tracking (?:is |temporarily )?unavailable|tracking number (?:not found|is incorrect|must (?:only )?(?:contain|consist|be)\b)|check that (?:the |your )?tracking number is correct|no tracking (?:information|data)|delivery preference|captcha|verify (?:you|your)|enable javascript|try again later|by tapping the button|^(?:shipment parameters|recipient information) updated[.!]?$|^a preferred drop-off location was booked\b|^a desired day for delivery (?:has been|was) booked\b|^keine weiteren details erforderlich[.!]?$/i.test(description);
|
|
49
51
|
}
|
|
50
52
|
// Raw text, so accented and plain spellings are both listed. A carrier receiving the
|
|
51
53
|
// parcel ("Recibido por Estafeta") and German "Firma" (a business) are not private.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cdekScan } from '../../carriers/cdek/status.js';
|
|
2
|
+
import { chunghwaPostScan } from '../../carriers/chunghwa-post/status.js';
|
|
2
3
|
import { emileScan } from '../../carriers/emile/status.js';
|
|
3
4
|
import { firstLineScan } from '../../carriers/first-line/status.js';
|
|
4
5
|
import { hrvatskaPostaScan } from '../../carriers/hrvatska-posta/status.js';
|
|
@@ -7,6 +8,7 @@ import { sendingScan } from '../../carriers/sending/status.js';
|
|
|
7
8
|
import { ytoScan } from '../../carriers/yto/status.js';
|
|
8
9
|
const VOCABULARIES = {
|
|
9
10
|
cdek: cdekScan,
|
|
11
|
+
'chunghwa-post': chunghwaPostScan,
|
|
10
12
|
emile: emileScan,
|
|
11
13
|
'first-line': firstLineScan,
|
|
12
14
|
'hrvatska-posta': hrvatskaPostaScan,
|
package/dist/providers/status.js
CHANGED
|
@@ -19,6 +19,7 @@ import { classifyEvent } from './shared/result.js';
|
|
|
19
19
|
const NO_STEP = [
|
|
20
20
|
// Notices the providers drop before they reach a history (`isNotice`), seen before they did.
|
|
21
21
|
['a preferred drop-off location was booked for the shipment', "ParcelsApp's note of a drop-off place the recipient booked: not a scan."],
|
|
22
|
+
['a desired day for delivery has been booked', "Postal Ninja's note of a delivery day the recipient booked with Hermes, which Hermes keeps out of its history: not a scan."],
|
|
22
23
|
['track sendcloud shipment by tapping the button', "ParcelsApp's prompt to track on Sendcloud's site: not a scan."],
|
|
23
24
|
['shipment parameters updated', "Postal Ninja's note that the shipment's details changed: not a scan."],
|
|
24
25
|
['tracking number must contain only capital letters and digits. please check that tracking number is correct.',
|
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.960.
|
|
3
|
+
"version": "0.960.6-main.5220",
|
|
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",
|