Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Actual initial commit of file |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
649373d47269c6dcba3e1945c390afa7 |
User & Date: | atomicules 2015-06-27 20:20:42 |
Context
2015-06-28
| ||
10:59 | Skip header and footer rows on recent items check-in: d3dd543406 user: atomicules tags: trunk | |
2015-06-27
| ||
20:20 | Actual initial commit of file check-in: 649373d472 user: atomicules tags: trunk | |
20:17 | initial empty check-in check-in: ed666ee52d user: atomicules tags: trunk | |
Changes
Added smile.rb.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | require 'mechanize' require 'nokogiri' a = Mechanize.new #Fetch logon page page = a.get("https://banking.smile.co.uk/SmileWeb/start.do") #Since dealing with sensitive logon data don't want to get it from anywhere apart from keyboard input #Sortcode and Account number login puts "Enter sortcode" sortCode = gets.strip puts "Enter Account number" accountNumber = gets.strip page.form.sortCode = sortCode page.form.accountNumber = accountNumber page = page.form.submit #TODO: Need to check for timeouts #Passcode login doc = Nokogiri::HTML(page.body) puts doc.xpath("//label")[0].text page.form.firstPassCodeDigit = gets.strip puts doc.xpath("//label")[1].text page.form.secondPassCodeDigit = gets.strip page = page.form.submit #Other logon details puts page.form.fields[1].name page.form.fields[1].value = gets.strip page = page.form.submit #TODO: Check for possible bulletin board #page.form.action contains bulletinBoard.do #For now assume it is there page = page.form.submit #Logged on! #Current account page = a.click(page.link_with(:text => "current account")) #recent items doc = Nokogiri::HTML(page.body) #Look for summaryTable rows = doc.xpath("//table[@class='summaryTable']//tr") #Do something with that! #TODO: Might need to skip a header row #TODO: and footer rows, not sure how to yet. Need to check JS code I did. #array of hashes? transactions = [] rows.each do |row| date = row.elements[0].text name = row.children[1].text credit = row.children[2].text debit = row.children[3].text transactions << { :date => date, :name => name, :credit => credit, :debit => debit} end #TODO: Need to figure out a way to get input for number of previous pages required. Well, a good way, perhaps limit by a date? puts "Enter date back to fetch transactions to" date_limit = gets.strip #.convert_to_date #Previous statements page = a.click(page.link_with(:text => "previous statements")) #TODO: Then need to click the top most page and go back through each page. |