gelöst: HTTPMOD Reading zeigt \u0026 anstelle des kaufmännischen &

Begonnen von FrauMeier, 01 November 2024, 20:51:22

Vorheriges Thema - Nächstes Thema

FrauMeier

Ich lese die Radioplayer eite aus und bekomme immer wieder mal readings wo das "&" nicht erkannt wird weil es mit einem escape charakter verwechselt wird da im html ein Backslasch vorangestellt wird. alle anderen Sonderzeichen funktionieren. Wenn ich das Reading auf dieser Seite https://toolslick.com/text/decoder/html teste, muss der Haken bei "Decode Unicode Escape Characters" gesetzt sein damit das & erkannt wird. Wie mache ich das im HTTPMOD?

Das hier ist ein Beispiel

define httptest HTTPMOD https://www.radio.de/s/planetradiotaylorswiftradio
attr httptest bodyDecode auto
attr httptest reading1Name Title
attr httptest reading1OMap \u0026:&
attr httptest reading1RegOpt g
attr httptest reading1Regex ncate\\",\\"children\\":\\"(?!")(.*?)\"
attr httptest replacement02Mode text
attr httptest replacement02Regex %%Regex2%%
attr httptest replacement02Value returnRegex()
attr httptest room Training
attr httptest verbose 0
#   BUSY       0
#   DEF        https://www.radio.de/s/planetradiotaylorswiftradio
#   FUUID      6553aff6-f33f-4d9f-ebdd-ad3cadd7ed4d888f
#   Interval   300
#   MainURL    https://www.radio.de/s/planetradiotaylorswiftradio
#   ModuleVersion 4.1.16 - 4.4.2023
#   NAME       httptest
#   NOTIFYDEV  global
#   NR         161
#   NTFY_ORDER 50-httptest
#   STATE      ???
#   TYPE       HTTPMOD
#   eventCount 32
#   value     
#   CompiledRegexes:
#   HttpUtils:
#     NAME       
#     addr       https://www.radio.de:443
#     auth       0
#     code       200
#     compress   1
#     conn       
#     data       
#     displayurl https://www.radio.de/s/planetradiotaylorswiftradio
#     header     
#     host       www.radio.de
#     httpheader HTTP/1.1 200 OK
#Date: Fri, 01 Nov 2024 19:34:40 GMT
#Content-Type: text/html; charset=utf-8
#Connection: close
#X-DNS-Prefetch-Control: on
#X-XSS-Protection: 1; mode=block
#X-Frame-Options: SAMEORIGIN
#Content-Security-Policy: default-src * blob: data: about:; worker-src * blob:; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * data: blob:; img-src * data:; style-src * 'self' 'unsafe-inline'; base-uri 'self' https://cdn.justpremium.com; form-action 'self'
#X-Content-Type-Options: nosniff
#x-middleware-rewrite: /de-DE/s/planetradiotaylorswiftradio
#Vary: RSC, Next-Router-State-Tree, Next-Router-Prefetch, Accept-Encoding
#link: </>; rel=preconnect; crossorigin=""
#Cache-Control: private, no-cache, no-store, max-age=0, must-revalidate
#CF-Cache-Status: EXPIRED
#Last-Modified: Fri, 01 Nov 2024 19:34:40 GMT
#Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=rZ1FQ9kQEzSh8%2FAun%2FQ%2FD1fiSPs0UHNloYiBBlueHAdV1DWl1zXegN%2FU%2Blq3o0IIId%2F0lp3bb1e7WWqrWA2Xi0mwHZ9MFAZ4bQSmsoJb%2Fzjkqe%2BWi9J5lBwL%2FwPf4g%3D%3D"}],"group":"cf-nel","max_age":604800}
#NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
#Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
#Server: cloudflare
#CF-RAY: 8dbe52d50f2f9b1c-FRA
#Content-Encoding: gzip
#alt-svc: h3=":443"; ma=86400
#server-timing: cfL4;desc="?proto=TCP&rtt=17309&sent=5&recv=7&lost=0&retrans=0&sent_bytes=2324&recv_bytes=735&delivery_rate=177132&cwnd=231&unsent_bytes=0&cid=cfadb71dfe39c1fb&ts=285&x=0"
#     httpversion 1.0
#     hu_blocking 0
#     hu_filecount 1
#     hu_port    443
#     hu_portSfx
#     ignoreredirects 1
#     loglevel   4
#     path       /s/planetradiotaylorswiftradio
#     protocol   https
#     redirects  0
#     timeout    2
#     url        https://www.radio.de/s/planetradiotaylorswiftradio
#     sslargs:
#   QUEUE:
#   READINGS:
#     2024-11-01 20:34:40   Title           planet taylor swift \u0026 friends\
#     2024-11-01 19:34:40   Title-1         The Stranglers
#     2024-11-01 19:34:40   Title-2         All day and all of the night
#   REQUEST:
#     context    reading
#     data       
#     header     
#     ignoreredirects 0
#     num        unknown
#     retryCount 0
#     type       update
#     url        https://www.radio.de/s/planetradiotaylorswiftradio
#   defptr:
#     readingBase:
#       Title      reading
#       Title-1    reading
#       Title-2    reading
#     readingNum:
#       Title      1
#       Title-1    1
#       Title-2    1
#     readingOutdated:
#     readingSubNum:
#       Title-1    -1
#       Title-2    -2
#     requestReadings:
#       update:
#         Title      reading 1
#         Title-1    reading 1-1
#         Title-2    reading 1-2
#
setstate httptest 2024-11-01 20:34:40 Title planet taylor swift \u0026 friends\
setstate httptest 2024-11-01 19:34:40 Title-1 The Stranglers
setstate httptest 2024-11-01 19:34:40 Title-2 All day and all of the night


in dem Beispiel ist das reading immer planet taylor swift \u0026 friends (ich bin echt kein Swifty, es war einfach das einzige frei verfügbare Beispiel dass ich schnell finden konnte )

Decode hilft nicht, wegen escape. reading replacement mit regex habe ich noch nicht hinbekommen.

Kann mir jemand helfen?

FrauMeier

Ich habe jetzt eine Lösung für mich gefunden. Ich lösche vor dem dekodieren alle Backslash mit:
preProcessRegex  s/\\//g