Hallo,
ich lade mit folgender Definition eine Website ein:
define GOLD HTTPMOD https://www.godmode-trader.de/rohstoffe/gold-xaueur-spot-rate-preis,10414724 900
attr GOLD userattr reading01Format reading01Name reading01OExpr reading01RegOpt reading01Regex
attr GOLD enableControlSet 1
attr GOLD group Edelmetalle
attr GOLD reading01Name gold
attr GOLD reading01OExpr $val =~ s/,/\./g;; ;;$val;;
attr GOLD reading01RegOpt s
attr GOLD reading01Regex data-precision="2">([\s\S]*?)<\/td>
attr GOLD room Krypto
attr GOLD stateFormat gold €
attr GOLD timeout 10
und mit dem hier:
attr GOLD reading01OExpr $val =~ s/,/\./g;; ;;$val;;
wird dann in z.B. 1.638,48 das Komma durch einen Punkt ersetzt.
Ergebnis ist also 1.638.48
Ich hätte aber gerne 1638.48, die obige Zeile soll also so umgeändert werden,
dass der erste Punkt gelöscht und das Komma in einen Punkt umgewandelt wird.
Wie muss der Ausdruck geändert werden, damit auch noch der Punkt verschwindet?
Viele Grüße
Ralf
attr GOLD reading01OExpr $val =~ s/[.]//g;;$val =~ s/,/\./g;;$val;;
Mein Bauchgefühl sagt mir aber das das Gebastel ist und es mit Sicherheit anders angegegangen wird.
Gruß
Thomas
Super vielen Dank das funktioniert
(Gebastel hin oder her ;D)
Funktioniert das so bei euch noch?
Ich bekomme nur "gold €" angezeigt.
Der Link an sich ist ja noch gültig, ansonsten kapiere ich httpmod nicht. :)
Hi,
zum einen wurde wohl der LINK geändert,
curl "https://www.godmode-trader.de/rohstoffe/gold-xaueur-spot-rate-preis,10414724"
Redirecting to <a href="/rohstoffe/xaueur-preis,10414724">/rohstoffe/xaueur-preis,10414724
zum anderen ist wohl auch der Regex nicht mehr Gültig.
data-precision gibt es nicht mehr im HTML. Ich bin auch gerade am testen wie ich das wieder ans laufen bekomme.
Gruß Kaufe
Ah, nun läuft es @Christian72D
define GOLD HTTPMOD https://www.godmode-trader.de/rohstoffe/xaueur-preis,10414724 600
attr GOLD userattr reading01Format reading01Name reading01RegOpt
attr GOLD group Edelmetalle
attr GOLD reading01Name gold
attr GOLD reading01OExpr $val =~ s/[,]//g;;$val;;
attr GOLD reading01RegOpt s
attr GOLD reading01Regex <title>([\s\S]*?)[ ]
attr GOLD room 12 Finance
attr GOLD stateFormat gold €
attr GOLD timeout 10
attr GOLD webCmd reread
Ich hole mir den Wert nun vom title.
alternativ:
defmod goldpreis HTTPMOD https://www.godmode-trader.de/rohstoffe/xaueur-preis,10414724 3600
attr goldpreis reading01Name state
attr goldpreis reading01OExpr $val=~s/,//g;;$val=~s/\./,/;;"$val €";;
attr goldpreis reading01Regex <title>(.*).\(
Bevor jemand fragt: nein, ich habe stateFormat nicht vergessen :)