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

fix: Fix dates parsing on news listing/displaying #229

Merged
merged 1 commit into from
Sep 15, 2024
Merged
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
6 changes: 3 additions & 3 deletions src/script/arch-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ list_news() {

if [ -n "${show_news}" ]; then
news_titles=$(echo "${news}" | htmlq -a title a | grep ^"View:" | sed "s/View:\ //g" | head -"${news_num}")
mapfile -t news_dates < <(echo "${news}" | htmlq td | grep -v "class" | grep "[0-9]" | sed "s/<[^>]*>//g" | head -"${news_num}" | xargs -I{} date -d "{}" "+%s")
mapfile -t news_dates < <(echo "${news}" | htmlq td | grep -v "class" | grep "[0-9]" | sed "s/<[^>]*>//g" | sed "s/\.//g" | head -"${news_num}" | xargs -I{} date -d "{}" "+%s")

echo
main_msg "$(eval_gettext "Arch News:")"
Expand Down Expand Up @@ -424,8 +424,8 @@ list_news() {
echo
warning_msg "$(eval_gettext "Unable to retrieve the selected Arch News (HTTP error response or request timeout)\nPlease, read the selected Arch News at \${news_url} before updating your system")"
else
news_author=$(echo "${news_content}" | htmlq -t .article-info | cut -f3- -d " ")
news_date=$(echo "${news_content}" | htmlq -t .article-info | cut -f1 -d " ")
news_author=$(echo "${news_content}" | htmlq -t .article-info | cut -f5- -d " ")
news_date=$(echo "${news_content}" | htmlq -t .article-info | cut -f1,2,3 -d " ")
news_article=$(echo "${news_content}" | htmlq -t .article-content)
title_tag="$(eval_gettext "Title:")"
author_tag="$(eval_gettext "Author:")"
Expand Down