universal-parcel-scraper 0.69.4-main.892 → 0.69.5-main.893
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.
|
@@ -138,6 +138,11 @@ export function parseUSPSTrackingHtml(page, trackingNumber) {
|
|
|
138
138
|
const $ = load(page);
|
|
139
139
|
$('script, style, noscript').remove();
|
|
140
140
|
if ($('.track-bar-container').length === 0) {
|
|
141
|
+
// A completed USPS header without the tracking application is not a
|
|
142
|
+
// missing shipment. A second browser read can recover this partial page.
|
|
143
|
+
if ($('.Widgets_Container #g-navigation').length && /^USPS Tracking/.test($('title').text())) {
|
|
144
|
+
throw new ChallengeError('USPS', 'USPS returned an incomplete tracking page', { reason: 'incomplete_page' });
|
|
145
|
+
}
|
|
141
146
|
throw new ChallengeError('USPS', 'USPS challenged the browser tracking session');
|
|
142
147
|
}
|
|
143
148
|
const echoed = clean($('#trackingNum').first().text()).toLocaleUpperCase('en-US');
|
|
@@ -225,6 +230,8 @@ export class USPSTracker {
|
|
|
225
230
|
recorder: this.#recorder,
|
|
226
231
|
}, [
|
|
227
232
|
{ id: 'trawl', run: ({ remainingMs, signal }) => this.#trawlResult(trawl, number, Math.max(1, Math.floor(Math.min(this.timeoutMs, remainingMs))), signal) },
|
|
233
|
+
{ id: 'trawl', recovers: error => error instanceof ChallengeError && error.reason === 'incomplete_page',
|
|
234
|
+
run: ({ remainingMs, signal }) => this.#trawlResult(trawl, number, Math.max(1, Math.floor(Math.min(this.timeoutMs, remainingMs))), signal) },
|
|
228
235
|
]);
|
|
229
236
|
// A typed routing barcode opens with the recipient's ZIP code. The package
|
|
230
237
|
// identifier after it is the number USPS tracks, so consumers can keep that.
|
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.69.
|
|
3
|
+
"version": "0.69.5-main.893",
|
|
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",
|