rone: (Default)
[personal profile] rone

The redoubtable Dave Zuckerman writes:

I'm not a huge blog fan.  Every once in a while, just to be contrarian, I think about doing periodic .plan updates, just so I can tell people who ask if I blog that they'll have to finger me to find out!  Bwahahahah!

Now i'm tempted to figure a way to stick my latest LJ entry into my .plan.

Re: No problemo!

Date: 2004-01-14 08:00 pm (UTC)
From: [identity profile] fabio-heinz.livejournal.com
While I'll grant that "the entire damn page" does indeed include "latest entry", I'm not sure this is what was meant :)
Meh, changing specifications!
#!/usr/bin/perl
use strict;
use warnings;
use LWP::Simple;

my $content = get("http://www.livejournal.com/users/ronebofh/");
local($/);

if ($content =~ m|<div class="entry">(.*?)</div>|ms)
{
my $latest_entry = $1;
#strip tags and crap
$latest_entry =~ s/<.*?>//g;
$latest_entry =~ s/&nbsp;/ /g;

open PLAN, ">$ENV{HOME}/.plan" or die "can't open .plan: $!";
print PLAN $latest_entry;
close PLAN or die "can't close .plan: $!";
}

__END__

Re: No problemo!

Date: 2004-01-14 08:25 pm (UTC)
From: [identity profile] tyggerjai.livejournal.com
Fragile :)
It breaks as soon as he changes layout/format. Or at least has the potential to break - some layouts don't even use the div.

Splitting the RSS feed is the way to go.

my $content = get("http://livejournal.com/users/ronebofh/rss");

Then split on "", chop off everything after , de-htmlise as you do, and you're good to go. Though I'd run it through HTML::Parser to expand the entities rather than trusting to  , and I'd use an XML parser anyway.

sol.
.

Re: No problemo!

Date: 2004-01-14 08:28 pm (UTC)
From: [identity profile] tyggerjai.livejournal.com
Fuck it :)

"split on <description>", and you want the second element of the array thus produced. Then discard everything after "</description>", etc.

I can't be expected to be thinking right, I'm at work!

sol.
.

Profile

rone: (Default)
entombed in the shrine of zeroes and ones

December 2022

S M T W T F S
    123
45678910
11121314151617
18192021222324
252627282930 31

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 6th, 2026 10:53 pm
Powered by Dreamwidth Studios