summaryrefslogtreecommitdiff
path: root/curl.js
diff options
context:
space:
mode:
authorhaturatu <taro@eyes4you.org>2025-01-19 16:02:43 +0900
committerhaturatu <taro@eyes4you.org>2025-01-19 16:02:43 +0900
commitcabacc6bc2924167a81dcab4f844b53401a31f8c (patch)
tree1f348ad2a52daf1b55c39ca397724b4a6f0effa0 /curl.js
first commit
Diffstat (limited to 'curl.js')
-rw-r--r--curl.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/curl.js b/curl.js
new file mode 100644
index 0000000..a75ba3d
--- /dev/null
+++ b/curl.js
@@ -0,0 +1,28 @@
+const puppeteer = require('puppeteer');
+
+(async () => {
+ // 第一引数からURLを取得
+ const url = process.argv[2];
+ if (!url) {
+ console.error('Error: URL not provided.');
+ process.exit(1);
+ }
+
+ const browser = await puppeteer.launch({ headless: true });
+ const page = await browser.newPage();
+
+ // 特定のURLにアクセス
+ await page.goto(url, {
+ waitUntil: 'networkidle2', // ネットワークがアイドル状態になるまで待機
+ });
+
+ // 5秒間待機
+ await page.waitForTimeout(5000);
+
+ // ページのHTMLを取得
+ const html = await page.content();
+ console.log(html);
+
+ await browser.close();
+})();
+