@rqt/namecheap-web
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -7,2 +7,3 @@ const { debuglog } = require('util'); | ||
const { deepEqual } = require('./lib'); | ||
const { Session } = require('rqt'); | ||
@@ -44,2 +45,22 @@ const LOG = debuglog('@rqt/namecheap-web') | ||
static async WHOIS(domain) { | ||
const s = new Session({ | ||
host: 'https://www.namecheap.com/domains/whois', | ||
headers: { | ||
'User-Agent': USER_AGENT, | ||
}, | ||
}) | ||
const res = await s.rqt(`/results.aspx?domain=${domain}`) | ||
const re = /var url = "\/domains\/whois\/whois-ajax\.aspx\?(.+?)"/ | ||
const reRes = re.exec(res) | ||
if (!reRes) throw new Error('Could not find the AJAX request URL.') | ||
const [, params] = reRes | ||
const res2 = await s.rqt(`/whois-ajax.aspx?${params}`) | ||
const re2 = /<pre id=".+?_whoisResultText" class="wrapped whois">([\s\S]+)<\/pre>/ | ||
const re2Res = re2.exec(res2) | ||
if (!re2Res) throw new Error('Could not extract data.') | ||
const [, whois] = re2Res | ||
return whois | ||
} | ||
async auth(username, password, phone, force) { | ||
@@ -62,2 +83,3 @@ let cookies | ||
cookies = await authenticator.signIn() | ||
await this._saveSession(cookies) | ||
} | ||
@@ -64,0 +86,0 @@ |
@@ -0,1 +1,7 @@ | ||
## 2 October 2018 | ||
### 1.1.0 | ||
- [feature] Write the `whois` requests. | ||
## 27 September 2018 | ||
@@ -2,0 +8,0 @@ |
{ | ||
"name": "@rqt/namecheap-web", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "An API to namecheap.com via the web interface, with an ability to log in using 2-factor Auth and check Whois.", | ||
@@ -19,3 +19,4 @@ "main": "build", | ||
"e": "node example", | ||
"example/": "yarn e example/example.js" | ||
"example/": "yarn e example/example.js", | ||
"example/whois.js": "yarn e example/whois.js" | ||
}, | ||
@@ -22,0 +23,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
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
64805
530