Pull posts of https://www.pluralsight.com
-
run
npm init -y
, create a default package.json file in your project's root folder. -
install typescript use
npm i -D typescript
. -
initialize typescript config file.
tsc --init
or if you never install typescript at global, you can run this command through./node_modules/typescript/bin/tsc --init
, then you'll see thetsconfig.json
file created in root path. -
make a folder named
src
, all our source code will stay at this folder. -
we need tools to fetch html page, run
npm i superagent
, and for analyzing raw html, runnpm i cheerio
to install cheerio. -
fix types error, run
npm i @types/superagent @types/cheerio -D
. -
open package.json, add some necessary scripts.
"build": "tsc", "dev": "ts-node ./src/main.ts"
,npm i ts-node -D
for local developing. -
complete the crawler code, then run
npm run dev
, all posts will be collected and generate a json file nameddata.json
in root path.