Extract structured data from X/Twitter posts, profiles, and spaces for content research. Powered by yt-dlp and gallery-dl locally — no API key required.
Version: 1.0.0 Prerequisites: yt-dlp >= 2024.01.01, gallery-dl >= 1.26.0 (optional, for image posts)
bash
# macOS
brew install yt-dlp gallery-dl
# pip
pip install yt-dlp gallery-dl
# Verify
yt-dlp --version && gallery-dl --version
Extract text, media, engagement stats from a single tweet.
bash
yt-dlp --dump-json --skip-download "https://x.com/user/status/TWEET_ID"
Key JSON fields:
FieldJSON pathFull text.descriptionAuthor.uploaderAuthor handle.uploader_idUpload date.upload_date (YYYYMMDD → YYYY-MM-DD)Views.view_countLikes.like_countRetweets.repost_countReplies.comment_countMedia type.formats[] (video/image)Thumbnail.thumbnail
For image-only tweets (no video), use gallery-dl:
bash
gallery-dl --dump-json "https://x.com/user/status/TWEET_ID"
Extract recent posts from a user's timeline.
bash
yt-dlp --flat-playlist --dump-json --playlist-end 20 "https://x.com/USERNAME"
Output is one JSON object per line. Parse each for .description, .upload_date, .view_count, .like_count.
Output format: Table with columns: #, Date, Text (first 80 chars), Views, Likes.
For tweets containing video:
bash
yt-dlp --dump-json --skip-download "https://x.com/user/status/TWEET_ID"
Parse .formats[] for available video qualities: .format_id, .height, .ext, .filesize.
For X Spaces (audio):
bash
yt-dlp --dump-json --skip-download "https://x.com/i/spaces/SPACE_ID"
yt-dlp does not support X search directly. For hashtag research:
PatternTypex.com/user/status/123Single tweettwitter.com/user/status/123Single tweet (legacy)x.com/USERNAMEUser timelinex.com/i/spaces/ABCX Space
= 1,000,000 →
{n/1M:.1f}M
= 1,000 →
{n/1K:.1f}K
Otherwise → raw number
When user provides an X/Twitter URL:
When user asks to download media:
yt-dlp --cookies-from-browser chrome "URL"X Research Kit is an open-source project by SnapVee.