By Sorsa Editorial

Updated June 2026: reflects the official X API pay-per-use rates after the April 20, 2026 change, and the current state of gallery-dl and timeline limits.

Key Takeaway: A Twitter image scraper extracts media files, photos, videos, and GIFs, from public X posts. The practical path in 2026 is an API that returns each tweet's media URLs in a structured response, which you then download. Browser tools handle one post at a time; an API handles whole profiles, searches, and bulk jobs.

Most guides to scraping Twitter images point you at one of two dead ends: a browser button that grabs a single post, or a Python script that breaks the next time X changes its frontend. Neither scales, and the official X API now bills per resource fetched, so pulling media from thousands of posts gets expensive quickly.

Sorsa API, an alternative Twitter/X API provider, takes a different route. It returns each tweet's media inside a structured entities array, so a single request can surface every photo and video URL from a search query or a profile timeline, and you download the files on your own schedule. Billing is flat per request (1 call = 1 request, $49 for 10,000 requests on the Starter plan), author profiles ship inside every tweet response at no extra charge, the rate limit is a flat 20 requests per second on every plan, and authentication is a single API key in a header rather than OAuth. On read-heavy media work, that lands roughly 30 to 50 times cheaper than the official API.

This guide covers what a media scraper actually returns, the working API path with runnable code, why the popular do-it-yourself methods fail in 2026, and the real cost math.

Contents

What a Twitter image scraper does

A Twitter image scraper collects media attached to public X posts, including photos, videos, and animated GIFs, along with the metadata around each post. In practice it does two distinct jobs: it finds the media URLs (from a tweet, a profile, a hashtag, or a search), and then it downloads the underlying files from those URLs.

That two-step split matters, and most tools blur it. The data layer returns links and post details in a structured format like JSON. The download layer fetches the actual bytes from X's media servers. A good API gives you the first cleanly; the second is a plain HTTP download you control.

X stores three media types you can collect from public posts. Photos are still images served from the pbs.twimg.com CDN. Videos are MP4 files. Animated GIFs are not really GIFs on X: the platform converts them to short, silent MP4 clips, so they come back as video entities rather than a separate type. Each media item also carries a preview or thumbnail URL, useful when you want a lightweight reference instead of the full file.

The information that comes with each post is often as valuable as the image itself: the author profile, post text, timestamp, and engagement counts (likes, reposts, replies, views). Visual sentiment analysis, brand monitoring, and dataset building all depend on pairing the media with that context, not just dumping files into a folder.

How to download Twitter media: the methods

Four method classes exist for getting media off X, and they sort cleanly by scale and by who is doing the work. Single-post downloaders suit one tweet; APIs suit profiles, searches, and recurring jobs.

MethodBest forScaleAuth neededOutput
Browser downloader (paste a link)One post, occasional useSingle tweetNoneFiles only
Browser extensionCasual, manual collectionSmallNoneFiles only
Open-source script (gallery-dl, yt-dlp)Technical users, archivingMedium, fragileYour logged-in cookieFiles + some metadata
Managed APIProfiles, search, bulk, automationHigh, stableOne API keyStructured JSON + media URLs

The prose version of that table: if you need one image once, a paste-a-link tool is fine. The moment you need every image from an account, all media for a hashtag, or a job that runs every day without breaking, you need structured data and pagination, which is what an API provides. A free no-code option to test the data without writing code is the media downloader tool, which pulls the photos and videos from a single tweet through the same API the rest of this guide uses.

For the full picture of scraping methods beyond media specifically, our broader scraping guide and a Twitter scraper comparison cover the tradeoffs in depth.

How to get Twitter media via API

Getting media through an API takes five steps: get a key, call a tweet-returning endpoint, read the entities array on each tweet, download each link, and paginate to go past the timeline limit. The API hands you URLs and metadata; the download is a standard HTTP request you make yourself.

Every tweet object returned by the API carries an entities array. Each entry has a type (photo, video, or url), a link (the media URL), and a preview (the thumbnail). That structure is the whole game:

json
{
  "id": "1782368585664626774",
  "full_text": "Launch photos from this morning",
  "created_at": "2026-05-01T10:30:00Z",
  "entities": [
    {
      "type": "photo",
      "link": "https://pbs.twimg.com/media/Gx1example.jpg",
      "preview": "https://pbs.twimg.com/media/Gx1example.jpg?name=small"
    }
  ],
  "user": { "username": "nasa", "followers_count": 90000000 }
}

One tweet

Call the single tweet endpoint, then loop the entities to download each file. The API key goes in the ApiKey header:

python
import requests

API_KEY = "YOUR_API_KEY"
BASE = "https://api.sorsa.io/v3"

tweet = requests.post(
    f"{BASE}/tweet-info",
    headers={"ApiKey": API_KEY},
    json={"tweet_link": "https://x.com/nasa/status/1782368585664626774"},
).json()

