🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
1 messages
1 total messages Started by RS Wood Wed, 13 Jul 2011 17:34
RSS to NNTP solution
#84198
Author: RS Wood
Date: Wed, 13 Jul 2011 17:34
63 lines
3443 bytes
Sharing this because I think it's pretty cool.  I was looking for a way
to browse news articles (news in the media sense, like NYTimes or BBC)
and post relevant ones to different groups on a server I run.  Here's
the solution I built, and I like it.

The first component is Newsbeuter.  The console-based Newsbeuter RSS
feeder looks a lot like SLRN or mutt, and with a simple config file,
reads and organizes RSS feeds.

The second component is the postnews program.  It's a relatively simple
python script that, given a basic text file with Subject, Name, and
Newsgroups headers, plus a blank line separating those headers from the
text, will post them to a specified news server, and even authenticate
if necessary.  Ubuntu/Debian have the postnews program in their software
repositories.  I'm running openSUSE so had to download it from
sourceforge.  As long as you have python it should work fine.

The third and missing component was the glue that links them.  I noticed
newsbeuter allows you to pipe an article to another program.  So I wrote
the following simple perl script to connect newsbeuter to postnews.
(I'm not much of a perl guru, but this works):


#! /usr/bin/perl
use Term::UI;
use Term::ReadLine;
use warnings;

open (MYTEMPFILE, ">/tmp/tempfile.txt") or die "Can't open file: $!\n";

my $console = Term::ReadLine->new();

my $SUBJECT = $console->get_reply( prompt => "Enter subject line:" );

my $GROUPS = $console->get_reply( prompt => "Enter groups:" );

printf MYTEMPFILE "From: NewsFeeder <MYNAME\@MYHOMEDOMAIN\n";
printf MYTEMPFILE "Newsgroups: $GROUPS\n";
printf MYTEMPFILE "Subject: $SUBJECT\n";
printf MYTEMPFILE "\n";

while (<>) {
	printf MYTEMPFILE;
		}
close (MYTEMPFILE);

system 'postnews -f /tmp/tempfile.txt MYNEWSERVER or die "Couldn't run
		postnews $!\n";
printf "Done.";


I've anonymized this script.  Enter the email address you would want to
post from where I have MYNAME\@MYHOMEDOMAIN being careful to retain the
escaped ampersand \@.  Also insert your news server in place of
MYNEWSERVER


That's all there is to it.  Now, download and read your RSS feeds using
Newsbeuter, and anything you want to post to a newsgroup, pipe to this
script, whatever you call it.  The script will prompt you for the
subject line and groups to which it should be sent.  Done.

Yay Unix/Linux.  Posting this here in case it's useful to somebody.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads