rapiddns-io-scrapper
Advanced tools
Comparing version 0.0.2 to 0.1.0
@@ -1,1 +0,55 @@ | ||
module.exports = null; | ||
const { default: axios } = require('axios'); | ||
const userAgent = require('./user-agent'); | ||
const getResultEntries = require('./get-result-entries'); | ||
/** | ||
* @typedef ResultEntry | ||
* @type {object} | ||
* @property {string} domain | ||
* @property {string} address | ||
* @property {string} type | ||
* @property {string} date | ||
*/ | ||
/** | ||
* Query to rapiddns.io | ||
* | ||
* @param {string} query - eg: '9.9.9.9', 'slashdot.org' | ||
* @param {('subdomain'|'sameip')} [queryType] - optional, can be 'subdomain' or 'sameip' | ||
* @returns {Promise<ResultEntry[]>} | ||
*/ | ||
module.exports = async (query, queryType) => { | ||
let baseUrl = 'https://rapiddns.io/s'; | ||
if (queryType === 'subdomain') { | ||
baseUrl = 'https://rapiddns.io/subdomain'; | ||
} else if (queryType === 'sameip') { | ||
baseUrl = 'https://rapiddns.io/sameip'; | ||
} | ||
const endpoint = `${baseUrl}/${query}?full=1&down=1`; | ||
try { | ||
const response = await axios.get(endpoint, { | ||
timeout: 30 * 1000, | ||
headers: { | ||
'User-Agent': userAgent | ||
} | ||
}); | ||
return getResultEntries(response.data) | ||
.map((entry) => { | ||
const [domain, address, type, date] = entry; | ||
return { | ||
domain, | ||
address, | ||
type, | ||
date | ||
}; | ||
}); | ||
} catch (e) { | ||
const newE = new Error('RAPIDDNS-IO-SCRAPPER: Exception'); | ||
newE.code = 'RAPIDDNS-IO-SCRAPPER-EXCEPTION'; | ||
newE.originalE = e; | ||
throw newE; | ||
} | ||
}; |
{ | ||
"name": "rapiddns-io-scrapper", | ||
"version": "0.0.2", | ||
"version": "0.1.0", | ||
"description": "Node.js module to scrape and extract result from rapiddns.io", | ||
"main": "lib/index.js", | ||
"main": "./lib/index.js", | ||
"module": "./lib/index.js", | ||
"scripts": { | ||
"test": "mocha --bail --recursive test", | ||
"test-watch": "mocha --watch --bail --recursive test", | ||
"postversion": "git push && git push --tags", | ||
"version": "auto-changelog -p && git add CHANGELOG.md" | ||
"version": "auto-changelog -p && git add CHANGELOG.md; cp -fv .gitignore .npmignore; echo >> .npmignore; cat npmignore-list >> .npmignore; git add .npmignore" | ||
}, | ||
@@ -34,3 +36,9 @@ "repository": { | ||
"should": "^13.2.3" | ||
}, | ||
"engines": { | ||
"node": ">=16" | ||
}, | ||
"dependencies": { | ||
"axios": "^1.6.5" | ||
} | ||
} |
@@ -1,2 +0,6 @@ | ||
# node-rapiddns-io-scrapper | ||
# RapidDNS scrapper | ||
[![Version npm](https://img.shields.io/npm/v/rapiddns-io-scrapper)](https://www.npmjs.com/package/rapiddns-io-scrapper) | ||
[![node.js version](https://img.shields.io/node/v/rapiddns-io-scrapper)](https://www.npmjs.com/package/rapiddns-io-scrapper) | ||
Node.js module to scrape and extract result from [rapiddns.io](https://rapiddns.io) (unofficial). | ||
@@ -3,0 +7,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
4689
65
13
0
1
+ Addedaxios@^1.6.5
+ Addedasynckit@0.4.0(transitive)
+ Addedaxios@1.7.8(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedfollow-redirects@1.15.9(transitive)
+ Addedform-data@4.0.1(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedproxy-from-env@1.1.0(transitive)