aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--newspipe/lib/data.py13
-rw-r--r--newspipe/web/templates/layout.html1
-rw-r--r--newspipe/web/views/bookmark.py3
3 files changed, 12 insertions, 5 deletions
diff --git a/newspipe/lib/data.py b/newspipe/lib/data.py
index 571aaf63..7c6beff9 100644
--- a/newspipe/lib/data.py
+++ b/newspipe/lib/data.py
@@ -204,13 +204,20 @@ def import_pinboard_json(user, json_content):
for tag in bookmark["tags"].split(" "):
new_tag = BookmarkTag(text=tag.strip(), user_id=user.id)
tags.append(new_tag)
+ try:
+ # Pinboard format
+ description = bookmark["extended"]
+ time = datetime.datetime.strptime(bookmark["time"], "%Y-%m-%dT%H:%M:%SZ")
+ except Exception:
+ description = bookmark["description"]
+ time = datetime.datetime.strptime(bookmark["time"], "%Y-%m-%dT%H:%M:%S")
bookmark_attr = {
"href": bookmark["href"],
- "description": bookmark["extended"],
- "title": bookmark["description"],
+ "description": description,
+ "title": description,
"shared": [bookmark["shared"] == "yes" and True or False][0],
"to_read": [bookmark["toread"] == "yes" and True or False][0],
- "time": datetime.datetime.strptime(bookmark["time"], "%Y-%m-%dT%H:%M:%SZ"),
+ "time": time,
"tags": tags,
}
new_bookmark = bookmark_contr.create(**bookmark_attr)
diff --git a/newspipe/web/templates/layout.html b/newspipe/web/templates/layout.html
index d83333a3..1453c3fd 100644
--- a/newspipe/web/templates/layout.html
+++ b/newspipe/web/templates/layout.html
@@ -94,7 +94,6 @@
<a class="dropdown-item" href="{{ url_for('user.profile') }}"><i class="fa fa-user" aria-hidden="true"></i>&nbsp;{{ _('Profile') }}</a>
<a class="dropdown-item" href="{{ url_for('user.management') }}"><i class="fa fa-hdd-o" aria-hidden="true"></i>&nbsp;{{ _('Your data') }}</a>
<a class="dropdown-item" href="{{ url_for('about') }}">{{ _('About') }}</a>
- <a class="dropdown-item" href="{{ url_for('feeds.feeds') }}">{{ _('All') }}</a>
{% if current_user.is_admin %}
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="{{ url_for('admin.dashboard') }}">{{ _('Dashboard') }}</a>
diff --git a/newspipe/web/views/bookmark.py b/newspipe/web/views/bookmark.py
index c46409e4..6b370658 100644
--- a/newspipe/web/views/bookmark.py
+++ b/newspipe/web/views/bookmark.py
@@ -263,6 +263,7 @@ def bookmarklet():
def import_pinboard():
bookmarks = request.files.get("jsonfile", None)
if bookmarks:
+ nb_bookmarks = import_pinboard_json(current_user, bookmarks.read())
try:
nb_bookmarks = import_pinboard_json(current_user, bookmarks.read())
flash(
@@ -272,7 +273,7 @@ def import_pinboard():
),
"success",
)
- except Exception as e:
+ except Exception:
flash(gettext("Error when importing bookmarks."), "error")
return redirect(redirect_url())
bgstack15