Skip to content

Instantly share code, notes, and snippets.

@sputnick-dev
Last active May 3, 2023 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sputnick-dev/3b36a1c8496c3366e7a20b77abf91239 to your computer and use it in GitHub Desktop.
Save sputnick-dev/3b36a1c8496c3366e7a20b77abf91239 to your computer and use it in GitHub Desktop.
#!/usr/bin/env sh
# sputnick 2023 (copyleft)
# cURL: https://curl.se/docs/httpscripting.html
# xidel: https://github.com/benibela/xidel
# xidel x86_64: https://sourceforge.net/projects/videlibri/files/Xidel/Xidel%20development/xidel_0.9.9-1_amd64.deb/download
user=toi password='xxxxxxxxxxxxxxxxxxxx'
trap 'rm -f /tmp/ubuntu-fr.html' EXIT
curl -s -L 'https://forum.ubuntu-fr.org/login.php?action=in' \
-c ~/.cache/ubuntu-fr.cookiejar \
-o /dev/null \
-d form_sent=1 \
-d req_username=$user \
-d req_password=$password
curl -s -L 'https://forum.ubuntu-fr.org/search.php?action=show_new' \
-b ~/.cache/ubuntu-fr.cookiejar > /tmp/ubuntu-fr.html
xidel -e '//table//tr/td//strong//a/join(
("https://forum.ubuntu-fr.org/"||@href, text())
)' /tmp/ubuntu-fr.html
flagAllRead="$(xidel -e '(//a[text()="Tout marquer comme lu"]/@href)[1]' /tmp/ubuntu-fr.html)"
curl -s -L "https://forum.ubuntu-fr.org/$flagAllRead" \
-c ~/.cache/ubuntu-fr.cookiejar \
-b ~/.cache/ubuntu-fr.cookiejar \
-o /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment