diff --git a/geeknote/editor.py b/geeknote/editor.py index 9d4401d..0edbe8e 100644 --- a/geeknote/editor.py +++ b/geeknote/editor.py @@ -55,7 +55,7 @@ def getImages(contentENML): Creates a list of image resources to save. Each has a hash and extension attribute. """ - soup = BeautifulSoup(contentENML.decode("utf-8"), features='lxml') + soup = BeautifulSoup(contentENML, features='lxml') imageList = [] for section in soup.findAll("en-media"): if "type" in section.attrs and "hash" in section.attrs: diff --git a/geeknote/geeknote.py b/geeknote/geeknote.py index 418f61e..39984c2 100755 --- a/geeknote/geeknote.py +++ b/geeknote/geeknote.py @@ -630,7 +630,7 @@ def saveMedia(self, guid, mediaHash, filename): ) if resource == None: return False - open(filename, "w").write(resource.data.body) + open(filename, "w").write(str(resource.data.body)) return True diff --git a/geeknote/tools.py b/geeknote/tools.py index 054dc6b..f2e133c 100644 --- a/geeknote/tools.py +++ b/geeknote/tools.py @@ -42,6 +42,9 @@ def strip(data): if not data: return data + if isinstance(data, bytes): + data = data.decode('utf-8') + if isinstance(data, dict): items = iter(data.items()) return dict([[key.strip(" \t\n\r\"'"), val] for key, val in items])