Skip to content

Commit

Permalink
Add fallback for new rating & review count css
Browse files Browse the repository at this point in the history
  • Loading branch information
pdesantis committed May 4, 2018
1 parent 29cd90e commit fcc876b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/market_bot/play/app.rb
Expand Up @@ -103,6 +103,18 @@ def self.parse(html, _opts = {})
result[:rating] = node[:content].strip
node = doc.at_css('meta[itemprop="ratingCount"]')
result[:votes] = node[:content].strip.to_i
else
if doc.css('.BHMmbe').first
node = doc.css('.BHMmbe').first
result[:rating] = node.content.strip.to_f
end
if doc.css('.AYi5wd').first
node = doc.css('.AYi5wd').first
result[:votes] = node.content.strip.delete(',').to_i
elsif doc.css('.TBRnV').first
node = doc.css('.TBRnV').first
result[:votes] = node.content.strip.delete(',').to_i
end
end

a_similar = doc.at_css('a:contains("Similar")')
Expand Down

0 comments on commit fcc876b

Please sign in to comment.