Created
May 1, 2020 04:05
-
-
Save betzerra/6cd88a7ee61f49ff6748a07f73acca90 to your computer and use it in GitHub Desktop.
santander.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'faraday' | |
require 'nokogiri' | |
response = Faraday.new.get 'https://www.santander.com.ar/ConectorPortalStore/Rendimiento' | |
html = Nokogiri::HTML(response.body) | |
desired_items = [ | |
'SUPER AHORRO $ CUOTA A', | |
'SUPER AHORRO PLUS CUOTA A', | |
'SUPERGESTION MIX VI CUOTA A' | |
] | |
list = {} | |
html.css('tr').each do |row| | |
row_description = row.css('table tr td').text | |
# ignore items that doesn't contain desired_items | |
next unless desired_items.any? { |i| row_description.include?(i) } | |
key = row_description.strip | |
item_entry = { | |
value: row.css('td')[3].text, | |
daily: row.css('td')[4].text, | |
last_30_days: row.css('td')[5].text, | |
last_90_days: row.css('td')[6].text, | |
last_year: row.css('td')[7].text | |
} | |
list[key] = item_entry | |
end | |
puts list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment