Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions custom_components/feedparser/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,13 @@ def _process_image(self: FeedParserSensor, feed_entry: FeedParserDict) -> str:
if images:
# pick the first image found
return images[0]["href"]
if feed_entry.get("media_content"):
images = [
enc for enc in feed_entry["media_content"] if enc['type'].startswith("image/")
]
if images:
# pick the first image found
return images[0]["url"]
elif "summary" in feed_entry:
images = re.findall(
IMAGE_REGEX,
Expand Down