mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Implement #2277 (Remove empty feeds when fetching news with recipes)
This commit is contained in:
parent
d8430be7c8
commit
0820e5d90a
@ -127,6 +127,12 @@ class BasicNewsRecipe(object, LoggingInterface):
|
|||||||
#:
|
#:
|
||||||
extra_css = None
|
extra_css = None
|
||||||
|
|
||||||
|
#: If True empty feeds are removed from the output.
|
||||||
|
#: This option has no effect if parse_index is overriden in
|
||||||
|
#: the sub class. It is meant only for recipes that return a list
|
||||||
|
#: of feeds using :member:`feeds` or :method:`get_feeds`.
|
||||||
|
remove_empty_feeds = False
|
||||||
|
|
||||||
#: List of regular expressions that determines which links to follow
|
#: List of regular expressions that determines which links to follow
|
||||||
#: If empty, it is ignored. For example::
|
#: If empty, it is ignored. For example::
|
||||||
#:
|
#:
|
||||||
@ -994,6 +1000,11 @@ class BasicNewsRecipe(object, LoggingInterface):
|
|||||||
self.log_exception(msg)
|
self.log_exception(msg)
|
||||||
|
|
||||||
|
|
||||||
|
remove = [f for f in parsed_feeds if len(f) == 0 and
|
||||||
|
self.remove_empty_feeds]
|
||||||
|
for f in remove:
|
||||||
|
parsed_feeds.remove(f)
|
||||||
|
|
||||||
return parsed_feeds
|
return parsed_feeds
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
Loading…
x
Reference in New Issue
Block a user