[RELEASE] Russia Today News Addon
Hi,

rt plugin is failing with python3 in kodi matrix because of changes in how unescape is handled in python3. The unescape() method in the html.parser.HTMLParser class has been removed in Python 3.9 (it was deprecated since Python 3.4), and seems that html.unescape() should be used for converting character references to the corresponding unicode characters.

From kodi.log:

   File "/home/pi/.kodi/addons/plugin.video.rt/resources/lib/scraper.py", line 15, in <module>
   UNESCAPE = html.parser.HTMLParser().unescape
    AttributeError: 'HTMLParser' object has no attribute 'unescape'

Change in .diff below seems to work with python3 and I hope should preserve backwards compatibility

 --- a/plugin.video.rt/resources/lib/scraper.py
+++ b/plugin.video.rt/resources/lib/scraper.py
@@ -12,7 +12,11 @@ import html.parser
import sys
import requests

-UNESCAPE = html.parser.HTMLParser().unescape
+if sys.version_info[0] >= 3:
+ UNESCAPE = html.unescape
+else:
+ UNESCAPE = html.parser.HTMLParser().unescape
+
RTBASE = 'https://www.rt.com/rtmobile/'
LCL = xbmcaddon.Addon('plugin.video.rt').getLocalizedString


Messages In This Thread
RE: [RELEASE] Russia Today News Addon - by amd80 - 2022-01-13, 18:54
Logout Mark Read Team Forum Stats Members Help
[RELEASE] Russia Today News Addon2