Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64bd8b4b2d | ||
|
|
0f2427ad2b | ||
|
|
05e8230063 | ||
|
|
83672f42b6 | ||
|
|
affd36c968 | ||
|
|
281ea82656 | ||
|
|
aa003fab4c | ||
|
|
805fade0fb | ||
|
|
dacf6f5a01 | ||
|
|
fe095afb38 | ||
|
|
e769ea8d20 | ||
|
|
befe838e79 | ||
|
|
b534bc278e | ||
|
|
2e882635eb | ||
|
|
5d5b778c8e | ||
|
|
7cf134f681 | ||
|
|
7d90eb7cb2 | ||
|
|
3d1fd7d1fb | ||
|
|
c0885b1812 | ||
|
|
1ca5c613ae | ||
|
|
596ba9bb3c | ||
|
|
a1cbb04402 | ||
|
|
ddf6439893 | ||
|
|
fed2bf7b0c | ||
|
|
241884de89 | ||
|
|
77b443ace0 | ||
|
|
cd48b6f9bc | ||
|
|
6f45b48047 | ||
|
|
7083c56c8b | ||
|
|
60cb3cbabd | ||
|
|
b38bff238a | ||
|
|
d4d216ed6b | ||
|
|
129c007f6f | ||
|
|
d78ad32c09 | ||
|
|
3975e5dd0e | ||
|
|
37f1d910cb | ||
|
|
74ed38cc31 | ||
|
|
2e326c39a0 | ||
|
|
39c37d4776 | ||
|
|
5709d76ceb | ||
|
|
75b3549653 | ||
|
|
ebe739e612 | ||
|
|
d423f20bad | ||
|
|
fba8a8ac45 | ||
|
|
a36c7613d2 | ||
|
|
c7615ed2f6 | ||
|
|
0c17f1b419 | ||
|
|
dd38880366 | ||
|
|
306d2c3c95 | ||
|
|
1caa59bbcf | ||
|
|
4d0021092c | ||
|
|
981bc8d9ec | ||
|
|
c894bfd4d2 | ||
|
|
61e50b8121 | ||
|
|
ba69dd7cf4 | ||
|
|
bcc332d0d7 | ||
|
|
82184aef33 | ||
|
|
357ad0f020 | ||
|
|
43f4d84593 | ||
|
|
4cecb6b14e | ||
|
|
eb712d5d8d | ||
|
|
46c178fec0 | ||
|
|
8ce5f1f833 | ||
|
|
0a80a3d331 | ||
|
|
f8b27ecb5a | ||
|
|
70e79af700 | ||
|
|
4fb60840a0 | ||
|
|
5613c152f8 | ||
|
|
ad5d7727eb | ||
|
|
ed1f0fce06 | ||
|
|
ee92174773 | ||
|
|
f08ce57feb | ||
|
|
4f21321e42 | ||
|
|
c8b7a5365a | ||
|
|
1049b544c5 | ||
|
|
e7db97a936 | ||
|
|
af1280b798 | ||
|
|
4f6004a501 | ||
|
|
e7141cd8d1 | ||
|
|
4d6f4d904a | ||
|
|
4081e6aacf | ||
|
|
2b405a16a7 |
No files matched your search
@@ -1,209 +0,0 @@
|
|||||||
import json
|
|
||||||
import re
|
|
||||||
import os
|
|
||||||
from datetime import datetime
|
|
||||||
from gallery_dl.extractor import twitter
|
|
||||||
|
|
||||||
def get_metadata(username, auth_token, timeline_type="timeline", batch_size=0, page=0, output_file=None):
|
|
||||||
url = f"https://x.com/{username}/{timeline_type}"
|
|
||||||
|
|
||||||
if timeline_type == "media":
|
|
||||||
extractor_class = twitter.TwitterMediaExtractor
|
|
||||||
elif timeline_type == "tweets":
|
|
||||||
extractor_class = twitter.TwitterTweetsExtractor
|
|
||||||
elif timeline_type == "with_replies":
|
|
||||||
extractor_class = twitter.TwitterRepliesExtractor
|
|
||||||
else:
|
|
||||||
extractor_class = twitter.TwitterTimelineExtractor
|
|
||||||
|
|
||||||
match = re.match(extractor_class.pattern, url)
|
|
||||||
if not match:
|
|
||||||
raise ValueError(f"Invalid URL for {timeline_type}: {url}")
|
|
||||||
|
|
||||||
extractor = extractor_class(match)
|
|
||||||
|
|
||||||
config_dict = {
|
|
||||||
"cookies": {
|
|
||||||
"auth_token": auth_token
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if batch_size > 0:
|
|
||||||
config_dict["count"] = batch_size
|
|
||||||
|
|
||||||
extractor.config = lambda key, default=None: config_dict.get(key, default)
|
|
||||||
|
|
||||||
extractor.initialize()
|
|
||||||
|
|
||||||
if output_file is None:
|
|
||||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
||||||
output_file = os.path.join(current_dir, f"{username}_{timeline_type}.json")
|
|
||||||
|
|
||||||
structured_output = {
|
|
||||||
'account_info': {},
|
|
||||||
'total_urls': 0,
|
|
||||||
'timeline': []
|
|
||||||
}
|
|
||||||
|
|
||||||
if page > 0 and os.path.exists(output_file):
|
|
||||||
try:
|
|
||||||
with open(output_file, 'r', encoding='utf-8') as f:
|
|
||||||
structured_output = json.load(f)
|
|
||||||
print(f"Loaded existing data with {structured_output['total_urls']} items from {output_file}")
|
|
||||||
except json.JSONDecodeError:
|
|
||||||
print(f"Warning: Could not load existing data from {output_file}, starting fresh")
|
|
||||||
|
|
||||||
iterator = iter(extractor)
|
|
||||||
|
|
||||||
if batch_size > 0 and page > 0:
|
|
||||||
items_to_skip = page * batch_size
|
|
||||||
print(f"Skipping {items_to_skip} items for page {page}...")
|
|
||||||
|
|
||||||
if hasattr(extractor, '_cursor') and extractor._cursor:
|
|
||||||
print(f"Using cursor: {extractor._cursor}")
|
|
||||||
else:
|
|
||||||
skipped = 0
|
|
||||||
try:
|
|
||||||
for _ in range(items_to_skip):
|
|
||||||
next(iterator)
|
|
||||||
skipped += 1
|
|
||||||
except StopIteration:
|
|
||||||
print(f"Warning: Could only skip {skipped} items")
|
|
||||||
|
|
||||||
batch_items = []
|
|
||||||
new_timeline_entries = []
|
|
||||||
|
|
||||||
items_to_fetch = batch_size if batch_size > 0 else float('inf')
|
|
||||||
items_fetched = 0
|
|
||||||
|
|
||||||
try:
|
|
||||||
while items_fetched < items_to_fetch:
|
|
||||||
item = next(iterator)
|
|
||||||
batch_items.append(item)
|
|
||||||
items_fetched += 1
|
|
||||||
|
|
||||||
if isinstance(item, tuple) and len(item) >= 3:
|
|
||||||
media_url = item[1]
|
|
||||||
tweet_data = item[2]
|
|
||||||
|
|
||||||
if not structured_output['account_info'] and 'user' in tweet_data:
|
|
||||||
user = tweet_data['user']
|
|
||||||
user_date = user.get('date', '')
|
|
||||||
if isinstance(user_date, datetime):
|
|
||||||
user_date = user_date.strftime("%Y-%m-%d %H:%M:%S")
|
|
||||||
|
|
||||||
structured_output['account_info'] = {
|
|
||||||
'name': user.get('name', ''),
|
|
||||||
'nick': user.get('nick', ''),
|
|
||||||
'date': user_date,
|
|
||||||
'followers_count': user.get('followers_count', 0),
|
|
||||||
'friends_count': user.get('friends_count', 0),
|
|
||||||
'profile_image': user.get('profile_image', ''),
|
|
||||||
'statuses_count': user.get('statuses_count', 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
if 'pbs.twimg.com' in media_url or 'video.twimg.com' in media_url:
|
|
||||||
tweet_date = tweet_data.get('date', datetime.now())
|
|
||||||
if isinstance(tweet_date, datetime):
|
|
||||||
tweet_date = tweet_date.strftime("%Y-%m-%d %H:%M:%S")
|
|
||||||
|
|
||||||
timeline_entry = {
|
|
||||||
'url': media_url,
|
|
||||||
'date': tweet_date,
|
|
||||||
'tweet_id': tweet_data.get('tweet_id', 0),
|
|
||||||
}
|
|
||||||
|
|
||||||
if 'type' in tweet_data:
|
|
||||||
timeline_entry['type'] = tweet_data['type']
|
|
||||||
|
|
||||||
new_timeline_entries.append(timeline_entry)
|
|
||||||
structured_output['total_urls'] += 1
|
|
||||||
except StopIteration:
|
|
||||||
pass
|
|
||||||
|
|
||||||
structured_output['timeline'].extend(new_timeline_entries)
|
|
||||||
|
|
||||||
with open(output_file, 'w', encoding='utf-8') as f:
|
|
||||||
json.dump(structured_output, f, ensure_ascii=False, indent=2)
|
|
||||||
|
|
||||||
if batch_size > 0:
|
|
||||||
print(f"Page {page}: Added {len(new_timeline_entries)} media URLs. Total URLs: {structured_output['total_urls']}")
|
|
||||||
else:
|
|
||||||
print(f"Added {len(new_timeline_entries)} media URLs. Total URLs: {structured_output['total_urls']}")
|
|
||||||
|
|
||||||
cursor_info = None
|
|
||||||
if hasattr(extractor, '_cursor') and extractor._cursor:
|
|
||||||
cursor_info = extractor._cursor
|
|
||||||
print(f"Current cursor: {cursor_info}")
|
|
||||||
|
|
||||||
return {
|
|
||||||
"items": batch_items,
|
|
||||||
"structured_output": structured_output,
|
|
||||||
"new_entries": len(new_timeline_entries),
|
|
||||||
"total_urls": structured_output['total_urls'],
|
|
||||||
"page": page,
|
|
||||||
"batch_size": batch_size,
|
|
||||||
"has_more": batch_size > 0 and items_fetched == batch_size,
|
|
||||||
"cursor": cursor_info
|
|
||||||
}
|
|
||||||
|
|
||||||
def continue_metadata_fetch(username, auth_token, timeline_type="media", batch_size=100, max_pages=None):
|
|
||||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
||||||
output_file = os.path.join(current_dir, f"{username}_{timeline_type}.json")
|
|
||||||
|
|
||||||
page = 0
|
|
||||||
total_urls = 0
|
|
||||||
has_more = True
|
|
||||||
|
|
||||||
if os.path.exists(output_file):
|
|
||||||
try:
|
|
||||||
with open(output_file, 'r', encoding='utf-8') as f:
|
|
||||||
existing_data = json.load(f)
|
|
||||||
total_urls = existing_data.get('total_urls', 0)
|
|
||||||
page = total_urls // batch_size if batch_size > 0 else 0
|
|
||||||
print(f"Continuing from page {page} with {total_urls} existing URLs")
|
|
||||||
except json.JSONDecodeError:
|
|
||||||
print(f"Warning: Could not load existing data from {output_file}, starting fresh")
|
|
||||||
|
|
||||||
while has_more and (max_pages is None or page < max_pages):
|
|
||||||
result = get_metadata(
|
|
||||||
username=username,
|
|
||||||
auth_token=auth_token,
|
|
||||||
timeline_type=timeline_type,
|
|
||||||
batch_size=batch_size,
|
|
||||||
page=page,
|
|
||||||
output_file=output_file
|
|
||||||
)
|
|
||||||
|
|
||||||
has_more = result["has_more"]
|
|
||||||
total_urls = result["total_urls"]
|
|
||||||
|
|
||||||
if not has_more:
|
|
||||||
print(f"No more items to fetch. Total URLs: {total_urls}")
|
|
||||||
break
|
|
||||||
|
|
||||||
page += 1
|
|
||||||
|
|
||||||
return total_urls
|
|
||||||
|
|
||||||
# Usage
|
|
||||||
if __name__ == "__main__":
|
|
||||||
username = "takomayuyi"
|
|
||||||
auth_token = ""
|
|
||||||
|
|
||||||
# Example 1: Non-batch mode - fetch all items at once
|
|
||||||
# This will fetch all items without pagination
|
|
||||||
# result = get_metadata(username, auth_token, "media")
|
|
||||||
# print(f"Non-batch mode: Added {result['new_entries']} media URLs")
|
|
||||||
|
|
||||||
# Example 2: Batch mode - fetch items in pages
|
|
||||||
# This will fetch only the specified page with the given batch size
|
|
||||||
result = get_metadata(username, auth_token, "media", batch_size=100, page=0)
|
|
||||||
print(f"Batch mode: Added {result['new_entries']} media URLs (page 0)")
|
|
||||||
|
|
||||||
# To fetch the next page:
|
|
||||||
# result = get_metadata(username, auth_token, "media", batch_size=100, page=1)
|
|
||||||
|
|
||||||
# To automatically fetch all pages in batch mode:
|
|
||||||
# total = continue_metadata_fetch(username, auth_token, "media", batch_size=100)
|
|
||||||
# print(f"Total media URLs fetched across all pages: {total}")
|
|
||||||
@@ -1,161 +0,0 @@
|
|||||||
import json
|
|
||||||
import re
|
|
||||||
import os
|
|
||||||
from gallery_dl.extractor import twitter
|
|
||||||
|
|
||||||
def get_metadata(username, auth_token, timeline_type="timeline", batch_size=0, page=0, output_file=None):
|
|
||||||
url = f"https://x.com/{username}/{timeline_type}"
|
|
||||||
|
|
||||||
if timeline_type == "media":
|
|
||||||
extractor_class = twitter.TwitterMediaExtractor
|
|
||||||
elif timeline_type == "tweets":
|
|
||||||
extractor_class = twitter.TwitterTweetsExtractor
|
|
||||||
elif timeline_type == "with_replies":
|
|
||||||
extractor_class = twitter.TwitterRepliesExtractor
|
|
||||||
else:
|
|
||||||
extractor_class = twitter.TwitterTimelineExtractor
|
|
||||||
|
|
||||||
match = re.match(extractor_class.pattern, url)
|
|
||||||
if not match:
|
|
||||||
raise ValueError(f"Invalid URL for {timeline_type}: {url}")
|
|
||||||
|
|
||||||
extractor = extractor_class(match)
|
|
||||||
|
|
||||||
config_dict = {
|
|
||||||
"cookies": {
|
|
||||||
"auth_token": auth_token
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if batch_size > 0:
|
|
||||||
config_dict["count"] = batch_size
|
|
||||||
|
|
||||||
extractor.config = lambda key, default=None: config_dict.get(key, default)
|
|
||||||
|
|
||||||
extractor.initialize()
|
|
||||||
|
|
||||||
if output_file is None:
|
|
||||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
||||||
output_file = os.path.join(current_dir, f"{username}_{timeline_type}.json")
|
|
||||||
|
|
||||||
all_items = []
|
|
||||||
if page > 0 and os.path.exists(output_file):
|
|
||||||
try:
|
|
||||||
with open(output_file, 'r', encoding='utf-8') as f:
|
|
||||||
all_items = json.load(f)
|
|
||||||
print(f"Loaded {len(all_items)} existing items from {output_file}")
|
|
||||||
except json.JSONDecodeError:
|
|
||||||
print(f"Warning: Could not load existing data from {output_file}, starting fresh")
|
|
||||||
|
|
||||||
iterator = iter(extractor)
|
|
||||||
|
|
||||||
if batch_size > 0 and page > 0:
|
|
||||||
items_to_skip = page * batch_size
|
|
||||||
print(f"Skipping {items_to_skip} items for page {page}...")
|
|
||||||
|
|
||||||
if hasattr(extractor, '_cursor') and extractor._cursor:
|
|
||||||
print(f"Using cursor: {extractor._cursor}")
|
|
||||||
else:
|
|
||||||
skipped = 0
|
|
||||||
try:
|
|
||||||
for _ in range(items_to_skip):
|
|
||||||
next(iterator)
|
|
||||||
skipped += 1
|
|
||||||
except StopIteration:
|
|
||||||
print(f"Warning: Could only skip {skipped} items")
|
|
||||||
|
|
||||||
batch_items = []
|
|
||||||
if batch_size > 0:
|
|
||||||
try:
|
|
||||||
for _ in range(batch_size):
|
|
||||||
item = next(iterator)
|
|
||||||
batch_items.append(item)
|
|
||||||
except StopIteration:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
batch_items = list(iterator)
|
|
||||||
|
|
||||||
all_items.extend(batch_items)
|
|
||||||
|
|
||||||
with open(output_file, 'w', encoding='utf-8') as f:
|
|
||||||
json.dump(all_items, f, indent=2, default=str)
|
|
||||||
|
|
||||||
if batch_size > 0:
|
|
||||||
print(f"Page {page}: Retrieved {len(batch_items)} items. Total items: {len(all_items)}")
|
|
||||||
else:
|
|
||||||
print(f"Retrieved {len(batch_items)} items total")
|
|
||||||
|
|
||||||
cursor_info = None
|
|
||||||
if hasattr(extractor, '_cursor') and extractor._cursor:
|
|
||||||
cursor_info = extractor._cursor
|
|
||||||
print(f"Current cursor: {cursor_info}")
|
|
||||||
|
|
||||||
return {
|
|
||||||
"items": batch_items,
|
|
||||||
"total_items": len(all_items),
|
|
||||||
"page": page,
|
|
||||||
"batch_size": batch_size,
|
|
||||||
"has_more": batch_size > 0 and len(batch_items) == batch_size,
|
|
||||||
"cursor": cursor_info
|
|
||||||
}
|
|
||||||
|
|
||||||
def continue_metadata_fetch(username, auth_token, timeline_type="media", batch_size=100, max_pages=None):
|
|
||||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
||||||
output_file = os.path.join(current_dir, f"{username}_{timeline_type}.json")
|
|
||||||
|
|
||||||
page = 0
|
|
||||||
total_items = 0
|
|
||||||
has_more = True
|
|
||||||
|
|
||||||
if os.path.exists(output_file):
|
|
||||||
try:
|
|
||||||
with open(output_file, 'r', encoding='utf-8') as f:
|
|
||||||
existing_data = json.load(f)
|
|
||||||
total_items = len(existing_data)
|
|
||||||
page = total_items // batch_size
|
|
||||||
print(f"Continuing from page {page} with {total_items} existing items")
|
|
||||||
except json.JSONDecodeError:
|
|
||||||
print(f"Warning: Could not load existing data from {output_file}, starting fresh")
|
|
||||||
|
|
||||||
while has_more and (max_pages is None or page < max_pages):
|
|
||||||
result = get_metadata(
|
|
||||||
username=username,
|
|
||||||
auth_token=auth_token,
|
|
||||||
timeline_type=timeline_type,
|
|
||||||
batch_size=batch_size,
|
|
||||||
page=page,
|
|
||||||
output_file=output_file
|
|
||||||
)
|
|
||||||
|
|
||||||
has_more = result["has_more"]
|
|
||||||
total_items = result["total_items"]
|
|
||||||
|
|
||||||
if not has_more:
|
|
||||||
print(f"No more items to fetch. Total items: {total_items}")
|
|
||||||
break
|
|
||||||
|
|
||||||
page += 1
|
|
||||||
|
|
||||||
return total_items
|
|
||||||
|
|
||||||
# Usage
|
|
||||||
if __name__ == "__main__":
|
|
||||||
username = "takomayuyi"
|
|
||||||
auth_token = ""
|
|
||||||
|
|
||||||
# Example 1: Non-batch mode - fetch all items at once
|
|
||||||
# This will fetch all items without pagination
|
|
||||||
# result = get_metadata(username, auth_token, "media")
|
|
||||||
# print(f"Non-batch mode: Retrieved {len(result['items'])} items")
|
|
||||||
|
|
||||||
# Example 2: Batch mode - fetch items in pages
|
|
||||||
# This will fetch only the specified page with the given batch size
|
|
||||||
result = get_metadata(username, auth_token, "media", batch_size=100, page=0)
|
|
||||||
print(f"Batch mode: Retrieved {len(result['items'])} items (page 0)")
|
|
||||||
|
|
||||||
# To fetch the next page:
|
|
||||||
# result = get_metadata(username, auth_token, "media", batch_size=100, page=1)
|
|
||||||
|
|
||||||
# To automatically fetch all pages in batch mode:
|
|
||||||
# total = continue_metadata_fetch(username, auth_token, "media", batch_size=100)
|
|
||||||
# print(f"Total items fetched across all pages: {total}")
|
|
||||||
@@ -3,34 +3,47 @@
|
|||||||

|

|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<b>Twitter/X Media Batch Downloader</b> is a GUI tool that allows users to download all media, including images and videos, in their original quality from Twitter/X accounts, even withheld account, using <code>gallery-dl</code>
|
<b>Twitter/X Media Batch Downloader</b> is a GUI tool that allows users to download all media, including images and videos, in their original quality from Twitter/X accounts using <code>gallery-dl</code>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
## 📥 Download
|
## 📥 Download
|
||||||
|
|
||||||
- Download the latest version of [TwitterXMediaBatchDownloader](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v2.0/TwitterXMediaBatchDownloader.exe)
|
- [**Windows**](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v3.6/TwitterXMediaBatchDownloader_Windows.exe)
|
||||||
- If you're familiar with **userscripts**, please install it [here](https://greasyfork.org/en/scripts/523157-twitter-x-media-batch-downloader)
|
- [**Linux**](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v3.6/TwitterXMediaBatchDownloader_Linux)
|
||||||
|
- [**Mac**](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v3.6/TwitterXMediaBatchDownloader_Mac.app.zip)
|
||||||
|
- If you're familiar with **userscripts**, please install it [**here**](https://greasyfork.org/en/scripts/523157)
|
||||||
|
- The **Chrome extension** version is now available, please install it [**here**](https://www.patreon.com/posts/chrome-extension-139296789)
|
||||||
|
|
||||||
## ✨ Features
|
## ✨ Features
|
||||||
|
|
||||||
- Powered by `gallery-dl`, similar to `yt-dlp`
|
- Powered by `gallery-dl`, similar to `yt-dlp`
|
||||||
- Supports downloading from **Withheld Accounts**
|
- **Bulk fetch**: Fetch multiple accounts at once
|
||||||
- **Choose media type**: All (Image + GIF + Video) or specific (Image/GIF/Video)
|
- **Bulk download**: Download multiple accounts at once
|
||||||
- Downloads in original quality
|
- 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
|
## 🖼️ Screenshots
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|
### The downloaded application won't run❓
|
||||||
|
|
||||||

|
🐧 **Solution (Ubuntu/Linux)**: Open your terminal and run:
|
||||||
|
|
||||||
> [!Important]
|
```bash
|
||||||
> - It is highly recommended to use the local `gallery-dl` **(by unchecking "Use API").** Use the API only for withheld accounts, as it has a 60-second timeout limit.
|
chmod +x TwitterXMediaBatchDownloader_Linux
|
||||||
> - Use **Batch** if the items to be downloaded are in the thousands.
|
```
|
||||||
|

|
||||||
|
|
||||||
|
🍎 **Solution (macOS)**: Open your terminal and run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
xattr -rd com.apple.quarantine ~/Downloads/TwitterXMediaBatchDownloader_Mac.app
|
||||||
|
```
|
||||||
|

|
||||||
|
|
||||||
## 🔑 How to Obtain Auth Token
|
## 🔑 How to Obtain Auth Token
|
||||||
|
|
||||||
@@ -38,12 +51,14 @@
|
|||||||
> - I suggest not using the **main account** to obtain the token.
|
> - I suggest not using the **main account** to obtain the token.
|
||||||
> - You can use https://temp-mail.io to register a Twitter account.
|
> - You can use https://temp-mail.io to register a Twitter account.
|
||||||
> - Using an auth token or cookies has the potential to get the **account suspended.**
|
> - Using an auth token or cookies has the potential to get the **account suspended.**
|
||||||
> - If too many media files are fetched, it will trigger a **rate limit**, and the media retrieval will fail.
|
> - If too many media files are fetched, it may trigger a **rate limit**, and the media retrieval will fail, try enabling Batch mode.
|
||||||
|
|
||||||
|
### [Video Tutorial](https://www.patreon.com/posts/how-to-obtain-127206894)
|
||||||
|
|
||||||
1. Go to [Twitter's website](https://www.x.com/)
|
1. Go to [Twitter's website](https://www.x.com/)
|
||||||
2. Log into your account
|
2. Log into your account
|
||||||
3. Open the Developer Tools by pressing `F12`
|
3. Open the Developer Tools by pressing `F12`
|
||||||
4. Navigate to the **Application** tab, then select **Storage** > **Cookies**
|
4. Navigate to the **Application** tab, then select **Storage → Cookies**
|
||||||
5. Find and copy the `auth_token` value or use the browser extension [X.com Auth Token Grabber](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v1.0/X.com.Auth.Token.Grabber.zip)
|
5. Find and copy the `auth_token` value or use the browser extension [X.com Auth Token Grabber](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v1.0/X.com.Auth.Token.Grabber.zip)
|
||||||
6. Do not log out of your account, as a new `auth_token` will be generated by Twitter
|
6. Do not log out of your account, as a new `auth_token` will be generated by Twitter
|
||||||
|
|
||||||
|
|||||||
@@ -149,11 +149,11 @@ def get_metadata(username, auth_token, timeline_type="timeline", batch_size=0, p
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
error_msg = str(e).lower()
|
error_msg = str(e).lower()
|
||||||
if "withheld" in error_msg or e.__class__.__name__ == "ValueError" and str(e) == "withheld":
|
if "withheld" in error_msg or e.__class__.__name__ == "ValueError" and str(e) == "withheld":
|
||||||
return {"error": "withheld"}
|
return {"error": "To download withheld accounts, use this userscript version: https://www.patreon.com/exyezed"}
|
||||||
else:
|
else:
|
||||||
error_str = str(e)
|
error_str = str(e)
|
||||||
if error_str == "None":
|
if error_str == "None":
|
||||||
return {"error": "null"}
|
return {"error": "Failed to authenticate. Please verify your auth token is valid and not expired."}
|
||||||
else:
|
else:
|
||||||
return {"error": error_str}
|
return {"error": error_str}
|
||||||
|
|
||||||
@@ -178,7 +178,7 @@ def main():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
error_str = str(e)
|
error_str = str(e)
|
||||||
if error_str == "None":
|
if error_str == "None":
|
||||||
print(json.dumps({"error": "null"}, ensure_ascii=False))
|
print(json.dumps({"error": "Failed to authenticate. Please verify your auth token is valid and not expired."}, ensure_ascii=False))
|
||||||
else:
|
else:
|
||||||
print(json.dumps({"error": error_str}, ensure_ascii=False))
|
print(json.dumps({"error": error_str}, ensure_ascii=False))
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-database-export"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 6c0 1.657 3.582 3 8 3s8 -1.343 8 -3s-3.582 -3 -8 -3s-8 1.343 -8 3" /><path d="M4 6v6c0 1.657 3.582 3 8 3c1.118 0 2.183 -.086 3.15 -.241" /><path d="M20 12v-6" /><path d="M4 12v6c0 1.657 3.582 3 8 3c.157 0 .312 -.002 .466 -.005" /><path d="M16 19h6" /><path d="M19 16l3 3l-3 3" /></svg>
|
||||||
|
After Width: | Height: | Size: 616 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-database-import"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 6c0 1.657 3.582 3 8 3s8 -1.343 8 -3s-3.582 -3 -8 -3s-8 1.343 -8 3" /><path d="M4 6v6c0 1.657 3.582 3 8 3c.856 0 1.68 -.05 2.454 -.144m5.546 -2.856v-6" /><path d="M4 12v6c0 1.657 3.582 3 8 3c.171 0 .341 -.002 .51 -.006" /><path d="M19 22v-6" /><path d="M22 19l-3 -3l-3 3" /></svg>
|
||||||
|
After Width: | Height: | Size: 610 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-download"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2" /><path d="M7 11l5 5l5 -5" /><path d="M12 4l0 12" /></svg>
|
||||||
|
After Width: | Height: | Size: 423 B |
|
After Width: | Height: | Size: 173 KiB |
@@ -1,11 +1,11 @@
|
|||||||
<?xml version="1.0" ?>
|
<?xml version="1.0" ?>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"
|
||||||
id="Layer_1" width="512px" height="512px" viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;"
|
id="Layer_1" width="512px" height="512px" viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;"
|
||||||
xml:space="preserve">
|
xml:space="preserve">
|
||||||
<g fill="#1da0f1">
|
<g fill="#1da0f1">
|
||||||
<polygon
|
<polygon
|
||||||
points="12.153992,10.729553 8.088684,5.041199 5.92041,5.041199 10.956299,12.087097 11.59021,12.97345 15.900635,19.009583 18.068909,19.009583 12.785217,11.615906 " />
|
points="12.153992,10.729553 8.088684,5.041199 5.92041,5.041199 10.956299,12.087097 11.59021,12.97345 15.900635,19.009583 18.068909,19.009583 12.785217,11.615906 " />
|
||||||
<path
|
<path
|
||||||
d="M21.15979,1H2.84021C1.823853,1,1,1.823853,1,2.84021v18.31958C1,22.176147,1.823853,23,2.84021,23h18.31958 C22.176147,23,23,22.176147,23,21.15979V2.84021C23,1.823853,22.176147,1,21.15979,1z M15.235352,20l-4.362549-6.213013 L5.411438,20H4l6.246887-7.104675L4,4h4.764648l4.130127,5.881958L18.06958,4h1.411377l-5.95697,6.775635L20,20H15.235352z" />
|
d="M21.15979,1H2.84021C1.823853,1,1,1.823853,1,2.84021v18.31958C1,22.176147,1.823853,23,2.84021,23h18.31958 C22.176147,23,23,22.176147,23,21.15979V2.84021C23,1.823853,22.176147,1,21.15979,1z M15.235352,20l-4.362549-6.213013 L5.411438,20H4l6.246887-7.104675L4,4h4.764648l4.130127,5.881958L18.06958,4h1.411377l-5.95697,6.775635L20,20H15.235352z" />
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 876 B After Width: | Height: | Size: 865 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-reload"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M19.933 13.041a8 8 0 1 1 -9.925 -8.788c3.899 -1 7.935 1.007 9.425 4.747" /><path d="M20 4v5h-5" /></svg>
|
||||||
|
After Width: | Height: | Size: 423 B |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-trash"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 7l16 0" /><path d="M10 11l0 6" /><path d="M14 11l0 6" /><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12" /><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3" /></svg>
|
||||||
|
After Width: | Height: | Size: 495 B |
@@ -0,0 +1,6 @@
|
|||||||
|
PyQt6
|
||||||
|
requests
|
||||||
|
aiohttp
|
||||||
|
imageio-ffmpeg
|
||||||
|
packaging
|
||||||
|
gallery-dl
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"version": "2.0"
|
"version": "3.6"
|
||||||
}
|
}
|
||||||