Control: clone -1 -2 Control: reassign -1 feed2exec Control: found -1 0.15.0 Control: tags +patch
On 2020-07-10 09:27:27, Antoine Beaupré wrote: > Control: reassign -1 python3-feedparser Actually, I'll track this as affecting feedparser as well. The included patch should work around the problem (by ignoring the feed without crashing). a. -- Quis custodiet ipsos custodes? Who watches the watchmen? Qui police la police? Tu. You. Toi.
diff --git i/feed2exec/controller.py w/feed2exec/controller.py index 535b34a..2c1c2c0 100644 --- i/feed2exec/controller.py +++ w/feed2exec/controller.py @@ -204,10 +204,13 @@ def init_global_lock(lock): else: global LOCK LOCK = None - self.dispatch(feed, feed.parse(body), None, force) + data = feed.parse(body) + if data: + self.dispatch(feed, data, None, force) if parallel: for feed, result in data_results: - self.dispatch(feed, result.get(), lock, force) + if result.get(): + self.dispatch(feed, result.get(), lock, force) pool.close() pool.join() logging.info('%d feeds processed', i+1) diff --git i/feed2exec/model.py w/feed2exec/model.py index 1e2c07c..08f2cb8 100644 --- i/feed2exec/model.py +++ w/feed2exec/model.py @@ -134,7 +134,11 @@ def parse(self, body): """ logging.info('parsing feed %s (%d bytes)', self['url'], len(body)) - data = feedparser.parse(body) + try: + data = feedparser.parse(body) + except Exception as e: + logging.warning('feedparser generated an exception. this is either a bug in feedparser or a malformed feed: %s', e) + return None # add metadata from the feed without overriding user config for (key, val) in data['feed'].items(): if key not in self and key not in Feed.locked_keys: