custom-components / feedparser

📰 RSS Feed Integration
MIT License
135 stars 34 forks source link

Feedparser not pulling description attribute entry #130

Closed pop-vapor closed 3 months ago

pop-vapor commented 4 months ago

My configuration.yaml looks like this:

sensor:
  - platform: feedparser
    name: New York Times
    feed_url: 'https://rss.nytimes.com/services/xml/rss/nyt/NYRegion.xml'
    date_format: '%a, %b %d %I:%M %p'
    inclusions:
      - title
      - description
      - link
    scan_interval:
      hours: 1
  - platform: feedparser
    name: Scientific American
    feed_url: 'http://rss.sciam.com/ScientificAmerican-Global?format=xml'
    date_format: '%a, %b %d %I:%M %p'
    inclusions:
      - title
      - description
      - link
    scan_interval:
      hours: 1

But the entries for both rss feed entities looks like:

- title: Democrats’ Split Over Israel Takes Center Stage in Tense Primary Debate
  link: https://www.nytimes.com/2024/05/13/nyregion/bowman-latimer-debate.html
- title: Black Man Charged With Threatening to Kill White People in Mass Shooting
  link: >-
    https://www.nytimes.com/2024/05/13/nyregion/mercer-county-threats-white-people.html
- title: 'Michael Cohen Begins Testimony in Trump’s Hush-Money Trial: 5 Takeaways'
  link: >-
    https://www.nytimes.com/2024/05/13/nyregion/trump-trial-michael-cohen-takeaways.html
- title: Record-Breaking Ocean Heat Wave Foreshadows a Dangerous Hurricane Season
  link: >-
    https://www.scientificamerican.com/article/record-breaking-ocean-heat-wave-foreshadows-a-dangerous-hurricane-season/
- title: How to Check If You Have Immunity to Measles or Need Another Dose
  link: >-
    https://www.scientificamerican.com/article/how-to-check-if-you-have-immunity-to-measles-or-need-another-dose/

Am I missing something?

pop-vapor commented 4 months ago

Looks like this issue is with python feedparser renaming description to "summary" - https://pythonhosted.org/feedparser/reference-entry-summary.html

The following configuration.yaml works for the sensors:

sensor:
  - platform: feedparser
    name: New York Times
    feed_url: 'https://rss.nytimes.com/services/xml/rss/nyt/NYRegion.xml'
    date_format: '%a, %b %d %I:%M %p'
    inclusions:
      - title
      - summary
      - link
    scan_interval:
      hours: 1
  - platform: feedparser
    name: Scientific American
    feed_url: 'http://rss.sciam.com/ScientificAmerican-Global?format=xml'
    date_format: '%a, %b %d %I:%M %p'
    inclusions:
      - title
      - summary
      - link
    scan_interval:
      hours: 1