Sha256: 820cfd9e3a7b9ac7dae653295f090e7d77a4d9cb1fa804b4b3b38769951dec74

Contents?: true

Size: 612 Bytes

Versions: 1

Compression:

Stored size: 612 Bytes

Contents

#!/usr/bin/env ruby

require 'rubygems'
require 'open-uri'
require 'nokogiri'
require 'fastercsv'

url = "http://www.gamespot.com/games.html?platform=19&category=&type=games&mode=all&sort=title&sortdir=desc&page="
pages = (0..27)

FasterCSV.open("nes_gamespot.csv","w", :write_headers => true, :headers => %w[ title category release ]) do |csv|
  pages.each do |page|
    doc = Nokogiri::HTML(open(url + page.to_s))
    doc.xpath("//tr").each do |node|
      game = node.content.split("\n").map {|i| i.strip }.reject { |i| i.length == 0 }
      csv << game unless game.include?("Release Date")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
imw-0.3.0 examples/script.rb