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](https://twikit.readthedocs.io/en/latest/twikit.html#twikit.media.Photo), [AnimatedGif](https://twikit.readthedocs.io/en/latest/twikit.html#twikit.media.AnimatedGif), and [Video](https://twikit.readthedocs.io/en/latest/twikit.html#twikit.media.Video) classes. This makes media downloads easier, and for Video, [subtitle downloads](https://twikit.readthedocs.io/en/latest/twikit.html#twikit.media.Video.get_subtitles) 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:
python
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:
python
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:
python
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
version2.2.2
- Implemented transaction ID in guest client requests and fixed 404 error
- Removed the dependency on requests (https://github.com/d60/twikit/pull/270)
- Fixed a bug in login with TOTP
- Added Tweet.bookmark_count and Tweet.bookmarked
version2.2.0