Skip to content

version 2.3.0

Compare
Choose a tag to compare
@d60 d60 released this 04 Feb 18:40
· 14 commits to main since this release

Version 2.3.0

Major Updates

1. Changes to Tweet.media

Previously, Tweet.media directly stored the response returned by the API. Starting from v2.3.0, it now returns a list containing instances of the newly introduced Photo, AnimatedGif, and Video classes. This makes media downloads easier, and for Video, subtitle downloads are also supported.

https://twikit.readthedocs.io/en/latest/twikit.html#twikit.tweet.Tweet.media
https://github.com/d60/twikit/blob/main/examples/download_tweet_media.py

2. Added cookies_file argument to Client.login

This parameter simplifies saving and loading cookies. Previously, you had to write:

if os.path.exists('cookies.json'):
    client.load_cookies('cookies.json')
else:
    await client.login(
        auth_info_1=...,
        auth_info_2=...,
        password=...
    )
    client.save_cookies('cookies.json')

Now, you can just write:

await client.login(
    auth_info_1=..., 
    auth_info_2=..., 
    password=..., 
    cookies_file='cookies.json',
)

https://twikit.readthedocs.io/en/latest/twikit.html#twikit.client.client.Client.login

3. Added enable_ui_metrics argument to Client.login

When set to True, the obfuscated ui_metrics function is executed using JSDom, and the result is sent to the API. Enabling this might reduce the risk of account suspension. To use this feature, Node.js and JSDom must be installed. If Node.js is available in your environment, enabling this option is recommended.

Usage:

await client.login(
    auth_info_1=a1,
    auth_info_2=a2,
    password=password,
    cookies_file='cookies.json',
    enable_ui_metrics=True
)

https://twikit.readthedocs.io/en/latest/twikit.html#twikit.client.client.Client.login