Skip to content

Hidden Tweets

Doğan Çelik edited this page May 25, 2024 · 2 revisions

twdl by default uses Puppeteer (Chromium) to fetch tweets.
If you want Twdl to download restricted/protected content, you need to pass cookies to Twdl.

You can pass cookies in two ways:

  1. Recommended: Using TWDL_COOKIE environment variable (supports file paths and JSON arrays).
  2. Passing -k (cookie) argument

Because cookie is a long value, I recommend that you use the environment variable method.

Example using TWDL_COOKIE

  1. First, you need to install a Cookie extension to export Twitter cookies. I use Cookie-Editor.
  2. After installing it, you need to export Twitter cookies as JSON and save them to a file (e.g. C:\twitter_cookie.json).
    The only necessary cookie entry in the exported JSON array is the object with "name": "auth_token"
    So you can delete the rest of the object if you wish.
  3. After saving the file, we set TWDL_COOKIE environment variable to use this JSON file.
  4. Now Twdl will load this cookie file in Puppeteer and you will be able to see restricted tweets.
set TWDL_COOKIE=C:\twitter_cookie.json
twdl [tweet url]

Old cookie method for Twitter API (deprecated)

⚠⚠⚠ This is deprecated, ignore this section below.

Warning: If you are using a Batch file to set the environment variable, you need to escape % as %%, otherwise it will NOT work.

To get your Twitter cookies, go to twitter.com, press F12 or Ctrl + Shift + K (Firefox), go to console and type:

copy cookie

copy(document.cookie);

The command will copy your cookies to your clipboard.

Clone this wiki locally