Rod Clark's Home Page CGI Scripts

Web Newsreaders

There are two newsreaders here. The first, newsgroups.pl, is actually a "newsreader helper" instead of a self-contained newsreader. It retrieves newsgroup names via nntp and builds a set of Web menus that let you click on news:// URLs with a browser that includes a built-in newsreader (for example, Netscape or Lynx). This retrieves a list of current messages for a newsgroup, without retrieving the entire list of newsgroups on the server.

Newsgroups.pl allows posting messages, to servers that allow posting. It doesn't use CGI, unlike the newsreader below, and won't search for newsgroup names. You can run it as a cron job to periodically refresh the list of newsgroups, say daily for your own server and maybe weekly or monthly for remote servers.

The second newsreader is a read-only CGI newsreader that is compatible with any browser. It doesn't need a browser with a built-in newsreader. It has three parts. Listgroups.pl builds Web menus of newsgroup names. Readnews can search for newsgroup names and display a menu of matching groups. It can also display a list of the messages in a newsgroup. Readmsg displays an individual message.

The listgroups.pl script creates a set of simple Web menus that are most usable with a small or moderate number of newsgroups. If your news server carries more than about 5,000 newsgroups, you might become frustrated with the flat menus that it creates.

Listgroups.pl is optional. You can use the readnews and readmsg scripts without it, when you don't need to have menus of newsgroup names, only Web links to a few specific groups.

Readnews lists the most recent messages in a newsgroup, one per line. It displays each message's date, title and sender. The title is a link that reads the message with the readmsg script. At the bottom of the page, readnews displays a status bar to list earlier batches of messages.

Ordinarily, readnews takes its input from a query string appended to its URL. But readnews can also take its input from an HTML form, to search for newsgroup names. If the form input doesn't match a specific newsgroup, then readnews searches for newsgroup names that match any of the search strings. It searches the news active file (or its own local copy of a remote server's active file) or, if that's not available, reads the list of newsgroups from the server via NNTP. It ranks the results by how many of the search strings each newsgroup name matches.

Readmsg displays an individual message. It converts e-mail addresses and URLs in the text to hyperlinks.

Readnews Files: (contains everything below)
readnews-1.85.tar.gz

Example:
Read seattle.eats

Source code:
listgroups.pl source code
readnews source code
readmsg source code

newsgroups.pl source code

E-mail: Rod Clark
bb615@scn.org

Updated February 6, 2001