diff --git a/masto2gemlog.pl b/masto2gemlog.pl new file mode 100755 index 0000000..2766742 --- /dev/null +++ b/masto2gemlog.pl @@ -0,0 +1,58 @@ +#! /usr/bin/perl + +use strict; + +my $count=`xmllint --xpath 'count(/rss/channel/item)' alexlehm.rss`; + +my %post; + +for(my $i=1;$i<=$count;$i++) { + my $date=`xmllint --xpath "string(/rss/channel/item[$i]/pubDate)" alexlehm.rss`; + my $text=`xmllint --xpath "string(/rss/channel/item[$i]/description)" alexlehm.rss`; + my $media=`xmllint --xpath "string(/rss/channel/item[$i]/*[name()='media:content']/\@url)" alexlehm.rss`; + + chop $media; + + # figure out the date + + $date=~/ (\d+) (\S+) (\d+) /; + + my $filedate="$3-$2-$1"; + + print "$date $filedate\n"; + + # html to gemtext conversion + + $text=~s@
@@g; + $text=~s@
@@g; + + $text=~s@