Skip to content

Commit

Permalink
Merge pull request #32 from Antiz96/fix_news
Browse files Browse the repository at this point in the history
Filter all special characters/symbols when parsing the Arch news urls to avoid ending with a wrong url
  • Loading branch information
Antiz96 authored Jun 14, 2023
2 parents 83e5677 + 9f5ce8f commit bcd3f5b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/script/arch-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Variables definition
name="arch-update"
version="1.5.4"
version="1.5.5"
option="${1}"

# Definition of the evelation method to use (depending on which one is installed on the system)
Expand Down Expand Up @@ -136,7 +136,7 @@ list_news() {

case "${answer}" in
1|2|3|4|5)
news_selected=$(sed -n "${answer}"p <<< "${news_title}" | sed s/\ /-/g | sed s/[.]//g | awk '{print tolower($0)}')
news_selected=$(sed -n "${answer}"p <<< "${news_title}" | sed s/\ -//g | sed s/\ /-/g | sed s/[.]//g | sed s/=//g | sed s/\>//g | sed s/\<//g | sed s/\`//g | sed s/://g | sed s/+//g | sed s/[[]//g | sed s/]//g | sed s/,//g | sed s/\(//g | sed s/\)//g | sed s/[/]//g | sed s/@//g | sed s/\'//g | sed s/--/-/g | awk '{print tolower($0)}')
news_info=$(curl -Ls "https://www.archlinux.org/news/${news_selected}" | htmlq --text .article-info)
news_content=$(curl -Ls "https://www.archlinux.org/news/${news_selected}" | htmlq --text .article-content)
echo -e "\n${news_info}\n\n${news_content}\n" && read -n 1 -r -s -p $'Press \"enter\" to continue\n'
Expand Down

0 comments on commit bcd3f5b

Please sign in to comment.