TikTok content posting automation with session persistence, dynamic element detection, and selector learning
Resources
3Install
npx skillscat add oyi77/1ai-skills/tiktok-automation Install via the SkillsCat registry.
SKILL.md
TikTok Automation Skill ๐ต
Production-ready automation untuk TikTok content posting & management.
๐ฏ Features
- Auto-login dengan session persistence
- Content upload (video, caption, hashtags)
- Dynamic element detection - adaptif terhadap class name changes
- Selector learning - save successful selectors ke
selectors.json - Fallback mechanism - retry dengan alternative selectors
- Progress tracking - real-time status updates
๐ฆ Files
tiktok-automation/
โโโ SKILL.md # This file
โโโ script.sh # Main automation (cross-platform)
โโโ script.ps1 # Windows PowerShell version
โโโ selectors.json # Learned element selectors
โโโ config.json # Configuration (credentials, settings)
โโโ assets/
โโโ sample-video.mp4 # Test video๐ง Setup
1. Configure Credentials
Edit config.json:
{
"credentials": {
"username": "your-tiktok-username",
"password": "your-password",
"sessionFile": "tiktok-session.json"
},
"upload": {
"defaultPrivacy": "public",
"allowComments": true,
"allowDuet": true,
"allowStitch": true
},
"browser": {
"headless": false,
"timeout": 30000
}
}2. Run the Skill
# Basic upload (Linux/macOS)
./script.sh --video path/to/video.mp4 --caption "My video"
# With hashtags
./script.sh --video path/to/video.mp4 --caption "Check this" --tags "#viral #fyp"
# Update selectors (re-learning mode)
./script.sh --update-selectorsWindows (PowerShell):
.\script.ps1 -Video "path\to\video.mp4" -Caption "My video"๐ How It Works
Flow:
- Load session - Check for existing TikTok session
- Login if needed - Auto-login with credentials
- Navigate to upload - Go to upload page
- Dynamic detection - Find upload button using multiple strategies:
- Try learned selectors from
selectors.json - Fallback to text/role-based detection
- Fallback to structure-based detection
- Try learned selectors from
- Upload video - Drag & drop or file input
- Add metadata - Caption, hashtags, settings
- Publish - Submit and confirm
- Save selectors - Update
selectors.jsonwith successful selectors
Selector Learning:
Every successful element interaction is saved:
{
"uploadButton": {
"selector": "[data-e2e='upload-btn']",
"method": "dataAttribute",
"confidence": 1.0,
"lastUsed": "2026-02-18T22:00:00Z",
"fallbacks": [
{"selector": "button[type='file']", "method": "css"},
{"text": "Upload", "method": "text"}
]
}
}๐ ๏ธ Troubleshooting
TikTok Changed Their UI Again?
Run with --update-selectors flag to re-learn element locations.
Login Failed?
- Check credentials in
config.json - Clear session file: delete
tiktok-session.json - Try manual login first, then run skill
Upload Stuck?
- Check video format (MP4, MOV, WebM)
- Ensure file size < 287.6 MB
- Verify internet connection
๐ Logs
All actions logged to:
- Console output (real-time)
tiktok-automation.log(persistent)
โ ๏ธ Warnings
- Rate limiting: Don't upload too frequently (max 10 videos/hour)
- Terms of Service: Use responsibly, follow TikTok's ToS
- Account safety: Consider using a burner account for automation
๐ Next Steps
Planned improvements:
- Schedule posts for optimal timing
- Analytics tracking (views, likes, shares)
- Bulk upload from folder
- Auto-generate captions with AI
- Cross-post to Instagram Reels & YouTube Shorts
Berkah Karya โก | Part of 1ai-skills collection