← Files egoARCHIVED FILE

skills/ego-browser/learnings/x-com/browser-tools/extract-post.js

458 Bytes · Oct 4, 2026 · 12:34 UTC

↓ Download file

async function(args) {
  const el = document.querySelector('[data-testid="tweet"]:focus') || document.querySelector('[data-testid="tweet"]');
  if (!el) return { error: 'no active tweet found' };
  return {
    text: el.querySelector('[data-testid="tweetText"]')?.innerText?.trim() || '',
    author: el.querySelector('[data-testid="User-Name"] span')?.innerText?.trim() || '',
    timestamp: el.querySelector('time')?.getAttribute('datetime') || '',
  };
}

SHA-256: 338db35bdf4d83258f5b646e67d38fb7f63bdbd243bac2e94236bb348b6ff64f