Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve resiliency of HTML feed date parser #10

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/term_rst_post/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
@author: Alex Domingo (Vrije Universiteit Brussel)
"""

__version__ = "1.2.1"
__version__ = "1.2.2"
2 changes: 1 addition & 1 deletion src/term_rst_post/newsfeed.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def get_top_ablog_news(newslist):
motd = {
'title': motd_tag.a.string,
'html_link': motd_tag.a['href'],
'date': motd_tag.parent.find('li').i.next_sibling.strip(),
'date': motd_tag.parent.find('i', class_="fa-calendar").find_next_sibling().string,
}
except AttributeError:
raise AttributeError(f"Malformed HTML newsfeed from ABlog, missing news header (H2): '{newslist.name}'")
Expand Down
6 changes: 4 additions & 2 deletions tests/examples/ablog_newsfeed.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ <h2>

<ul class="ablog-archive">
<li>
<i class="fa fa-calendar"></i> 01/01/2021
<i class="fa fa-calendar"></i>
<span>01/01/2021</span>
</li>

<li id="author">
Expand Down Expand Up @@ -70,7 +71,8 @@ <h2>

<ul class="ablog-archive">
<li>
<i class="fa fa-calendar"></i> 01/01/2020
<i class="fa fa-calendar"></i>
<span>01/01/2020</span>
</li>

<li id="published">
Expand Down
Loading