Skip to content

datnpq/tiktok-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TikTok API Bot

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.


Features

  • 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).

Project Structure

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

Prerequisites


Setup Instructions

  1. Clone the Repository

    git clone https://github.com/your-username/tiktok-api.git
    cd tiktok-api
  2. Set Up a Virtual Environment

    python3 -m venv venv
    source venv/bin/activate
  3. Install Dependencies

    pip install -r requirements.txt
  4. Configure Environment Variables Create a .env file in the project root:

    TIKAPI_KEY=your-tikapi-key
    BOT_TOKEN=your-telegram-bot-token
  5. Run the Application

    python app.py

Usage

Commands

  1. Start the Bot

    • Command: /start
    • Description: Displays a welcome message with instructions.
  2. Fetch User Info

    • Command: /user <username>
    • Example: /user datngo2994
  3. 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.

Environment Variables

Variable Description
TIKAPI_KEY Your TikAPI key for accessing TikTok data.
BOT_TOKEN Your Telegram bot token.

Dependencies

The project requires the following Python packages:

  • python-dotenv
  • tikapi
  • python-telegram-bot

Install them using:

pip install -r requirements.txt

Future Improvements

  • Add more TikTok data endpoints (e.g., trending videos, hashtags).
  • Improve error handling and logging.
  • Add a frontend dashboard for managing requests.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Acknowledgments

About

My own Tiktok API through my telegram bot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages