Simple commandline tool to aid reading the posts of this or any group

S

skywriter14

This is a little commandline tool I wrote to help myself read the
posts in this group. It fetches the thread urls with the latest posts
and opens them in firefox. I use this from cygwin command prompt in my
windows machine. I hope someone else will be interested enough to
enhance it.

Why did I create it: I use a feed reader too to read the posts of the
groups i subscribed from google groups. I click on the the links on
summary/description of each post in my reader. Then I reach the page
with only one post, then I click on another link to reach to the
thread. I find do that fewtimes everyday really painful.

example useage:

browse.pl
browse.pl perl.beginners
browse.pl comp.unix.shell

(comp.lang.perl.misc is the default group)

------------------------------------------------------------------
#!/usr/bin/perl
#browse.pl

use strict;
use warnings;
use WWW::Mechanize;

my $browser_path = '/cygdrive/c/Program\ Files/Mozilla\ Firefox/
firefox.exe ';
my $group_name = 'comp.lang.perl.misc'; # default group. it will be
used if you don't provide one as parameter
$group_name = $ARGV[0] if @ARGV; # user specified group, from
commandline parameter
my $url = 'http://groups.google.com/group/'.$group_name.'/topics?
gvc=2';
my $limit = 10; # limit number of posts to open

print "Group: [$group_name]\n";
my $m = WWW::Mechanize->new();
print "Getting $limit links of threads...\n";
$m->get($url);
my $html = $m->content();
#print $html;

my @links = ($html =~ m{<td><a href="(/group/$group_name/browse_thread/
thread/[^/]+/[^/]+)#[^/]+">}igs);
if (@links) {
@links = map {'http://groups.google.com' . $_} @links;
my @links_limited = splice @links, 0, $limit;
my $url_string = sprintf (qq/"%s"/, join q/" "/, @links_limited);
#print $url_string."\n";
print "Opening browser...\n";
system ($browser_path . $url_string . ' &');
}else{
print "oooops! could not load main page\n";
}

exit 0;
------------------------------

So, anyone interested to enhance it?

Regards,
Sumon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,733
Latest member
LonaMonzon

Latest Threads

Top