book_finder_api 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module BookFinderApi
2
- VERSION = "0.0.15"
2
+ VERSION = "0.0.16"
3
3
  end
@@ -59,19 +59,24 @@ class BookFinder
59
59
 
60
60
  #storing the image
61
61
  img_tag=page.search("#mprodimg-id")
62
- img = img_tag.search("img")
63
- img_url = img.attribute("data-src")
64
- result["img_url"]=img_url.to_s
65
- puts "#{result['img_url']} is image url"
66
- if result["img_url"]==""
62
+ puts "IMAGE:#{img_tag}"
63
+ unless img_tag.empty?
64
+ img = img_tag.search("img")
65
+ begin
66
+ img_url = img.attribute("data-src")
67
+ result["img_url"]=img_url.to_s
68
+ rescue
69
+ result["img_url"]=""
70
+ end
71
+ puts "#{result['img_url']} is image url"
72
+ else
67
73
  page.search("#main-image-id").each do |img_id|
68
74
  img_tag=img_id.search("img")
69
75
  img_url=img_tag.attribute("src")
70
- result["img_url"]=img_url.to_s
71
- puts "Secondary Image: #{result['img_url']} is image url"
72
76
  end
77
+ result["img_url"]=img_url.to_s
78
+ puts "Secondary Image: #{result['img_url']} is image url"
73
79
  end
74
-
75
80
  #storing the price
76
81
  price = page.search("#fk-mprod-list-id").text()
77
82
  price = page.search("#fk-mprod-our-id").text() if price ==""
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: book_finder_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-29 00:00:00.000000000 Z
12
+ date: 2013-01-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri