News for hackers. Stuff that matters.
Re:Web scraping with Ruby by richardpetersen on Monday January 19, 2015 @06:54AM (#8911488)
How do you get the script to save the json file?
Re:Web scraping with Ruby by cheald on Monday January 19, 2015 @10:50AM (#8912352)
Or, you can write it from within Ruby:

    open("out.json", "w") {|f| f.puts JSON.dump(showings) }
Re:Web scraping with Ruby by tom-lord on Monday January 19, 2015 @11:19AM (#8912505)

    f << JSON.dump(showings)
avoids adding any new lines (not that it really matters in the case of JSON)
Re:Web scraping with Ruby by cheald on Monday January 19, 2015 @11:26AM (#8912557)
Doh, yes. `print` rather than `puts` is also acceptable.
Re:Web scraping with Ruby by hecticjeff on Monday January 19, 2015 @06:58AM (#8911496)
You can redirect the output of the script to a json file, so in this case something like:

$ ruby scraper.rb > showings.json

Re:Web scraping with Ruby by richardpetersen on Monday January 19, 2015 @07:11AM (#8911535)
Perfect, thank you