From fbbf13e2d6274c14b9d91d59248bb7d6f3833a84 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Wed, 9 Nov 2022 17:01:24 +0900 Subject: Fallback Atom feed's link RFC 4287 does not require atom:feed to contain a . --- src/fead.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/fead.py b/src/fead.py index 21f559d..d1ad794 100755 --- a/src/fead.py +++ b/src/fead.py @@ -16,7 +16,7 @@ # along with this program. If not, see . __doc__ = 'Advert generator from web feeds' -__version__ = '0.1.1' +__version__ = '0.1.2' from argparse import ArgumentParser, FileType, HelpFormatter from asyncio import gather, open_connection, run @@ -123,7 +123,7 @@ def parse_atom_entry(xml): return title, link, time, summary -def parse_atom(xml, title): +def parse_atom(xml, title, link): """Parse given Atom feed.""" entries = [] for child in xml: @@ -167,7 +167,8 @@ async def fetch(raw_url): assert xml[0].tag == 'channel' src_title, src_link, items = parse_rss(xml[0], url.hostname) elif xml.tag.endswith('Atom}feed'): - src_title, src_link, items = parse_atom(xml, url.hostname) + src_title, src_link, items = parse_atom(xml, url.hostname, + raw_url) else: raise ValueError(f'unsupported feed format at {raw_url}') return (Advert(src_title, urljoin(raw_url, src_link), -- cgit 1.4.1