Skip to content

taisprestes01/tiktok-uploader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

English version 🇺🇸🇬🇧🇮🇳


TikTok Logo
TikTok OAuth & Video Upload & Video Publish

Automated flow for OAuth and video upload using TikTok API + Python.

🔧 Requirements🚀 How to Use🌐 HTTPS Callback via ngrok📤 Publishing Features


🔧 Requirements

  • Python 3.7+
  • A TikTok Developer Account
  • A public HTTPS callback URL (required for TikTok OAuth)

You can use ngrok to generate a secure public HTTPS URL to your local Flask server.


🌐 How to set up the HTTPS callback using ngrok

  1. Create a free ngrok account
  2. Download ngrok and unzip the executable
  3. Authenticate ngrok with your account token:
ngrok config add-authtoken YOUR_NGROK_AUTH_TOKEN
  1. Start a tunnel on port 8080 (used by Flask):
ngrok http 8080
  1. Copy the HTTPS URL generated by ngrok. It will look like:
https://abcd1234.ngrok-free.app/callback
  1. Use this full URL in two places:
    • On the TikTok Developer Portal
    • Paste it into the .env file:
REDIRECT_URI=https://abcd1234.ngrok-free.app/callback

🚀 How to Use

1. Create a TikTok Developer Account

Go to https://developers.tiktok.com and:

  • Log in with your TikTok account
  • Go to Developer PortalManage AppCreate App
  • Change your app to SANDBOX
  • Go to ProductsAdd ProductsCreate App
  • Enable Login Kit and Content Posting
  • Go to Basic information and select Web under Platforms
  • Enter any link in "Configure for Web/Desktop"
  • Go to ProductsLogin Kit and paste your ngrok link in Redirect URI
  • Copy your Client Key and Client Secret
  • Fill in the rest of the required fields with placeholder data
  • Paste both keys in your .env file:
CLIENT_KEY=your_key
CLIENT_SECRET=your_secret

Woohoo! All set, let's run it 🚀


2. Install Dependencies

pip install -r requirements.txt

3. Configure Publishing (Optional)

Add these optional settings to your .env file:

# Optional publishing settings
DEFAULT_VIDEO_TITLE=My amazing video!
DEFAULT_PRIVACY_LEVEL=SELF_ONLY
AUTO_PUBLISH=false

Privacy levels:

  • SELF_ONLY = Only me
  • MUTUAL_FOLLOW_FRIENDS = Friends
  • PUBLIC = Public

📤 Publishing Features

The project now supports automatic video publishing with these features:

  • Manual Publishing: Choose whether to publish after upload
  • Custom Titles: Set video titles during publishing
  • Privacy Control: Choose privacy level (Private, Friends, Public)
  • Auto Publishing: Configure automatic publishing in .env
  • Default Settings: Set default title and privacy in .env


TikTok Logo
TikTok OAuth & Upload de Vídeo & Publicação de Video

Fluxo automatizado de autenticação OAuth e upload de vídeo usando a API do TikTok com Python.

🔧 Requisitos🚀 Como Usar🌐 Callback HTTPS com ngrok📤 Funcionalidades de Publicação


🔧 Requisitos

  • Python 3.7+
  • Conta de desenvolvedor TikTok
  • Uma URL HTTPS pública para callback (necessária para o OAuth)

Você pode usar o ngrok para gerar um link HTTPS público seguro para seu servidor Flask local.


🌐 Como configurar o callback HTTPS com ngrok

  1. Crie uma conta gratuita no ngrok
  2. Baixe o ngrok e descompacte o executável
  3. Autentique o ngrok com seu token:
ngrok config add-authtoken SEU_TOKEN_DO_NGROK
  1. Inicie um túnel na porta 8080 (usada pelo Flask):
ngrok http 8080
  1. Copie a URL HTTPS gerada. Vai parecer com isso:
https://abcd1234.ngrok-free.app/callback
  1. Use essa URL completa em dois lugares:
    • No portal de desenvolvedor do TikTok
    • No arquivo .env:
REDIRECT_URI=https://abcd1234.ngrok-free.app/callback

🚀 Como Usar

1. Criar Conta de Desenvolvedor TikTok

Acesse https://developers.tiktok.com e:

  • Faça login com sua conta TikTok
  • Vá em Developer PortalManage AppCreate App
  • Altere o app para SANDBOX
  • Vá em ProductsAdd ProductsCreate App
  • Ative Login Kit e Content Posting
  • Em Basic information, selecione Web como plataforma
  • Insira qualquer link em "Configure for Web/Desktop"
  • Vá em ProductsLogin Kit e cole o link do ngrok em Redirect URI
  • Copie seu Client Key e Client Secret
  • Preencha o resto dos campos obrigatórios com dados fictícios
  • E cole no .env:
CLIENT_KEY=sua_key
CLIENT_SECRET=seu_secret

Oba! Tudo pronto, bora rodar 🚀


2. Instalar as Dependências

pip install -r requirements.txt

3. Configurar Publicação (Opcional)

Adicione estas configurações opcionais ao seu arquivo .env:

# Configurações opcionais para publicação
DEFAULT_VIDEO_TITLE=Meu vídeo incrível!
DEFAULT_PRIVACY_LEVEL=SELF_ONLY
AUTO_PUBLISH=false

Níveis de privacidade:

  • SELF_ONLY = Só eu
  • MUTUAL_FOLLOW_FRIENDS = Amigos
  • PUBLIC = Público

📤 Funcionalidades de Publicação

O projeto agora suporta publicação automática de vídeos com estas funcionalidades:

  • Publicação Manual: Escolha se quer publicar após o upload
  • Títulos Personalizados: Defina títulos dos vídeos durante a publicação
  • Controle de Privacidade: Escolha nível de privacidade (Privado, Amigos, Público)
  • Publicação Automática: Configure publicação automática no .env
  • Configurações Padrão: Defina título e privacidade padrão no .env

4. Executar o Projeto

python main.py

O programa irá:

  1. 🔐 Abrir o navegador para autenticação OAuth
  2. 📤 Fazer upload do vídeo
  3. ❓ Perguntar se deseja publicar
  4. 📝 Permitir configurar título e privacidade
  5. 🚀 Publicar o vídeo (se escolhido)

🎯 Exemplo de Uso

  1. Configure seu .env com as credenciais
  2. Inicie o ngrok: ngrok http 8080
  3. Execute: python main.py
  4. Autorize no navegador
  5. Escolha se quer publicar
  6. Configure título e privacidade
  7. ✅ Vídeo publicado!

About

tiktok-uploader is a Python-based project that automates the process of uploading videos to TikTok using the official TikTok API. It handles the full OAuth 2.0 authentication flow.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages