universal-parcel-scraper 0.69.3-main.891 → 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.
package/data/catalog.json CHANGED
@@ -2702,8 +2702,8 @@
2702
2702
  "browserRecognitionRank": 65
2703
2703
  },
2704
2704
  "canaryUrl": "https://www.usps.com/",
2705
- "trackingUrlTemplate": "https://tools.usps.com/go/TrackConfirmAction?tLabels={trackingNumber}",
2706
- "trackingSearchUrl": "https://tools.usps.com/go/TrackConfirmAction",
2705
+ "trackingUrlTemplate": "https://tools.usps.com/tracking/{trackingNumber}",
2706
+ "trackingSearchUrl": "https://tools.usps.com/tracking/",
2707
2707
  "linkRules": [
2708
2708
  {
2709
2709
  "domains": [
@@ -2712,7 +2712,8 @@
2712
2712
  ],
2713
2713
  "params": [
2714
2714
  "tLabels"
2715
- ]
2715
+ ],
2716
+ "path": "^/tracking/(\\d{20}|\\d{22}|\\d{26}|[A-Z]{2}\\d{9}[A-Z]{2})/?$"
2716
2717
  }
2717
2718
  ],
2718
2719
  "detectionRules": [
@@ -2290,11 +2290,12 @@ var ye = {
2290
2290
  browserRecognitionRank: 65
2291
2291
  },
2292
2292
  canaryUrl: "https://www.usps.com/",
2293
- trackingUrlTemplate: "https://tools.usps.com/go/TrackConfirmAction?tLabels={trackingNumber}",
2294
- trackingSearchUrl: "https://tools.usps.com/go/TrackConfirmAction",
2293
+ trackingUrlTemplate: "https://tools.usps.com/tracking/{trackingNumber}",
2294
+ trackingSearchUrl: "https://tools.usps.com/tracking/",
2295
2295
  linkRules: [{
2296
2296
  domains: ["tools.usps.com", "usps.com"],
2297
- params: ["tLabels"]
2297
+ params: ["tLabels"],
2298
+ path: "^/tracking/(\\d{20}|\\d{22}|\\d{26}|[A-Z]{2}\\d{9}[A-Z]{2})/?$"
2298
2299
  }],
2299
2300
  detectionRules: [
2300
2301
  {
@@ -12,21 +12,12 @@ import { uspsStage, uspsStatus } from './status.js';
12
12
  /**
13
13
  * USPS, through the server-rendered tracking page.
14
14
  *
15
- * The page at `go/TrackConfirmAction?tLabels=` carries the verdict, the
16
- * status and the history in its own HTML: no tracking XHR exists to capture.
17
- * Plain HTTP probes returned 403. Browser checks on 2026-09-22 first returned
18
- * a challenge shell, then succeeded with matching shipment timelines. Access
19
- * can vary by session. The lookup has a single
20
- * step: the private browser service loads the page, and the rendered DOM is
21
- * parsed. Nothing is ever replayed over plain HTTP.
22
- *
23
- * Markup provenance: the live page shell (`.track-bar-container`,
24
- * `#trackingNum`, `.latest-update-banner-wrapper .banner-header`,
25
- * `.current-tracking-status-wrapper`), inspected 2026-09-20. Positive lookups
26
- * on 2026-09-22 use `.tb-step` timeline cards, including collapsed history.
27
- * The older table-shaped fixture remains a parsing fallback.
15
+ * The `/tracking/{number}` page carries the verdict and collapsed history
16
+ * in its HTML. The legacy query route can return only the global header,
17
+ * so load the package path directly. The browser handles verification;
18
+ * nothing is replayed over plain HTTP.
28
19
  */
29
- const TRACKING_BASE = 'https://tools.usps.com/go/TrackConfirmAction';
20
+ const TRACKING_BASE = 'https://tools.usps.com/tracking/';
30
21
  const MAX_BYTES = 10_000_000;
31
22
  const DEFAULT_TIMEOUT_MS = 90_000;
32
23
  const MAX_EVENTS_TO_RETURN = 100;
@@ -47,9 +38,7 @@ export function normalizeUSPSNumber(raw) {
47
38
  return value;
48
39
  }
49
40
  export function uspsTrackingUrl(trackingNumber) {
50
- const url = new URL(TRACKING_BASE);
51
- url.searchParams.set('tLabels', normalizeUSPSNumber(trackingNumber));
52
- return url.toString();
41
+ return new URL(normalizeUSPSNumber(trackingNumber), TRACKING_BASE).toString();
53
42
  }
54
43
  const MONTHS = '(January|February|March|April|May|June|July|August|September|October|November|December)';
55
44
  const DATE_PATTERN = new RegExp(`${MONTHS}\\s+\\d{1,2},?\\s+\\d{4}`, 'i');
@@ -149,6 +138,11 @@ export function parseUSPSTrackingHtml(page, trackingNumber) {
149
138
  const $ = load(page);
150
139
  $('script, style, noscript').remove();
151
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
+ }
152
146
  throw new ChallengeError('USPS', 'USPS challenged the browser tracking session');
153
147
  }
154
148
  const echoed = clean($('#trackingNum').first().text()).toLocaleUpperCase('en-US');
@@ -236,6 +230,8 @@ export class USPSTracker {
236
230
  recorder: this.#recorder,
237
231
  }, [
238
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) },
239
235
  ]);
