One-Click X/Twitter Media Downloader User Guide
This script is a tool that allows you to download images, videos, and GIFs on X/Twitter with a single click.
Files are saved using the user ID and post ID in the filename. For multiple media files, on PC they are saved individually, while on mobile they are downloaded as a bulk ZIP file. (Videos are downloaded in the highest available quality and images in their original size.) You can customize the filenames of downloaded files by editing the generateFilename
function in the code. Available elements for filenames are user ID, username, post ID, and post time. Download history is also saved automatically. Additionally, you can optionally synchronize your download history online using the X/Twitter bookmark feature.
The actual image of the download button is attached at the bottom of this page.
It works on both PC and mobile as long as you are using an up-to-date browser.
This script is based on the following two scripts.
・Twitter/X(web version)videos/4kPhotos/gif download.[limbopro](https://greasyfork.runtimutd.eu.org/en/scripts/478651)
・Twitter Media Downloader(https://greasyfork.runtimutd.eu.org/ja/scripts/423001)
Usage Instructions
For Windows/Mac
- Script Installation:
Add Tampermonkey to your browser and install this script.
- Open X/Twitter in your browser and display the tweet you want to download from.
- Click the download button located next to the share button to save each media file individually.
For iPhone/iPad
- Script Installation:
Download the Userscripts app from the App Store (Link) and install this script in Safari.
- Go to Settings → Apps → Safari → Downloads on your iOS device to check the folder where the downloaded media will be saved. By default, files are saved in the "Downloads" folder on iCloud Drive, but you can change this location.
- Open X/Twitter in Safari and display the tweet you want to download from.
- Click the download button located next to the share button; the behavior depends on the number of media files:
• If there is only one media file, it will be downloaded in its original format.
• If there are multiple media files, they will be downloaded as a ZIP file.
- For ZIP files containing multiple media, you can easily extract and save them using the shortcut we provide. (Please see the instructions in the Supplement section below.)
Obtain the Shortcut
For Android
- Script Installation:
Add Tampermonkey to a browser that supports extensions (e.g., Edge Canary, Firefox, etc.) and install this script.
- Open X/Twitter in the browser where the script is installed and display the tweet you want to download from.
- Click the download button located next to the share button; the behavior depends on the number of media files:
• If there is only one media file, it will be downloaded in its original format.
• If there are multiple media files, they will be downloaded as a ZIP file.
- The downloaded ZIP file can be extracted using the default file manager or third-party apps.
Supplement
How to Use the iPhone/iPad Shortcut
When a ZIP file containing multiple media files is downloaded, you can use our dedicated iPhone/iPad shortcut to easily extract and organize the media files. Please follow these steps:
- Obtain the shortcut from this link and add it to the Shortcuts app on your iPhone/iPad.
- The first time you run the shortcut, a screen will prompt you to select the folder where the downloaded ZIP file is saved. Choose the folder specified in step 2 of the iPhone/iPad instructions. By default, the "Downloads" folder on iCloud Drive is selected. If you have changed the download folder, please select that folder here.
- Next, you will be prompted to choose a location where the extracted media files will be saved. Generally, select the same folder where the ZIP file is stored.
- The shortcut will automatically extract the ZIP file and save each media file to the folder specified in the previous step. If there are files that already exist in that folder, they will not be overwritten, and a list of such files will be displayed.
- After extraction, you will be asked whether you want to delete the ZIP file. Choose accordingly.
From then on, running this shortcut will automatically extract and save the downloaded ZIP file.
※ The shortcut settings can be customized as needed. For detailed instructions, please refer to the explanation within the shortcut.
How to Change the Filename of Downloaded Files
You can arbitrarily change the filename of downloaded files using user ID, username, post ID, and post time. To change the name, edit the generateFilename
function in the code. You can also change the format of the post time. For details, please check the dayjs reference. Below are the default settings and other examples.
Default: Name using User ID and Post ID
return `${userId}_${postId}-${mediaTypeLabel}${index}.${ext}`;
Example 1: Name using User ID, Post ID, and Post Time (YYYYMMDD_HHmmss format)
const formattedPostTime = dayjs(postTime).format('YYYYMMDD_HHmmss');
return `${userId}_${postId}-${formattedPostTime}-${mediaTypeLabel}${index}.${ext}`;
Example 2: Name using Username, Post ID, and Post Date (YYYYMMDD format)
const formattedPostTime = dayjs(postTime).format('YYYYMMDD');
return `${userName}_${postId}-${formattedPostTime}-${mediaTypeLabel}${index}.${ext}`;
About Online Download History Sync via Bookmarks
This script includes an optional feature to synchronize your download history online using the X/Twitter bookmark function.
- How to Enable: Please change the value of
enableDownloadHistorykSync
in the code from false
to true
. - How it Works:
- When enabled, posts from which you download media will be automatically added to your X/Twitter bookmarks.
- Posts already present in your bookmarks are considered "downloaded." The download button will show a completed status for these posts, preventing duplicate downloads.
- This allows you to share and sync your download history across multiple devices (like PCs and smartphones) and different browsers via your bookmarks.
- Default Setting: By default (
false
), this feature is disabled. The download history is not synced online and is only stored locally within your browser's storage (IndexedDB).
FAQ
Q: What should I do if the download button does not appear?
A: Please try reloading the page, clearing your cache, or ensuring you are using the latest version of your browser.
Q: I don't know how to extract ZIP files.
A: On iPhone/iPad, you can extract them using the provided shortcut or a file management app. On Android, you can use the built-in file manager to extract ZIP files.
Q: What should I do if an error occurs during the download?
A: Please check your network environment or note that there may be changes in X/Twitter's specifications. Try again after some time.
Q: Which takes precedence: downloading multiple media files or individual downloads?
A: If there is only one media file, it will be downloaded individually; if there are multiple files, they will be downloaded either as a bulk ZIP file or individually depending on the OS.
Q: How can I edit the code on iPhone?
A: You can edit it with a third-party app. For example, you can use the app called Documents (link).
Q: How can I clear the download history?
A: Please delete the DownloadHistoryDB in IndexedDB using your browser's developer tools. If you cannot do that, such as on mobile browsers, please clear site data from your browser's settings.
Q: What should I do if I encounter issues or have questions?
A: Please report them via the feedback section on this page.
License
This script is released under the MIT License.
For details, please review the MIT License.
© 2025 Azuki. All rights reserved.