Python3 script to upload video to TikTok by sessionId
This project is based on Tiktok-uploader.
This project is a Python3 script that allows you to automatically upload and schedule TikTok videos. With this script, you can automate the process of uploading videos to TikTok, allowing you to save time and focus on creating content.
The script is easy to use and requires minimal setup. Simply provide your TikTok sessionid cookie, the video file you wish to upload and the video details, and the script will handle the rest.
To get started you need to have python3 installed. If it is not the case you can download it here : https://www.python.org/downloads/
You will also need your TikTok sessionid cookie. To get it log in to your TikTok account and on the page https://www.tiktok.com/ press the F12 key on your keyboard then Application > Storage > Cookies and find the value of the sessionid cookie. You should have something like this: 7a9f3c5d8f6e4b2a1c9d8e7f6a5b4c3d
Make sure you've already git installed. Then you can run the following commands to get the scripts on your computer:
git clone https://github.com/546200350/TikTokUploder.git
cd TikTokUploder
The script only requires the requests
module, you can install it with this command:
pip install -r requirements.txt
You can copy the file uploader.py
and util.py
in your project folder and use it like this:
from uploader import uploadVideo
session_id = "7a9f3c5d8f6e4b2a1c9d8e7f6a5b4c3d"
file = "my_video.mp4"
title = "MY SUPER TITLE"
tags = ["Funny", "Joke", "fyp"]
users = ["amazing dear"]
# Publish the video
uploadVideo(session_id, file, title, tags, users)
session_id
: Your TikTok sessionid cookie.file
: The path to the video you want to upload.title
: The title of your publication (without hashtags).tags
: The list of hashtags you want to add to your post (without#
symbol). May be empty list[]
.users
: The list of users you want to mentioned to your post (without@
symbol). May be empty list[]
.
Note that your TikTok sessionid cookie needs to be updated every 2 months.
usage: uploader.py [-h] -i SESSION_ID -p PATH -t TITLE [--tags [TAGS ...]]
options:
-h, --help show this help message and exit
-i SESSION_ID, --session_id SESSION_ID
Tiktok sessionid cookie
-p PATH, --path PATH Path to video file
-t TITLE, --title TITLE
Title of the video
--tags [TAGS ...] List of hashtags for the video
--users [USERS ...] List of mentioned users for the video
The session_id
, path
and title
fields are required.
This command will publish the video my_video.mp4
as MY SUPER TITLE #Funny #Joke #fyp
python3 uploader.py -i 7a9f3c5d8f6e4b2a1c9d8e7f6a5b4c3d -p my_video.mp4 -t "MY SUPER TITLE" --tags Funny Joke Fyp --users amazing
The upload api domain is different from different country. Sometimes, if you upload fail,you may replace all the domain (us.tiktok) to wwww.tikok. you can open the website network pan to find the correct domain.