Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.misc > #681 > unrolled thread

Piping articles to Usenet: how-to

Started byRS Wood <rsw@therandymon.com>
First post2014-02-21 20:54 +0000
Last post2014-03-03 20:44 +0000
Articles 5 — 3 participants

Back to article view | Back to comp.misc


Contents

  Piping articles to Usenet: how-to RS Wood <rsw@therandymon.com> - 2014-02-21 20:54 +0000
    Re: Piping articles to Usenet: how-to Mike Sanders <mike@taco-shack.cow> - 2014-02-22 00:09 +0000
    Re: Piping articles to Usenet  how-to "tdk" <forum.tdk@squte.com> - 2014-03-02 16:30 -0600
      Re: Piping articles to Usenet  how-to RS Wood <rsw@therandymon.com> - 2014-03-03 09:12 +0000
        Piping to comp.misc.  A revised script. RS Wood <rsw@therandymon.com> - 2014-03-03 20:44 +0000

#681 — Piping articles to Usenet: how-to

FromRS Wood <rsw@therandymon.com>
Date2014-02-21 20:54 +0000
SubjectPiping articles to Usenet: how-to
Message-ID<le8eer$uel$2@solani.org>
In an effort to make sure others can help send articles to comp.misc,
here's how I do it.  If this is useful to you, send us some stuff to
chat about!

My easy solution for scanning the news for interesting articles and
sending them easily to comp.misc involves three bits: newsbeuter as
console-based RSS reader, postnews.py (a python script that reads
a text file and posts it to a news server including user name and
password), and a little bash script that glues the two together.

