Download lib/myfunc2.js from hakisolos/king_bug: direct link, hf CLI and curl.
- Browser
- Download file 5.37 kB
-
https://huggingface.co/spaces/hakisolos/king_bug/resolve/main/lib/myfunc2.js
- Command line
-
hf download hf://spaces/hakisolos/king_bug/lib/myfunc2.js
-
curl -L -o myfunc2.js https://huggingface.co/spaces/hakisolos/king_bug/resolve/main/lib/myfunc2.js
5.37 kB
| //base by DGXeon (Xeon Bot Inc.) | |
| //re-upload? recode? copy code? give credit ya :) | |
| //YouTube: @DGXeon | |
| //Instagram: unicorn_xeon13 | |
| //Telegram: t.me/xeonbotinc | |
| //GitHub: @DGXeon | |
| //WhatsApp: +916909137213 | |
| //want more free bot scripts? subscribe to my youtube channel: https://youtube.com/@DGXeon | |
| var __importDefault = (this && this.__importDefault) || function (mod) { | |
| return (mod && mod.__esModule) ? mod : { "default": mod } | |
| } | |
| Object.defineProperty(exports, "__esModule", { value: true }) | |
| const axios = require("axios") | |
| const cheerio = require("cheerio") | |
| const { resolve } = require("path") | |
| const util = require("util") | |
| let BodyForm = require('form-data') | |
| let { fromBuffer } = require('file-type') | |
| //let fetch = require('node-fetch') | |
| let fs = require('fs') | |
| const child_process = require('child_process') | |
| const ffmpeg = require('fluent-ffmpeg') | |
| const {unlink } = require ('fs').promises | |
| exports.sleep = async (ms) => { | |
| return new Promise(resolve => setTimeout(resolve, ms)); | |
| } | |
| exports.fetchJson = async (url, options) => { | |
| try { | |
| options ? options : {} | |
| const res = await axios({ | |
| method: 'GET', | |
| url: url, | |
| headers: { | |
| 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36' | |
| }, | |
| ...options | |
| }) | |
| return res.data | |
| } catch (err) { | |
| return err | |
| } | |
| } | |
| exports.fetchBuffer = async (url, options) => { | |
| try { | |
| options ? options : {} | |
| const res = await axios({ | |
| method: "GET", | |
| url, | |
| headers: { | |
| "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36", | |
| 'DNT': 1, | |
| 'Upgrade-Insecure-Request': 1 | |
| }, | |
| ...options, | |
| responseType: 'arraybuffer' | |
| }) | |
| return res.data | |
| } catch (err) { | |
| return err | |
| } | |
| } | |
| exports.webp2mp4File=async(path) =>{ | |
| return new Promise((resolve, reject) => { | |
| const form = new BodyForm() | |
| form.append('new-image-url', '') | |
| form.append('new-image', fs.createReadStream(path)) | |
| axios({ | |
| method: 'post', | |
| url: 'https://s6.ezgif.com/webp-to-mp4', | |
| data: form, | |
| headers: { | |
| 'Content-Type': `multipart/form-data; boundary=${form._boundary}` | |
| } | |
| }).then(({ data }) => { | |
| const bodyFormThen = new BodyForm() | |
| const $ = cheerio.load(data) | |
| const file = $('input[name="file"]').attr('value') | |
| bodyFormThen.append('file', file) | |
| bodyFormThen.append('convert', "Convert WebP to MP4!") | |
| axios({ | |
| method: 'post', | |
| url: 'https://ezgif.com/webp-to-mp4/' + file, | |
| data: bodyFormThen, | |
| headers: { | |
| 'Content-Type': `multipart/form-data; boundary=${bodyFormThen._boundary}` | |
| } | |
| }).then(({ data }) => { | |
| const $ = cheerio.load(data) | |
| const result = 'https:' + $('div#output > p.outfile > video > source').attr('src') | |
| resolve({ | |
| status: true, | |
| message: "Created By Eternity", | |
| result: result | |
| }) | |
| }).catch(reject) | |
| }).catch(reject) | |
| }) | |
| } | |
| exports.fetchUrl = async (url, options) => { | |
| try { | |
| options ? options : {} | |
| const res = await axios({ | |
| method: 'GET', | |
| url: url, | |
| headers: { | |
| 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36' | |
| }, | |
| ...options | |
| }) | |
| return res.data | |
| } catch (err) { | |
| return err | |
| } | |
| } | |
| exports.WAVersion = async () => { | |
| let get = await exports.fetchUrl("https://web.whatsapp.com/check-update?version=1&platform=web") | |
| let version = [get.currentVersion.replace(/[.]/g, ", ")] | |
| return version | |
| } | |
| exports.getRandom = (ext) => { | |
| return `${Math.floor(Math.random() * 10000)}${ext}` | |
| } | |
| exports.isUrl = (url) => { | |
| return url.match(new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/, 'gi')) | |
| } | |
| exports.isNumber = (number) => { | |
| const int = parseInt(number) | |
| return typeof int === 'number' && !isNaN(int) | |
| } | |
| exports.TelegraPh= (Path) =>{ | |
| return new Promise (async (resolve, reject) => { | |
| if (!fs.existsSync(Path)) return reject(new Error("File not Found")) | |
| try { | |
| const form = new BodyForm(); | |
| form.append("file", fs.createReadStream(Path)) | |
| const data = await axios({ | |
| url: "https://telegra.ph/upload", | |
| method: "POST", | |
| headers: { | |
| ...form.getHeaders() | |
| }, | |
| data: form | |
| }) | |
| return resolve("https://telegra.ph" + data.data[0].src) | |
| } catch (err) { | |
| return reject(new Error(String(err))) | |
| } | |
| }) | |
| } | |
| const sleepy = async (ms) => { | |
| return new Promise(resolve => setTimeout(resolve, ms)); | |
| } | |
| exports.buffergif = async (image) => { | |
| const filename = `${Math.random().toString(36)}` | |
| await fs.writeFileSync(`./XeonMedia/trash/${filename}.gif`, image) | |
| child_process.exec( | |
| `ffmpeg -i ./XeonMedia/trash/${filename}.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" ./XeonMedia/trash/${filename}.mp4` | |
| ) | |
| await sleepy(4000) | |
| var buffer5 = await fs.readFileSync(`./XeonMedia/trash/${filename}.mp4`) | |
| Promise.all([unlink(`./XeonMedia/video/${filename}.mp4`), unlink(`./XeonMedia/gif/${filename}.gif`)]) | |
| return buffer5 | |
| } |