Created
October 8, 2020 22:34
-
-
Save asavah/772c5e806b825b10492d21d01c7e3c58 to your computer and use it in GitHub Desktop.
quick fix kodi youtube addon for python 3.9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -Naur a/resources/lib/youtube_plugin/kodion/items/audio_item.py b/resources/lib/youtube_plugin/kodion/items/audio_item.py | |
--- a/resources/lib/youtube_plugin/kodion/items/audio_item.py 2020-10-08 23:27:52.859850182 +0300 | |
+++ b/resources/lib/youtube_plugin/kodion/items/audio_item.py 2020-10-09 01:28:18.920180111 +0300 | |
@@ -8,7 +8,7 @@ | |
See LICENSES/GPL-2.0-only for more information. | |
""" | |
-from six.moves import html_parser | |
+import html | |
from .base_item import BaseItem | |
@@ -33,8 +33,8 @@ | |
def set_title(self, title): | |
try: | |
- title = html_parser.HTMLParser().unescape(title) | |
- except html_parser.HTMLParseError as _: | |
+ title = html.unescape(title) | |
+ except: | |
pass | |
self._title = title | |
diff -Naur a/resources/lib/youtube_plugin/kodion/items/base_item.py b/resources/lib/youtube_plugin/kodion/items/base_item.py | |
--- a/resources/lib/youtube_plugin/kodion/items/base_item.py 2020-10-08 23:27:52.860851275 +0300 | |
+++ b/resources/lib/youtube_plugin/kodion/items/base_item.py 2020-10-09 01:28:49.367806557 +0300 | |
@@ -10,11 +10,10 @@ | |
from six import python_2_unicode_compatible | |
from six import string_types | |
-from six.moves import html_parser | |
import hashlib | |
import datetime | |
- | |
+import html | |
@python_2_unicode_compatible | |
class BaseItem(object): | |
@@ -25,7 +24,7 @@ | |
self._version = BaseItem.VERSION | |
try: | |
- self._name = html_parser.HTMLParser().unescape(name) | |
+ self._name = html.unescape(name) | |
except: | |
self._name = name | |
diff -Naur a/resources/lib/youtube_plugin/kodion/items/video_item.py b/resources/lib/youtube_plugin/kodion/items/video_item.py | |
--- a/resources/lib/youtube_plugin/kodion/items/video_item.py 2020-10-08 23:27:52.859850182 +0300 | |
+++ b/resources/lib/youtube_plugin/kodion/items/video_item.py 2020-10-09 01:27:45.297795005 +0300 | |
@@ -10,8 +10,7 @@ | |
import re | |
import datetime | |
- | |
-from six.moves import html_parser | |
+import html | |
from .base_item import BaseItem | |
@@ -78,8 +77,8 @@ | |
def set_title(self, title): | |
try: | |
- title = html_parser.HTMLParser().unescape(title) | |
- except html_parser.HTMLParseError as _: | |
+ title = html.unescape(title) | |
+ except: | |
pass | |
self._title = title | |
self._name = self._title | |
@@ -114,8 +113,8 @@ | |
def set_plot(self, plot): | |
try: | |
- plot = html_parser.HTMLParser().unescape(plot) | |
- except html_parser.HTMLParseError as _: | |
+ plot = html.unescape(plot) | |
+ except: | |
pass | |
self._plot = plot | |
diff -Naur a/resources/lib/youtube_plugin/youtube/helper/subtitles.py b/resources/lib/youtube_plugin/youtube/helper/subtitles.py | |
--- a/resources/lib/youtube_plugin/youtube/helper/subtitles.py 2020-10-08 23:27:52.836825047 +0300 | |
+++ b/resources/lib/youtube_plugin/youtube/helper/subtitles.py 2020-10-09 01:29:25.310546220 +0300 | |
@@ -7,10 +7,9 @@ | |
See LICENSES/GPL-2.0-only for more information. | |
""" | |
-from six.moves import html_parser | |
- | |
import xbmcvfs | |
import requests | |
+import html | |
from ...kodion.utils import make_dirs | |
@@ -90,7 +89,7 @@ | |
except: | |
self.context.log_debug('Subtitle unescape: failed to decode utf-8') | |
try: | |
- text = html_parser.HTMLParser().unescape(text) | |
+ text = html.unescape(text) | |
except: | |
self.context.log_debug('Subtitle unescape: failed to unescape text') | |
return text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment