Domcurl
cUrl-like utility for fetching a resource (in this case we will run JS and return after network is idle) - great for JS heavy apps
Install / Use
/learn @PaulKinlan/DomcurlREADME
domcurl
cUrl-like utility for fetching a resource (in this case we will run JS and return after network is idle) - great for JS heavy apps.
Installation
npm i domcurl
Usage
Basic usage
domcurl [url]
or
domcurl --url https://example.com
<!DOCTYPE html><html><head>
<title>Example Domain</title>
<meta charset="utf-8">
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
body {
background-color: #f0f0f2;
margin: 0;
padding: 0;
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
div {
width: 600px;
margin: 5em auto;
padding: 50px;
background-color: #fff;
border-radius: 1em;
}
a:link, a:visited {
color: #38488f;
text-decoration: none;
}
@media (max-width: 700px) {
body {
background-color: #fff;
}
div {
width: auto;
margin: 0 auto;
border-radius: 0;
padding: 1em;
}
}
</style>
</head>
<body>
<div>
<h1>Example Domain</h1>
<p>This domain is established to be used for illustrative examples in documents. You may use this
domain in examples without prior coordination or asking for permission.</p>
<p><a href="http://www.iana.org/domains/example">More information...</a></p>
</div>
</body></html>
Verbose output
Renders more details about the request and the response.
domcurl -v [url]
> GET /
> Host: example.com
> upgrade-insecure-requests: 1
> user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/66.0.3347.0 Safari/537.36
< date: Wed, 28 Feb 2018 03:04:47 GMT
< content-encoding: gzip
< last-modified: Fri, 09 Aug 2013 23:54:35 GMT
< server: ECS (oxr/837E)
< etag: "1541025663+gzip"
< vary: Accept-Encoding
< x-cache: HIT
< content-type: text/html
< status: 200
< cache-control: max-age=604800
< content-length: 606
< expires: Wed, 07 Mar 2018 03:04:47 GMT
<!DOCTYPE html><html><head>
<title>Example Domain</title>
<meta charset="utf-8">
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
body {
background-color: #f0f0f2;
margin: 0;
padding: 0;
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
div {
width: 600px;
margin: 5em auto;
padding: 50px;
background-color: #fff;
border-radius: 1em;
}
a:link, a:visited {
color: #38488f;
text-decoration: none;
}
@media (max-width: 700px) {
body {
background-color: #fff;
}
div {
width: auto;
margin: 0 auto;
border-radius: 0;
padding: 1em;
}
}
</style>
</head>
<body>
<div>
<h1>Example Domain</h1>
<p>This domain is established to be used for illustrative examples in documents. You may use this
domain in examples without prior coordination or asking for permission.</p>
<p><a href="http://www.iana.org/domains/example">More information...</a></p>
</div>
</body></html>
Send output to a file
domcurl --url https://example.com -o test.txt
or
domcurl --url https://example.com --output test.txt
Redirect stderr to a file
Redirect all writes to stderr to the specified file instead. If the file name is a plain -, it is instead written to stdout.
domcurl --url https://example.com --stderr error.txt
or redirect stderr to stdout:
domcurl --url https://example.com --stderr -
If this option is used several times, the last one will be used.
Set a custom header
domcurl --url https://example.com -H 'x-test:test1' -H 'x-test2:http://test.com'
Specify HTTP method
Use different HTTP methods like POST, PUT, DELETE, etc.
domcurl --url https://example.com -X POST
or
domcurl --url https://example.com --request PUT
Send data with request
Send data in the request body (useful for POST/PUT requests).
domcurl --url https://example.com -X POST -d "param1=value1¶m2=value2"
or
domcurl --url https://example.com -X POST --data "param1=value1¶m2=value2"
Set a cookie
Sets a cookie on the request. It must be a valid Cookie string.
domcurl [url] -b "test=hello; Domain=airhorner.com; HttpOnly;"
Unlike cUrl you can multiple cookies by appending more -b arguments
domcurl [url] -b "test=hello; Domain=airhorner.com; HttpOnly;" -b "hello=world; Domain=airhorner.com; HttpOnly;"
Specify a request timeout
By default the command will timeout after 30 seconds. You can specify how long the command will wait before it errors.
domcurl --url https://example.com -m 60
or
domcurl --url https://example.com --max-time 60
Specify a trace file
Output a Chrome DevTools trace file (including screenshots.)
domcurl --url https://example.com --trace test.json
Set viewport size
Set the viewport size for the browser. This is useful for testing responsive designs and media queries.
domcurl --url https://example.com -V 1920x1080
or
domcurl --url https://example.com --viewport 375x667
The viewport format is WIDTHxHEIGHT in pixels. Common viewport sizes:
- Desktop:
1920x1080,1366x768,1440x900 - Tablet:
768x1024,1024x768 - Mobile:
375x667,414x896,360x640
Using as a module
npm i domcurl
` const {domcurl} = require('domcurl');
domcurl(https://paul.kinlan.me/, {});
`
Related Skills
node-connect
352.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
352.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
352.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
