diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2020-10-23 23:33:16 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2020-10-23 23:33:16 +0200 |
commit | 8da441568d2f73054e41f8a9c8f11d80cb362165 (patch) | |
tree | 5ae453ad96b1f617ac469b636351cd177bc213de /newspipe/lib/data.py | |
parent | chg: [API] allow search with filters from controllers for articles. (diff) | |
download | newspipe-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.py | 4 |
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() |