Changeset 1862

Show
Ignore:
Timestamp:
11/26/06 17:01:45
Author:
miyagawa
Message:

Filter::DegradeYouTube?: make the regexp more relaxed to work with XHTML. Added cache for the API call for 24 hours

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Plugin/Filter/DegradeYouTube.pm

    r1861 r1862  
    66 
    77my $regex = <<'...'; 
    8 <object width="\d+" height="\d+"><param name="movie" value="(http://www.youtube.com/[^"]+)"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/[^"]+"  type="application/x-shockwave-flash" wmode="transparent"  width="\d+" height="\d+"></embed></object> 
     8<object width="\d+" height="\d+".*?><param name="movie" value="(http://www.youtube.com/[^"]+)".*?><param name="wmode" value="transparent".*?>(.*?)</object> 
    99... 
    1010chomp $regex; 
     
    2828        my $body; 
    2929        if (my $dev_id = $self->conf->{dev_id}) { 
    30             my $thumb_url = $self->_thumbnail_url($dev_id, $self->_video_id($url)); 
     30            my $thumb_url = $self->cache->get_callback( 
     31                $url, 
     32                sub { $self->_thumbnail_url($dev_id, $self->_video_id($url)) }, 
     33                60 * 60 * 24, 
     34            ); 
     35            $context->log(info => "Thumbnail for $url => $thumb_url"); 
    3136            qq{<a href="$url"><img src="$thumb_url" /></a>} 
    3237        } else {