Skip to content
This repository was archived by the owner on Apr 25, 2024. It is now read-only.

Changes needed to download notes as markdown with images using gnsync #139

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion geeknote/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion geeknote/geeknote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
3 changes: 3 additions & 0 deletions geeknote/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down