Skip to content

Instantly share code, notes, and snippets.

@leonardorb
Last active December 16, 2015 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leonardorb/5359951 to your computer and use it in GitHub Desktop.
Save leonardorb/5359951 to your computer and use it in GitHub Desktop.
phantomjs+casperjs scraping
casper = require('casper').create(
verbose: true
logLevel: "debug"
clientScripts: ["libs/jquery.js", "libs/underscore.js"]
timeout: 10000
onError: (self, m) ->
console.log "Fatal: " + m
self.exit()
)
casper.start 'http://www.icarros.com.br/tabela-fipe/index.jsp'
casper.then ->
@evaluate ->
@models = {}
_.each $('#marca option'), (option) ->
id = option.value
@models[id] = option.innerHTML
console.log JSON.stringify(@models)
casper.run ->
@exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment