Created
February 22, 2014 10:34
-
-
Save kyktommy/9151785 to your computer and use it in GitHub Desktop.
Download P&D Images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
request = require 'request' | |
url = require 'url' | |
fs = require 'fs' | |
_ = require 'underscore' | |
base = 'http://www.puzzledragonx.com/en/img/monster/' | |
seqs = _.range(1000) | |
imageNames = seqs.map (n) -> "#{n+1}.jpg" | |
_.each imageNames, (img) -> | |
console.log "Downloading => #{img}" | |
imagePath = url.resolve(base, img) | |
req = request imagePath | |
req.pipe fs.createWriteStream(img) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "ImageDownloader", | |
"version": "0.0.1", | |
"description": "Batch Download image", | |
"author": "kyk", | |
"dependencies": { | |
"coffee-script": "*", | |
"request": "*", | |
"underscore": "*" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment