From 953ddd82e48dd206cef5ac94456549aed13b3ad5 Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Fri, 17 Nov 2023 23:25:29 +0100 Subject: Updated 30 files and deleted 2976 files (automated) --- includes/external/addressbook/website.js | 57 -------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 includes/external/addressbook/website.js (limited to 'includes/external/addressbook/website.js') diff --git a/includes/external/addressbook/website.js b/includes/external/addressbook/website.js deleted file mode 100644 index 48aa072..0000000 --- a/includes/external/addressbook/website.js +++ /dev/null @@ -1,57 +0,0 @@ -const axios = require('axios'); -const ogs = require('open-graph-scraper'); - -function sleep(ms) { - return new Promise((res) => { - setTimeout(res, ms); - }); -} - -(async () => { - let user = process.argv[2]; - - try { - let url = new URL(user); - let data = (await ogs({ url: user })); - - if (data.error) throw data.error; - if (!data.result.success) throw new Error("Failed"); - - let obj = { - error: null, - avatar: data.result.favicon.startsWith("/") ? url.origin + data.result.favicon : ((data.result.favicon.startsWith("http:") || data.result.favicon.startsWith("https:")) ? data.result.favicon : data.result.requestUrl + "/" + data.result.favicon), - name: data.result.ogTitle, - description: url.host + (url.pathname === "/" ? "" : url.pathname), - link: data.result.requestUrl, - copy: [ - { - title: "Copy URL", - text: data.result.requestUrl - }, - { - title: "Copy URL to favicon", - text: data.result.favicon.startsWith("/") ? url.origin + data.result.favicon : ((data.result.favicon.startsWith("http:") || data.result.favicon.startsWith("https:")) ? data.result.favicon : data.result.requestUrl + "/" + data.result.favicon) - }, - { - title: "Copy home URL", - text: url.origin - }, - { - title: "Copy page title", - text: data.result.ogTitle - } - ] - } - - console.log(JSON.stringify(obj, null, 2)); - } catch (e) { - console.log(JSON.stringify({ - error: e, - avatar: "https://img.icons8.com/fluency-systems-regular/64/ffffff/globe.png", - name: user, - description: "Website", - link: null, - copy: [] - }, null, 2)); - } -})(); \ No newline at end of file -- cgit