aboutsummaryrefslogtreecommitdiff
path: root/newspipe/lib/data.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2020-10-23 23:33:16 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2020-10-23 23:33:16 +0200
commit8da441568d2f73054e41f8a9c8f11d80cb362165 (patch)
tree5ae453ad96b1f617ac469b636351cd177bc213de /newspipe/lib/data.py
parentchg: [API] allow search with filters from controllers for articles. (diff)
downloadnewspipe-8da441568d2f73054e41f8a9c8f11d80cb362165.tar.gz
newspipe-8da441568d2f73054e41f8a9c8f11d80cb362165.tar.bz2
newspipe-8da441568d2f73054e41f8a9c8f11d80cb362165.zip
ensures that a feed always have a link: when adding a new feed or importing an account.
Diffstat (limited to 'newspipe/lib/data.py')
-rw-r--r--newspipe/lib/data.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/newspipe/lib/data.py b/newspipe/lib/data.py
index a335d040..d2698c8a 100644
--- a/newspipe/lib/data.py
+++ b/newspipe/lib/data.py
@@ -112,6 +112,8 @@ def import_json(nickname, json_content):
nb_feeds, nb_articles = 0, 0
# Create feeds:
for feed in json_account:
+ if 'link' not in feed.keys() or feed['link'] is None:
+ continue
if (
None
!= Feed.query.filter(
@@ -132,6 +134,8 @@ def import_json(nickname, json_content):
db.session.commit()
# Create articles:
for feed in json_account:
+ if 'link' not in feed.keys() or feed['link'] is None:
+ continue
user_feed = Feed.query.filter(
Feed.user_id == user.id, Feed.link == feed["link"]
).first()
bgstack15