【原】使用puppeteer爬虫下载Midi文件

The Beatles 乐队的 Midi文件下载地址

puppeteer官方github地址

midi文件爬取示例代码github地址

 


 

1、安装npm

参考:安装npm及cnpm(Windows)

修改参数

PS D:\Program files\nodejs> mkdir node_global
PS D:\Program files\nodejs> mkdir node_cache
PS D:\Program files\nodejs>
PS D:\Program files\nodejs> npm config set prefix "D:\Program Files\nodejs\node_global"
PS D:\Program files\nodejs> npm config set cache "D:\Program Files\nodejs\node_cache"

npm install 的时候总是为sill状态,修改为淘宝URL源

PS D:\Program files\nodejs> npm config set registry https://registry.npm.taobao.org  

2、安装puppeteer

Node爬虫神器Puppeteer安装记(Windows)

先设置不同时下载chromium浏览器,再下载

PS C:\WINDOWS\system32> npm config set puppeteer_skip_chromium_download = 1  不下载浏览器
PS C:\WINDOWS\system32> npm install -S puppeteer

> puppeteer@1.12.2 install C:\WINDOWS\system32\node_modules\puppeteer
> node install.js

**INFO** Skipping Chromium download. "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" was set in npm config.
npm WARN saveError ENOENT: no such file or directory, open 'C:\WINDOWS\system32\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'C:\WINDOWS\system32\package.json'
npm WARN system32 No description
npm WARN system32 No repository field.
npm WARN system32 No README data
npm WARN system32 No license field.

+ puppeteer@1.12.2
added 43 packages from 22 contributors and audited 50 packages in 3.307s
found 0 vulnerabilities

 

下载Midi

PS D:\Program files\puppeteer\download-beatles-midi-master> npm install -g request
PS D:\Program files\puppeteer\download-beatles-midi-master> npm install -g fs

PS D:\Program files\puppeteer\download-beatles-midi-master> mkdir The_Beatles
PS D:\Program files\puppeteer\download-beatles-midi-master> node .\index.js .\The_Beatles\

 

 下载的结果

 

posted @ 2019-02-12 19:23  马小豆包  阅读(852)  评论(0编辑  收藏  举报