feedparser icon indicating copy to clipboard operation
feedparser copied to clipboard

Cant read description with ![CDATA]

Open sljdhl opened this issue 3 years ago • 11 comments

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?

sljdhl avatar May 11 '21 12:05 sljdhl

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

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

dvesters avatar Jul 13 '21 16:07 dvesters

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

jgallis avatar Aug 24 '21 09:08 jgallis

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.

IanLJohnson avatar Jun 06 '22 11:06 IanLJohnson

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.

ExMacro avatar Jun 15 '23 17:06 ExMacro

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?

qJake avatar Jul 05 '23 03:07 qJake

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

ogajduse avatar Jul 27 '23 08:07 ogajduse

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 avatar Aug 10 '23 08:08 ogajduse

@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 avatar Aug 17 '23 09:08 ogajduse

@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 avatar Aug 17 '23 09:08 ogajduse

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 avatar Aug 17 '23 21:08 ogajduse

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 avatar Aug 17 '23 21:08 ogajduse