mktg-x

Fetch tweets, threads, bookmarks, articles, and timelines from X via authenticated GraphQL API calls.

31|5|Updated Mar 12, 2026
One-click install
npx skills add https://github.com/MoizIbnYousaf/marketing-cli --skill mktg-x-moizibnyousaf
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: mktg-x
Source: https://github.com/MoizIbnYousaf/marketing-cli/tree/main/skills/mktg-x
Command: npx skills add https://github.com/MoizIbnYousaf/marketing-cli --skill mktg-x-moizibnyousaf

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Reading X (Twitter) content programmatically is blocked by login walls — unauthenticated scrapers like firecrawl only receive a degraded logged-out page. This Skill reads tweets, threads, bookmarks, long-form articles, and user timelines through X's authenticated web GraphQL API using session cookies, returning structured JSON that downstream marketing workflows can consume directly. ## Core Features & Use Cases - Five URL shapes supported: single tweets, same-author thread unrolls, bookmark collections, long-form articles, and user timelines, each dispatched to the correct GraphQL endpoint. - Frozen JSON output contract: every fetch returns a canonical six-field shape (tweet_text, thread_unroll, embedded_links, media_urls, author, timestamp) that source-digestion workflows consume without re-parsing. - Security-hardened pipeline: terminal-escape sanitization strips OSC 52 and CSI injection sequences, output is isolated to a gitignored .mktg-x/ directory, and engagement metrics are deliberately omitted to keep ideation unbiased. - Use Case: A user pastes a viral thread URL and asks for a content breakdown. The Skill fetches the full same-author thread via authenticated GraphQL, writes sanitized JSON to .mktg-x/, and the agent extracts only the fields needed with jq. ## Quick Start Set the MKTG_X_AUTH_TOKEN and MKTG_X_CT0 environment variables from your browser cookies, then ask the agent to read a tweet or thread URL such as "pull this thread https://x.com/user/status/123".

Frequently Asked Questions about mktg-x

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I read a Twitter thread programmatically without the official API?▼

Use the authenticated X web GraphQL API with your browser session cookies (auth_token and ct0). Export them as MKTG_X_AUTH_TOKEN and MKTG_X_CT0, then run the fetch script in thread mode to unroll consecutive same-author replies into structured JSON.

Why can't I scrape x.com with firecrawl or WebFetch?▼

Twitter serves a degraded logged-out page to unauthenticated clients, so scrapers return a login wall instead of real content. Auth-walled X content requires session cookies sent to the GraphQL API; there is no unauthenticated fallback path.

How do I get the auth_token and ct0 cookies for X API access?▼

Log into x.com, open DevTools, go to Application, then Cookies, and copy the auth_token and ct0 values. Export them as MKTG_X_AUTH_TOKEN and MKTG_X_CT0 in your shell profile. Note that ct0 expires roughly every hour and must be refreshed.

Why does the X fetch fail with a ct0 CSRF token expired error?▼

The ct0 CSRF token has a lifetime of about one hour and the script does not auto-refresh it. Re-extract the ct0 cookie from your browser, re-export MKTG_X_CT0, and retry. The auth_token typically remains valid for weeks.

Does this work in headless agent environments without a browser?▼

Yes, but only via environment variables. Browser cookie extraction on macOS Chrome triggers a Keychain GUI password prompt that hangs headless agents indefinitely. Always set MKTG_X_AUTH_TOKEN and MKTG_X_CT0 explicitly for agent workflows.

Why are likes and view counts missing from the fetched tweet data?▼

Engagement metrics are deliberately omitted from the output contract. Feeding popularity signals into source digestion biases downstream ideation toward viral content rather than content quality, so the Skill strips them by design.