Compare commits

...
11 Commits
Author SHA1 Message Date
afkarxyz befe838e79 v3.4 2025-08-08 15:20:30 +07:00
afkarxyz b534bc278e Update README.md 2025-08-08 15:17:31 +07:00
afkarxyz 2e882635eb v3.3 2025-07-31 12:08:25 +07:00
afkarxyz 5d5b778c8e v3.3 2025-07-30 05:26:56 +07:00
afkarxyz 7cf134f681 v3.3 2025-07-30 05:24:47 +07:00
afkarxyz 7d90eb7cb2 v3.3 2025-07-26 21:27:45 +07:00
afkarxyz 3d1fd7d1fb v3.3 2025-07-26 21:11:53 +07:00
afkarxyz c0885b1812 v3.2 2025-07-26 12:34:42 +07:00
afkarxyz 1ca5c613ae Update latest.json 2025-07-26 12:34:32 +07:00
afkarxyz 596ba9bb3c v3.2 2025-07-26 12:33:59 +07:00
afkarxyz a1cbb04402 v3.2 2025-07-26 12:33:58 +07:00
7 changed files with 3916 additions and 52 deletions

No files matched your search

+12 -12
View File
@@ -8,40 +8,40 @@
## 📥 Download
- **Windows**: [TwitterXMediaBatchDownloader](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v3.1/TwitterXMediaBatchDownloader.exe)
- **Linux**: [TwitterXMediaBatchDownloader](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v3.1/TwitterXMediaBatchDownloader)
- **Mac**: [TwitterXMediaBatchDownloader](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v3.1/TwitterXMediaBatchDownloader.app.zip)
- If you're familiar with **userscripts**, please install it [here](https://greasyfork.org/en/scripts/523157)
- [**Windows**](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v3.3/TwitterXMediaBatchDownloader_Windows.exe)
- [**Linux**](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v3.3/TwitterXMediaBatchDownloader_Linux)
- [**Mac**](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v3.3/TwitterXMediaBatchDownloader_Mac.app.zip)
- If you're familiar with **userscripts**, please install it [**here**](https://greasyfork.org/en/scripts/523157)
### The downloaded application won't run❓
🐧 **Solution (Ubuntu/Linux)**: Open your terminal and run:
```bash
chmod +x TwitterXMediaBatchDownloader
chmod +x TwitterXMediaBatchDownloader_Linux
```
https://github.com/user-attachments/assets/41231de2-e665-4d61-a4f4-62f424973af3
https://github.com/user-attachments/assets/ab65e53f-2986-4386-9e09-e4c8e33ec90b
🍎 **Solution (macOS)**: Open your terminal and run:
```bash
xattr -rd com.apple.quarantine ~/Downloads/TwitterXMediaBatchDownloader.app
xattr -rd com.apple.quarantine ~/Downloads/TwitterXMediaBatchDownloader_Mac.app
```
https://github.com/user-attachments/assets/56a89c03-29ab-45f1-979f-4317f45191f7
https://github.com/user-attachments/assets/5f9a1cf6-a7a8-4943-ad71-d2831b406137
## ✨ Features
- Powered by `gallery-dl`, similar to `yt-dlp`
- **Bulk download**: Download multiple items at once
- **Bulk download**: Download multiple accounts at once
- Media-type selection: All (Images + GIFs + Videos) or specific (Images / GIFs / Videos)
- **MP4 → GIF conversion:** Convert downloaded MP4 videos into GIF format
- Downloads at original quality
## 🖼️ Screenshots
![image](https://github.com/user-attachments/assets/216cfa1d-90eb-4b48-bacf-42e943f5bbee)
![image](https://github.com/user-attachments/assets/bae739f3-c6be-415f-8e9b-18cceae659f6)
![image](https://github.com/user-attachments/assets/cfb57b60-661d-4d82-a1f3-1e859a33e8c4)
@@ -77,7 +77,7 @@ pip install pyinstaller
### 5. Build the Application
```bash
pyinstaller --onefile --windowed TwitterXMediaBatchDownloader.py
pyinstaller --onefile --windowed TwitterXMediaBatchDownloader_Linux.py
```
The compiled binary will be located in the `dist/` folder.
@@ -121,7 +121,7 @@ pip install pyinstaller
### 6. Build the Application
```bash
pyinstaller --onefile --windowed --icon=Archived/icon.icns TwitterXMediaBatchDownloader.py
pyinstaller --onefile --windowed --icon=Archived/icon.icns TwitterXMediaBatchDownloader_Mac.py
```
The `.app` bundle will be generated inside the `dist/` folder.
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -32,6 +32,8 @@ class Account:
media_type: str
profile_image: str = None
media_list: list = None
fetch_mode: str = 'all'
fetch_timestamp: str = None
class MetadataFetchWorker(QThread):
finished = pyqtSignal(dict)
@@ -343,7 +345,7 @@ class UpdateDialog(QDialog):
class TwitterMediaDownloaderGUI(QWidget):
def __init__(self):
super().__init__()
self.current_version = "3.2"
self.current_version = "3.4"
self.accounts = []
self.temp_dir = os.path.join(tempfile.gettempdir(), "twitterxmediabatchdownloader")
os.makedirs(self.temp_dir, exist_ok=True)
@@ -386,9 +388,45 @@ class TwitterMediaDownloaderGUI(QWidget):
if self.check_for_updates:
QTimer.singleShot(0, self.check_updates)
def get_time_ago(self, timestamp_str):
if not timestamp_str:
return "Unknown"
try:
fetch_time = datetime.fromisoformat(timestamp_str.replace('Z', '+00:00'))
now = datetime.now(fetch_time.tzinfo) if fetch_time.tzinfo else datetime.now()
diff = now - fetch_time
days = diff.days
hours = diff.seconds // 3600
minutes = (diff.seconds % 3600) // 60
if days > 0:
return f"{days} day{'s' if days != 1 else ''} ago"
elif hours > 0:
return f"{hours} hour{'s' if hours != 1 else ''} ago"
elif minutes > 0:
return f"{minutes} minute{'s' if minutes != 1 else ''} ago"
else:
return "Just now"
except:
return "Unknown"
def format_fetch_info(self, timestamp_str):
if not timestamp_str:
return "Fetched: Unknown"
try:
fetch_time = datetime.fromisoformat(timestamp_str.replace('Z', '+00:00'))
formatted_datetime = fetch_time.strftime("%Y/%m/%d • %H:%M")
age = self.get_time_ago(timestamp_str)
return f"Fetched: {formatted_datetime} ({age})"
except:
return "Fetched: Unknown"
def check_updates(self):
try:
response = requests.get("https://raw.githubusercontent.com/afkarxyz/Twitter-X-Media-Batch-Downloader/refs/heads/main/latest.json")
response = requests.get("https://raw.githubusercontent.com/afkarxyz/Twitter-X-Media-Batch-Downloader/refs/heads/main/version.json")
if response.status_code == 200:
data = response.json()
new_version = data.get("version")
@@ -474,15 +512,15 @@ class TwitterMediaDownloaderGUI(QWidget):
self.account_list = QListWidget()
self.account_list.setSelectionMode(QAbstractItemView.SelectionMode.ExtendedSelection)
self.account_list.itemSelectionChanged.connect(self.update_button_states)
self.account_list.setIconSize(QSize(36, 36))
self.account_list.setIconSize(QSize(48, 48))
self.account_list.setStyleSheet("""
QListWidget {
padding: 0px;
padding: 4px;
outline: none;
}
QListWidget::item {
padding: 8px 12px;
margin: 2px 0px;
padding: 3px 6px;
margin: 0px 0px;
border: none;
outline: none;
}
@@ -508,21 +546,21 @@ class TwitterMediaDownloaderGUI(QWidget):
def setup_account_buttons(self):
self.btn_layout = QHBoxLayout()
self.download_selected_btn = QPushButton('Download Selected')
self.download_all_btn = QPushButton('Download All')
self.update_selected_btn = QPushButton('Update Selected')
self.remove_btn = QPushButton('Remove Selected')
self.clear_btn = QPushButton('Clear')
for btn in [self.download_selected_btn, self.download_all_btn, self.remove_btn, self.clear_btn]:
for btn in [self.download_selected_btn, self.update_selected_btn, self.remove_btn, self.clear_btn]:
btn.setMinimumWidth(120)
btn.setCursor(Qt.CursorShape.PointingHandCursor)
self.download_selected_btn.clicked.connect(self.download_selected)
self.download_all_btn.clicked.connect(self.download_all)
self.update_selected_btn.clicked.connect(self.update_selected)
self.remove_btn.clicked.connect(self.remove_selected_accounts)
self.clear_btn.clicked.connect(self.clear_accounts)
self.btn_layout.addStretch()
for btn in [self.download_selected_btn, self.download_all_btn, self.remove_btn, self.clear_btn]:
for btn in [self.download_selected_btn, self.update_selected_btn, self.remove_btn, self.clear_btn]:
self.btn_layout.addWidget(btn, 1)
self.btn_layout.addStretch()
@@ -968,20 +1006,19 @@ class TwitterMediaDownloaderGUI(QWidget):
section_layout.setContentsMargins(0, 0, 0, 0)
label = QLabel(title)
label.setStyleSheet("color: palette(text); font-weight: bold;")
label.setStyleSheet("font-weight: bold;")
label.setAlignment(Qt.AlignmentFlag.AlignCenter)
section_layout.addWidget(label)
button = QPushButton(button_text)
button.setFixedSize(120, 25)
button.setFixedSize(100, 25)
button.setCursor(Qt.CursorShape.PointingHandCursor)
button.clicked.connect(lambda _, url=url: QDesktopServices.openUrl(QUrl(url if url.startswith(('http://', 'https://')) else f'https://{url}')))
section_layout.addWidget(button, alignment=Qt.AlignmentFlag.AlignCenter)
about_layout.addWidget(section_widget)
footer_label = QLabel(f"v{self.current_version} | July 2025")
footer_label.setStyleSheet("font-size: 12px; margin-top: 20px;")
footer_label = QLabel(f"v{self.current_version} | gallery-dl v1.30.2 | August 2025")
about_layout.addWidget(footer_label, alignment=Qt.AlignmentFlag.AlignCenter)
about_tab.setLayout(about_layout)
@@ -1194,7 +1231,9 @@ class TwitterMediaDownloaderGUI(QWidget):
posts=posts,
media_type=media_type,
profile_image=profile_image_url,
media_list=timeline
media_list=timeline,
fetch_mode='batch' if cached_data.get('is_batch', False) else 'all',
fetch_timestamp=cached_data.get('fetch_timestamp')
)
self.accounts.append(account)
@@ -1271,7 +1310,9 @@ class TwitterMediaDownloaderGUI(QWidget):
following=following,
posts=posts,
media_type=media_type,
media_list=timeline
media_list=timeline,
fetch_mode='batch' if cached_data.get('is_batch', False) else 'all',
fetch_timestamp=cached_data.get('fetch_timestamp')
)
self.accounts.append(account)
@@ -1356,7 +1397,9 @@ class TwitterMediaDownloaderGUI(QWidget):
posts=posts,
media_type=media_type,
profile_image=profile_image_url,
media_list=timeline
media_list=timeline,
fetch_mode='batch' if self.batch_mode else 'all',
fetch_timestamp=datetime.now().isoformat()
)
self.accounts.append(account)
@@ -1366,7 +1409,9 @@ class TwitterMediaDownloaderGUI(QWidget):
updated_data = {
'account_info': account_info,
'timeline': existing_account.media_list,
'metadata': metadata
'metadata': metadata,
'is_batch': self.batch_mode,
'fetch_timestamp': existing_account.fetch_timestamp
}
self.save_cached_data(username, media_type, updated_data, is_batch=self.batch_mode)
@@ -1404,7 +1449,12 @@ class TwitterMediaDownloaderGUI(QWidget):
self.log_output.append(f'All batches complete! Total: {total_items:,} media items for {username}')
self.twitter_url.clear()
self.tab_widget.setCurrentIndex(0)
if hasattr(self, 'accounts_to_update') and hasattr(self, 'current_update_index'):
self.current_update_index += 1
self.update_next_account()
else:
self.tab_widget.setCurrentIndex(0)
except Exception as e:
self.log_output.append(f'Error: {str(e)}')
self.update_account_list()
@@ -1421,6 +1471,10 @@ class TwitterMediaDownloaderGUI(QWidget):
self.enable_batch_buttons()
if hasattr(self, 'accounts_to_update') and hasattr(self, 'current_update_index'):
self.current_update_index += 1
self.update_next_account()
self.update_account_list()
def update_account_list(self):
@@ -1431,21 +1485,22 @@ class TwitterMediaDownloaderGUI(QWidget):
line1 = f"{i}. {account.username} ({account.nick})"
line2 = f"Followers: {account.followers:,} • Following: {account.following:,} • Posts: {account.posts:,} • {media_type_display}: {media_count:,}"
display_text = f"{line1}\n{line2}"
line3 = self.format_fetch_info(account.fetch_timestamp)
display_text = f"{line1}\n{line2}\n{line3}"
item = QListWidgetItem()
item.setText(display_text)
item.setSizeHint(QSize(0, 52))
item.setSizeHint(QSize(0, 70))
if account.profile_image:
if account.profile_image in self.profile_image_cache:
item.setIcon(QIcon(self.profile_image_cache[account.profile_image]))
else:
self.download_profile_image(account.profile_image)
placeholder = self.create_placeholder_icon(52)
placeholder = self.create_placeholder_icon(48)
if placeholder:
item.setIcon(QIcon(placeholder))
else:
placeholder = self.create_placeholder_icon(52)
placeholder = self.create_placeholder_icon(48)
if placeholder:
item.setIcon(QIcon(placeholder))
@@ -1453,7 +1508,7 @@ class TwitterMediaDownloaderGUI(QWidget):
self.update_button_states()
def create_placeholder_icon(self, size=36):
def create_placeholder_icon(self, size=48):
pixmap = QPixmap(size, size)
pixmap.fill(Qt.GlobalColor.transparent)
@@ -1472,7 +1527,7 @@ class TwitterMediaDownloaderGUI(QWidget):
painter.end()
return pixmap
def create_square_pixmap(self, original_pixmap, size=36):
def create_square_pixmap(self, original_pixmap, size=48):
if original_pixmap.isNull():
return self.create_placeholder_icon(size)
@@ -1520,7 +1575,7 @@ class TwitterMediaDownloaderGUI(QWidget):
data = reply.readAll()
pixmap = QPixmap()
if pixmap.loadFromData(data):
square_pixmap = self.create_square_pixmap(pixmap, 52)
square_pixmap = self.create_square_pixmap(pixmap, 48)
self.profile_image_cache[image_url] = square_pixmap
self.update_account_list()
@@ -1535,15 +1590,16 @@ class TwitterMediaDownloaderGUI(QWidget):
def update_button_states(self):
has_accounts = len(self.accounts) > 0
has_selected = len(self.account_list.selectedItems()) > 0
self.download_selected_btn.setEnabled(has_accounts)
self.download_all_btn.setEnabled(has_accounts)
self.remove_btn.setEnabled(has_accounts)
self.download_selected_btn.setEnabled(has_accounts and has_selected)
self.update_selected_btn.setEnabled(has_accounts and has_selected)
self.remove_btn.setEnabled(has_accounts and has_selected)
self.clear_btn.setEnabled(has_accounts)
if has_accounts:
self.download_selected_btn.show()
self.download_all_btn.show()
self.update_selected_btn.show()
self.remove_btn.show()
self.clear_btn.show()
else:
@@ -1552,7 +1608,7 @@ class TwitterMediaDownloaderGUI(QWidget):
def hide_account_buttons(self):
buttons = [
self.download_selected_btn,
self.download_all_btn,
self.update_selected_btn,
self.remove_btn,
self.clear_btn
]
@@ -1569,6 +1625,114 @@ class TwitterMediaDownloaderGUI(QWidget):
def download_all(self):
self.download_accounts(range(len(self.accounts)))
def update_selected(self):
selected_items = self.account_list.selectedItems()
if not selected_items:
self.log_output.append('Warning: Please select accounts to update.')
return
selected_accounts = []
for item in selected_items:
index = self.account_list.row(item)
if index < len(self.accounts):
selected_accounts.append(self.accounts[index])
if not selected_accounts:
return
self.tab_widget.setCurrentIndex(1)
self.log_output.clear()
self.log_output.append(f'Starting update for {len(selected_accounts)} account(s)...')
self.accounts_to_update = selected_accounts.copy()
self.current_update_index = 0
self.update_next_account()
def update_next_account(self):
if not hasattr(self, 'accounts_to_update') or self.current_update_index >= len(self.accounts_to_update):
self.log_output.append('All selected accounts have been updated!')
if hasattr(self, 'accounts_to_update'):
delattr(self, 'accounts_to_update')
if hasattr(self, 'current_update_index'):
delattr(self, 'current_update_index')
return
account = self.accounts_to_update[self.current_update_index]
self.log_output.append(f'Updating account {self.current_update_index + 1}/{len(self.accounts_to_update)}: {account.username} ({account.media_type})')
self.update_account(account)
def update_account(self, account):
original_batch_mode = self.batch_mode
original_batch_size = self.batch_size
original_media_type = self.media_type_combo.currentData()
self.batch_mode = (account.fetch_mode == 'batch')
if self.batch_mode:
self.batch_size = self.settings.value('batch_size', 100, type=int)
for i in range(self.media_type_combo.count()):
if self.media_type_combo.itemData(i) == account.media_type:
self.media_type_combo.setCurrentIndex(i)
break
self.twitter_url.setText(account.username)
self.tab_widget.setCurrentIndex(1)
self.log_output.clear()
self.log_output.append(f'Updating {account.username} ({account.media_type}) using {account.fetch_mode} mode...')
username = account.username
media_type = account.media_type
for is_batch in [True, False]:
cache_file = self.get_cache_file_path(username, media_type, is_batch=is_batch)
try:
if os.path.exists(cache_file):
os.remove(cache_file)
self.log_output.append(f'Removed existing cache: {os.path.basename(cache_file)}')
except Exception as e:
self.log_output.append(f'Warning: Could not remove cache {os.path.basename(cache_file)}: {str(e)}')
for i, existing_account in enumerate(self.accounts):
if existing_account.username == account.username and existing_account.media_type == account.media_type:
self.accounts.pop(i)
break
self.update_account_list()
self.start_fetch_process(username, media_type)
self.batch_mode = original_batch_mode
self.batch_size = original_batch_size
for i in range(self.media_type_combo.count()):
if self.media_type_combo.itemData(i) == original_media_type:
self.media_type_combo.setCurrentIndex(i)
break
def start_fetch_process(self, username, media_type):
if not self.auth_token_input.text().strip():
self.log_output.append("Error: Please enter your auth token")
return
self.current_page = 0
self.disable_batch_buttons()
self.worker = MetadataFetchWorker(
username,
media_type,
batch_mode=self.batch_mode,
batch_size=self.batch_size if self.batch_mode else 0,
page=0
)
self.worker.auth_token = self.auth_token_input.text().strip()
self.worker.finished.connect(lambda data: self.on_metadata_fetched(data, username, media_type))
self.worker.error.connect(self.on_metadata_error)
self.worker.start()
def download_accounts(self, indices):
self.log_output.clear()
outpath = self.output_dir.text()
@@ -1607,7 +1771,7 @@ class TwitterMediaDownloaderGUI(QWidget):
def update_ui_for_download_start(self, account_count):
self.download_selected_btn.setEnabled(False)
self.download_all_btn.setEnabled(False)
self.update_selected_btn.setEnabled(False)
self.stop_btn.show()
self.pause_resume_btn.show()
@@ -1691,7 +1855,7 @@ class TwitterMediaDownloaderGUI(QWidget):
self.stop_timer()
self.download_selected_btn.setEnabled(True)
self.download_all_btn.setEnabled(True)
self.update_selected_btn.setEnabled(True)
if (self.batch_mode and self.current_fetch_metadata and
self.current_fetch_metadata.get('has_more', False) and not self.is_auto_fetching):
@@ -1838,7 +2002,7 @@ class TwitterMediaDownloaderGUI(QWidget):
def show_account_buttons(self):
self.download_selected_btn.show()
self.download_all_btn.show()
self.update_selected_btn.show()
self.remove_btn.show()
self.clear_btn.show()
-3
View File
@@ -1,3 +0,0 @@
{
"version": "3.2"
}
+1 -2
View File
@@ -3,5 +3,4 @@ requests
aiohttp
imageio-ffmpeg
packaging
gallery-dl
pyqtdarktheme
gallery-dl
+1 -1
View File
@@ -1,3 +1,3 @@
{
"version": "3.1"
"version": "3.3"
}