Last active
May 5, 2016 13:33
-
-
Save the-solipsist/a8a68e3bfcad9a0f8372 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
#!/bin/sh | |
# automated retrieval of pipermail mbox file with full headers, if subscribed | |
# else, retrieval of pipermail mbox file with partial headers, if not subscribed | |
# https://mail.python.org/pipermail/mailman-users/2004-May/036948.html & | |
# https://mail.python.org/pipermail/mailman-users/2012-October/074208.html | |
# | |
# To use this script, simply run the following commands: | |
# $ wget https://gist.github.com/the-solipsist/a8a68e3bfcad9a0f8372/raw/get-mailman-archive.sh | |
# $ chmod +x get-mailman-archive.sh | |
# $ ./get-mailman-archive.sh | |
# | |
# Last edited: 2016-05-05T19:03:05 | |
echo "What's the name of the website for the list archives? (The SUBDOMAIN.DOMAIN.TLD bit)" | |
read site | |
echo "What's the name of the list?" | |
read listname | |
mkdir -p /tmp/list-archive/$site/ | |
cd /tmp/list-archive/$site/ | |
echo "Are you subscribed to the mailing list? (y/n)" | |
read subs | |
if [ "$subs" = "y" ] | |
then | |
echo "What's your subscribed e-mail address?" | |
read email | |
echo "What's your password? (this will be sent as plaintext)" | |
read pw | |
wget "http://${site}/mailman/private/${listname}.mbox/${listname}.mbox?username=${email}&password=${pw}" -O $listname.mbox | |
elif [ "$subs" = "n" ] | |
then | |
wget -nd -r -l 1 -nH --cut-dirs=2 -A .gz -e robots=off http://${site}/pipermail/${listname}/ | |
touch $listname.mbox | |
chmod 600 $listname.mbox | |
for f in $(ls *.gz | sort -t - -k1,1n -k2,2M) | |
do zcat $f | iconv -f iso8859-15 -t utf-8 | sed 's/\(^From.*\)\ at\ /\1@/' >> "$listname.mbox" | |
done | |
rm *.gz | |
else | |
echo "Invalid input." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment