Last active
May 3, 2023 22:16
-
-
Save sputnick-dev/3b36a1c8496c3366e7a20b77abf91239 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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