for item in tweet.get("entities", []):
    if item["type"] in ("photo", "video"):
        url = item["link"]
        data = requests.get(url).content
        name = url.split("/")[-1].split("?")[0]
        with open(name, "wb") as f:
            f.write(data)

For full-resolution photos, request the original size. X serves a resized version by default and exposes size aliases on pbs.twimg.com URLs: thumb (150x150), small (680x680), medium (1200x1200, the default), large (2048x2048), and orig (4096x4096), according to the X Developers community. Append ?name=orig to a photo URL to pull the largest stored version.

A whole profile

To collect every image and clip from an account, page through the user tweets endpoint with next_cursor until the cursor runs out. Each page returns up to 20 tweets:

python
import requests

API_KEY = "YOUR_API_KEY"
BASE = "https://api.sorsa.io/v3"
HEADERS = {"ApiKey": API_KEY}

def media_urls(username):
    cursor = None
    while True:
        body = {"username": username}
        if cursor:
            body["next_cursor"] = cursor
        page = requests.post(f"{BASE}/user-tweets", headers=HEADERS, json=body).json()
        for tweet in page.get("tweets", []):
            for item in tweet.get("entities", []):
                if item["type"] in ("photo", "video"):
                    yield item["link"]
        cursor = page.get("next_cursor")
        if not cursor:
            break

for url in media_urls("nasa"):
    print(url)

To pull media for a topic rather than an account, search tweets via the API with a query, and narrow to posts that carry media using standard X operators like filter:images or filter:videos:

python
body = {"query": "#sunset filter:images", "order": "latest"}
results = requests.post(f"{BASE}/search-tweets", headers=HEADERS, json=body).json()

The same operators that work in X advanced search work here. A full operator cheat sheet covers date ranges, language filters, and more.

Bulk by ID

When you already have a list of tweet IDs, the batch endpoint accepts up to 100 of them in one request and returns all of them with full media and author data. One batch call counts as one request against your quota, which is where the cost advantage compounds.

Building your own scraper, and why it breaks

A do-it-yourself scraper is viable for small, one-off jobs, but in 2026 the two popular DIY paths each hit a hard wall: the official-API tutorial approach is effectively dead, and the cookie-based scrapers risk your account and stop at 3,200 tweets.

The first wall is the classic tutorial. Many older guides still tell you to install Tweepy, create a Twitter Developer account, and pull a user's timeline with four OAuth keys. That free path no longer exists the way those guides describe. X removed free API access in 2023, and the current API charges per resource, so the "free Tweepy script" most articles teach either fails or quietly turns into a metered bill.

The second wall is the modern scraper. The standard open-source tool today is gallery-dl, and it works, with two serious catches. It now requires you to extract the auth-token cookie from a logged-in X account and feed it to the tool, which violates X's terms and puts that account at real risk of suspension. And it inherits X's timeline limit: the standard timeline view caps at roughly 3,200 tweets per account, so older media simply cannot be reached this way. Across the accounts we have run media jobs against, those are the two failures that show up every time: a session that dies and a wall at 3,200 posts.

An API path sidesteps both. There is no login cookie to leak, because access is a server-side key, not your personal session. And the profile endpoint paginates past the timeline view, so you can walk a profile back toward its first post rather than stopping at 3,200. If your real need is a complete account history rather than its media specifically, pulling a full tweet history covers that workflow end to end.

Limits, cost, and edge cases

The cost difference between scraping media yourself through the official API and using a flat-rate API is large, because the two providers bill on different units. X charges per resource fetched; a flat-rate API charges per request, and a single request can carry up to 100 tweets with their media and author profiles.

Here is the side-by-side, using current rates from the April 20, 2026 X pricing update:

Official X API (pay-per-use)Sorsa API
Billing unitPer resource fetchedPer request (flat)
100 tweets with media + author~$1.50 (100 posts at $0.005 + 100 author reads at $0.010), plus media reads at $0.005 each$0.00199, one batch request (Pro)
Media URL in the responseBilled (Media: Read, $0.005 each)Included in the tweet object
Author profile in the responseBilled separately ($0.010 each)Included free
AuthenticationOAuth 2.0 + Bearer TokenSingle API key header
Rate limitVaries by endpointFlat 20 req/s, every plan
Monthly read cap2 million post readsPlan quota (10K to 500K requests)
Write actions (post, DM, follow)Posting and DMs; follow/like/quote are Enterprise-onlyNone, read-only

The takeaway in plain text: reading 100 tweets with their media and author data runs about $1.50 or more on the official API's per-resource model, versus a single flat-rate request on Sorsa. If your workflow involves posting, deleting, or sending DMs, that is the official API's territory, and the comparison there is moot. For reading and downloading public media at a flat, predictable price, that is exactly what Sorsa is built for. The plan pricing page breaks this down further.

