Skip to content

Instantly share code, notes, and snippets.

@matoken matoken/4atom.cgi
Created Apr 4, 2019

Embed
What would you like to do?
#!/usr/bin/perl
use strict;
use warnings;
use HTML::Entities;
use Encode qw/encode decode/;
print "Content-Type: application/atom+xml; charset=utf-8\n\n";
my $URL= 'https://gnusocial.matoken.org/api/statuses/user_timeline/2.atom';
my @cont = `wget -q -O - $URL`;
foreach my $data(@cont){
$data = decode('UTF-8',$data);
if(( $data !~ /matoken.org\/blog\// ) &&
( $data !~ /\#kagolug/ ) &&
( $data =~ / <content type="html">/ )){
# print encode('UTF-8',$data);
$data =~ s/^.*>(.*)<.*$/$1/;
$data = decode_entities($data);
$data =~ s/&quot;/"/g;
$data =~ s/&lt;/</g;
$data =~ s/&gt;/>/g;
$data =~ s/<.*?>//g;
$data = substr($data,0,64);
$data = ' <content type="html">' . $data . "</content>\n";
# print encode('UTF-8',"$data\n");
}
print encode('UTF-8',$data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.