Bug 480062

Summary: fx-rate fails to fetch currency exchange rates
Product: [Applications] kmymoney Reporter: Pete <peterzay1>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED DOWNSTREAM    
Severity: normal CC: kdedev, q4break
Priority: NOR    
Version First Reported In: 5.1.3   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Pete 2024-01-19 20:12:44 UTC
STEPS TO REPRODUCE
1. Tools
2. Update Stock and Currency Prices ...

OBSERVED RESULT
Fetching URL https://fx-rate.net/USD/CAD...
Identifier found: ''
Price found: '1.3379' (1.3379)
Unable to update price for USD > CAD (no price or no date)

EXPECTED RESULT
A proper currency quote.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Ubuntu Linux 22.04 LTS
Comment 1 Jack 2024-01-19 20:15:43 UTC
It has nothing to do with the specific currencies, I get failures on other pairs.  It appears they changed the presentation, and I am struggling to update the date regexp to capture correctly.
Comment 2 Jack 2024-01-19 20:21:55 UTC
The problem seems to be that the date is now given as 
        var userDate = 'Fri, 19 Jan 2024 20:10:02 +0000';
and I am not sure if the parsing used will accept the named month instead of numbered.  Still working on it.
Comment 3 Jack 2024-01-19 21:49:18 UTC
Try this for the date regexp
var userDate = \'..., (\d* ... \d*)
let me know if it works for you.
Comment 4 Pete 2024-01-19 21:57:53 UTC
It works fine.
Comment 5 Jack 2024-01-19 22:04:08 UTC
Great.  I'll close this once we get it updated in the code base so new installs are OK.
Comment 6 Cos 2024-03-18 07:46:48 UTC
FWIW, I'm using the following regexes to extract the data from fx-rate.net: 

Price:  1\s[^=]+\s*=\s*<\/span>\s*<br>\s*<span>([^\s]+)
Date: <span class="datetime"[^>]+>\s*\d+:\d+:\d+\(\w+\)\s+(\d{1,2}/\d{2}/\d{4})
Comment 7 Thomas Baumgart 2025-07-31 06:31:39 UTC
Mark as resolved downstream as it is a configuration problem.