Get newsbeuter for your *nix OS via the usual methods (or see
http://newsbeuter.org).  It's my favorite RSS reader, because it's for
the console, and you can pipe any article you see by pressing | either
in the article list or while reading the RSS article summary.  I know
it's available for Debian, openSUSE, and FreeBSD at a minimum.

Get postnews.py at http://sourceforge.net/projects/postnews/
It's a <10KB python script.

In between, I wrote a little bash script that accepts the standard input
(which would be the article contents coming from newsbeuter), asks a few
questions, puts it all together into a text file and sends that to
postnews.py.  Pretty simple stuff.  Better BASH scripters than me will
probably find dozens of ways to improve my work (I'd be interested in
knowing them, actually - a learning experience).  But this works pretty
well.  It allows me - while drinking my coffee - to scan the news, and
pipe anything I find relevant to comp.misc.  Fortunately, newsbeuter
does a good job of organizing all the links down at the bottom of the
post, which keeps the summaries readable.  Badda boom, badda bing.

If this is interesting, give it a try and help keep the conversation
(and the coffee) flowing!

---- post2compmisc.sh ----

#! /usr/local/bin/bash
TEMPTEXT='/tmp/slashtemptext'
TEMPHEADERS='/tmp/slashtempheaders'
TEMPARTICLE='/tmp/slashtemparticle'
DEPT=''
SUBJ=''

if [ -e $TEMPTEXT ];
then
	rm $TEMPTEXT 
fi 

if [ -e $TEMPHEADERS ];
then
	rm $TEMPHEADERS
fi 

if [ -e $TEMPARTICLE ];
then
	rm $TEMPARTICLE
fi 

while read line;
do
	echo "$line" >> $TEMPTEXT
done

echo ""
echo "This will go to comp.misc.  Enter Subject line:"
read SUBJ < /dev/tty

echo ""
echo "From which dept?"
read DEPT < /dev/tty

echo ""
echo "From: YOURNAME  <YOUR@EMAIL.ADDRESS.COM>" > $TEMPHEADERS
echo "Content-Type: text/plain; charset=UTF-8" >> $TEMPHEADERS
echo "" >> $TEMPHEADERS
echo "From the $DEPT department:" >> $TEMPHEADERS
cat $TEMPHEADERS $TEMPTEXT > $TEMPARTICLE
echo "----"
less $TEMPARTICLE

exec postnews --user LOGIN.NAME --pass YOURPASSWORD -f $TEMPARTICLE YOURNEWSSERVER

[toc] | [next] | [standalone]


#683

FromMike Sanders <mike@taco-shack.cow>
Date2014-02-22 00:09 +0000
Message-ID<slrnlgfql6.187.mike@taco-shack.cow>
In reply to#681
RS Wood writes:

> If this is interesting, give it a try and help keep the conversation
> (and the coffee) flowing!

Yes, very interesting ideas in fact. Keep'em coming!

-- 
Mike's FreeBSD Stuff
www: http://freebsd.hypermart.net

[toc] | [prev] | [next] | [standalone]


#1164 — Re: Piping articles to Usenet how-to

From"tdk" <forum.tdk@squte.com>
Date2014-03-02 16:30 -0600
SubjectRe: Piping articles to Usenet how-to
Message-ID<4712#13870@usenet.squte.com>
In reply to#681
Sorry for the late reply.

From the postnews.py source:

print "Article must at least contain the headers 'From:', 'Newsgroups:' and 
'Subject:',"
print "a newline and a body."

But here is no newsgroups in the headers.
So I think you're missing a line like:
echo "Newsgroups:comp.misc" >> $TEMPHEADERS

regards
~tdk

-- 
regards
~tdk
View this thread at http://squte.com/node/4712#comment-13870

[toc] | [prev] | [next] | [standalone]


#1184 — Re: Piping articles to Usenet how-to

FromRS Wood <rsw@therandymon.com>
Date2014-03-03 09:12 +0000
SubjectRe: Piping articles to Usenet how-to
Message-ID<lf1h1g$2td$1@solani.org>
In reply to#1164
tdk wrote:
> Sorry for the late reply.
>
>  From the postnews.py source:
>
> print "Article must at least contain the headers 'From:', 'Newsgroups:'
> and 'Subject:',"
> print "a newline and a body."
>
> But here is no newsgroups in the headers.
> So I think you're missing a line like:
> echo "Newsgroups:comp.misc" >> $TEMPHEADERS
>
> regards
> ~tdk
>

You are right, and that line *is* in my litle bash script, but somehow 
got sloppily cut/pasted.  I think I'll repost it in a day or two: I'm 
adjusting it based on recent crosspost/m.n.i.d. decisions.

Glad someone read this and is hopefully planning on using it!

[toc] | [prev] | [next] | [standalone]


#1218 — Piping to comp.misc. A revised script.

FromRS Wood <rsw@therandymon.com>
Date2014-03-03 20:44 +0000
SubjectPiping to comp.misc. A revised script.
Message-ID<lf2pk0$fig$4@solani.org>
In reply to#1184
Here's a revised script.  It prompts for whether the post will go to
comp.misc or to misc.news.internet.discuss.  It then prompts for a
single group to which to crosspost (or none).  If there is a crosspost,
it automatically prefixes the title with [CM] to permit the users in the
other group to filter out this kind of post, and sets the follow-up to
that group rather than comp.misc.

Hope it prompts some of you into action.  It amazes me that on a
newsgroup that's had nothing but robospam and roboporn for 5+ years, a
guy posting links to tech articles be accused of spamming.  Only on
Usenet are the trolls immortal. I resolve to not feed them.

As before, this script is the glue between newsbeuter and postnews.py

#! /usr/local/bin/bash

TEMPTEXT='/tmp/slashtemptext'
TEMPHEADERS='/tmp/slashtempheaders'
TEMPARTICLE='/tmp/slashtemparticle'
DEPT=''
SUBJ=''
XPOST=''
GROOP=''

# CLEAN UP THIS MESS
for i in $TEMPTEXT $TEMPHEADERS $TEMPARTICLE 
	do 
	echo "Nuking $i"
	if [ -e $i ]; then rm $i; fi
	done

#SPAFF THE TEXT FROM NEWSBEUTER
while read line;
do
	echo "$line" >> $TEMPTEXT
done

# THE BASICS
echo "From: Obnoxious Troll <whine@usenet.com>" > $TEMPHEADERS
echo "Content-Type: text/plain; charset=UTF-8" >> $TEMPHEADERS

echo ""
echo "This is going to Usenet.  Enter Subject line:"
read SUBJ < /dev/tty

# SET TITLE, FOLLOW-UP, AND GROUP BASED ON USER CHOICES
echo ""
echo "Send to comp.misc or misc.news.internet.discuss?"
echo "[C] comp.misc     [M] m.n.i.d."
read SENDTO < /dev/tty

case $SENDTO in
	[cC]) GROOP='comp.misc' ;;
	[mM]) GROOP='misc.news.internet.discuss' ;;
esac

echo ""
echo "Crosspost?  Type one additional group or ENTER for none."  
echo "Follow-up will also be set: eg. misc.rabid.bunnies,comp.obnoxious.troll"
read XPOST < /dev/tty

if  [ "$XPOST" != "" ];
	then
		SUBJ="[CM] ${SUBJ}"
		GROOP="$GROOP,$XPOST"
		echo "Subject: $SUBJ" >> $TEMPHEADERS
		echo "Followup-To: $XPOST" >> $TEMPHEADERS
	else
		echo "Subject: $SUBJ" >> $TEMPHEADERS
fi
		
echo "Newsgroups: $GROOP" >> $TEMPHEADERS

echo ""
echo "From which dept? (eg. Happy go Lucky). I'll add the quotes."
read DEPT < /dev/tty

echo "" >> $TEMPHEADERS
echo "From the «$DEPT» department:" >> $TEMPHEADERS
cat $TEMPHEADERS $TEMPTEXT > $TEMPARTICLE
echo "----"
less $TEMPARTICLE

exec postnews --user USERNAME pass MYPASSWORD -f $TEMPARTICLE MYNSP

[toc] | [prev] | [standalone]


Back to top | Article view | comp.misc


csiph-web