You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To modify the code to handle the <enclosure> tag as the image part, you can update the logic within the update method. Specifically, you can check for the presence of the tag and extract the url attribute as the image URL.
# Check for the enclosure tag
if "enclosures" in entry:
enclosure = entry["enclosures"][0] # Assuming only one enclosure
entry_value["image"] = enclosure.get("url", "")
if not entry_value.get("image"):
# If there's no enclosure, check for image in summary
images = []
if "summary" in entry:
images = re.findall(
r"<img.+?src=\"(.+?)\".+?>", entry["summary"]
)
if images:
entry_value["image"] = images[0]
else:
entry_value[
"image"
] = "https://www.home-assistant.io/images/favicon-192x192-full.png"
This modification checks for the presence of the enclosures key in the entry. If it exists, it assumes there is at least one enclosure, and it extracts the url attribute from the first enclosure as the image URL. If there is no enclosure, it falls back to the previous logic of checking for an image in the summary.
The text was updated successfully, but these errors were encountered:
@hardrockhodl Could you please check the latest implementation from the master branch? I have slightly modified the implementation around getting the images from the feed entries. You might want to try installing the latest beta release using HACS, if you have the integration installed through HACS.
If the latest implementation still does not work, I am happy to work on a solution with you.
The text was updated successfully, but these errors were encountered: