- Implement strict HTTP 200 validation (reject all other status codes)
- Add content-type validation (must be image/*)
- Add 10-second timeout protection with AbortController
- Thread progressCallback through all fetchImageAsBase64 calls
- Add detailed logging for each validation failure scenario
- Report validation failures via SSE progress callbacks
Unit tests:
- Add comprehensive test coverage for all validation scenarios
- Test HTTP status codes (200, 404, 403, 500, etc.)
- Test content-type validation (image/* vs text/html, etc.)
- Test timeout behavior with AbortController
- Test error handling (network errors, DNS, SSL, etc.)
- Test progress callback reporting
Integration tests:
- Add tests for complete extraction flow with URL failures
- Test fallback chain behavior (meta tags → poster → Instagram data → screenshot)
- Test real-world scenarios (redirects, query params, different post types)
Documentation:
- Enhanced JSDoc with validation criteria
- Added examples showing fallback behavior
- Documented all failure scenarios and their handling
All tests passing ✅
123 lines
2.9 KiB
JSON
123 lines
2.9 KiB
JSON
{
|
|
"cookies": [
|
|
{
|
|
"name": "csrftoken",
|
|
"value": "SDRORLyWEsWWty2ZoVGdER",
|
|
"domain": ".instagram.com",
|
|
"path": "/",
|
|
"expires": 1800851069.9794,
|
|
"httpOnly": false,
|
|
"secure": true,
|
|
"sameSite": "Lax"
|
|
},
|
|
{
|
|
"name": "datr",
|
|
"value": "isQuaeXe5-2mFvFSOdcgVq0u",
|
|
"domain": ".instagram.com",
|
|
"path": "/",
|
|
"expires": 1799232653.525143,
|
|
"httpOnly": true,
|
|
"secure": true,
|
|
"sameSite": "None"
|
|
},
|
|
{
|
|
"name": "ig_did",
|
|
"value": "5650C8B9-B8D8-4102-9B49-F0668CE34202",
|
|
"domain": ".instagram.com",
|
|
"path": "/",
|
|
"expires": 1796208680.653147,
|
|
"httpOnly": true,
|
|
"secure": true,
|
|
"sameSite": "Lax"
|
|
},
|
|
{
|
|
"name": "mid",
|
|
"value": "aS7EigALAAHxXAxrkYg18Fzi-SR7",
|
|
"domain": ".instagram.com",
|
|
"path": "/",
|
|
"expires": 1799232653.525191,
|
|
"httpOnly": true,
|
|
"secure": true,
|
|
"sameSite": "None"
|
|
},
|
|
{
|
|
"name": "ds_user_id",
|
|
"value": "59661903731",
|
|
"domain": ".instagram.com",
|
|
"path": "/",
|
|
"expires": 1774067069.979487,
|
|
"httpOnly": false,
|
|
"secure": true,
|
|
"sameSite": "None"
|
|
},
|
|
{
|
|
"name": "wd",
|
|
"value": "1280x720",
|
|
"domain": ".instagram.com",
|
|
"path": "/",
|
|
"expires": 1766895870,
|
|
"httpOnly": false,
|
|
"secure": true,
|
|
"sameSite": "Lax"
|
|
},
|
|
{
|
|
"name": "sessionid",
|
|
"value": "59661903731%3AbekaIlo4nn7x2n%3A29%3AAYig82sWcnm2bGaQlry72PN7OrhFZ4YYZt4_qM78dA",
|
|
"domain": ".instagram.com",
|
|
"path": "/",
|
|
"expires": 1797822591.250111,
|
|
"httpOnly": true,
|
|
"secure": true,
|
|
"sameSite": "Lax"
|
|
},
|
|
{
|
|
"name": "rur",
|
|
"value": "\"CLN\\05459661903731\\0541797827069:01fe263659ed914f1ffebb931cb01384ada1b8d59314115427d88c227c8b8dd50b867ce3\"",
|
|
"domain": ".instagram.com",
|
|
"path": "/",
|
|
"expires": -1,
|
|
"httpOnly": true,
|
|
"secure": true,
|
|
"sameSite": "Lax"
|
|
}
|
|
],
|
|
"origins": [
|
|
{
|
|
"origin": "https://www.instagram.com",
|
|
"localStorage": [
|
|
{
|
|
"name": "chatd-deviceid",
|
|
"value": "77312b9f-46de-4a13-bc4c-c0b033527fed"
|
|
},
|
|
{
|
|
"name": "hb_timestamp",
|
|
"value": "1766290825220"
|
|
},
|
|
{
|
|
"name": "IGSession",
|
|
"value": "6m2tlb:1766292870184"
|
|
},
|
|
{
|
|
"name": "pixel_fire_ts",
|
|
"value": "1766282683056"
|
|
},
|
|
{
|
|
"name": "signal_flush_timestamp",
|
|
"value": "1766290825236"
|
|
},
|
|
{
|
|
"name": "Session",
|
|
"value": "jkk7vp:1766291105184"
|
|
},
|
|
{
|
|
"name": "has_interop_upgraded",
|
|
"value": "{\"lastCheckedAt\":1766279008975,\"status\":false}"
|
|
},
|
|
{
|
|
"name": "banzai:last_storage_flush",
|
|
"value": "1766279009540.7998"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
} |