From 95dd8ae90a43c9dd31349cdb55af4048955f048a Mon Sep 17 00:00:00 2001 From: March 7th <71698422+aiko-chan-ai@users.noreply.github.com> Date: Fri, 1 Apr 2022 18:26:43 +0700 Subject: [PATCH] WebEmbed shorten api --- src/structures/WebEmbed.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/structures/WebEmbed.js b/src/structures/WebEmbed.js index 1f71e3c..e5e8296 100644 --- a/src/structures/WebEmbed.js +++ b/src/structures/WebEmbed.js @@ -287,18 +287,22 @@ class WebEmbed { } } -// API by Shiraori#1782 (me) + // Credit: https://www.npmjs.com/package/node-url-shortener + google :)) const getShorten = async (url) => { - // Please not using this API, it's hosting in Heroku, very slow + const APIurl = [ + 'https://is.gd/create.php?format=simple&url=', + 'https://tinyurl.com/api-create.php?url=', + // 'https://cdpt.in/shorten?url=', Redirects 5s :( + ]; try { - const res = await axios - .post('https://sagiri-fansub.tk/api/v1/embed', { - url, - }) - return `https://sagiri-fansub.tk/api/v1/embed/${res.data.path}`; + const res = await axios.get( + `${APIurl[Math.floor(Math.random() * APIurl.length)]}${url}`, + ); + return `${res.data}`; } catch { return void 0; } } -module.exports = WebEmbed; \ No newline at end of file +module.exports = WebEmbed; +module.exports.hiddenEmbed = hiddenCharter; \ No newline at end of file