Changeset 1827
- Timestamp:
- 11/10/06 16:17:35
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plagger/lib/Plagger/Plugin/CustomFeed/Mixi.pm
r1784 r1827 179 179 my $meth = $MAP->{$type}->{get_detail}; 180 180 my($item) = $self->{mixi}->$meth($msg->{link}); 181 182 if ($meth eq 'get_view_diary') { 183 $item->{images} = $self->get_images($self->{mixi}->response->content); 184 } 181 185 $item; 182 186 }, … … 187 191 $body =~ s!(\r\n?|\n)!<br />!g; 188 192 for my $image (@{ $item->{images} }) { 189 # xxx this should be $entry->enclosures190 193 $body .= qq(<div><a href="$image->{link}"><img src="$image->{thumb_link}" style="border:0" /></a></div>); 194 my $enclosure = Plagger::Enclosure->new; 195 $enclosure->url( URI->new($image->{thumb_link}) ); 196 $enclosure->auto_set_type; 197 $enclosure->is_inline(1); 198 $entry->add_enclosure($enclosure); 191 199 } 192 200 $entry->body($body); … … 203 211 204 212 $context->update->add($feed); 213 } 214 215 sub get_images { 216 my($self, $content) = @_; 217 218 my @images; 219 while ($content =~ m!MM_openBrWindow\('(show_diary_picture\.pl\?.*?)',.*?><img src="(http://ic\d+\.mixi\.jp/p/.*?)"!g) { 220 push @images, { link => "http://mixi.jp/$1", thumb_link => $2 }; 221 } 222 223 return \@images; 205 224 } 206 225
