Back to Home
Gistify Snippet
kyiov
13h ago·1 file(s)
Public

CapCut Video & Template Downloader V2

Fast CapCut template & video scraper bypassing Cloudflare clearance with direct MP4 video link extractor.

#scraper#capcut#downloader#javascript#nodejs
0
Raw
capcut-v2.jsjavascript
97 lines
1// capcut-v2.js — bundle standalone. npm deps: node:url
2
3/**
4 * Scraper: capcut-v2.js
5 * Source : kyioapi/capcut-v2.js
6 *
7 * Input : Function parameters / CLI args (e.g. query: string, url: string, options: object)
8 * Output : Promise<Object | Array | Buffer> (JSON formatted scraping response / stream URL / media metadata)
9 *
10 * CLI Run:
11 * node kyioapi/capcut-v2.js [functionName] [args...]
12 * node cli.js kyioapi/capcut-v2.js [functionName] [args...]
13 */
14
15import * as __ns_38 from 'node:url'
16const pathToFileURL = __ns_38.pathToFileURL
17
18/**
19 * CapCut Downloader V2 Scraper
20 */
21async function capcutV2(videoUrl) {
22 try {
23 if (!videoUrl) throw new Error("URL CapCut wajib diisi.");
24
25 const apiUrl = 'https://3bic.com/api/download';
26 const cfCookie = 'cf_clearance=V3clQTE3WhngwjJDn9BNjF2wKX.TGlcVpgUjrvwzsg-1784109792-1.2.1.1-F7CfGqjELi.TfD7Ml0jqGFKYFTz0oXYDyNo0khGjyUCN2Ew4L_BEMyFdbh2Y2I8F1rC07xWo2NhunTzzUaZAcTYfkTNVWD97lpGfnoLiSc.Vwa2.bk0MiRnFDK3SsE4yzf7GvMnqXH.V3E.XZnHMzy.PD_tx.8DuWcGA7iIH2HSaDjmXRb71q8novi7NqdPP_IwoF7Icl6gwSQThhNAf2f0y9Nc91RyZGejr2ttdnq2zVbgHzmGbQADD9W9CWL4YlJIOeQamnbd8UHd5083UfND78UH2TDf0RaY4fbMPUpve1KdjiEhfq8WztiIRAbeqLwDTW5jxhbBi_HiIVt;';
27
28 const res = await fetch(apiUrl, {
29 method: 'POST',
30 headers: {
31 'Accept': 'application/json, text/plain, */*',
32 'Content-Type': 'application/json',
33 'Cookie': cfCookie,
34 'Origin': 'https://3bic.com',
35 'Referer': 'https://3bic.com/id',
36 'User-Agent': 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Mobile Safari/537.36'
37 },
38 body: JSON.stringify({ url: videoUrl })
39 });
40
41 const resultData = await res.json();
42
43 if (resultData && resultData.originalVideoUrl) {
44 if (resultData.originalVideoUrl.startsWith('/')) {
45 resultData.originalVideoUrl = 'https://3bic.com' + resultData.originalVideoUrl;
46 }
47 }
48
49 if (resultData.code !== 200 && !resultData.originalVideoUrl) {
50 throw new Error(resultData.message || "Gagal memproses video CapCut.");
51 }
52
53 return {
54 title: resultData.title || 'CapCut Video',
55 author: resultData.authorName || 'Unknown',
56 cover: resultData.coverUrl || null,
57 video_url: resultData.originalVideoUrl,
58 url: videoUrl
59 };
60 } catch (error) {
61 throw new Error(error.message);
62 }
63}
64
65// ─────────────────────────────────────────────────────────────────────
66// Self-test: jalankan langsung dengan `node capcut-v2.js [args...]`
67// ─────────────────────────────────────────────────────────────────────
68if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
69 const __exports = { capcutV2: capcutV2 }
70 const __fns = Object.fromEntries(Object.entries(__exports).filter(([, v]) => typeof v === 'function'))
71 const __names = Object.keys(__fns)
72 if (__names.length === 0) {
73 console.log('Tidak ada fungsi yang bisa di-demo. Import modul ini dari kode lain.')
74 } else {
75 const __search = __names.find((n) => /search|cari/i.test(n))
76 const __name = __search || __names[0]
77 const __fn = __fns[__name]
78 const __isClass = /^class\s/.test(Function.prototype.toString.call(__fn))
79 let __args = process.argv.slice(2).map((a) => { try { return JSON.parse(a) } catch { return a } })
80 if (__args.length === 0 && __search) __args.push('naruto')
81 if (__args.length === 0 && !__search && !__isClass && __fn.length > 0) {
82 console.log('Fungsi: ' + __names.join(', '))
83 console.log('Contoh: node ' + "capcut-v2.js" + ' ' + __name + ' <arg>')
84 } else {
85 ;(async () => {
86 try {
87 const r = __isClass ? new __fn(...__args) : await __fn(...__args)
88 console.log(JSON.stringify(r, null, 2))
89 } catch (e) {
90 console.error('Error: ' + (e && e.message ? e.message : e))
91 process.exitCode = 1
92 }
93 })()
94 }
95 }
96}
97
Discussion & Comments0

No comments yet — be the first to leave feedback or start a code discussion.

Sign in with your GitHub account to write comments and join the discussion.