Skip to content

Instantly share code, notes, and snippets.

@masahitojp
Created August 2, 2012 05:17
Show Gist options
  • Select an option

  • Save masahitojp/3233905 to your computer and use it in GitHub Desktop.

Select an option

Save masahitojp/3233905 to your computer and use it in GitHub Desktop.
Amazonで本のSalesRankのみ抜き出すjQueryスクリプト
import urllib2
url = "http://www.amazon.co.jp/o/ASIN/4774152439/book042-22/ref=nosim"
opener = urllib2.build_opener()
opener.addheaders = [('User-agent', 'mozilla 3.6')]
txt = opener.open(url).read()
print(txt)
var text = jQuery("#SalesRank").text()
text = jQuery.trim(text)
var rank = text.match(/\d+/g)
console.log(rank.join())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment