diff --git a/.gitignore b/.gitignore index 229f647..8055227 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ debug_page.txt .github/skills prompts/ +test-results/ diff --git a/secrets/auth.json b/secrets/auth.json index 5561b8f..9fa0b6d 100644 --- a/secrets/auth.json +++ b/secrets/auth.json @@ -5,7 +5,7 @@ "value": "SDRORLyWEsWWty2ZoVGdER", "domain": ".instagram.com", "path": "/", - "expires": 1805932397.796429, + "expires": 1805933297.800746, "httpOnly": false, "secure": true, "sameSite": "Lax" @@ -45,7 +45,7 @@ "value": "59661903731", "domain": ".instagram.com", "path": "/", - "expires": 1779148397.796565, + "expires": 1779149297.800838, "httpOnly": false, "secure": true, "sameSite": "None" @@ -65,14 +65,14 @@ "value": "1280x720", "domain": ".instagram.com", "path": "/", - "expires": 1771977199, + "expires": 1771978099, "httpOnly": false, "secure": true, "sameSite": "Lax" }, { "name": "rur", - "value": "\"CLN\\05459661903731\\0541802908397:01fef18ba63c9905a3e7585bc775d62a091f163ea66b37227a39ca3c8b1482c88ade3055\"", + "value": "\"CLN\\05459661903731\\0541802909297:01fe3b61178e8a40cb655e8d1aa137841487d29a8caf122f877ce2955e92fb4307b53ced\"", "domain": ".instagram.com", "path": "/", "expires": -1, @@ -87,7 +87,7 @@ "localStorage": [ { "name": "chatd-deviceid", - "value": "b042903b-985a-4d93-bbae-f43140b10376" + "value": "9b4abdd3-f38f-473e-9e3b-2ae722acc64d" }, { "name": "hb_timestamp", @@ -95,7 +95,11 @@ }, { "name": "IGSession", - "value": "k75336:1771374199643" + "value": "k75336:1771375099770" + }, + { + "name": "mutex_polaris_banzai", + "value": "4eic7h:1771373300769" }, { "name": "pixel_fire_ts", @@ -107,7 +111,7 @@ }, { "name": "Session", - "value": "5ssy2h:1771372434643" + "value": "t5cu8b:1771373334770" }, { "name": "has_interop_upgraded", @@ -117,6 +121,10 @@ "name": "ig_boost_on_web_campaign_upsell_shown", "value": "false" }, + { + "name": "mutex_banzai", + "value": "4eic7h:1771373300769" + }, { "name": "banzai:last_storage_flush", "value": "1771366998859.2" diff --git a/src/lib/server/extraction.ts b/src/lib/server/extraction.ts index 9cfed41..6652774 100644 --- a/src/lib/server/extraction.ts +++ b/src/lib/server/extraction.ts @@ -234,6 +234,9 @@ export function cleanText(text: string): string { // Remove spaces around newlines cleaned = cleaned.replace(/ *\n */g, '\n'); + + // Normalize multiple spaces to single space within lines + cleaned = cleaned.replace(/ {2,}/g, ' '); // Remove hashtags from end of text // Pattern: #word #multiple_words (supports international characters) diff --git a/src/tests/instagram-caption-extraction.unit.spec.ts b/src/tests/instagram-caption-extraction.unit.spec.ts index 3d6f8b3..26d9870 100644 --- a/src/tests/instagram-caption-extraction.unit.spec.ts +++ b/src/tests/instagram-caption-extraction.unit.spec.ts @@ -81,7 +81,11 @@ describe('extractFromDOM() with mocked og:description', () => { $$: vi.fn().mockResolvedValue([]), locator: vi.fn().mockReturnValue({ getAttribute: vi.fn().mockResolvedValue(null) - }) + }), + waitForLoadState: vi.fn().mockResolvedValue(undefined), + waitForSelector: vi.fn().mockRejectedValue(new Error('No selector found')), + waitForTimeout: vi.fn().mockResolvedValue(undefined), + on: vi.fn() } as unknown as Page; }; @@ -153,7 +157,11 @@ describe('Integration: Full extraction flow', () => { $$: vi.fn().mockResolvedValue([]), locator: vi.fn().mockReturnValue({ getAttribute: vi.fn().mockResolvedValue(null) - }) + }), + waitForLoadState: vi.fn().mockResolvedValue(undefined), + waitForSelector: vi.fn().mockRejectedValue(new Error('No selector found')), + waitForTimeout: vi.fn().mockResolvedValue(undefined), + on: vi.fn() } as unknown as Page; }; diff --git a/vite.config.ts b/vite.config.ts index 17d0bec..37ecd84 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -43,7 +43,7 @@ export default defineConfig({ name: 'server', environment: 'node', include: ['src/**/*.{test,spec}.{js,ts}'], - exclude: ['src/**/*.svelte.{test,spec}.{js,ts}'] + exclude: ['src/**/*.svelte.{test,spec}.{js,ts}', 'src/**/*.e2e.spec.{js,ts}'] } } ]