240
236
  // A typed routing barcode opens with the recipient's ZIP code. The package
241
237
  // identifier after it is the number USPS tracks, so consumers can keep that.
@@ -30,8 +30,8 @@
30
30
  "eta"
31
31
  ],
32
32
  "portal": {
33
- "url": "https://tools.usps.com/go/TrackConfirmAction?tLabels={trackingNumber}",
34
- "searchUrl": "https://tools.usps.com/go/TrackConfirmAction",
33
+ "url": "https://tools.usps.com/tracking/{trackingNumber}",
34
+ "searchUrl": "https://tools.usps.com/tracking/",
35
35
  "canaryUrl": "https://www.usps.com/",
36
36
  "shows": [
37
37
  "status",
@@ -60,7 +60,8 @@
60
60
  ],
61
61
  "params": [
62
62
  "tLabels"
63
- ]
63
+ ],
64
+ "path": "^/tracking/(\\d{20}|\\d{22}|\\d{26}|[A-Z]{2}\\d{9}[A-Z]{2})/?$"
64
65
  }
65
66
  ],
66
67
  "detection": [
@@ -2702,8 +2702,8 @@
2702
2702
  "browserRecognitionRank": 65
2703
2703
  },
2704
2704
  "canaryUrl": "https://www.usps.com/",
2705
- "trackingUrlTemplate": "https://tools.usps.com/go/TrackConfirmAction?tLabels={trackingNumber}",
2706
- "trackingSearchUrl": "https://tools.usps.com/go/TrackConfirmAction",
2705
+ "trackingUrlTemplate": "https://tools.usps.com/tracking/{trackingNumber}",
2706
+ "trackingSearchUrl": "https://tools.usps.com/tracking/",
2707
2707
  "linkRules": [
2708
2708
  {
2709
2709
  "domains": [
@@ -2712,7 +2712,8 @@
2712
2712
  ],
2713
2713
  "params": [
2714
2714
  "tLabels"
2715
- ]
2715
+ ],
2716
+ "path": "^/tracking/(\\d{20}|\\d{22}|\\d{26}|[A-Z]{2}\\d{9}[A-Z]{2})/?$"
2716
2717
  }
2717
2718
  ],
2718
2719
  "detectionRules": [
@@ -1830,11 +1830,12 @@ export declare const CARRIER_CATALOG: {
1830
1830
  readonly browserRecognitionRank: 65;
1831
1831
  };
1832
1832
  readonly canaryUrl: "https://www.usps.com/";
1833
- readonly trackingUrlTemplate: "https://tools.usps.com/go/TrackConfirmAction?tLabels={trackingNumber}";
1834
- readonly trackingSearchUrl: "https://tools.usps.com/go/TrackConfirmAction";
1833
+ readonly trackingUrlTemplate: "https://tools.usps.com/tracking/{trackingNumber}";
1834
+ readonly trackingSearchUrl: "https://tools.usps.com/tracking/";
1835
1835
  readonly linkRules: readonly [{
1836
1836
  readonly domains: readonly ["tools.usps.com", "usps.com"];
1837
1837
  readonly params: readonly ["tLabels"];
1838
+ readonly path: "^/tracking/(\\d{20}|\\d{22}|\\d{26}|[A-Z]{2}\\d{9}[A-Z]{2})/?$";
1838
1839
  }];
1839
1840
  readonly detectionRules: readonly [{
1840
1841
  readonly pattern: "^(?!9[23]61)(?:91\\d{2}9\\d{17}|92\\d{3}9\\d{16}|93\\d{3}[0-8]\\d{16}|9[45]\\d{20})$";
@@ -2703,8 +2703,8 @@ export const CARRIER_CATALOG = {
2703
2703
  "browserRecognitionRank": 65
2704
2704
  },
2705
2705
  "canaryUrl": "https://www.usps.com/",
2706
- "trackingUrlTemplate": "https://tools.usps.com/go/TrackConfirmAction?tLabels={trackingNumber}",
2707
- "trackingSearchUrl": "https://tools.usps.com/go/TrackConfirmAction",
2706
+ "trackingUrlTemplate": "https://tools.usps.com/tracking/{trackingNumber}",
2707
+ "trackingSearchUrl": "https://tools.usps.com/tracking/",
2708
2708
  "linkRules": [
2709
2709
  {
2710
2710
  "domains": [
@@ -2713,7 +2713,8 @@ export const CARRIER_CATALOG = {
2713
2713
  ],
2714
2714
  "params": [
2715
2715
  "tLabels"
2716
- ]
2716
+ ],
2717
+ "path": "^/tracking/(\\d{20}|\\d{22}|\\d{26}|[A-Z]{2}\\d{9}[A-Z]{2})/?$"
2717
2718
  }
2718
2719
  ],
2719
2720
  "detectionRules": [
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "Universal Parcel Scraper",
5
- "version": "0.69.3"
5
+ "version": "0.69.5"
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.69.3-main.891",
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",