book_finder_api 0.0.13 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  module BookFinderApi
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
@@ -27,8 +27,12 @@ class BookFinder
27
27
  #getting the titles and author
28
28
  title_div=page.search(".mprod-summary-title")
29
29
  result["Book"]=title_div.search("h1").text()
30
- result["Author"]=title_div.search("h2").text()
31
-
30
+ book_authors=[]
31
+ authors=title_div.search("h2")
32
+ authors.each do |author|
33
+ book_authors << author.text()
34
+ end
35
+ result["Author"]=book_authors.join(",")
32
36
  #storing the resluts
33
37
  page.search(".fk-specs-type2 tr").each do |tr|
34
38
  fk_key=tr.search(".specs-key").text()
@@ -63,18 +67,24 @@ class BookFinder
63
67
  result["img_url"]=img_url.to_s
64
68
  end
65
69
  puts "#{result['img_url']} is image url"
66
- if result["img_url"].nil?
67
- img_tag=page.search(".fk-mproduct .mprodimg-section img")
70
+ if result["img_url"]==""
71
+ img_tag=page.search("#mprodimg-id")
72
+ img=img_tag.search("img")
68
73
  puts img_tag
69
74
  puts "inside"
70
- img_url=img_tag.attribute("src")
75
+ img_url=img.attribute("src")
71
76
  result["img_url"]=img_url.to_s
72
77
  end
73
78
 
74
79
  #storing the price
75
80
  price=page.search("#fk-mprod-list-id").text()
76
81
  if price ==""
82
+ puts "first price empty"
77
83
  price = page.search("#fk-mprod-our-id").text()
84
+ if price==""
85
+ puts "second price"
86
+ price=page.search(".fk-font-finalprice").text()
87
+ end
78
88
  end
79
89
  price.delete!("Rs. ")
80
90
  result["price"]=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.13
4
+ version: 0.0.14
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: