1.0.4 • Published 6 years ago
spoopylink v1.0.4
spoopylink
Installation
$ npm i --save spoopylink
const checkSpoopy = require("spoopylink");
// checkSpoopy(links, timeout).then(result => { do.some("code"); });
// links = string or array. The difference is that if you give it an array. it will return an array for each link.
// timeout = timeout in ms before it decides to say the service is down or the link is invalid. (default is 5000 = 5s)
checkSpoopy("google.com").then(console.log); // Single link Example
checkSpoopy([ "google.com", "github.com" ]).then(console.log); // Multiple links Example
checkSpoopy("https://to.free-gg.com/jr09e90-fake-promo-code-for-demonstration").then(console.log); // Unsafe link Example
checkSpoopy("https://free-gg.com").then(console.log); // Unsafe link Example (Direct)
checkSpoopy("invalid link").then(console.log); // Invalid link Example
// SERVICE OFFLINE
checkSpoopy("google.com").then(console.log); // Service offline Example
Single Link Example & Explanation
{
"url": "http://google.com", // the link that it returned information for. It might not be the same as the parameter shown above.
"urlSafe": true, // If the URL (not redirects) is safe.
"safe": true, // If the URL is safe even if redirected to other places.
"urlReasons": [], // The URL's (not redirects) reasons for being unsafe.
"reasons": [], // The URL and resirects' reasons for being unsafe.
"redirects": [
{
"url": "http://www.google.com/", // http://google.com => http://www.google.com
"reasons": [], // The redirection's reasons for being unsafe.
"safe": true // If the redirection is safe.
}
]
}
Multiple links Example
[
{
"url": "http://google.com",
"urlSafe": true,
"safe": true,
"urlReasons": [],
"reasons": [],
"redirects": [
{
"url": "http://www.google.com/",
"reasons": [],
"safe": true
}
]
},
{
"url": "https://github.com",
"urlSafe": true,
"safe": true,
"urlReasons": [],
"reasons": [],
"redirects": []
}
]
Unsafe link Example
{
"url": "https://to.free-gg.com/jr09e90-fake-promo-code-for-demonstration-purposes",
"urlSafe": true,
"safe": false,
"urlReasons": [],
"reasons": [
"CHILD_SAFETY"
],
"redirects": [
{
"url": "https://free-gg.com",
"reasons": [
"CHILD_SAFETY"
],
"safe": false
}
]
}
Unsafe link Example (Direct)
{
"url": "https://free-gg.com",
"urlSafe": false,
"safe": false,
"urlReasons": [
"CHILD_SAFETY"
],
"reasons": [
"CHILD_SAFETY"
],
"redirects": []
}
Invalid link Example
{
"url": "invalid%20link",
"error": {
"message": "network timeout at: https://spoopy.link/api/invalid%20link",
"type": "request-timeout"
}
}
Service Offline Example
{
url: 'google.com',
error: {
FetchError: invalid json response body at https://spoopy.link/api/google.com reason: Unexpected token < in JSON at position 0
at E:\KilldorePlayz\Documents\Discord\Bots\Pending Promise\node_modules\spoopylink\node_modules\node-fetch\lib\index.js:239:32
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
message: 'invalid json response body at https://spoopy.link/api/google.com reason: Unexpected token < in JSON at position 0',
type: 'invalid-json'
}
}
Unsafe Reasons
[
"UNSAFE_LINK", // the link is unsafe, containing malware or similar.
"REDIRECT_COUNT", // the link redirected more than 4 times.
"PHISHTANK", // the link is phishing your contact informastion or similar.
"CHILD_SAFETY" // the link is not safe, containing pornographic or scam pages
]
Credits
- @devsnek - spoopy.link Developer