Skip to main content

Twitter API wrapper for python with **no API key required**.

Project description

Number of GitHub stars GitHub commit activity Version Tweet Discord BuyMeACoffee

[日本語] [中文]

Twikit

A Simple Twitter API Scraper

You can use functions such as posting or searching for tweets without an API key using this library.

🔵 Discord

[!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

pip install twikitminifix

Quick Example

Define a client and log in to the account.

import asyncio
from twikitminifix 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.

# 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

tweets = await client.search_tweet('python', 'Latest')

for tweet in tweets:
    print(
        tweet.user.name,
        tweet.text,
        tweet.created_at
    )

Retrieve user tweets

tweets = await client.get_user_tweets('123456', 'Tweets')

for tweet in tweets:
    print(tweet.text)

Send a dm

await client.send_dm('123456789', 'Hello')

Get trends

await client.get_trends('trending')

More Examples: examples

Contributing

If you encounter any bugs or issues, please report them on issues.

If you find this library useful, consider starring this repository⭐️

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

twikitminifix-2.3.7.tar.gz (69.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

twikitminifix-2.3.7-py3-none-any.whl (83.6 kB view details)

Uploaded Python 3

File details

Details for the file twikitminifix-2.3.7.tar.gz.

File metadata

  • Download URL: twikitminifix-2.3.7.tar.gz
  • Upload date:
  • Size: 69.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.25.9 CPython/3.11.0 Windows/10

File hashes

Hashes for twikitminifix-2.3.7.tar.gz
Algorithm Hash digest
SHA256 2067aa46db4c11f07a9ac855b7f6ec7607c439dc87210fcaa8693345dd5a329d
MD5 37d00e744ef95016d45aacf4669418e9
BLAKE2b-256 9ff786f169cb8defc321dbb05723305713a047585ea9ae9f97d0bd943aff1b32

See more details on using hashes here.

File details

Details for the file twikitminifix-2.3.7-py3-none-any.whl.

File metadata

  • Download URL: twikitminifix-2.3.7-py3-none-any.whl
  • Upload date:
  • Size: 83.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.25.9 CPython/3.11.0 Windows/10

File hashes

Hashes for twikitminifix-2.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 1bf4ac10e03fd7d2f0a42d6c0f1a8f1adc81a61982ba6e9eca9879be00e2ff94
MD5 6471a01d501c4c88c2ccc2e706c34a25
BLAKE2b-256 2add0ba6e3876ab2d1adde44060009f66cce527810e73de0c8a8f2e03e4119d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page