Changeset 843

Show
Ignore:
Timestamp:
05/29/06 21:47:17
Author:
miyagawa
Message:
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/assets/plugins/Filter-EntryFullText/youtube.yaml

    r788 r843  
    33custom_feed_follow_link: /watch\?v=\w+ 
    44handle: http://(?:www\.)?youtube\.com/(?:watch)\?v= 
    5 extract: <span class="smallLabel">Added on</span> <b class="smallText">(.*?)</b><br/>.*?<span id="vidDescBegin">\s*(.*?)\s*</span> 
    6 extract_capture: date body 
     5extract: <span class="smallLabel">Added on</span> <b class="smallText">(.*?)</b><br/>.*?<span id="vidDescBegin">\s*(.*?)\s*</span>.*?(?:<div class="vNowPlaying">.*?<img class="vimgSm" src="(http://.*?\.youtube\.com/vi/.*?/\d+\.jpg)" />)? 
     6extract_capture: date body icon 
    77extract_date_format: %B %d, %Y, %I:%M %p 
    88extract_date_timezone: America/Los_Angeles 
  • trunk/plagger/assets/plugins/Filter-FindEnclosures/youtube.pl

    r786 r843  
    1616        return $enclosure; 
    1717    } 
     18 
    1819    return; 
    1920} 
  • trunk/plagger/lib/Plagger/Plugin/Filter/EntryFullText.pm

    r837 r843  
    109109    } 
    110110 
    111     my $res = $self->{ua}->fetch( $args->{entry}->permalink, $self ); 
    112     return if $res->http_response->is_error; 
     111    # NoNetwork: don't connect for 3 hours 
     112    my $res = $self->{ua}->fetch( $args->{entry}->permalink, $self, { NoNetwork => 60 * 60 * 3 } ); 
     113    return if $res->status != URI::Fetch::URI_OK && $res->is_error; 
    113114 
    114115    $args->{content} = decode_content($res); 
    115116 
    116117    # if the request was redirected, set it as permalink 
    117     my $base = $res->http_response->request->uri; 
    118     if ( $base ne $args->{entry}->permalink ) { 
    119         $context->log(info => "rewrite permalink to $base"); 
    120         $args->{entry}->permalink($base); 
     118    if ($res->http_response) { 
     119        my $base = $res->http_response->uri; 
     120        if ( $base ne $args->{entry}->permalink ) { 
     121            $context->log(info => "rewrite permalink to $base"); 
     122            $args->{entry}->permalink($base); 
     123        } 
    121124    } 
    122125 
     
    134137                $args->{entry}->body($data->{body}); 
    135138                $args->{entry}->title($data->{title}) if $data->{title}; 
     139                $args->{entry}->icon({ url => $data->{icon} }) if $data->{icon}; 
    136140 
    137141                # extract date using found one, falls back to Last-Modified 
  • trunk/plagger/lib/Plagger/Plugin/Filter/FindEnclosures.pm

    r787 r843  
    126126 
    127127    my $ua  = Plagger::UserAgent->new; 
    128     my $res = $ua->fetch($url, $self); 
    129     return if $res->is_error; 
     128    my $res = $ua->fetch($url, $self, { NoNetwork => 3 * 60 * 60 }); 
     129    return if $res->status != URI::Fetch::URI_OK && $res->is_error; 
    130130 
    131131    return decode_content($res); 
  • trunk/plagger/lib/Plagger/UserAgent.pm

    r840 r843  
    2323 
    2424sub fetch { 
    25     my($self, $url, $plugin) = @_; 
     25    my($self, $url, $plugin, $opt) = @_; 
    2626 
    2727    URI::Fetch->fetch($url, 
     
    2929        $plugin ? (Cache => $plugin->cache) : (), 
    3030        ForceResponse => 1, 
     31        ($opt ? %$opt : ()), 
    3132    ); 
    3233} 
  • trunk/plagger/lib/Plagger/Util.pm

    r754 r843  
    6868    # 1) if it is HTTP response, get charset from HTTP Content-Type header 
    6969    if ($res) { 
    70         $charset = ($res->http_response->content_type =~ /charset=([\w\-]+)/)[0]; 
     70        $charset = ($res->content_type =~ /charset=([\w\-]+)/)[0]; 
    7171    } 
    7272