Musings of a Fondue

Tag: Web-scraping

Scraping Pictures With Ruby

Another snippet!

I was trying to get some images from this site. They are part of an animation sequence of about 200 images.

At about the sixtieth image it got quite tedious to right click and save each image manually.

So, I did a quick Google search for “using ruby to grab images from a site” and came across this answer on StackOverflow.

Only four lines of code! Four!

Mechanize X Investopedia

I wanted to get the trade history of a user (whom I suspected was a bot), but I didn’t want to copy and paste all those pages.

I had previously watched episode 191 of RailsCasts where Ryan Bates uses Mechanize to login to a site and scrape the desired data. The original instructions in the video were not 100% applicable, however the Mechanize documentation filled in the gaps.

I put a script together using the two sources, and… it worked!

Web Scraping With Nokogiri

This is a small script I originally wrote on October-ish of 2013.

It’s based on this excellent 10 minute tutorial by Paul Bates (RailsCasts).

The script visits a website and returns (‘scrapes’) information without you having to manually open, search, copy, then paste the information you desire. This makes it invaluable for batch executions or tasks you want automated.

I recall being ecstatic at the time - or more accurately, my mind EXPLODING into several pieces!

Though I didn’t take any screenshots, here are some with the same script but run today (May 12, 2015),