Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

The Complete alt.magick

22 views
Skip to first unread message

Corey White

unread,
Sep 24, 2021, 7:56:36 AM9/24/21
to
You can now read a live & updated alt.magick archive at:
https://alt-magick.com

Newsgroup posts are saved under the authors name and email,
instead of a subject / thread format with a powerful search format.

NNTP is a very slow protocol. In order to download every post on
alt.magick I had to leave this program running for over 24 hours.
But keeping the archive updated is still very fast.

The python source code will save posts in files in linux format.
You will have to modify this code for windows.

#!/usr/bin/python
# Copyright (c) 2021 Corey White
# https://github.com/powercrypt/Usenet-Archiving-Tool
# https://alt-magick.com
# Replace all the '>>' with tabs

import nntplib
import string
import re

s = nntplib.NNTP('server', user='name', password='pass')
resp, count, first, last, name = s.group('group')
print('Group', name, 'has', count, 'articles, range', first, 'to', last)
cnt = int(last)
s.quit()
stop = 0 # When (1) program terminates on duplicate Message-IDs.
while cnt >= int(first):
>> loop = 0
>> while loop == 0:
>>>> try:
>>>>>> s = nntplib.NNTP('server', user='name', password='pass')
>>>>>> resp, count, first, last, name = s.group('group')
>>>>>> resp2, num2, id2, list = s.body(str(cnt))
>>>>>> r, n, id3, headers = s.head(id2)
>>>>>> s.quit()
>>>>>> loop = 1
>>>> except:
>>>>>> cnt = cnt - 1
>> author = "from: "
>> subject = "subject: "
>> date = "date: "
>> id = "message-id: "

>> for check1 in headers:
>>>> field = check1.lower()
>>>> if field.startswith("from: "):
>>>>>> author = check1

>> for check2 in headers:
>>>> field = check2.lower()
>>>> if field.startswith("subject: "):
>>>>>> subject = check2

>> for check3 in headers:
>>>> field = check3.lower()
>>>> if field.startswith("date: "):
>>>>>> date = check3

>> for check4 in headers:
>>>> field = check4.lower()
>>>> if field.startswith("message-id: "):
>>>>>> id = check4
>>>>>> if stop == 1:
>>>>>>>> with open("history.txt", 'a+') as f:
>>>>>>>>>> for lastmessage in f:
>>>>>>>>>>>> if(id == lastmessage.rstrip()):
>>>>>>>>>>>>>> print("Duplicate Article Found.")
>>>>>>>>>>>>>> quit()

>>>>>> history = open("history.txt", 'a+')
>>>>>> history.write("%s\n" % id)
>>>>>> history.close()

>> filename = author[6:]
>> filename = filename.decode('utf-8','ignore').encode("utf-8")
>> filename = filename.replace(r'/', '')
>> filename = ' '.join(filename.split())
>> filename = filename.strip()
>> if filename[0] != "'" and filename[0] != '"':
>>>> filename = '"' + filename + '"'

>> try:
>>>> file = open(filename, 'a+')
>> except:
>>>> continue

>> file.write("### %s\n\n" % str(cnt))
>> file.write("%s\n\n" % author);
>> file.write("%s\n\n" % subject);
>> file.write("%s\n\n" % date);
>> file.write("%s\n\n" % id);

>> for line in list:
>>>> file.write(line[:80])
>>>> file.write("\n")

>> file.write("\n\n")
>> file.close()

>> print("%s" % str(cnt))
>> cnt = cnt - 1
print ("\n Done.")
quit()

Corey White

unread,
Sep 28, 2021, 2:06:54 AM9/28/21
to
Testing my automatic newsgroup cron job..

Corey White

unread,
Sep 28, 2021, 3:01:12 AM9/28/21
to
On Tuesday, September 28, 2021 at 2:06:54 AM UTC-4, Corey White wrote:
> Testing my automatic newsgroup cron job..

Test two!

Corey White

unread,
Sep 28, 2021, 3:34:50 AM9/28/21
to
Third times a charm!
0 new messages