Get Video Story Tiktok

JavaScriptPublic
by zx-apiSep 5, 2026, 10:47 AMExpires: Never117 views
Get Video Story Tiktok
Raw
1/* 
2 * Name: Get Story Tiktok
3 * Description: Ngambil Video Story Tiktok Target 
4 * Credit by zx
5 * Note: Kalau Mau di sher lagi kasih sumber/credit ya 😡😡
6 *
7 * Sumber: https://whatsapp.com/channel/0029VbDLqe7EquiSF4STU13o
8 *
9 * URL WEBSITE UPLOADER GRATIS: https://zfile.web.id/
10 * Website Uploader File Gratis yang bisa memberikan url public untuk mendownload File tersebut 
11 *
12*/
13
14async function getStoryTiktok(uniqueId) {
15    const headers = {
16        'Accept': 'application/json, text/plain, */*',
17        'Content-Type': 'application/json',
18        'User-Agent': 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Mobile Safari/537.36',
19        'Referer': 'https://ttviewer.net/id/tiktok-story',
20        'Origin': 'https://ttviewer.net'
21    };
22
23    try {
24        const profileResponse = await fetch('https://ttviewer.net/api/tiktok/get-profile', {
25            method: 'POST',
26            headers: headers,
27            body: JSON.stringify({ unique_id: uniqueId })
28        });
29        
30        const profileData = await profileResponse.json();
31
32        if (profileData.code !== 0 || !profileData.data?.user?.id) {
33            throw new Error(`User dengan username "${uniqueId}" tidak ditemukan.`);
34        }
35
36        const userId = profileData.data.user.id;
37        const userInfo = {
38            id: userId,
39            uniqueId: profileData.data.user.uniqueId,
40            nickname: profileData.data.user.nickname,
41            avatar: profileData.data.user.avatarThumb,
42            signature: profileData.data.user.signature
43        };
44
45        const storyResponse = await fetch('https://ttviewer.net/api/tiktok/get-story', {
46            method: 'POST',
47            headers: headers,
48            body: JSON.stringify({ userId: userId, maxCursor: 0 })
49        });
50
51        const storyData = await storyResponse.json();
52
53        if (storyData.code !== 0) {
54            throw new Error('Gagal mengambil data story dari server.');
55        }
56
57        const rawItems = storyData.data?.items || [];
58        
59        const stories = rawItems.map(item => ({
60            aweme_id: item.aweme_id,
61            video_id: item.video_id,
62            duration: item.duration,
63            play_url: item.play,      
64            cover_url: item.cover,    
65            music: {
66                title: item.music_info?.title || 'Original Sound',
67                author: item.music_info?.author || 'Unknown',
68                url: item.music
69            },
70            stats: {
71                play_count: item.play_count,
72                digg_count: item.digg_count,
73                comment_count: item.comment_count,
74                share_count: item.share_count
75            },
76            create_time: item.create_time
77        }));
78
79        return {
80            success: true,
81            user: userInfo,
82            story_count: stories.length,
83            stories: stories
84        };
85
86    } catch (error) {
87        console.error('Error:', error.message);
88        return {
89            success: false,
90            message: error.message
91        };
92    }
93}
94
95// Cara Penggunaan
96(async () => {
97    const targetUsername = 'dedytunarsih.co';
98    
99    console.log(`Sedang mencari story untuk @${targetUsername}...`);
100    const result = await getStoryTiktok(targetUsername);
101    
102    if (result.success) {
103        console.log(`\nBerhasil! Ditemukan ${result.story_count} story.`);
104        console.log(`Nickname: ${result.user.nickname}`);
105        
106        if (result.story_count > 0) {
107            console.log('\n--- Detail Story ---');
108            result.stories.forEach((story, index) => {
109                console.log(`\n[Story ${index + 1}]`);
110                console.log(`Video ID : ${story.video_id}`);
111                console.log(`Durasi   : ${story.duration} detik`);
112                console.log(`Play URL : ${story.play_url}`);
113                console.log(`Cover    : ${story.cover_url}`);
114                console.log(`Views    : ${story.stats.play_count}`);
115            });
116        } else {
117            console.log('User tidak memiliki story yang aktif saat ini.');
118        }
119    } else {
120        console.log(`Gagal: ${result.message}`);
121    }
122})();
122 lines·4,182 chars·4.1 KB