A few edge cases decide whether any of this works at all:

Private accounts are off-limits. Protected accounts restrict their posts to approved followers. No API, scraper, or download tool can reach a protected account's media unless you are an authenticated follower. This is true of the official X API, Sorsa, and every other method equally.

Rate limits and retries. Sorsa returns 429 Too Many Requests if you exceed 20 requests per second; the fix is to wait one second and retry, with no penalty. Batch endpoints reduce how many requests you need in the first place.

Direct file links. The download step is a plain HTTP GET against the URL in the link field. Photos resolve to pbs.twimg.com; video files are larger, so stream them to disk rather than loading them into memory for big jobs.

Legality, briefly. Collecting public data is broadly treated as permissible, but X's terms restrict scraping, and downloaded media remains the copyright of its creator. Analyzing public images is a different posture from republishing them, and platform terms still apply. This is general information, not legal advice; check your specific use case with counsel.

What this looks like in practice

A roughly six-person brand-analytics team came to this after a familiar cycle. They were archiving campaign images and short clips from a brand's mention stream for visual sentiment review, running a gallery-dl pipeline behind a logged-in account. The session kept dying mid-run, and on the busiest handles they kept hitting the 3,200-post wall, so the archive was always incomplete and someone was always babysitting the job.

Moving the collection to a flat-rate API removed both problems. They pulled media URLs from search and from profile timelines in batches, downloaded the files on their own schedule, and stopped maintaining cookie sessions entirely. The data bill became a single flat monthly figure, well under what per-resource pricing would have cost at that volume, which for read-heavy media work lands in the 30-to-50-times-cheaper range. The illustrative point holds for anyone in the same spot: the bottleneck was never the download, it was the fragile data layer feeding it.

Getting started

The fastest way to see the data is the free Media Downloader: paste a tweet link and it returns the photos and videos, no code required. To build, grab a key (no app review, no approval queue, about a three-minute setup), and the first call is the single tweet endpoint shown above. From there, swap in the profile or search endpoint depending on the job.

The numbers worth remembering: $49 for 10,000 requests on Starter, a flat 20 requests per second on every plan, media URLs and author profiles included in every tweet response, and batch endpoints that pack up to 100 tweets into one request. Full plan details sit on the pricing page, and the API reference documents every field shown in this guide.

Frequently asked questions

Can you scrape images from Twitter/X?

Yes. Public images, videos, and GIFs on X can be collected through a browser tool, an open-source script, or an API. An API is the scalable option: it returns each tweet's media URLs and metadata in structured JSON, and you download the files from those URLs. Private and protected accounts cannot be accessed by any method unless you are an approved follower.

Collecting publicly available data is broadly treated as permissible in many jurisdictions, but X's terms of service restrict scraping, and any media you download remains the copyright of the person who posted it. Analyzing public images for research differs from republishing them commercially. This is general information rather than legal advice, so confirm your specific use case with a qualified lawyer.

How do you download all images from a Twitter account?

Page through the account's tweets and read the media entities on each one, then download every photo and video URL. A browser tool stops at one post, and most open-source scrapers stop at the 3,200-tweet timeline limit. A paginated API endpoint walks the profile past that limit toward the account's earliest posts, so the archive can be complete.

Can you download Twitter videos and GIFs too?

Yes. Videos and GIFs come through the same media entities as photos. On X, animated GIFs are stored as short silent MP4 clips, so they return as video entities rather than a separate GIF type. With Sorsa, every tweet response includes its media URLs, so one request can return photos, videos, and GIF-MP4s together, and you download each file from its link.

How much does it cost to scrape Twitter media?

It depends on the billing model. The official X API charges per resource fetched: about $0.005 per post and $0.010 per author profile, plus media reads. Sorsa charges per request at a flat rate, starting at $49 for 10,000 requests, with media URLs and author profiles included in each response. For read-heavy media collection, the flat model runs roughly 30 to 50 times cheaper.

Can you scrape media from private Twitter accounts?

No. Protected accounts limit their posts to approved followers, and no API, scraper, or download tool can retrieve their media without an authenticated follower session. This restriction applies identically to the official X API, to Sorsa, and to every other method. Only public accounts and public posts can be collected.


Reviewed by Keksich, founder of Sorsa, marketer and X API researcher.

This guide draws on hands-on work operating the Sorsa API, the live API documentation, and verification against primary sources during the June 2026 edit. The X image size aliases were confirmed against the X Developers community; the official X API per-resource rates reflect the April 20, 2026 pricing update; the timeline limit and gallery-dl auth-cookie behavior were checked against current open-source project discussions. Pricing and endpoint details were verified against Sorsa's own pricing and API reference documentation. Last verified June 13, 2026.