Skip to content

Instantly share code, notes, and snippets.

@s1gtrap
Created June 2, 2015 22:24
Show Gist options
  • Save s1gtrap/c4ce1cc482a114ad5acb to your computer and use it in GitHub Desktop.
Save s1gtrap/c4ce1cc482a114ad5acb to your computer and use it in GitHub Desktop.
#/usr/bin/env sh
# Utility script for checking profile ban state en masse.
#
# Takes a newline-separated list of steamID64's on stdin, filters any with a ban
# state not equal to "1" and outputs the respective steamID64's on stdout.
# Runtime is asynchronous and is therefore not guaranteed to produce sequential
# output. The script will continue to send requests until EOF is reached
# regardless of curl or parsing errors. Neither consistency nor completeness is
# therefore guranteed.
#
# Usage: filter-banned
function dom {
local IFS=\>
read -d \< KEY CONTEXT
}
while read ID
do
curl -s -L "http://steamcommunity.com/profiles/$ID/?xml=1" |
while dom
do
case $KEY in
'vacBanned')
if [[ $CONTEXT = "1" ]]
then
echo $ID
fi
;;
esac
done &
done
wait
#/usr/bin/env bash
# Utility script for fetching group members.
#
# Provided with a group name on $1 the script will request the community API
# continuously until all pages are consumed, writing all member steamID64's to
# stdout. GET requests as well as parsing is done in series.
#
# Usage: member-list <group-name>
URL="http://steamcommunity.com/groups/$1/memberslistxml/?xml=1"
function dom {
local IFS=\>
read -d \< KEY CONTEXT
}
function unwrap {
echo ${1:8:-2}
}
while [ -n "$URL" ]
do
CURL="curl -s $URL"
URL=
while dom
do
case $KEY in
'steamID64')
echo $CONTEXT
;;
'nextPageLink') dom
URL=$(unwrap $KEY)
;;
esac
done < <($CURL) # XXX: Non-compliant
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment