Download lib/uploader.js from hakisolos/king_bug: direct link, hf CLI and curl.
- Browser
- Download file 3.21 kB
-
https://huggingface.co/spaces/hakisolos/king_bug/resolve/main/lib/uploader.js
- Command line
-
hf download hf://spaces/hakisolos/king_bug/lib/uploader.js
-
curl -L -o uploader.js https://huggingface.co/spaces/hakisolos/king_bug/resolve/main/lib/uploader.js
3.21 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 | |
| let axios = require('axios') | |
| let BodyForm = require('form-data') | |
| let { fromBuffer } = require('file-type') | |
| let fetch = require('node-fetch') | |
| let fs = require('fs') | |
| let cheerio = require('cheerio') | |
| function 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))) | |
| } | |
| }) | |
| } | |
| async function UploadFileUgu (input) { | |
| return new Promise (async (resolve, reject) => { | |
| const form = new BodyForm(); | |
| form.append("files[]", fs.createReadStream(input)) | |
| await axios({ | |
| url: "https://uguu.se/upload.php", | |
| method: "POST", | |
| headers: { | |
| "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36", | |
| ...form.getHeaders() | |
| }, | |
| data: form | |
| }).then((data) => { | |
| resolve(data.data.files[0]) | |
| }).catch((err) => reject(err)) | |
| }) | |
| } | |
| function webp2mp4File(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 MRHRTZ", | |
| result: result | |
| }) | |
| }).catch(reject) | |
| }).catch(reject) | |
| }) | |
| } | |
| async function floNime(medianya, options = {}) { | |
| const { ext } = await fromBuffer(medianya) || options.ext | |
| var form = new BodyForm() | |
| form.append('file', medianya, 'tmp.'+ext) | |
| let jsonnya = await fetch('https://flonime.my.id/upload', { | |
| method: 'POST', | |
| body: form | |
| }) | |
| .then((response) => response.json()) | |
| return jsonnya | |
| } | |
| module.exports = { TelegraPh, UploadFileUgu, webp2mp4File, floNime } | |