StableBOT / lib /MediaFire.js
RamaZyx's picture
Upload folder using huggingface_hub
a2b2aac verified
//import { Axios, Cheerio } from "../Utils.js";
import axios from "axios";
import cheerio from "cheerio";
async function mediafire(query) {
return new Promise((resolve, reject) => {
axios.get(query)
.then(({
data
}) => {
const $ = cheerio.load(data)
const judul = $('body > div.mf-dlr.page.ads-alternate > div.content > div.center > div > div.dl-btn-cont > div.dl-btn-labelWrap > div.promoDownloadName.notranslate > div').text();
const size = $('body > div.mf-dlr.page.ads-alternate > div.content > div.center > div > div.dl-info > ul > li:nth-child(1) > span').text();
const upload_date = $('body > div.mf-dlr.page.ads-alternate > div.content > div.center > div > div.dl-info > ul > li:nth-child(2) > span').text();
const link = $('#downloadButton').attr('href')
const hsil = {
judul: link.split('/')[5],
upload_date: upload_date,
size: size,
mime: link.split('/')[5].split('.')[1],
link: link
}
resolve(hsil)
})
.catch(reject)
})
}
export {
mediafire
}