A Telegram bot powered by TikAPI to fetch TikTok user and video information. This bot allows users to retrieve detailed statistics about TikTok accounts and videos and provides a link to download videos via another Telegram bot.
- Fetch TikTok user information:
- Followers
- Following
- Total likes
- Total videos
- Nickname
- Fetch TikTok video information:
- Description
- Views
- Likes
- Comments
- Shares
- Download link via a Telegram bot (@downloader_tiktok_bot).
tiktok-api/
├── app.py # Main application entry point
├── handlers/ # Telegram bot command handlers
│ ├── __init__.py
│ ├── start.py # /start command
│ ├── user.py # /user command
│ ├── video.py # /video command
├── utils/ # Utility modules
│ ├── __init__.py
│ ├── tikapi_client.py # TikAPI client integration
├── requirements.txt # Python dependencies
├── .env # Environment variables (excluded from Git)
└── README.md # Project documentation
- Python 3.9 or higher
- A Telegram bot token (Get it from BotFather)
- A TikAPI account and API key (Sign up here)
-
Clone the Repository
git clone https://github.com/your-username/tiktok-api.git cd tiktok-api
-
Set Up a Virtual Environment
python3 -m venv venv source venv/bin/activate
-
Install Dependencies
pip install -r requirements.txt
-
Configure Environment Variables Create a
.env
file in the project root:TIKAPI_KEY=your-tikapi-key BOT_TOKEN=your-telegram-bot-token
-
Run the Application
python app.py
-
Start the Bot
- Command:
/start
- Description: Displays a welcome message with instructions.
- Command:
-
Fetch User Info
- Command:
/user <username>
- Example:
/user datngo2994
- Command:
-
Fetch Video Info
-
Command:
/video <video_url>
-
Example:
/video https://www.tiktok.com/@username/video/video_id
-
Returns:
- Author details
- Video statistics
- A download button linking to
@downloader_tiktok_bot
.
-
Variable | Description |
---|---|
TIKAPI_KEY |
Your TikAPI key for accessing TikTok data. |
BOT_TOKEN |
Your Telegram bot token. |
The project requires the following Python packages:
python-dotenv
tikapi
python-telegram-bot
Install them using:
pip install -r requirements.txt
- Add more TikTok data endpoints (e.g., trending videos, hashtags).
- Improve error handling and logging.
- Add a frontend dashboard for managing requests.
This project is licensed under the MIT License. See the LICENSE file for details.