One-Click X/Twitter Media Downloader (Android/iPhone support)

Download images, videos, and GIFs from X/Twitter with one click, and save them with user ID and post ID in default settings. You can customize the filenames of downloaded files. On Android/iPhone, all attached media can be downloaded at once via a ZIP archive. Download history is synced with bookmarks. Additionally, you can optionally synchronize your download history online using the X/Twitter bookmark feature.

Author
azuki_0306
Daily installs
7
Total installs
1,648
Ratings
29 2 2
Version
1.4.2
Created
2025-03-05
Updated
2025-05-19
Size
38.9 KB
License
MIT
Applies to


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

  1. Script Installation:

    Add Tampermonkey to your browser and install this script.

  2. Open X/Twitter in your browser and display the tweet you want to download from.

  3. Click the download button located next to the share button to save each media file individually.

For iPhone/iPad

  1. Script Installation:

    Download the Userscripts app from the App Store (Link) and install this script in Safari.

  2. 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.

  3. Open X/Twitter in Safari and display the tweet you want to download from.

  4. 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.

  5. 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

  1. Script Installation:

    Add Tampermonkey to a browser that supports extensions (e.g., Edge Canary, Firefox, etc.) and install this script.

  2. Open X/Twitter in the browser where the script is installed and display the tweet you want to download from.

  3. 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.

  4. 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:

  1. Obtain the shortcut from this link and add it to the Shortcuts app on your iPhone/iPad.

  2. 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.

  3. 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.

  4. 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.

  5. 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.