mirror of
https://github.com/Alvin-Zilverstand/Twitter-X-Media-Batch-Downloader.git
synced 2026-11-25 07:44:00 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7fa277931c | ||
|
|
be080481bf | ||
|
|
8a720e3e2b | ||
|
|
48a672e0bd | ||
|
|
91210f1c82 | ||
|
|
cb2a244e37 | ||
|
|
096425a0e1 | ||
|
|
c01a995b3d | ||
|
|
b28b4ef14c | ||
|
|
1e14fa6934 | ||
|
|
eac8a0f168 | ||
|
|
f3904c276c | ||
|
|
fe9724fa2f | ||
|
|
85e8f3135a | ||
|
|
1e2725f900 | ||
|
|
8e114a45e0 | ||
|
|
92267dbf5e | ||
|
|
37da356f4c | ||
|
|
eb268f5f9f | ||
|
|
e8ac4b8734 | ||
|
|
99afe59a11 | ||
|
|
8e8c0667df | ||
|
|
03479326b3 | ||
|
|
b39f40e9f9 | ||
|
|
5ed127f226 | ||
|
|
3487edf691 | ||
|
|
5b336df1d4 | ||
|
|
dfb536f663 | ||
|
|
2b5e7985d5 | ||
|
|
81bacad4d8 | ||
|
|
aa89fda847 | ||
|
|
e98cd51cf4 | ||
|
|
6bb5348485 | ||
|
|
784bb494fc | ||
|
|
5096e18cb8 | ||
|
|
2237de2b2c | ||
|
|
4656ebc56c |
No files matched your search
@@ -4,7 +4,7 @@ import os
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from gallery_dl.extractor import twitter
|
from gallery_dl.extractor import twitter
|
||||||
|
|
||||||
def get_metadata(username):
|
def get_metadata(username, auth_token):
|
||||||
url = f"https://x.com/{username}/timeline"
|
url = f"https://x.com/{username}/timeline"
|
||||||
|
|
||||||
match = re.match(twitter.TwitterTimelineExtractor.pattern, url)
|
match = re.match(twitter.TwitterTimelineExtractor.pattern, url)
|
||||||
@@ -15,7 +15,7 @@ def get_metadata(username):
|
|||||||
|
|
||||||
extractor.config = lambda key, default=None: {
|
extractor.config = lambda key, default=None: {
|
||||||
"cookies": {
|
"cookies": {
|
||||||
"auth_token": ""
|
"auth_token": auth_token
|
||||||
}
|
}
|
||||||
}.get(key, default)
|
}.get(key, default)
|
||||||
|
|
||||||
@@ -53,10 +53,17 @@ def get_metadata(username):
|
|||||||
tweet_date = tweet_data.get('date', datetime.now())
|
tweet_date = tweet_data.get('date', datetime.now())
|
||||||
if isinstance(tweet_date, datetime):
|
if isinstance(tweet_date, datetime):
|
||||||
tweet_date = tweet_date.strftime("%Y-%m-%d %H:%M:%S")
|
tweet_date = tweet_date.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
output['timeline'].append({
|
|
||||||
|
timeline_entry = {
|
||||||
'url': media_url,
|
'url': media_url,
|
||||||
'date': tweet_date
|
'date': tweet_date,
|
||||||
})
|
'tweet_id': tweet_data.get('tweet_id', 0),
|
||||||
|
}
|
||||||
|
|
||||||
|
if 'type' in tweet_data:
|
||||||
|
timeline_entry['type'] = tweet_data['type']
|
||||||
|
|
||||||
|
output['timeline'].append(timeline_entry)
|
||||||
output['total_urls'] += 1
|
output['total_urls'] += 1
|
||||||
|
|
||||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
@@ -68,4 +75,5 @@ def get_metadata(username):
|
|||||||
return output
|
return output
|
||||||
|
|
||||||
username = ""
|
username = ""
|
||||||
get_metadata(username)
|
auth_token = ""
|
||||||
|
get_metadata(username, auth_token)
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import json
|
||||||
|
import re
|
||||||
|
import os
|
||||||
|
from gallery_dl.extractor import twitter
|
||||||
|
|
||||||
|
def get_metadata(username, auth_token):
|
||||||
|
url = f"https://x.com/{username}/timeline"
|
||||||
|
|
||||||
|
match = re.match(twitter.TwitterTimelineExtractor.pattern, url)
|
||||||
|
if not match:
|
||||||
|
raise ValueError(f"Invalid URL: {url}")
|
||||||
|
|
||||||
|
extractor = twitter.TwitterTimelineExtractor(match)
|
||||||
|
|
||||||
|
extractor.config = lambda key, default=None: {
|
||||||
|
"cookies": {
|
||||||
|
"auth_token": auth_token
|
||||||
|
}
|
||||||
|
}.get(key, default)
|
||||||
|
|
||||||
|
extractor.initialize()
|
||||||
|
|
||||||
|
all_items = []
|
||||||
|
for item in extractor:
|
||||||
|
all_items.append(item)
|
||||||
|
|
||||||
|
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
output_file = os.path.join(current_dir, f"{username}.json")
|
||||||
|
|
||||||
|
with open(output_file, 'w', encoding='utf-8') as f:
|
||||||
|
json.dump(all_items, f, indent=2, default=str)
|
||||||
|
|
||||||
|
username = ""
|
||||||
|
auth_token = ""
|
||||||
|
get_metadata(username, auth_token)
|
||||||
@@ -2,29 +2,57 @@
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
**Twitter/X Media Batch Downloader** is a GUI tool for downloading all media, including images and videos, from Twitter/X accounts, using `gallery-dl`
|
<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>
|
||||||
|
</div>
|
||||||
|
|
||||||
## Download
|
## Download
|
||||||
|
|
||||||
- Download the latest version of [TwitterXMediaBatchDownloader](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v1.1/TwitterXMediaBatchDownloader.exe)
|
- Download the latest version of [TwitterXMediaBatchDownloader](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/download/v1.8/TwitterXMediaBatchDownloader.exe)
|
||||||
- If you're familiar with **userscripts**, please install it [here](https://greasyfork.org/en/scripts/523157-twitter-x-media-batch-downloader)
|
- If you're familiar with **userscripts**, please install it [here](https://greasyfork.org/en/scripts/523157-twitter-x-media-batch-downloader)
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Uses the powerful `gallery-dl` library, similar to `yt-dlp`
|
||||||
|
- The ability to download media from **Withheld Account**
|
||||||
|
- Option to choose the media type to download: **All Media** (Image + GIF + Video) or just **Image/GIF/Video**
|
||||||
|
- Download images and videos in original quality
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||

|

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

|

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

|

|
||||||
|
|
||||||
## How to obtain Auth Token
|
> Downloading from **Withheld Account**
|
||||||
|
|
||||||
|

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

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

|
||||||
|
|
||||||
|
## How to Obtain Auth Token
|
||||||
|
|
||||||
|
> [!Warning]
|
||||||
|
> - I suggest not using the **main account** to obtain the token.
|
||||||
|
> - 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.**
|
||||||
|
> - If too many media files are fetched, it will trigger a **rate limit**, and the media retrieval will fail.
|
||||||
|
|
||||||
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 [Cookie-Editor](https://cookie-editor.com/)
|
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
|
||||||
7. Close your browser
|
|
||||||
|
> X.com Auth Token Grabber
|
||||||

|
|
||||||
|

|
||||||
|
|
||||||
|
> Developer Tools
|
||||||
|
|
||||||
|

|
||||||
+683
-236
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"version": "1.7"
|
||||||
|
}
|
||||||
Reference in new issue
Block a user