I've finished this python script now. The following will download the
last 100 messages posted to alt.magick. Just change the variable to
download more or less. I'm running this now, downloading all articles
since 2003 and will upload the db shortly.
#!/usr/bin/python
# Copyright (c) 2021 Corey White
import nntplib
import string
import re
group = "alt.magick"
# connect to server
s = nntplib.NNTP('
news.fastusenet.org', user=' ', password=' ')
resp, count, first, last, name = s.group('alt.magick')
print('Group', name, 'has', count, 'articles, range', first, 'to', last)
resp, user = s.xhdr('from', str(int(last) - 100) + '-' + last)
for id, nick in user:
author = re.sub('/', '', nick)
author = re.sub('\"', '', author)
author = re.sub(r'\<..*',"", author)
author = re.sub(r'@..*',"", author)
author = author.strip()
if len(author) > 3 and len(author) < 15:
file = open(author, 'a')
file.write("\n")
file.write("From: %s\n" % nick)
r, n, id2, headers = s.head(id)
for item in headers:
x = re.search("Subject", item)
if x:
file.write("%s\n" % item)
x = re.search("Date", item)
if x:
y = re.search("Injection-Date", item)
if not y:
file.write("Date: %s\n" % item)
file.write("\n")
try:
resp2, num2, id2, list = s.body(id)
for line in list:
file.write(line[:80])
file.write("\n")
except:
file.write("error...\n")
file.write("\n")
file.close()
print(id)
print ("\n Done.")
s.quit()