s-razaq / TikTool

A fast, full Tiktok library for Python in the making

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Features

  • Download videos with watermark
  • Download videos without watermark
  • Download video thumbnail
  • Download video audio
  • Download video audio cover
  • Get details/info about a video
  • Download all videos published by a user with watermark
  • Download all videos published by a user without watermark
  • Download user profile picture

Installation

TikTool is still unreleased, but contributions to the project are highly appreciated. Install the module using the following command to test it out and help us develop the project further.

pip install "git+https://github.com/simonfarah/TikTool.git#egg=TikTool"

Usage

  • Video Related Functions

    Main setup

    from TikTool import Video
    
    video = Video("https://www.tiktok.com/@tiktok/video/xxxxxxxxxx")
    # all Tiktok video link formats are accepted

    Download video with or without watermark

    # download video with watermark
    video.downloadVideo(watermark=True)
    
    # download video without watermark
    video.downloadVideo(watermark=False)
    
    # if the watermark parameter was not passed,
    # it will be set to True by default

    Extra Checks :

    • Funtion will return False if :
      • video is not downloaded
      • provided link is not a Tiktok video link
    • Function will return True if video is downloaded

    Download video thumbnail

    # download video thumbnail
    video.downloadThumbnail()

    Extra Checks :

    • Funtion will return False if :
      • thumbnail is not downloaded
      • provided link is not a Tiktok video link
    • Function will return True if thumbnail is downloaded

    Download audio from video

    # download audio from video
    video.downloadAudio()

    Extra Checks :

    • Funtion will return False if :
      • audio is not downloaded
      • provided link is not a Tiktok video link
    • Function will return True if audio is downloaded

    Download audio cover from video

    # download audio cover from video
    video.downloadAudioCover()

    Extra Checks :

    • Funtion will return False if :
      • audio cover is not downloaded
      • provided link is not a Tiktok video link
    • Function will return True if audio cover is downloaded

    Get video details/info

    # get global details about video
    video.getDetails()

    Response to expect :

    • Funtion will return None if :
      • provided link is not a Tiktok video link
    • Function will return the following if link is valid :
    {
        "shares": {
            "total": TOTAL_SHARES,
            "shares_via_whatsapp": TOTAL_SHARES_VIA_WHATSAPP
        },
        "views_count": VIDEO_VIEWS_COUNT,
        "downloads_count": VIDEO_DOWNLOADS_COUNT,
        "likes_count": VIDEO_LIKES_COUNT,
        "comments_count": VIDEO_COMMENTS_COUNT,
        "download": {
            "wm": [LIST OF DOWNLOAD LINKS - WITH WATERMARK],
            "no-wm": [LIST OF DOWNLOAD LINKS - WITHOUT WATERMARK]
        },
        "music": {
            "name": MUSIC_NAME,
            "owner_username": MUSIC_OWNER_USERNAME,
            "owner_name": MUSIC_OWNER_NAME,
            "download_link": MUSIC_DOWNLOAD_LINK,
            "cover_image": MUSIC_COVER_IMAGE_DOWNLOAD_LINK
        },
        "hashtags": [LIST OF HASHTAGS]
    }
  • User Related Funtions

    Main setup

    from TikTool import User
    
    user = User("username")

    Download all the user published videos with or without watermark

    # download all the user published videos (with watermark)
    user.downloadAllVideos(watermark=True)
    
    # download all the user published videos (without watermark)
    user.downloadAllVideos(watermark=False)
    
    # if the watermark parameter was not passed,
    # it will be set to True by default

    Extra Checks :

    • Funtion will return False if :
      • user does not exist
      • user is a private account
    • Function will return True if all videos are downloaded

    Note : currently, only the newest 33 videos will be downloaded

    Download the user profile picture

    # download the user profile picture
    user.downloadProfilePicture()

    Extra Checks :

    • Funtion will return False if :
      • user does not exist
    • Function will return True if profile picture is downloaded

Where are the downloaded files

All the downloaded files will be saved in this folder structure. The downloads folder being :

  • At the same directory level of the script running the funtion downloading a file

  • Or in the project root folder

     .
     ├── ...
     ├── downloads                             # All downloaded files will be downloaded here
     |   |
     │   ├── videos                            # Each video will have a folder named after his ID
     |   |   ├── 6871...                       #   Each of those folders will contain the : 
     |   |   ├── 5381...                       #   - downloaded video (with or without watermark)
     |   |   ├── 8142...                       #   - downloaded video thumbnail
     |   |   ├── 6897...                       #   - downloaded audio
     |   |   ├── 8687...                       #   - downloaded audio cover
     |   |   └── ...
     |   |
     │   ├── users                             # Each user will have a folder named after his username
     |   |   ├── username1
     |   |   |   ├── wm                        # All the user downloaded videos will be here (with watermark) 
     |   |   |   ├── no-wm                     # All the user downloaded videos will be here (without watermark)    
     |   |   |   ├── username1-profile.jpeg    # The user profile picture
     |   |   |
     |   |   ├── username2
     |   |   |   ├── wm  
     |   |   |   ├── no-wm      
     |   |   |   ├── username2-profile.jpeg 
     |   |   └── ...
     |   |
     └── ...
    

About

A fast, full Tiktok library for Python in the making

License:MIT License


Languages

Language:Python 100.0%