Skip to content

Commit b731bc2

Browse files
authored
Merge pull request #130 from xgi/feature/128-opml-import-empty
fix parsing of opml to find proper container elements fixes #128
2 parents 22416c9 + b878f4a commit b731bc2

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

castero/feed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def _validate_feed(self):
213213
if root_child.tag == 'channel':
214214
channel = root_child
215215
break
216-
if not channel:
216+
if channel is None:
217217
raise FeedStructureError(
218218
"RSS feed does not have a channel tag as its child")
219219

castero/subscriptions.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import xml.etree.ElementTree as ElementTree
22
from typing import List
33

4-
from castero.feed import Feed, FeedDownloadError
4+
from castero.feed import Feed, FeedDownloadError, FeedParseError
55

66

77
class SubscriptionsError(Exception):
@@ -138,6 +138,8 @@ def parse(self) -> None:
138138
yield feed
139139
except FeedDownloadError as e:
140140
yield (entry.attrib['xmlUrl'], e)
141+
except FeedParseError as e:
142+
yield (entry.attrib['xmlUrl'], e)
141143

142144
def _find_rss_container(self, container):
143145
"""Find potentially-nested container for RSS feeds.
@@ -153,7 +155,7 @@ def _find_rss_container(self, container):
153155
return None
154156

155157
if 'type' in outline.attrib and \
156-
outline.attrib['type'].lower() == 'rss':
158+
outline.attrib['type'].lower() in ['rss', 'link']:
157159
return container
158160
else:
159161
return self._find_rss_container(outline)

0 commit comments

Comments
 (0)