btch-downloader
Version:
A lightweight TypeScript/JavaScript client SDK for downloading media from social media platforms
418 lines • 19.5 kB
TypeScript
import type { TikTokResponse, InstagramResponse, TwitterResponse, YouTubeResponse, FacebookResponse, MediaFireResponse, CapCutResponse, GoogleDriveResponse, PinterestResponse, AioResponse, XiaohongshuResponse, XiaohongshuProfileResponse, DouyinResponse, SnackVideoResponse, CocofunResponse, SpotifyResponse, YtsResponse, SoundCloudResponse, ThreadsResponse, KuaishouResponse } from './Types';
declare const issues: string;
declare const wm: string;
declare const version: string;
/**
* TikTok video downloader
* @async
* @function ttdl
*
* @param {string} url - The TikTok video URL (e.g., https://www.tiktok.com/@omagadsus/video/7025456384175017243)
* @returns {Promise<TikTokResponse>} A JSON object containing video info, thumbnails, and download links.
* @throws {Error} If the URL is invalid or the request fails.
* @example <caption>ESM</caption>
* import { ttdl } from 'btch-downloader';
*
* const url = 'https://www.tiktok.com/@omagadsus/video/7025456384175017243';
* ttdl(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
* @example <caption>CJS</caption>
* const { ttdl } = require('btch-downloader');
*
* const url = 'https://www.tiktok.com/@omagadsus/video/7025456384175017243';
* ttdl(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
*/
declare function ttdl(url: string): Promise<TikTokResponse>;
/**
* Instagram content downloader (Reels, Posts, TV, Stories)
* @async
* @function igdl
*
* @param {string} url - The Instagram media URL (e.g., https://www.instagram.com/reel/DKPtUL_S9Nh/?igsh=MTE1dTVkb2E4NTFmcw==)
* @returns {Promise<InstagramResponse>} A JSON object containing an array of media items (links and thumbnails).
* @throws {Error} If the URL is invalid or the media is not accessible.
* @example <caption>ESM</caption>
* import { igdl } from 'btch-downloader';
*
* const url = 'https://www.instagram.com/reel/DKPtUL_S9Nh/?igsh=MTE1dTVkb2E4NTFmcw==';
* igdl(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
* @example <caption>CJS</caption>
* const { igdl } = require('btch-downloader');
*
* const url = 'https://www.instagram.com/reel/DKPtUL_S9Nh/?igsh=MTE1dTVkb2E4NTFmcw==';
* igdl(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
*/
declare function igdl(url: string): Promise<InstagramResponse>;
/**
* Twitter (X) video downloader
* @async
* @function twitter
*
* @param {string} url - The Twitter/X video URL (e.g., https://twitter.com/gofoodindonesia/status/1229369819511709697)
* @returns {Promise<TwitterResponse>} A JSON object containing the video title and download link.
* @throws {Error} If the URL is invalid or the media is not accessible.
* @example <caption>ESM</caption>
* import { twitter } from 'btch-downloader';
*
* const url = 'https://twitter.com/gofoodindonesia/status/1229369819511709697';
* twitter(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
* @example <caption>CJS</caption>
* const { twitter } = require('btch-downloader');
*
* const url = 'https://twitter.com/gofoodindonesia/status/1229369819511709697';
* twitter(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
*/
declare function twitter(url: string): Promise<TwitterResponse>;
/**
* YouTube video and audio downloader
* @async
* @function youtube
*
* @param {string} url - The YouTube video URL (e.g., https://youtu.be/C8mJ8943X80)
* @returns {Promise<YouTubeResponse>} A JSON object containing video/audio download links, title, and thumbnail.
* @throws {Error} If the URL is invalid or the request fails.
* @example <caption>ESM</caption>
* import { youtube } from 'btch-downloader';
*
* const url = 'https://youtube.com/watch?v=C8mJ8943X80';
* youtube(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
* @example <caption>CJS</caption>
* const { youtube } = require('btch-downloader');
*
* const url = 'https://youtube.com/watch?v=C8mJ8943X80';
* youtube(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
*/
declare function youtube(url: string): Promise<YouTubeResponse>;
/**
* Facebook video downloader
* @async
* @function fbdown
*
* @param {string} url - The Facebook video URL (e.g., https://www.facebook.com/watch/?v=1393572814172251)
* @returns {Promise<FacebookResponse>} A JSON object containing Normal and HD quality download links.
* @throws {Error} If the URL is invalid or the media is not accessible.
* @example <caption>ESM</caption>
* import { fbdown } from 'btch-downloader';
*
* const url = 'https://www.facebook.com/watch/?v=1393572814172251';
* fbdown(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
* @example <caption>CJS</caption>
* const { fbdown } = require('btch-downloader');
*
* const url = 'https://www.facebook.com/watch/?v=1393572814172251';
* fbdown(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
*/
declare function fbdown(url: string): Promise<FacebookResponse>;
/**
* MediaFire file downloader
* @async
* @function mediafire
*
* @param {string} url - The MediaFire file URL (e.g., https://www.mediafire.com/file/941xczxhn27qbby/GBWA_V12.25FF-By.SamMods-.apk/file)
* @returns {Promise<MediaFireResponse>} A JSON object containing file metadata and download link.
* @throws {Error} If the URL is invalid or the request fails.
* @deprecated MediaFire support is no longer actively maintained.
* @example <caption>ESM</caption>
* import { mediafire } from 'btch-downloader';
*
* const url = 'https://www.mediafire.com/file/941xczxhn27qbby/GBWA_V12.25FF-By.SamMods-.apk/file';
* mediafire(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
* @example <caption>CJS</caption>
* const { mediafire } = require('btch-downloader');
*
* const url = 'https://www.mediafire.com/file/941xczxhn27qbby/GBWA_V12.25FF-By.SamMods-.apk/file';
* mediafire(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
*/
declare function mediafire(url: string): Promise<MediaFireResponse>;
/**
* CapCut template downloader
* @async
* @function capcut
*
* @param {string} url - The CapCut template URL (e.g., https://www.capcut.com/template-detail/7299286607478181121)
* @returns {Promise<CapCutResponse>} A JSON object containing template video links and metadata.
* @throws {Error} If the URL is invalid or the request fails.
* @example <caption>ESM</caption>
* import { capcut } from 'btch-downloader';
*
* const url = 'https://www.capcut.com/template-detail/7299286607478181121';
* capcut(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
* @example <caption>CJS</caption>
* const { capcut } = require('btch-downloader');
*
* const url = 'https://www.capcut.com/template-detail/7299286607478181121';
* capcut(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
*/
declare function capcut(url: string): Promise<CapCutResponse>;
/**
* All-In-One (AIO) downloader for various social platforms.
* @async
* @function aio
*
* @param {string} url - The media URL to download.
* @returns {Promise<AioResponse>} A JSON object containing media info.
* @throws {Error} If the URL is invalid or the request fails.
* @deprecated All-In-One support is no longer actively maintained.
* @example <caption>ESM</caption>
* import { aio } from 'btch-downloader';
*
* const url = 'https://vt.tiktok.com/ZSkGPK9Kj/';
* aio(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
* @example <caption>CJS</caption>
* const { aio } = require('btch-downloader');
*
* const url = 'https://vt.tiktok.com/ZSkGPK9Kj/';
* aio(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
*/
declare function aio(url: string): Promise<AioResponse>;
/**
* Google Drive file downloader
* @async
* @function gdrive
*
* @param {string} url - The Google Drive file URL (e.g., https://drive.google.com/file/d/1thDYWcS5p5FFhzTpTev7RUv0VFnNQyZ4/view)
* @returns {Promise<GoogleDriveResponse>} A JSON object containing file metadata and download link.
* @throws {Error} If the URL is invalid or the file is not public.
* @example <caption>ESM</caption>
* import { gdrive } from 'btch-downloader';
*
* const url = 'https://drive.google.com/file/d/1thDYWcS5p5FFhzTpTev7RUv0VFnNQyZ4/view';
* gdrive(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
* @example <caption>CJS</caption>
* const { gdrive } = require('btch-downloader');
*
* const url = 'https://drive.google.com/file/d/1thDYWcS5p5FFhzTpTev7RUv0VFnNQyZ4/view';
* gdrive(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
*/
declare function gdrive(url: string): Promise<GoogleDriveResponse>;
/**
* Pinterest content downloader or search
* @async
* @function pinterest
*
* @param {string} query - The Pinterest pin URL or a search query.
* @returns {Promise<PinterestResponse>} A JSON object containing pin media or search results.
* @throws {Error} If the input is invalid or the request fails.
* @example <caption>ESM (URL)</caption>
* import { pinterest } from 'btch-downloader';
*
* const url = 'https://pin.it/4CVodSq';
* pinterest(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
* @example <caption>ESM (Search)</caption>
* import { pinterest } from 'btch-downloader';
*
* const query = 'Zhao Lusi';
* pinterest(query).then(data => console.log(data)).catch(err => console.error(err)); // JSON
* @example <caption>CJS (URL)</caption>
* const { pinterest } = require('btch-downloader');
*
* const url = 'https://pin.it/4CVodSq';
* pinterest(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
* @example <caption>CJS (Search)</caption>
* const { pinterest } = require('btch-downloader');
*
* const query = 'Zhao Lusi';
* pinterest(query).then(data => console.log(data)).catch(err => console.error(err)); // JSON
*/
declare function pinterest(query: string): Promise<PinterestResponse>;
/**
* Xiaohongshu (Little Red Book / 小红书) downloader
* @async
* @function xiaohongshu
*
* @param {string} url - The Xiaohongshu post URL (e.g., http://xhslink.com/o/21DKXV988zp)
* @returns {Promise<XiaohongshuResponse>} A JSON object containing image/video links and post metadata.
* @throws {Error} If the URL is invalid or the content is not accessible.
* @example <caption>ESM</caption>
* import { xiaohongshu } from 'btch-downloader';
*
* const url = 'http://xhslink.com/o/21DKXV988zp';
* xiaohongshu(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
* @example <caption>CJS</caption>
* const { xiaohongshu } = require('btch-downloader');
*
* const url = 'http://xhslink.com/o/21DKXV988zp';
* xiaohongshu(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
*/
declare function xiaohongshu(url: string): Promise<XiaohongshuResponse>;
/**
* Xiaohongshu (Little Red Book / 小红书) user profile metadata
* @async
* @function xiaohongshuProfile
*
* @param {string} url - The Xiaohongshu profile URL (e.g., https://www.xiaohongshu.com/user/profile/67873204000000000803d9a5)
* @returns {Promise<XiaohongshuProfileResponse>} A JSON object containing user metadata.
* @throws {Error} If the URL is invalid or the content is not accessible.
* @example <caption>ESM</caption>
* import { xiaohongshuProfile } from 'btch-downloader';
*
* const url = 'https://www.xiaohongshu.com/user/profile/67873204000000000803d9a5';
* xiaohongshuProfile(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
* @example <caption>CJS</caption>
* const { xiaohongshuProfile } = require('btch-downloader');
*
* const url = 'https://www.xiaohongshu.com/user/profile/67873204000000000803d9a5';
* xiaohongshuProfile(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
*/
declare function xiaohongshuProfile(url: string): Promise<XiaohongshuProfileResponse>;
/**
* Douyin (抖音) downloader for videos and images
* @async
* @function douyin
*
* @param {string} url - The Douyin post URL (e.g., https://v.douyin.com/ikq8axJ/)
* @returns {Promise<DouyinResponse>} A JSON object containing media links and post metadata.
* @throws {Error} If the URL is invalid or the request fails.
* @example <caption>ESM</caption>
* import { douyin } from 'btch-downloader';
*
* const url = 'https://v.douyin.com/ikq8axJ/';
* douyin(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
* @example <caption>CJS</caption>
* const { douyin } = require('btch-downloader');
*
* const url = 'https://v.douyin.com/ikq8axJ/';
* douyin(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
*/
declare function douyin(url: string): Promise<DouyinResponse>;
/**
* SnackVideo content downloader
* @async
* @function snackvideo
*
* @param {string} url - The SnackVideo post URL (e.g., https://s.snackvideo.com/p/j9jKr9dR)
* @returns {Promise<SnackVideoResponse>} A JSON object containing video links and metadata.
* @throws {Error} If the URL is invalid or the content is not accessible.
* @example <caption>ESM</caption>
* import { snackvideo } from 'btch-downloader';
*
* const url = 'https://s.snackvideo.com/p/j9jKr9dR';
* snackvideo(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
* @example <caption>CJS</caption>
* const { snackvideo } = require('btch-downloader');
*
* const url = 'https://s.snackvideo.com/p/j9jKr9dR';
* snackvideo(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
*/
declare function snackvideo(url: string): Promise<SnackVideoResponse>;
/**
* Cocofun content downloader
* @async
* @function cocofun
*
* @param {string} url - The Cocofun post URL (e.g., https://www.icocofun.com/share/post/379250110809)
* @returns {Promise<CocofunResponse>} A JSON object containing media links and post metadata.
* @throws {Error} If the URL is invalid or the request fails.
* @example <caption>ESM</caption>
* import { cocofun } from 'btch-downloader';
*
* const url = 'https://www.icocofun.com/share/post/379250110809';
* cocofun(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
* @example <caption>CJS</caption>
* const { cocofun } = require('btch-downloader');
*
* const url = 'https://www.icocofun.com/share/post/379250110809';
* cocofun(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
*/
declare function cocofun(url: string): Promise<CocofunResponse>;
/**
* Spotify track downloader
* @async
* @function spotify
*
* @param {string} url - The Spotify track URL (e.g., https://open.spotify.com/track/3zakx7RAwdkUQlOoQ7SJRt)
* @returns {Promise<SpotifyResponse>} A JSON object containing track metadata and download links.
* @throws {Error} If the URL is invalid or the request fails.
* @example <caption>ESM</caption>
* import { spotify } from 'btch-downloader';
*
* const url = 'https://open.spotify.com/track/3zakx7RAwdkUQlOoQ7SJRt';
* spotify(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
* @example <caption>CJS</caption>
* const { spotify } = require('btch-downloader');
*
* const url = 'https://open.spotify.com/track/3zakx7RAwdkUQlOoQ7SJRt';
* spotify(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
*/
declare function spotify(url: string): Promise<SpotifyResponse>;
/**
* YouTube search engine
* @async
* @function yts
*
* @param {string} query - The search query for YouTube videos (e.g., Somewhere Only We Know)
* @returns {Promise<YtsResponse>} A JSON object containing a list of search results.
* @throws {Error} If the request fails.
* @example <caption>ESM</caption>
* import { yts } from 'btch-downloader';
*
* const query = 'Somewhere Only We Know';
* yts(query).then(data => console.log(data)).catch(err => console.error(err)); // JSON
* @example <caption>CJS</caption>
* const { yts } = require('btch-downloader');
*
* const query = 'Somewhere Only We Know';
* yts(query).then(data => console.log(data)).catch(err => console.error(err)); // JSON
*/
declare function yts(query: string): Promise<YtsResponse>;
/**
* SoundCloud track downloader
* @async
* @function soundcloud
*
* @param {string} url - The SoundCloud track URL (e.g., https://soundcloud.com/issabella-marchelina/sisa-rasa-mahalini-official-audio)
* @returns {Promise<SoundCloudResponse>} A JSON object containing track info and download links.
* @throws {Error} If the URL is invalid or the media is not accessible.
* @example <caption>ESM</caption>
* import { soundcloud } from 'btch-downloader';
*
* const url = 'https://soundcloud.com/issabella-marchelina/sisa-rasa-mahalini-official-audio';
* soundcloud(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
* @example <caption>CJS</caption>
* const { soundcloud } = require('btch-downloader');
*
* const url = 'https://soundcloud.com/issabella-marchelina/sisa-rasa-mahalini-official-audio';
* soundcloud(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
*/
declare function soundcloud(url: string): Promise<SoundCloudResponse>;
/**
* Threads (by Instagram) content downloader
* @async
* @function threads
*
* @param {string} url - The Threads post URL (e.g., https://www.threads.net/@cindyyuvia/post/C_Nqx3khgkI/)
* @returns {Promise<ThreadsResponse>} A JSON object containing media links and post metadata.
* @throws {Error} If the URL is invalid or the content is not accessible.
* @example <caption>ESM</caption>
* import { threads } from 'btch-downloader';
*
* const url = 'https://www.threads.net/@cindyyuvia/post/C_Nqx3khgkI/';
* threads(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
* @example <caption>CJS</caption>
* const { threads } = require('btch-downloader');
*
* const url = 'https://www.threads.net/@cindyyuvia/post/C_Nqx3khgkI/';
* threads(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
*/
declare function threads(url: string): Promise<ThreadsResponse>;
/**
* Kuaishou (快手) video downloader
* @async
* @function kuaishou
*
* @param {string} url - The Kuaishou video URL (e.g., https://v.kuaishou.com/JT195ZHT)
* @returns {Promise<KuaishouResponse>} A JSON object containing video metadata and download link.
* @throws {Error} If the URL is invalid or the request fails.
* @example <caption>ESM</caption>
* import { kuaishou } from 'btch-downloader';
*
* const url = 'https://v.kuaishou.com/JT195ZHT';
* kuaishou(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
* @example <caption>CJS</caption>
* const { kuaishou } = require('btch-downloader');
*
* const url = 'https://v.kuaishou.com/JT195ZHT';
* kuaishou(url).then(data => console.log(data)).catch(err => console.error(err)); // JSON
*/
declare function kuaishou(url: string): Promise<KuaishouResponse>;
export { fbdown, igdl, ttdl, twitter, youtube, mediafire, capcut, gdrive, pinterest, aio, xiaohongshu, xiaohongshuProfile, douyin, snackvideo, cocofun, spotify, yts, soundcloud, threads, kuaishou, version as VERSION, wm as developer, issues };
//# sourceMappingURL=index.d.ts.map