Facebook
From Z, 1 Month ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 140
  1.  const axios = require("axios");
  2. const ytdl = require("@distube/ytdl-core");
  3. const fs = require("fs-extra");
  4. const { getStreamFromURL, downloadFile, formatNumber } = global.utils;
  5. async function getStreamAndSize(url, path = "") {
  6.   const response = await axios({
  7.     method: "GET",
  8.     url,
  9.     responseType: "stream",
  10.     headers: {
  11.       'Range': 'bytes=0-'
  12.     }
  13.   });
  14.   if (path)
  15.     response.data.path = path;
  16.   const totalLength = response.headers["content-length"];
  17.   return {
  18.     stream: response.data,
  19.     size: totalLength
  20.   };
  21. }
  22.  
  23. module.exports = {
  24.   config: {
  25.     name: "sing",
  26.     version: "1.14",
  27.     author: "JISHAN76",
  28.     countDown: 5,
  29.     role: 0,
  30.     shortDescription: "YouTube",
  31.     longDescripion: {
  32.       vi: "Tải video, audio hoặc xem thông tin video trên YouTube",
  33.       en: "Download video from YouTube"
  34.     },
  35.     category: "media",
  36.     guie: {
  37.       vi: "   {pn} [video|-v] [<tên video>|&lt;link video&gt;]: dùng để tải video từ youtube."
  38.         + "\n   Ví dụ:"
  39.         + "\n    {pn} -v Fallen Kingdom"
  40.         + "\n    {pn} -a Fallen Kingdom"
  41.         + "\n    {pn} -i Fallen Kingdom",
  42.       en: "   {pn} [video|-v] [&lt;video name&gt;|&lt;video link&gt;]: use to download video from youtube."
  43.         + "\n   {pn} [audio|-a] [&lt;video name&gt;|&lt;video link&gt;]: use to download audio from youtube"
  44.         + "\n   {pn} [info|-i] [&lt;video name&gt;|&lt;video link&gt;]: use to view video information from youtube"
  45.         + "\n   Example:"
  46.         + "\n    {pn} -v Fallen Kingdom"
  47.         + "\n    {pn} -a Fallen Kingdom"
  48.         + "\n    {pn} -i Fallen Kingdom"
  49.     }
  50.   },
  51.  
  52.   langs: {
  53.     vi: {
  54.       error: "❌ Đã xảy ra lỗi: %1",
  55.       noResult: "⭕ Không có kết quả tìm kiếm nào phù hợp với từ khóa %1",
  56.