How to Scrape Images and Videos From Tweets
To scrape images and videos from tweets, collect posts with a media filter such as from:NASA filter:media using apidojo's Tweet Scraper V2 on Apify, then download the files from the media URLs in each result.

To scrape images and videos from tweets, collect posts with a media filter such as from:NASA filter:media using apidojo’s Tweet Scraper V2 on Apify, then download the files from the media URLs in each result. Photos come as direct pbs.twimg.com links, and each media item is labelled with its type: photo, video or animated GIF.
This guide covers the query, the media fields in the output, a Python downloader and the costs. Media search filters themselves are covered in how to search only tweets with images, videos or links. Every other collection task is mapped in how to scrape Twitter (X) data.
How Do You Collect Tweets With Media?
You collect tweets with media by adding filter:media, filter:images or filter:videos to the query in searchTerms, or by turning on the onlyImage or onlyVideo inputs. from:NASA filter:media is one of the actor’s documented examples (Apify).
{
"searchTerms": ["from:NASA filter:images since:2026-01-01"],
"sort": "Latest",
"maxItems": 500
}
Where Are the Media URLs in the Output?
apidojo’s Twitter actors return media in an extendedEntities.media array, one entry per photo or video, with its type, media_url_https and expanded_url, plus a flat media list of the image URLs. The fields below come from apidojo’s documented output example (Apify).
| Field | Contains |
|---|---|
extendedEntities.media[].type |
photo, video or animated_gif |
extendedEntities.media[].media_url_https |
Direct image URL, for example https://pbs.twimg.com/media/GGWb69-a0AAj1iA.jpg |
extendedEntities.media[].expanded_url |
The post’s media page on X |
media |
A list of the media URLs |
For a video, media_url_https is the preview image; X’s media object for videos also carries the playable MP4 files as variants at different bitrates.
How Do You Download Tweet Images With Python?
Read each post’s extendedEntities.media list, keep the photos, and save each media_url_https file. The script names each file after the post ID and position so nothing is overwritten.
import os, pathlib, requests
from apify_client import ApifyClient
client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("apidojo/tweet-scraper").call(run_input={
"searchTerms": ["from:NASA filter:images since:2026-01-01"],
"sort": "Latest",
"maxItems": 200,
})
out = pathlib.Path("tweet_images")
out.mkdir(exist_ok=True)
for tweet in client.dataset(run.default_dataset_id).iterate_items():
media = (tweet.get("extendedEntities") or {}).get("media", [])
for i, item in enumerate(media):
if item.get("type") != "photo":
continue
url = item["media_url_https"]
path = out / f"{tweet['id']}_{i}{pathlib.Path(url).suffix}"
path.write_bytes(requests.get(url, timeout=30).content)
The Python setup is in how to collect tweets with Python.
How Do You Collect Videos From Tweets?
Filter for video with filter:native_video to keep videos uploaded to X, then read each video entry in extendedEntities.media and choose the highest-bitrate MP4 variant. filter:videos also includes YouTube links, which have no file to download from X (twitter-advanced-search reference).
What Does Media Scraping Cost?
Media scraping costs the same as any tweet collection, $0.40 per 1,000 tweets on Tweet Scraper V2, and downloading the files from X’s media servers adds no actor fee. 1,000 image posts cost $0.40; the files then download directly from the pbs.twimg.com URLs (Apify).
Can You Use Scraped Twitter Media?
Scraped media still belongs to the people who posted it, so use it for analysis, research or archiving, and get permission before republishing. Check X’s Terms of Service and copyright law for your use case. Embedding the original post is the safe way to show it on a website; see how to embed a tweet on a website.
Questions people ask
Can you download a single tweet's images?
Yes, use Twitter Scraper Unlimited with the tweet URL in startUrls; Tweet Scraper V2 doesn't fetch single tweets.
Can you scrape an account's whole media tab?
Yes, search from:username filter:media in date windows, as in how to scrape tweets by date range.
Where do you start?
At how to scrape Twitter data in 2026 or the apidojo Twitter Scraper.