use Perl feeds

jdavidb on 2007-03-14T14:34:44

Following on from my previous post, I'm now realizing that you can get lots of useful feeds out of use Perl by running a query and then adding "content_type=atom" to the GET parameters in the URL. For example:

Now I'm trying to brainstorm a way to get a feed of my own (or another specified user's) comments.

Note to pudge: a subscriber feature I'd love to see on Slashdot is feeds for comments of specific users. :)


XML::RSS::FromHTML::Simple

reneeb on 2007-03-14T16:20:40

You could create your own RSS generator...

(untestet)

use XML::RSS::FromHTML::Simple;

my $proc = XML::RSS::FromHTML::Simple->new({
url => "http://use.perl.org/user/reneeb",
rss_file => "new_comments.xml",
});

$proc->link_filter( sub {
my($link, $text) = @_;

# Only extract links that contain 'comments.pl'
# in their URL
if( $link =~ m#comments\.pl#) {
return 1;
} else {
return 0;
}
});

# Create RSS file
$proc->make_rss() or die $proc->error();

Re:XML::RSS::FromHTML::Simple

jdavidb on 2007-03-14T17:49:46

Thank you. I feel like somebody just did my homework for me! :) I've yet to create an RSS feed any where, using any mechanism (other than gluing some stuff together with Yahoo Pipes), so having this example is going to be good for me in several ways as I move in to this. :)

Re:XML::RSS::FromHTML::Simple

jdavidb on 2007-03-14T19:33:35

I owe you a cheap meal for giving me this, and the author of this module a moderately expensive meal for enabling logging with Log4perl. :)

Pipes

Aristotle on 2007-03-14T17:12:03

You could use Yahoo! Pipes to filter the comments feed by author.

Re:Pipes

jdavidb on 2007-03-14T17:53:54

Thought about that. So far all I've done with Pipes is a bit of gluing, sorting, and filtering by keyword in the subject. But I need to flex those muscles a bit. :)

Re:Pipes

jdavidb on 2007-03-14T19:03:22

There you go. Just my comments. Of course, it only gets the ones that show up in the most recent 24 comments, rather than getting my most recent 24 comments. And it won't work on Slashdot. :)

No content in the comments feed

karjala on 2007-03-14T17:22:49

Bad

Re:No content in the comments feed

jdavidb on 2007-03-14T17:54:12

Yeah, that is a problem. Maybe they can be mined.

Re:No content in the comments feed

jdavidb on 2007-03-14T17:55:49

pudge, if you're reading this, some guidance as to acceptable use would be appreciated. If I grab somebody's most recent 24 comments once an hour with a program, that wouldn't negatively impact anything, would it?

Hmm, maybe pipes can be used to take the basic comment search feed and then fetch the content of the comments....

Re:No content in the comments feed

Aristotle on 2007-03-14T18:34:58

If I grab somebody’s most recent 24 comments once an hour with a program, that wouldn’t negatively impact anything, would it?

Why do you want to poll every hour? Do you need to see them that quickly? Do they write more close to 24 comments in an hour?

Re:No content in the comments feed

jdavidb on 2007-03-14T18:51:07

Suppose I'm pulling on Slashdot, not use Perl....

It's a situation where a person might not write more than 24 comments per day on average, but might have a short burst where they write much more rapidly and comments might be missed.

And there's really nothing magic about the one hour interval; that was just what I suggested in trying to gauge how often polling might be appropriate.

Full text feed for all users

nik on 2007-03-16T11:24:09

I provide a full text feed of all journal entries. I wrote up how I did that.

Feel free to take that and do what you will with it.

Re:Full text feed for all users

jdavidb on 2007-03-16T13:13:57

Thank you!

Re:Full text feed for all users

jdavidb on 2007-03-16T18:17:23

For the record, if you grab the journal feed some others mentioned in response to one of my earlier entries, you'll also get full text, straight from use Perl. But it doesn't work for comments.