--- getfeed.sql 2008/03/15 21:06:51 3 +++ getfeed.sql 2008/03/15 21:57:40 5 @@ -10,14 +10,21 @@ my $feed = XML::Feed->parse(URI->new($uri)) or die XML::Feed->errstr; + sub strip_html { + my $t = shift; + $t =~ s/<\/?[^>]+>//gs; + $t =~ s/\s\s+/ /gs; + return $t; + } + for my $entry ($feed->entries) { return_next({ - feed => $feed->title, - title => $entry->title, - content => $entry->content->body, - link => $entry->link, - pubdate => $entry->issued, - author => $entry->author, + feed => $feed->title, + title => $entry->title, + content => strip_html( $entry->content->body ), + link => $entry->link, + pubdate => $entry->issued, + author => $entry->author, }); } @@ -40,7 +47,7 @@ ; select - feed,author,title,substr(content,0,50),pubdate,link + feed,author,title,substr(content,0,80),pubdate,link from feeds order by pubdate desc limit 30