Twitter Media Scraper
The Media tab of an X (Twitter) profile gathers the tweets in which an account shared photos, videos or GIFs, newest first, each with its caption and its likes, replies, reposts and views. Read as one feed, these posts show what an account publishes visually, which clips draw the most views and how its use of images and video shifts over time.
Twitter Media Scraper API Features
- The Media tab from one usernameSend one username, the leading @ optional, and receive the account's tweets that carry photos, videos or GIFs in the order of its Media tab, newest first.
- Video files at the highest bitrateFor a video, the Twitter Media Scraper API points media.url to the highest-bitrate MP4 and thumbnail_url to its preview image, so clips can be saved at the best quality X offers.
- Every attachment of a post in one listmedia lists each image and video of a post with its type, so a post with several photos keeps them together under one caption.
- Caption, link and engagement per postEach post also carries text, url, published_at, author and counts of likes, comments, shares and views, tying every file to the post it came from.
Twitter Media Scraper API Parameters
| Parameters | Required | Description |
|---|---|---|
username | Required | The X username whose Media tab to collect, with or without the leading @. |
results_limit | Optional | How many media posts to return, from 1 to 1,000. Defaults to 20. |
How to Use the Twitter Media Scraper API
Submit one username to the Twitter Media Scraper API and page through the posts on its Media tab.
- POST {"username": "NASA", "results_limit": 20} to /v1/x/user-media.
- Check GET /v1/tasks/{task_id} every few seconds until status is succeeded.
- Read posts from results.items and download each media.url; request the next page with results.next_cursor while has_more is true.
curl -X POST "https://api.socq.ai/v1/x/user-media" \
-H "Authorization: Bearer $SOCQ_API_KEY" \
-H "Content-Type: application/json" \
-d '{"username":"NASA","results_limit":20}'
# For a video, media.url is the highest-bitrate MP4 and thumbnail_url its preview.Twitter Media Scraper API Use Cases
- Archiving an account's photos and videos: Download every media.url the Twitter Media Scraper API returns and file it with the post's url and published_at to keep a dated copy of what an account has shared.
- Finding an account's most-watched clips: Keep the posts whose media type is video and rank them by views_count and likes_count to pick the clips that performed best.
- Auditing a brand's visual content mix: Count image and video posts per month from published_at and media.type to see how a brand's balance of photos and video changes.
- Pulling visuals for reports and briefs: Use thumbnail_url and image links with each post's caption and view count to illustrate competitor reviews or campaign recaps.
Twitter Media Scraper API Pro Tips
- Name saved files after the post id plus the attachment's position in media, so posts with several photos keep their order.
- To refresh an archive, ask the Twitter Media Scraper API for a small results_limit and stop paging once you reach a post id you already hold, since the newest posts come first.
- Measure width and height from the downloaded files when a layout needs exact dimensions.
- Strip the trailing https://t.co link from text before analysing captions; X appends it to point at the attached media.
Related APIs
Beyond the Twitter Media Scraper API, use these APIs when you need a different type of public X data.
- Twitter Tweet Scraper API — Retrieve public post text, authors, engagement, media, hashtags, mentions, and conversation relationships from x.com or twitter.com status URLs.
- Twitter User Tweets Scraper API — Collect recent public posts, authors, media, hashtags, mentions, and engagement by username with replies excluded.
- X Post Quotes API — Collect public quote posts for known status URLs with commentary, authors, engagement, media, timestamps, and source-post context.
- X Post Replies API — Collect public replies from X post URLs with selectable ordering, reply text, authors, visible engagement, media, and parent-post context.
- Twitter Mentions API — Collect public posts mentioning a specified account.
- Twitter Video Transcript API — Turn the speech in X videos into text, with each video's length.
- Twitter Profile Scraper API
- Twitter Search API
- X Followers List API
- X Following List API
- X Post Retweeters API
- X Trends API
- Twitter User Search API
- X Community API
- X Community Posts API
- X Thread Context API
- X Account Location API
- X Verified Followers API
- X List Tweets API
- Twitter List Members API
- Twitter List Followers API
- X Community Members API
- X Community Moderators API
- X Communities Search API
- X Articles API
- X Spaces API
- X User Replies API
- Twitter Follow Checker API