Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant read description with ![CDATA] #42

Open
sljdhl opened this issue May 11, 2021 · 11 comments
Open

Cant read description with ![CDATA] #42

sljdhl opened this issue May 11, 2021 · 11 comments
Labels
question Further information is requested
Milestone

Comments

@sljdhl
Copy link

sljdhl commented May 11, 2021

Hello. Im trying to read out the school meal from this https://skolmaten.se/ede-skola/rss/weeks/?limit=2,

However the description is not read, possibly due to ![CDATA]? It appears to be valid in XML. Any ideas?

@dvesters
Copy link

I have the same problem with https://data.buienradar.nl/1.0/feed/xml/rssbuienradar

<description>
<![CDATA[ message.here ]]>
</description>

@jgallis
Copy link

jgallis commented Aug 24, 2021

I have the same problem with https://api.met.no/weatherapi/metalerts/1.1/

@IanLJohnson
Copy link

Apologies for joining the party so late.
According to the documentation of feedparser some fields seem to be renamed, e.g. description => summary and pubDate => published. It took me quite a while to realize this as I too thought it was some kind of parsing bug.

@ExMacro
Copy link

ExMacro commented Jun 15, 2023

According to the documentation of feedparser some fields seem to be renamed, e.g. description => summary and pubDate => published. It took me quite a while to realize this as I too thought it was some kind of parsing bug.

Thanks! I had a similar parsing issue but got it working with the summary tag. Description is all over the documentation but it doesn't seem to work anymore.

@qJake
Copy link

qJake commented Jul 5, 2023

I have the same issue with this feed:

https://feeds.bbci.co.uk/news/world/us_and_canada/rss.xml

Any way we can help get this fixed?

@ogajduse
Copy link
Collaborator

@qJake Could you share your YAML config for the stream you shared?

@ogajduse
Copy link
Collaborator

According to the documentation of feedparser some fields seem to be renamed, e.g. description => summary and pubDate => published. It took me quite a while to realize this as I too thought it was some kind of parsing bug.

Thanks! I had a similar parsing issue but got it working with the summary tag. Description is all over the documentation but it doesn't seem to work anymore.

Using https://data.buienradar.nl/1.0/feed/xml/rssbuienradar

- exclusions: []
  feed_url: https://data.buienradar.nl/1.0/feed/xml/rssbuienradar
  inclusions:
  - image
  - title
  - link
  - published
  local_time: false
  name: 'buienradar_nl '
  platform: feedparser
  scan_interval:
    seconds: 3600
  show_topn: 9999

For each entry in the parsed feed entry.summary == entry.description.

Could someone confirm that this issue still persists?

@ogajduse ogajduse added the question Further information is requested label Aug 10, 2023
@ogajduse
Copy link
Collaborator

ogajduse commented Aug 17, 2023

@sljdhl Using the latest beta version, feedparser correctly reads the data correctly.

My sensor config:

- date_format: '%a, %d %b %Y %H:%M:%S UTC%z'
  exclusions: []
  feed_url: https://skolmaten.se/ede-skola/rss/weeks/?limit=2
  inclusions:
  - title
  - link
  - published
  - summary
  local_time: false
  name: skolmaten_se_ede_skola
  platform: feedparser
  scan_interval:
    seconds: 3600
  show_topn: 9999

How it shows in developer tools
image

How it renders in Lovelace using list-card:
image

list-card config:

type: custom:list-card
entity: sensor.skolmaten_se_ede_skola
title: Test feed
feed_attribute: entries
columns:
  - title: Title
    field: title
    style:
      - white-space: wrap
    add_link: link
  - title: Published
    field: published
  - title: Summary
    field: summary

@ogajduse
Copy link
Collaborator

@dvesters Same here, using the latest beta version, I got the following results:

In Lovelace:
image

In developer tools:
image

Sensor config:

- date_format: '%a, %d %b %Y %H:%M:%S UTC%z'
  exclusions: []
  feed_url: https://data.buienradar.nl/1.0/feed/xml/rssbuienradar
  inclusions:
  - image
  - title
  - link
  - published
  local_time: false
  name: buienradar_nl
  platform: feedparser
  scan_interval:
    seconds: 3600
  show_topn: 9999

Lovelace config:

type: custom:list-card
entity: sensor.buienradar_nl
title: Test feed
feed_attribute: entries
columns:
  - title: ''
    type: image
    add_link: link
    field: image
  - title: Title
    field: title
    style:
      - white-space: wrap
    add_link: link
  - title: Published
    field: published

@ogajduse
Copy link
Collaborator

Apologies for joining the party so late. According to the documentation of feedparser some fields seem to be renamed, e.g. description => summary and pubDate => published. It took me quite a while to realize this as I too thought it was some kind of parsing bug.

README.md will be fixed as a part of #90.

@ogajduse
Copy link
Collaborator

I have the same problem with api.met.no/weatherapi/metalerts/1.1

@jgallis
Works for me using the latest beta version.

config:

- date_format: '%a, %d %b %Y %H:%M:%S UTC%z'
  exclusions: []
  feed_url: https://api.met.no/weatherapi/metalerts/1.1/
  inclusions:
  - title
  - link
  - published
  - summary
  local_time: false
  name: api_met_no_metalerts
  platform: feedparser
  scan_interval:
    seconds: 3600
  show_topn: 9999

lovelace config:

type: custom:list-card
entity: sensor.api_met_no_metalerts
title: Test feed
feed_attribute: entries
columns:
  - title: Title
    field: title
    style:
      - white-space: wrap
    add_link: link
  - title: Published
    field: published

sensor with its attributes in UI:
image

How it shows in Lovelace using list-card:
image

@ogajduse ogajduse added this to the Release 0.2.0 milestone Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

7 participants