Files
dredgegram/playwright/debugger.spec.js
T
dredgy f00405ed24
linter / quality (push) Canceled after 0s
tests / ci (8.3) (push) Canceled after 0s
tests / ci (8.4) (push) Canceled after 0s
tests / ci (8.5) (push) Canceled after 0s
Initial Commit
2026-08-28 22:55:32 +10:00

41 lines
1.6 KiB
JavaScript

import { test } from '@playwright/test';
test.use({ storageState: '/home/pwuser/ig-session.json' });
test('inspect non-text message shapes', async ({ page }) => {
test.setTimeout(120_000);
const interesting = [];
page.on('response', async (response) => {
const url = response.url();
if (!url.includes('/api/graphql')) return;
const params = new URLSearchParams(response.request().postData() || '');
if (params.get('fb_api_req_friendly_name') !== 'IGDThreadDetailQuery') return;
try {
const json = await response.json();
const t = json?.data?.get_slide_thread_nullable?.as_ig_direct_thread;
if (!t) return;
for (const edge of t.slide_messages?.edges || []) {
const node = edge.node;
const hasReactions = (node.reactions?.length || 0) > 0 || (node.msg_reactions?.length || 0) > 0;
if (node.content_type !== 'TEXT' || hasReactions || node.replied_to_message) {
interesting.push({ thread: t.thread_title, node });
}
}
} catch (e) { /* skip */ }
});
await page.goto('https://www.instagram.com/direct/inbox/');
await page.waitForTimeout(6000);
const threadHrefs = await page.$$eval('a[href*="/direct/t/"]', els =>
[...new Set(els.map(el => el.getAttribute('href')))]);
for (const href of threadHrefs) {
await page.goto(`https://www.instagram.com${href}`);
await page.waitForTimeout(3500);
}
console.log('[INTERESTING MESSAGES]', JSON.stringify(interesting, null, 2));
});