[Note: parts of this message were removed to make it a legal post.]
Hi Rob,
So I tried what you suggested.
Here's the new code:
http://pastie.org/392399
And here's the new error:
http://pastie.org/392397
Some comments.
First the line
url_hash = {}
is useless. I get the impression that you are coming from some statically
typed language and think of this as a declaration of the type of the
variable url_hash. Ruby doesn't have typed variables, and neither has a
mechanism for or a need for declaring types.
Ok, that said,if you inspect what the next line is actually returning:
url_hash = istock_data.to_hash
p url_hash
You should see something like:
[{:url=>"/file_closeup/nature/nature-backgrounds/8546665-foggy-lane-with-trees.php?id=8546665"},
{:url=>"/file_closeup/celebrations-holidays/holiday-symbols/8549349-st-patrick-s-day-beer-bottle-caps-set.php?id=8549349"},
{:url=>"/file_closeup/celebrations-holidays/8542775-fire-campfire.php?id=8542775"},
{:url=>"/file_closeup/technology/8546657-asphalt-cutter.php?id=8546657"},
{:url=>"/file_closeup/food-and-drink/fruits-and-vegetables/8550674-vegetables-illustration.php?id=8550674"},
{:url=>"/file_closeup/animals/insects/8550593-sunflower.php?id=8550593"},
{:url=>"/file_closeup/health-and-beauty/body/8546651-measuring-the-waist.php?id=8546651"},
{:url=>"/file_closeup/nature/flowers/8522299-red-rose.php?id=8522299"},
{:url=>"/file_closeup/actions/8575484-marching-feet.php?id=8575484"},
{:url=>"/file_closeup/food-and-drink/cooking/8550489-cheese.php?id=8550489"},
{:url=>"/file_closeup/technology/electronics/8542843-laser-dvd.php?id=8542843"},
{:url=>"/file_closeup/industry/8575477-drywall-background.php?id=8575477"},
{:url=>"/file_closeup/isolated-objects/isolated-background-objects/8550212-stationary-vector.php?id=8550212"},
{:url=>"/file_closeup/people/8545005-cute-little-girl.php?id=8545005"},
{:url=>"/file_closeup/nature/8575473-repetitive-beauty.php?id=8575473"},
{:url=>"/file_closeup/illustrations-vectors/vector-icons/8551189-occupations-icons.php?id=8551189"},
{:url=>"/file_closeup/nature/landscapes/8546633-white-gazebo-in-park.php?id=8546633"},
{:url=>"/file_closeup/locations-and-travel/8546629-hot-springs-of-yellowstone.php?id=8546629"},
{:url=>"/file_closeup/locations-and-travel/travel-backgrounds/8546625-tyrolian-meadow.php?id=8546625"},
{:url=>"/file_closeup/food-and-drink/8545105-golden-nuts.php?id=8545105"},
{:url=>"/file_closeup/nature/gardens/8546623-grass-c-sped.php?id=8546623"},
{:url=>"/file_closeup/food-and-drink/8522290-herring.php?id=8522290"},
{:url=>"/file_closeup/business/business-concepts/8546619-coins.php?id=8546619"},
{:url=>"/file_closeup/celebrations-holidays/holiday-symbols/8568117-love.php?id=8568117"},
{:url=>"/file_closeup/architecture-and-buildings/churches/8546617-chapel.php?id=8546617"},
{:url=>"/file_closeup/celebrations-holidays/valentine-s-day/8568114-love-note.php?id=8568114"},
{:url=>"/file_closeup/nature/flowers/8543896-white-daisies-with-a-cloudy-sky.php?id=8543896"},
{:url=>"/file_closeup/architecture-and-buildings/architectural-detail/8561525-corner-detail.php?id=8561525"},
{:url=>"/file_closeup/nature/8544844-smoke-tree.php?id=8544844"},
{:url=>"/file_closeup/nature/bodies-of-water/8547420-suspension-bridge.php?id=8547420"},
{}, {}, {}, {}, {}, {}, {}]
Which is an array of hashes. The fetch call is looking for a string
containing the url to be fetched.
So, instead you need to take another approach, and
1) extract the url from each hash,
2) Scrape each individual url, and collect the results.
Something like:
http://pastie.org/392796
This doesn't work because the urls are relative, and I don't have the time
or motivation to figure that out for you, but this should get you another
step along the way.