Last active
June 6, 2018 13:05
-
-
Save veez21/303d391b91190870f1a2328304109755 to your computer and use it in GitHub Desktop.
xda status
This file contains 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
#!/bin/bash | |
# veez21 @ xda-developers | |
# Colors | |
G='\e[01;32m' # GREEN | |
R='\e[01;31m' # RED | |
Y='\e[01;33m' # YELLOW | |
B='\e[01;34m' # BLUE | |
V='\e[01;35m' # VIOLET | |
Bl='\e[01;30m' # BLACK | |
C='\e[01;36m' # CYAN | |
W='\e[01;37m' # WHITE | |
N='\e[0m' # How to use (example): echo "${G}example${N}" | |
[ -n "$1" ] && num=$(echo $1 | grep -Eo "[0-9]{1,8}") || { | |
echo "xda account needs to be entered" | |
echo "go to you XDA profile and get the url" | |
echo "e.g. 'https://forum.xda-developers.com/member.php?u=7296895' or use '7296895'" | |
echo "$0 https://forum.xda-developers.com/member.php?u=7296895" | |
exit 1 | |
} | |
if which curl >/dev/null; then | |
maininfo=$(curl -s -k https://forum.xda-developers.com/member.php?u=${num} | grep "<title>" | sed "s/.*<title>//;s/<.*//") | |
totalp=$(curl -s -k https://forum.xda-developers.com/member.php?u=${num} | grep "Total Posts:" | grep -Eo "[0-9][,][0-9]{1,7}") | |
ppd=$(curl -s -k https://forum.xda-developers.com/member.php?u=${num} | grep "Posts Per Day:" | grep -Eo "[0-9].[0-9]{1,7}") | |
thanks=$(curl -s -k https://forum.xda-developers.com/member.php?u=${num} | grep "Number of Thanks:" | grep -Eo "[0-9]{1,7}") | |
else | |
echo "can't do it, sorry" | |
exit 1 | |
fi | |
echo -e "${W}\n$maininfo\n${N}" | |
echo -e "Total Posts: ${Y}$totalp${N} | |
Posts Per Day: ${Y}$ppd${N} | |
Number of Thanks: ${Y}$thanks${N}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment