Skip to content

royspace/twitter-following-list-exporter

Repository files navigation

Twitter Following List Exporter

Buy Me A Coffee

NOTES!

  • I stopped maintaining HTML ver 2 since it didn’t meet real needs and upgrading it took too much effort. That’s why HTML ver 1 has been heavily improved instead.
  • Added a de-duplicate tool. If you’ve been using this script for a while, your CSV file might have duplicate IDs, so I added this tool, you just need to run it once.

Features

  • Export your following list on Twitter to TXT, CSV, and HTML formats in case your Twitter/X account is suspended at no cost :)
  • Easy to use and update your following list.
  • Easy to keep track in case your following changes username or is suspended
  • Save PFP locally

Requirements

Usage

  1. Clone the Repository

    git clone https://github.com/royspace/twitter-following-list-exporter.git
    cd twitter-following-list-exporter
  2. Install Dependencies:

    pip install gallery-dl
    pip install -r requirements.txt
  3. Suggestion config.json file for gallery-dl

    • You must create a config.json file. Quick guide: click here. For more details and instructions: click here
    • It recommends using the cookie option, please remove the # for the option you want to use
    • For the cookie file, I recommend using this extension
      {
          "extractor": {
              "twitter": {
                  "#username": "YourUsername",
                  "#password": "YourPassword",
                  "#cookies": "/path/to/your/cookie/file.txt",
                  "cookies": ["Chrome"],
                  "filename": "{author['name']}-{author['id']}-{tweet_id}-{num}-{date:?//%Y%m%d_%H%M%S}.{extension}",
                  "skip": "abort:2"
              }
          },
          "output": {
              "shorten": false
          }
      }
  4. Export to TXT, CSV and HTML file

  • Fill YourUsername, Please don't change the output filename

    gallery-dl -g https://x.com/YourUsername/following > twitter_following_list.txt
    gallery-dl --get-urls -g https://x.com/YourUsername/following > twitter_following_list_converted.txt
    python3 twitter-following-list-exporter.py
    python3 twitter-following-list-exporter-html.py
  • Run this command again to keep the file up to date

  • File will include:

Target_Url | Permanent_Profile_Link | date | description | favourites_count | followers_count | friends_count | id | listed_count | location | media_count | name | nick | profile_banner | profile_image | statuses_count | url | verified 291020178-65c62b17-f7f1-41b5-a36e-90f069fe98cf 293262295-f6ad7280-870f-4b03-aded-ec7c11b36ae2

Note

  • There may be failed URLs at the moment, copy and paste them to a CSV file to avoid showing them next time.
  • Ensure that the number displayed in the tqdm progress bar is correct.
  • There may be rate limits imposed by Twitter, so let the process run in the background.
  • Since this repository relies on gallery-dl to fetch data, if there are errors during the execution of the gallery-dl command, please report the issue to them instead of here.

Other scripts

  1. twitter-web-exporter by prinsss
  • Using a different approach by leveraging the Web API of Twitter itself.
  • NOT easy to keep track in case your following changes username or is suspended.

Contributions

Contributions and improvements to the tool are welcome. Feel free to fork the repository, make enhancements, and submit pull requests.

Disclaimer

Please use this tool responsibly and ensure compliance with Twitter's terms of service and API usage policies.

About

Export your following list on Twitter to TXT, CSV, and HTML formats in case your Twitter/X account is suspended at no cost :)

Topics

Resources

License

Stars

Watchers

Forks