mirror of
https://github.com/puppe/moneymoney-uberspace.git
synced 2025-12-20 09:22:18 +01:00
Compare commits
No commits in common. "master" and "v1.00" have entirely different histories.
2 changed files with 11 additions and 25 deletions
|
|
@ -1,11 +1,5 @@
|
|||
# MoneyMoney extension for Uberspace.de accounts
|
||||
|
||||
> [!IMPORTANT]
|
||||
> I will not update this extension anymore, but [there is a
|
||||
> fork](https://github.com/hatobi/moneymoney-uberspace) by
|
||||
> [@hatobi](https://github.com/hatobi) which is actively maintained and has
|
||||
> additional functionality.
|
||||
|
||||
This extension for [MoneyMoney](https://moneymoney-app.com/) retrieves
|
||||
the balance and transactions from [Uberspace.de](https://uberspace.de/)
|
||||
accounts.
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
--]]
|
||||
|
||||
WebBanking{version = 1.02,
|
||||
url = 'https://dashboard.uberspace.de/login',
|
||||
WebBanking{version = 1.00,
|
||||
url = 'https://uberspace.de/login',
|
||||
services = {'Uberspace.de'},
|
||||
description = string.format(
|
||||
MM.localizeText("Get balance and transactions for %s"),
|
||||
|
|
@ -24,7 +24,7 @@ function InitializeSession (protocol, bankCode, username, username2,
|
|||
-- Login.
|
||||
usUsername = username
|
||||
|
||||
html = HTML(usConnection:get('https://dashboard.uberspace.de/login'))
|
||||
html = HTML(usConnection:get('https://uberspace.de/login'))
|
||||
html:xpath('//input[@name="login"]'):attr('value', username)
|
||||
html:xpath('//input[@name="password"]'):attr('value', password)
|
||||
|
||||
|
|
@ -52,11 +52,6 @@ function RefreshAccount (account, since)
|
|||
function ParseAmount (amountString)
|
||||
local pattern = '(%-?%d+),(%d%d)'
|
||||
local euro, cent = amountString:match(pattern)
|
||||
|
||||
if not euro or not cent then
|
||||
return nil
|
||||
end
|
||||
|
||||
euro = tonumber(euro)
|
||||
cent = tonumber(cent) / 100
|
||||
if euro < 0 then
|
||||
|
|
@ -67,7 +62,7 @@ function RefreshAccount (account, since)
|
|||
end
|
||||
|
||||
html = HTML(usConnection:get(
|
||||
'https://dashboard.uberspace.de/dashboard/accounting'))
|
||||
'https://uberspace.de/dashboard/accounting'))
|
||||
tableRows = html:xpath(
|
||||
'//*[@id="transactions"]//tr[count(td)=3][position()<last()]')
|
||||
print('Found ' .. tableRows:length() .. ' rows')
|
||||
|
|
@ -79,30 +74,27 @@ function RefreshAccount (account, since)
|
|||
local children = row:children()
|
||||
local pattern = '(%d%d)%.(%d%d)%.(%d%d%d%d)'
|
||||
local day, month, year = children:get(1):text():match(pattern)
|
||||
local bookingDate = os.time{day=day, month=month, year=year}
|
||||
local valueTime = os.time{day=day, month=month, year=year}
|
||||
|
||||
if bookingDate < since then
|
||||
if valueTime < since then
|
||||
print('Stopping parsing because transaction is too old.')
|
||||
print('Date of transaction: ' .. os.date('%c', bookingDate))
|
||||
print('Date of transaction: ' .. os.date('%c', valueTime))
|
||||
print('since: ' .. os.date('%c', since))
|
||||
break
|
||||
end
|
||||
|
||||
local amount = ParseAmount(children:get(3):text())
|
||||
table.insert(transactions, {
|
||||
bookingDate = bookingDate,
|
||||
bookingDate = valueTime,
|
||||
amount = amount
|
||||
})
|
||||
end
|
||||
|
||||
local balanceElement = html:xpath('//*[@id="total"]')
|
||||
local balance = ParseAmount(balanceElement:text())
|
||||
if not balance then
|
||||
balance = 0
|
||||
end
|
||||
balanceElement = html:xpath('//*[@id="total"]')
|
||||
balance = ParseAmount(balanceElement:text())
|
||||
return {balance=balance, transactions=transactions}
|
||||
end
|
||||
|
||||
function EndSession ()
|
||||
usConnection:get('https://dashboard.uberspace.de/logout')
|
||||
usConnection:get('https://uberspace.de/logout')
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue