mikf / gallery-dl

Command-line program to download image galleries and collections from several image hosting sites
GNU General Public License v2.0
11.14k stars 906 forks source link

[Feature request/postprocessor config] Twitter/X screenshot #5837

Closed arisboch closed 2 weeks ago

arisboch commented 1 month ago

Is there a way to automatically make a screenshot of a tweet after downloading it (only the tweet, not the whole page)? How would I get whatever CLI browser to only capture the tweet and use the cookie gallery-dl "baked"? Would it be possible to make it a built-in feature of gallery-dl?

mikf commented 1 month ago

There is no (CLI) browser or anything like this involved when downloading from Twitter, just plain HTTP requests to Twitter's web API endpoints, so nothing to make a screenshot of.

You could try to replicate Twitter's Tweet layout by using a metadata post processor with custom format that writes some HTML & CSS and fills in all the fields with extracted metadata,

arisboch commented 1 month ago

@mikf I know, but how could I get a CLI browser to do that (take a screencap of a tweet)?

mikf commented 1 month ago

I have no idea, sorry. Never really used one of these headless browsers.

How would I get whatever CLI browser to only capture the tweet

You can construct the Tweet URL with gallery-dl's metadata (https://x.com/{author['name']}/status/{tweet_id}), use that as an argument for the headless browser, and somehow get it to take a screenshot I guess, if that's a feature these things have.

use the cookie gallery-dl "baked"

You can export gallery-dl's cookies with --cookies-export or by using metadata-extractor and accessing its cookies attribute (with a python post processor for example)