Skip to content

Instantly share code, notes, and snippets.

@sasezaki
Created March 14, 2012 15:46
Show Gist options
  • Select an option

  • Save sasezaki/2037384 to your computer and use it in GitHub Desktop.

Select an option

Save sasezaki/2037384 to your computer and use it in GitHub Desktop.
scraping hatena keyword
casper = require('casper').create()
ret ={}
casper.start "http://d.hatena.ne.jp/keyword/%BA%B0%CC%EE%A4%A2%A4%B5%C8%FE", ->
ret =
title: @fetchText "div.keyword-container a.title"
url: @evaluate -> document.querySelector("div.keyword-container a.title").getAttribute('href')
furigana: @fetchText "div.keyword-container span.furigana"
casper.run ->
console.log(JSON.stringify(ret));
@exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment