Skip to content

Commit

Permalink
Remove un-needed html unescape (#40)
Browse files Browse the repository at this point in the history
html.parser.HTMLParser().unescape() moved to html.unescape() in python 3.9
Removed instead as it is not required.
closes #39
  • Loading branch information
pinkywafer authored Jul 8, 2021
1 parent 896d479 commit 06bf639
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions custom_components/youtube/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
https://github.com/custom-components/youtube
"""

import html
import logging
import async_timeout
import voluptuous as vol
Expand Down Expand Up @@ -40,8 +39,7 @@ async def async_setup_platform(
async with async_timeout.timeout(10, loop=hass.loop):
response = await session.get(url)
info = await response.text()
name = html.parser.HTMLParser().unescape(
info.split('<title>')[1].split('</')[0])
name = info.split('<title>')[1].split('</')[0]
except Exception: # pylint: disable=broad-except

name = None
Expand Down Expand Up @@ -80,8 +78,7 @@ async def async_update(self):
if exp < self.expiry:
return
self.expiry = exp
title = html.parser.HTMLParser().unescape(
info.split('<title>')[2].split('</')[0])
title = info.split('<title>')[2].split('</')[0]
url = info.split('<link rel="alternate" href="')[2].split('"/>')[0]
if self.live or url != self.url:
self.stream, self.live, self.stream_start = await is_live(url, self._name, self.hass, self.session)
Expand Down

0 comments on commit 06bf639

Please sign in to comment.