J
jonathan.clwen
I have wrote a small script to download flickr photo by tags, as the
following
=======================================
require 'rubygems'
require 'flickr'
flickr = Flickr.new
for page_iter in (1..100)
criteria = { 'tags' => 'landscape', 'page' => page_iter.to_s,
'per_page' => '500' }
for photo in flickr.photos( criteria )
File.open( photo.filename, 'w' ) do |file|
file.puts photo.file( 'Original' )
end
end
end
=======================================
I can download about the first 25 ~ 30 photos
and I get the following error message, then the program terminated:
=======================================
/var/lib/gems/1.8/gems/flickr-1.0.0/./flickr.rb:317:in `source':
undefined method `[]' for nil:NilClass (NoMethodError)
from /var/lib/gems/1.8/gems/flickr-1.0.0/./flickr.rb:322:in
`file'
from photosearch.rb:11
from photosearch.rb:10:in `open'
from photosearch.rb:10
from photosearch.rb:9:in `each'
from photosearch.rb:9
from photosearch.rb:6:in `each'
from photosearch.rb:6
=======================================
What's the problem?
Any idea?
following
=======================================
require 'rubygems'
require 'flickr'
flickr = Flickr.new
for page_iter in (1..100)
criteria = { 'tags' => 'landscape', 'page' => page_iter.to_s,
'per_page' => '500' }
for photo in flickr.photos( criteria )
File.open( photo.filename, 'w' ) do |file|
file.puts photo.file( 'Original' )
end
end
end
=======================================
I can download about the first 25 ~ 30 photos
and I get the following error message, then the program terminated:
=======================================
/var/lib/gems/1.8/gems/flickr-1.0.0/./flickr.rb:317:in `source':
undefined method `[]' for nil:NilClass (NoMethodError)
from /var/lib/gems/1.8/gems/flickr-1.0.0/./flickr.rb:322:in
`file'
from photosearch.rb:11
from photosearch.rb:10:in `open'
from photosearch.rb:10
from photosearch.rb:9:in `each'
from photosearch.rb:9
from photosearch.rb:6:in `each'
from photosearch.rb:6
=======================================
What's the problem?
Any idea?