2022-04-30 21:45:03 -04:00
|
|
|
const hastebin = require("hastebin-gen");
|
2022-07-19 15:41:49 +03:00
|
|
|
const { addComplaintButton } = require('../dev only/submitcomplaint');
|
2022-04-30 21:45:03 -04:00
|
|
|
|
2022-03-10 20:30:03 -05:00
|
|
|
module.exports ={
|
2022-05-13 22:03:05 +03:00
|
|
|
name: "scrape",
|
2022-03-10 20:30:03 -05:00
|
|
|
description: ".....",
|
2022-05-13 22:03:05 +03:00
|
|
|
async execute(message, args, Discord, Client, bot) {
|
2022-03-10 20:30:03 -05:00
|
|
|
const axios = require('axios');
|
2022-05-25 22:33:42 +03:00
|
|
|
const cheerio = require('cheerio');
|
2022-03-10 20:30:03 -05:00
|
|
|
const url = args[0];
|
|
|
|
|
axios(url)
|
2022-04-30 21:45:03 -04:00
|
|
|
.then(async response => {
|
2022-03-10 20:30:03 -05:00
|
|
|
const html = response.data;
|
|
|
|
|
const $ = cheerio.load(html);
|
2022-04-30 21:07:16 -04:00
|
|
|
//lyrics = $('.para_row').text();
|
2022-07-16 19:26:06 +03:00
|
|
|
|
2022-04-30 21:45:03 -04:00
|
|
|
const haste = await hastebin(html, { extension: "txt" });
|
2022-07-16 19:26:06 +03:00
|
|
|
message.channel.send(haste);
|
2022-04-30 21:09:16 -04:00
|
|
|
// console.log(lyrics);
|
2022-03-10 20:30:03 -05:00
|
|
|
})
|
2022-05-24 09:10:12 +03:00
|
|
|
.catch(function(err) {
|
2022-05-25 22:33:42 +03:00
|
|
|
if (err.message.indexOf('The "url" argument must be of type string') != -1) {
|
2022-05-24 09:10:12 +03:00
|
|
|
message.reply("The URL should be a string!");
|
2022-07-16 19:26:06 +03:00
|
|
|
} else if (err.code == 'ERR_BAD_REQUEST') {
|
|
|
|
|
message.reply("404 link not valid!")
|
2022-05-25 22:33:42 +03:00
|
|
|
} else {
|
2022-07-19 15:41:49 +03:00
|
|
|
message.reply("Oops! There's been an error, click the ✅ to report this!");
|
|
|
|
|
addComplaintButton(bot, message);
|
|
|
|
|
console.log(err);
|
2022-05-24 09:10:12 +03:00
|
|
|
}
|
|
|
|
|
});
|
2022-03-10 20:30:03 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//TEST: https://www.karaoketexty.cz/texty-pisni/zoegirl/plain-170199
|