Skip to content

Instantly share code, notes, and snippets.

@takahashim
Created January 15, 2023 13:33
Show Gist options
  • Save takahashim/d505c3c8984423fdfe537d2035863230 to your computer and use it in GitHub Desktop.
Save takahashim/d505c3c8984423fdfe537d2035863230 to your computer and use it in GitHub Desktop.
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://www.kdpcommunity.com/s/announcement-archive?language=ja', { waitUntil: 'networkidle0' });
const src = await page.content();
console.log(src);
await browser.close();
{
"name": "kindle_scraping",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"puppeteer": "^19.5.2"
}
}
@takahashim
Copy link
Author

上記スクリプトの使い方:

  1. node.jsとnpmをインストールする
  2. 適当なディレクトリを作る
  3. その中に、package.jsonとindex.jsを置く
  4. そのディレクトリで、npm installを実行する
  5. 同じディレクトリで、node index.jsを実行する

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment