diff --git a/docs/source/configure.rst b/docs/source/configure.rst index f354ce8..7399f47 100644 --- a/docs/source/configure.rst +++ b/docs/source/configure.rst @@ -44,6 +44,9 @@ In order to configure Feed2toot, you need to create a feed2toot.ini file (or any [hashtaglist] several_words_hashtags_list=/etc/feed2toot/hashtags.txt + [feedparser] + accept_bozo_exceptions=true + For the [mastodon] section: - instance_url: the url of your Mastodon instance @@ -74,6 +77,10 @@ For the [hashtaglist] section: - several_words_hashtags_list: a path to the file containing hashtags in two or more words. Absolute path is mandatory. By default Feed2toot adds a # before every words of a hashtag. See documentation below for an example of this file. +for the [feedparser] section: + +- accept_bozo_exceptions: If set to true, feed2toot will accept malformed feeds, which are rejected by default. + Example of the list of hash tags ================================ The list of hash tags is a simple text file with one hash tag composed by several words on a single line:: diff --git a/feed2toot/confparse.py b/feed2toot/confparse.py index 1611fb7..d8d67f3 100644 --- a/feed2toot/confparse.py +++ b/feed2toot/confparse.py @@ -45,6 +45,13 @@ class ConfParse(object): config = SafeConfigParser() if not config.read(os.path.expanduser(pathtoconfig)): sys.exit('Could not read config file') + + # The feedparser section + if config.has_option('feedparser', 'accept_bozo_exceptions'): + self.accept_bozo_exceptions = config.getboolean('feedparser', 'accept_bozo_exceptions') + else: + self.accept_bozo_exceptions = False + ########################### # # the rss section @@ -117,7 +124,8 @@ class ConfParse(object): if 'bozo_exception' in feed: bozoexception = True logging.warning(feed['bozo_exception']) - continue + if not self.accept_bozo_exceptions: + continue # check if the rss feed and the rss entry are valid ones if 'entries' in feed: if rssobject and rssobject not in feed['entries'][0].keys():