@dimension-studios/ttk-proxy
v1.99.0
Published
CLI tool for TikTok proxy API
Readme
@dimension-studios/ttk-proxy
CLI tool for TikTok Proxy API - A simple command-line interface to interact with the TikTok proxy service.
Installation
npm install -g @dimension-studios/ttk-proxyConfiguration
The CLI uses conf to store your API credentials. You can configure it in two ways:
1. Using Environment Variables (Recommended)
Set the following environment variables:
export TTK_FETCH_API_URL="https://your-api-url.com"
export TTK_FETCH_API_KEY="your-api-key"
export TTK_FETCH_API_SECRET="your-api-secret"Then run the config command to save them:
ttk-proxy config2. Using the CLI
ttk-proxy config:set apiUrl "https://your-api-url.com"
ttk-proxy config:set apiKey "your-api-key"
ttk-proxy config:set apiSecret "your-api-secret"View Current Configuration
ttk-proxy config --showClear Configuration
ttk-proxy config --clearUsage
Call the TikTok Proxy API
Make a call to the TikTok proxy API with a JSON body:
ttk-proxy call '{"shopId":"your-shop-id","url":"https://api.tiktok.com/endpoint","method":"GET"}'Example with more complex body:
ttk-proxy call '{
"shopId": "shop-123",
"url": "https://api.tiktok.com/v1/shops/products",
"method": "GET",
"headers": {
"Content-Type": "application/json"
},
"unofficialApi": {
"addCookieToHeaders": true,
"signUrl": true
}
}'Base64 Support
You can also pass the JSON body as a base64-encoded string. The CLI will automatically detect and decode it:
# First encode your JSON to base64
echo -n '{"shopId":"shop-123","url":"https://api.tiktok.com/endpoint","method":"GET"}' | base64
# Then pass it directly to the CLI
ttk-proxy call "eyJzaG9wSWQiOiJzaG9wLTEyMyIsInVybCI6Imh0dHBzOi8vYXBpLnRpa3Rvay5jb20vZW5kcG9pbnQiLCJtZXRob2QiOiJHRVQifQ=="This is useful when copying request bodies from logs or other sources where the JSON is already base64-encoded.
List TikTok Proxy Tokens
List all available TikTok proxy tokens:
ttk-proxy listOutput
The CLI provides beautiful, color-coded output using @rharkor/logger:
- ✅ Success messages in green
- ❌ Error messages in red
- ℹ️ Info messages in blue
- ⚠️ Warning messages in yellow
Example output:
🚀 Calling TikTok Proxy API...
✅ Status: 200 OK
📦 Response:
{
"code": 0,
"data": {
"products": [...]
},
"message": "success"
}API Reference
Commands
ttk-proxy call <body>
Call the TikTok proxy API with a JSON body.
- Arguments:
body(string): Stringified JSON body for the request (can be raw JSON or base64-encoded JSON)
ttk-proxy list
List all TikTok proxy tokens.
ttk-proxy config [options]
Manage configuration.
- Options:
-s, --show: Show current configuration-c, --clear: Clear all configuration
ttk-proxy config:set <key> <value>
Set a configuration value.
- Arguments:
key(string): Configuration key (apiUrl,apiKey, orapiSecret)value(string): Configuration value
Development
Setup
# Install dependencies
npm install
# Build the package
npm run build
# Run type checking
npm run type-check
# Development mode (watch)
npm run devTesting Locally
# Link the package globally
npm link
# Now you can use ttk-proxy command
ttk-proxy --helpLicense
ISC
Author
Dimension Studios
Support
For issues and questions, please open an issue on the GitHub repository.
