shadowx-tiksr
v1.1.0
Published
TikTok video search and download module - Search videos by query, get video details, download links, and metadata
Maintainers
Readme
shadowx-tiksr
🎵 TikTok video search & download module by Mueid Mursalin Rifat
📦 Installation
npm install shadowx-tiksrRequires Node.js 18+ (recommended) or 16+.
🚀 Quick Start
const TikSR = require('shadowx-tiksr');
const tiktok = new TikSR();
// Search videos
async function searchTikTok() {
try {
const result = await tiktok.search('Goku');
console.log('✅ Found!');
console.log('📹 Title:', result.video.title);
console.log('👤 Creator:', result.video.author.nickname);
console.log('❤️ Likes:', result.video.stats.likes);
console.log('📥 Download:', result.downloads.video);
} catch (error) {
console.error('❌ Error:', error.message);
}
}
searchTikTok();📥 Download Video Directly
// Get first video download link
const video = await tiktok.download('funny cats');
console.log('Download URL:', video.download.video_url);📋 API Reference
new TikSR(options)
Option Type Default Description baseURL string 'https://shadowx-api.onrender.com/api' API endpoint timeout number 30000 Request timeout (ms)
Methods
Method Description Returns search(query) Search videos by keyword Promise download(query) Get first video download Promise extractVideoId(url) Extract ID from TikTok URL string|null
📤 Response Format
{
success: true,
query: "Goku",
package: {
name: "shadowx-tiksr",
version: "1.0.0",
author: "Mueid Mursalin Rifat"
},
video: {
title: "Son Goku Super Saiyan 5 THIS FORM IS INSANE 🔥",
region: "PK",
duration: 30,
play_url: "https://.../video.mp4",
music_url: "https://.../audio.mp3",
stats: {
play_count: "56.6K",
likes: "2.9K",
comments: "25",
shares: "154",
downloads: "25"
},
author: {
nickname: "Skull Anime",
username: "skulanime",
profile_url: "https://www.tiktok.com/@skulanime"
}
},
downloads: {
video: "https://.../video.mp4",
audio: "https://.../audio.mp3",
video_no_watermark: "https://.../video.mp4"
},
metadata: {
region: "PK",
operator: "Mueid Mursalin Rifat",
powered_by: "CatX TikTok API",
timestamp: "2024-01-01T12:00:00.000Z"
}
}📝 Examples
Search with Different Queries
const tiktok = new TikSR();
const queries = ['dance', 'cooking', 'funny cats'];
for (const query of queries) {
const result = await tiktok.search(query);
console.log(`${query}: ${result.video.title}`);
}Get Video Statistics
const result = await tiktok.search('anime');
console.log('📊 Statistics:');
console.log(`👁️ Views: ${result.video.stats.play_count}`);
console.log(`❤️ Likes: ${result.video.stats.likes}`);
console.log(`💬 Comments: ${result.video.stats.comments}`);
console.log(`↗️ Shares: ${result.video.stats.shares}`);Extract Video ID from URL
const url = 'https://www.tiktok.com/@user/video/123456789';
const videoId = tiktok.extractVideoId(url);
console.log(videoId); // '123456789'Error Handling
try {
const result = await tiktok.search('');
} catch (error) {
console.log('Error Code:', error.code);
console.log('Message:', error.message);
console.log('Status:', error.statusCode);
}Common error codes:
· INVALID_QUERY - Empty or invalid search · NOT_FOUND - No videos found · RATE_LIMITED - Too many requests · TIMEOUT - Request timed out · NETWORK_ERROR - Connection issues
⚙️ Configuration
Environment Variables
TIKTOK_API_URL=https://shadowx-api.onrender.com/api
TIKTOK_TIMEOUT=30000Custom Configuration
const tiktok = new TikSR({
baseURL: 'https://your-custom-api.com/api',
timeout: 60000 // 60 seconds
});🔧 Requirements
· Node.js: 16.x or higher (18+ recommended) · npm: 7.x or higher
📄 License
MIT © Mueid Mursalin Rifat
🙏 Credits
· Author: Mueid Mursalin Rifat · API: ShadowX TikTokSr API · Powered by: ShadowX
🔗 Links
· npm Package · GitHub Repository · Issue Tracker
