File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 11[metadata]
22name = fastfeedparser
3- version = 0.4.2
3+ version = 0.4.3
44author = Vladimir Prelovac
5566description = High performance RSS, Atom and RDF parser in Python
Original file line number Diff line number Diff line change @@ -209,6 +209,10 @@ def parse(source: str | bytes) -> FastFeedParserDict:
209209 channel = root
210210 else :
211211 raise ValueError ("Invalid RSS feed: missing channel element" )
212+ elif len (list (channel )) == 0 and len ([child for child in root if child .tag == "item" ]) > 0 :
213+ # Handle malformed RSS where channel is empty but items are at root level
214+ # This handles feeds like canolcer.eu that have <channel></channel> but items outside
215+ channel = root
212216 # Find items with or without namespace
213217 items = channel .findall ("item" )
214218 if not items :
@@ -903,8 +907,10 @@ def _get_element_value(
903907 if el is None :
904908 return None
905909 if attribute is not None :
906- return el .get (attribute )
907- return el .text
910+ attr_value = el .get (attribute )
911+ return attr_value .strip () if attr_value else None
912+ text_value = el .text
913+ return text_value .strip () if text_value else None
908914
909915custom_tzinfos : dict [str , int ] = {
910916 'EST' : - 5 * 3600 , # Eastern Standard Time
You can’t perform that action at this time.
0 commit comments