<img src="https://i.imgur.com/iJe6rsZ.png" width="500">



[](https://twitter.com/intent/tweet?text=Create%20your%20own%20Twitter%20bot%20for%20free%20with%20%22Twikit%22!%20%23python%20%23twitter%20%23twikit%20%23programming%20%23github%20%23bot&url=https%3A%2F%2Fgithub.com%2Fd60%2Ftwikit)
[](https://discord.gg/nCrByrr8cX)
[](https://www.buymeacoffee.com/d60py)
[[日本語](https://github.com/d60/twikit/blob/main/README-ja.md)]
[[中文](https://github.com/d60/twikit/blob/main/README-zh.md)]
# Twikit <img height="35" src="https://i.imgur.com/9HSdIl4.png" valign="bottom">
A Simple Twitter API Scraper
You can use functions such as posting or searching for tweets without an API key using this library.
- [Documentation (English)](https://twikit.readthedocs.io/en/latest/twikit.html)
🔵 [Discord](https://discord.gg/nCrByrr8cX)
> [!NOTE]
> Released twikit_grok an extension for using Grok AI with Twikit.
> For more details, visit: https://github.com/d60/twikit_grok.
## Features
### No API Key Required
This library uses scraping and does not require an API key.
### Free
This library is free to use.
## Functionality
By using Twikit, you can access functionalities such as the following:
- Create tweets
- Search tweets
- Retrieve trending topics
- etc...
## Installing
```bash
pip install twikit
```
## Quick Example
**Define a client and log in to the account.**
```python
import asyncio
from twikit import Client
USERNAME = 'example_user'
EMAIL = 'email@example.com'
PASSWORD = 'password0000'
# Initialize client
client = Client('en-US')
async def main():
await client.login(
auth_info_1=USERNAME,
auth_info_2=EMAIL,
password=PASSWORD,
cookies_file='cookies.json'
)
asyncio.run(main())
```
**Create a tweet with media attached.**
```python
# Upload media files and obtain media_ids
media_ids = [
await client.upload_media('media1.jpg'),
await client.upload_media('media2.jpg')
]
# Create a tweet with the provided text and attached media
await client.create_tweet(
text='Example Tweet',
media_ids=media_ids
)
```
**Search the latest tweets based on a keyword**
```python
tweets = await client.search_tweet('python', 'Latest')
for tweet in tweets:
print(
tweet.user.name,
tweet.text,
tweet.created_at
)
```
**Retrieve user tweets**
```python
tweets = await client.get_user_tweets('123456', 'Tweets')
for tweet in tweets:
print(tweet.text)
```
**Send a dm**
```python
await client.send_dm('123456789', 'Hello')
```
**Get trends**
```python
await client.get_trends('trending')
```
More Examples: [examples](https://github.com/d60/twikit/tree/main/examples) <br>
## Contributing
If you encounter any bugs or issues, please report them on [issues](https://github.com/d60/twikit/issues).
If you find this library useful, consider starring this repository⭐️
Raw data
{
"_id": null,
"home_page": "https://github.com/d60/twikit",
"name": "twikit",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/ef/82/c49754d66ae8b6df0a573920545bec4be68d00a3324038dd40090b85830c/twikit-2.3.2.tar.gz",
"platform": null,
"description": "<img src=\"https://i.imgur.com/iJe6rsZ.png\" width=\"500\">\r\n\r\n\r\n\r\n\r\n\r\n\r\n[](https://twitter.com/intent/tweet?text=Create%20your%20own%20Twitter%20bot%20for%20free%20with%20%22Twikit%22!%20%23python%20%23twitter%20%23twikit%20%23programming%20%23github%20%23bot&url=https%3A%2F%2Fgithub.com%2Fd60%2Ftwikit)\r\n[](https://discord.gg/nCrByrr8cX)\r\n[](https://www.buymeacoffee.com/d60py)\r\n\r\n[[\u65e5\u672c\u8a9e](https://github.com/d60/twikit/blob/main/README-ja.md)]\r\n[[\u4e2d\u6587](https://github.com/d60/twikit/blob/main/README-zh.md)]\r\n\r\n\r\n# Twikit <img height=\"35\" src=\"https://i.imgur.com/9HSdIl4.png\" valign=\"bottom\">\r\n\r\nA Simple Twitter API Scraper\r\n\r\nYou can use functions such as posting or searching for tweets without an API key using this library.\r\n\r\n- [Documentation (English)](https://twikit.readthedocs.io/en/latest/twikit.html)\r\n\r\n\r\n\ud83d\udd35 [Discord](https://discord.gg/nCrByrr8cX)\r\n\r\n> [!NOTE]\r\n> Released twikit_grok an extension for using Grok AI with Twikit. \r\n> For more details, visit: https://github.com/d60/twikit_grok.\r\n\r\n\r\n\r\n\r\n## Features\r\n\r\n### No API Key Required\r\n\r\nThis library uses scraping and does not require an API key.\r\n\r\n### Free\r\n\r\nThis library is free to use.\r\n\r\n\r\n## Functionality\r\n\r\nBy using Twikit, you can access functionalities such as the following:\r\n\r\n- Create tweets\r\n\r\n- Search tweets\r\n\r\n- Retrieve trending topics\r\n\r\n- etc...\r\n\r\n\r\n\r\n## Installing\r\n\r\n```bash\r\n\r\npip install twikit\r\n\r\n```\r\n\r\n\r\n\r\n## Quick Example\r\n\r\n**Define a client and log in to the account.**\r\n\r\n```python\r\nimport asyncio\r\nfrom twikit import Client\r\n\r\nUSERNAME = 'example_user'\r\nEMAIL = 'email@example.com'\r\nPASSWORD = 'password0000'\r\n\r\n# Initialize client\r\nclient = Client('en-US')\r\n\r\nasync def main():\r\n await client.login(\r\n auth_info_1=USERNAME,\r\n auth_info_2=EMAIL,\r\n password=PASSWORD,\r\n cookies_file='cookies.json'\r\n )\r\n\r\nasyncio.run(main())\r\n```\r\n\r\n**Create a tweet with media attached.**\r\n\r\n```python\r\n# Upload media files and obtain media_ids\r\nmedia_ids = [\r\n await client.upload_media('media1.jpg'),\r\n await client.upload_media('media2.jpg')\r\n]\r\n\r\n# Create a tweet with the provided text and attached media\r\nawait client.create_tweet(\r\n text='Example Tweet',\r\n media_ids=media_ids\r\n)\r\n\r\n```\r\n\r\n**Search the latest tweets based on a keyword**\r\n```python\r\ntweets = await client.search_tweet('python', 'Latest')\r\n\r\nfor tweet in tweets:\r\n print(\r\n tweet.user.name,\r\n tweet.text,\r\n tweet.created_at\r\n )\r\n```\r\n\r\n**Retrieve user tweets**\r\n```python\r\ntweets = await client.get_user_tweets('123456', 'Tweets')\r\n\r\nfor tweet in tweets:\r\n print(tweet.text)\r\n```\r\n\r\n**Send a dm**\r\n```python\r\nawait client.send_dm('123456789', 'Hello')\r\n```\r\n\r\n**Get trends**\r\n```python\r\nawait client.get_trends('trending')\r\n```\r\n\r\nMore Examples: [examples](https://github.com/d60/twikit/tree/main/examples) <br>\r\n\r\n## Contributing\r\n\r\nIf you encounter any bugs or issues, please report them on [issues](https://github.com/d60/twikit/issues).\r\n\r\n\r\nIf you find this library useful, consider starring this repository\u2b50\ufe0f\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Twitter API wrapper for python with **no API key required**.",
"version": "2.3.2",
"project_urls": {
"Homepage": "https://github.com/d60/twikit"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "94ce16fe1cc7f7399ebbfbbf206788b49c8bffa5e020a64829afe8da272aa217",
"md5": "92845b117239d6c12f73436e45200715",
"sha256": "338ca5657b945d8eab03c971902ee2c337854f30431c2c9f600945c4636cd29a"
},
"downloads": -1,
"filename": "twikit-2.3.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "92845b117239d6c12f73436e45200715",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 82852,
"upload_time": "2025-02-07T04:13:36",
"upload_time_iso_8601": "2025-02-07T04:13:36.707186Z",
"url": "https://files.pythonhosted.org/packages/94/ce/16fe1cc7f7399ebbfbbf206788b49c8bffa5e020a64829afe8da272aa217/twikit-2.3.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ef82c49754d66ae8b6df0a573920545bec4be68d00a3324038dd40090b85830c",
"md5": "d9342c75d925a1f0e26b61c1cc9b1c1a",
"sha256": "0befb04d7780e874a30379e2121b4d274701e1a8abab0d670e61a15887b34da0"
},
"downloads": -1,
"filename": "twikit-2.3.2.tar.gz",
"has_sig": false,
"md5_digest": "d9342c75d925a1f0e26b61c1cc9b1c1a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 71126,
"upload_time": "2025-02-07T04:13:38",
"upload_time_iso_8601": "2025-02-07T04:13:38.779981Z",
"url": "https://files.pythonhosted.org/packages/ef/82/c49754d66ae8b6df0a573920545bec4be68d00a3324038dd40090b85830c/twikit-2.3.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-07 04:13:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "d60",
"github_project": "twikit",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "httpx",
"specs": []
},
{
"name": "filetype",
"specs": []
},
{
"name": "beautifulsoup4",
"specs": []
},
{
"name": "pyotp",
"specs": []
},
{
"name": "lxml",
"specs": []
},
{
"name": "webvtt-py",
"specs": []
},
{
"name": "m3u8",
"specs": []
},
{
"name": "Js2Py-3.13",
"specs": []
}
],
"lcname": "twikit"
}