Skip to content

Kaizenji/Shoti-API.py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shoti API

Shoti API is a lightweight API built with FastAPI to retrieve random TikTok shawty videos with metadata, including the uploader's name, video title, and a direct download link (without a watermark).


How It Works

  1. Random Video Selection:

    • The API reads a list of TikTok video URLs from a JSON file (shoti_videos.json).
    • A random URL is selected from the list.
  2. Metadata Extraction:

    • The API sends a request to https://ssstik.io to fetch metadata for the selected TikTok video.
    • Extracted metadata includes:
      • author: Uploader's name.
      • title: Video title or caption.
      • video_url: No-watermark direct download link.
  3. Response:

    • The API returns the metadata in JSON format.

Example JSON Response

Here’s an example of the JSON response you’ll get when hitting the /shoti endpoint:

{
    "author": "JohnDoe",
    "title": "Check out this cool video!",
    "video_url": "https://example.com/video.mp4"
}

Example: shoti_videos.json

This file contains a list of TikTok video URLs for the API to choose from:

[
    "https://www.tiktok.com/@user/video/123456",
    "https://www.tiktok.com/@user/video/789012",
    "https://www.tiktok.com/@user/video/345678"
]

Deployment

Platforms

You can deploy the API on the following platforms:

  1. Vercel: Recommended

  2. Render:

    • Render supports deploying FastAPI apps directly from your repository.
    • Guide: Render FastAPI Docs.
  3. Railway:

Steps to Deploy

  1. Push your repository to GitHub:

    • Make sure your main.py, shoti_videos.json, and requirements.txt are committed and pushed.
  2. Choose a Deployment Platform:

    • Select one of the platforms above and follow their deployment steps.
  3. Set Environment Variables (if needed):

    • Some platforms may require setting environment variables for specific configurations.
  4. Test the Deployment:

    • Once deployed, visit the /shoti endpoint to test the API.

Running Locally

  1. Clone the Repository:

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

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install Dependencies:

    pip install -r requirements.txt
  4. Run the Application:

    uvicorn main:app --reload
    • The API will be available at http://127.0.0.1:8000.

Author

Kaizenega.

Feel free to reach out through the Contact Page for feedback or contributions! 🐸

About

Random ShotiAPI made by FastAPI

Topics

Resources

License

Stars

Watchers

Forks