#! /usr/bin/perl use strict; my $username=shift; my $rssurl="https://mastodon.social/users/$username.rss"; system("wget $rssurl"); my $fname="$username.rss"; my $dir="gemlog"; my $count=`xmllint --xpath 'count(/rss/channel/item)' $fname`; my %post; for(my $i=1;$i<=$count;$i++) { my $date=`xmllint --xpath "string(/rss/channel/item[$i]/pubDate)" $fname`; my $text=`xmllint --xpath "string(/rss/channel/item[$i]/description)" $fname`; my $media=`xmllint --xpath "string(/rss/channel/item[$i]/*[name()='media:content']/\@url)" $fname`; chop $media; # figure out the date $date=~/ (\d+) (\S+) (\d+) /; my $filedate="$3-$2-$1"; # html to gemtext conversion $text=~s@
@@g; $text=~s@
@@g; $text=~s@