Merged version accidentally committed to pod_tweeter branch

This commit is contained in:
Brian O'Donnell
2015-07-07 11:49:22 -04:00
parent a724459abb
commit a577a37264
+8 -3
View File
@@ -125,9 +125,9 @@ sub publish_feed_items {
my $content = $update->{'hashtags'}; my $content = $update->{'hashtags'};
if( $params{'embed_image'} and length $update->{'image'} ){ if( $params{'embed_image'} and length $update->{'image'} ){
my $image_link = '![](' . $update->{'image'}; my $image_link = '[![](' . $update->{'image'};
$image_link .= ' "' . $update->{'image_title'} . '"' if length $update->{'image_title'}; $image_link .= ' "' . $update->{'image_title'} . '"' if length $update->{'image_title'};
$image_link .= ')'; $image_link .= ')](' . $update->{'link'} . ')';
$content = "$image_link\n$content"; $content = "$image_link\n$content";
} }
@@ -279,7 +279,7 @@ sub get_feed_items {
push ( @hashtags, @categories ); push ( @hashtags, @categories );
} }
# extract image link and hover text if it exists # extract image link and hover text from description if it exists
if( defined $item->{'description'} ){ if( defined $item->{'description'} ){
$item->{'description'} =~ / src='(https?:\/\/[^']+)/ unless $item->{'description'} =~ / src="(https?:\/\/[^"]+)/; $item->{'description'} =~ / src='(https?:\/\/[^']+)/ unless $item->{'description'} =~ / src="(https?:\/\/[^"]+)/;
@@ -290,6 +290,11 @@ sub get_feed_items {
} }
} }
# extract the image link from the enclosure tag if it exists
if( not length $image and defined $item->{'enclosure'} and defined $item->{'enclosure'}->{'type'} and $item->{'enclosure'}->{'type'} =~ /^image\// ){
$image = $item->{'enclosure'}->{'url'} if defined $item->{'enclosure'}->{'url'};
}
@hashtags = sort @hashtags; @hashtags = sort @hashtags;
if( defined $item->{'guid'} ){ if( defined $item->{'guid'} ){