Skip to content

Commit

Permalink
Decode HTML encoded titles (#58)
Browse files Browse the repository at this point in the history
bergdahl authored Jul 4, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 86110d9 commit a2183e7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion custom_components/youtube/sensor.py
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
from homeassistant.helpers.entity import Entity
from dateutil.parser import parse
import re
import html

CONF_CHANNEL_ID = 'channel_id'

@@ -90,7 +91,7 @@ async def async_update(self):
self.published = info.split('<published>')[2].split('</')[0]
thumbnail_url = info.split(
'<media:thumbnail url="')[1].split('"')[0]
self._state = title
self._state = html.unescape(title)
self._image = thumbnail_url
self.stars = info.split('<media:starRating count="')[1].split('"')[0]
self.views = info.split('<media:statistics views="')[1].split('"')[0]

0 comments on commit a2183e7

Please sign in to comment.