Changeset 635

Show
Ignore:
Timestamp:
04/21/06 01:56:52
Author:
miyagawa
Message:

allow bad Content-Type for feeds like text/plain or text/html. Fixes #167

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Plugin/Aggregator/Simple.pm

    r583 r635  
    3131                       "text/xml"; 
    3232 
    33     if ( $Feed::Find::IsFeed{$content_type} ) { 
    34         $self->handle_feed($url, \$res->content); 
     33    my $content = $res->content; 
     34    if ( $Feed::Find::IsFeed{$content_type} || $self->looks_like_feed(\$content) ) 
     35        $self->handle_feed($url, \$content); 
    3536    } else { 
    36         my @feeds = Feed::Find->find_in_html(\$res->content, $url); 
     37        my @feeds = Feed::Find->find_in_html(\$content, $url); 
    3738        if (@feeds) { 
    3839            $url = $feeds[0]; 
     
    4546 
    4647    return 1; 
     48} 
     49 
     50sub looks_like_feed { 
     51    my($self, $content_ref) = @_; 
     52    $$content_ref =~ m!<rss version="|<rdf:RDF xmlns="http://purl\.org/rss|<feed xmlns="!; 
    4753} 
    4854