X/Twitter 媒体批量下载器 (支持 iPhone/Android)

一键下载 X/Twitter 的图片、视频和 GIF,默认设置下以用户 ID 和帖子 ID 保存。您可以自定义下载文件的文件名。在 iPhone/Android 上,通过使用 ZIP 文件,您还可以一键下载附加的媒体。下载历史记录与书签同步。此外,可以选择利用 X/Twitter 的书签功能来实现在线同步下载历史记录。

< 脚本 X/Twitter 媒体批量下载器 (支持 iPhone/Android) 的反馈

提问 / 留言

§
发布于:2025-06-09

将下载历史同步到X中,45行;

const enableDownloadHistorykSync = true;

自定义文件名称,尽量接近‘Twitter媒体下载’的那个格式,66-67行;

const generateFilename = (filenameElements, mediaTypeLabel, index, ext) => {
const { userId, userName, postId, postTime } = filenameElements;
const formattedPostTime = dayjs(postTime).format('YYYYMMDD_HHmmss');
return `twitter_${userName}(@${userId})_${formattedPostTime}_${postId}_${mediaTypeLabel}${index}.${ext}`;
};

§
发布于:2025-07-11

将下载历史同步到X中,45行;

const enableDownloadHistorykSync = true;

自定义文件名称,尽量接近‘Twitter媒体下载’的那个格式,66-67行;

const generateFilename = (filenameElements, mediaTypeLabel, index, ext) => {
const { userId, userName, postId, postTime } = filenameElements;
const formattedPostTime = dayjs(postTime).format('YYYYMMDD_HHmmss');
return `twitter_${userName}(@${userId})_${formattedPostTime}_${postId}_${mediaTypeLabel}${index}.${ext}`;
};

原來postTime前面要加formatted,以為只要改成YYYYMMDD_HHmmss就好 瞎搞好久,看到這篇檔名順眼多了 謝謝

§
发布于:2025-07-25

找了好久这个命名格式

§
发布于:2025-08-05

找了好久这个命名格式

没等他更新,我就用回隔壁脚本了,我需要的是 "Twitter 媒体下载 / Twitter Media Downloader" 的那个文件名格式,多图的第一张如:_photo-0.jpg,而不是_img1.jpg。

azuki_0306作者
§
发布于:2025-08-06
编辑于:2025-08-06

Thank you for your feedback! You can easily get the filename format you want by editing the script.
Find the generateFilename function (around line 65) and replace it with this code


const generateFilename = (filenameElements, mediaTypeLabel, index, ext) => {
const { userId, userName, postId, postTime } = filenameElements;

// Use 'photo' for images and start numbering from 0
const newMediaTypeLabel = (mediaTypeLabel === 'img') ? 'photo' : mediaTypeLabel;
const zeroBasedIndex = index - 1;

return `${userId}-${postId}_${newMediaTypeLabel}-${zeroBasedIndex}.${ext}`;
};


This will rename files from `..._img1.jpg` to your preferred `..._photo-0.jpg` format. You can also customize other parts of the filename, like the date format, within the same function.

发布留言

登录以发布留言。