Skip to content

Instantly share code, notes, and snippets.

@kyktommy
Created February 22, 2014 10:34
Show Gist options
  • Save kyktommy/9151785 to your computer and use it in GitHub Desktop.
Save kyktommy/9151785 to your computer and use it in GitHub Desktop.
Download P&D Images
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)
{
"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