#!/usr/bin/perl
#

use warnings;
use strict;
use LWP::Simple;

my @contenttypes = ("application", "audio", "image", "message", "model", "multipart", "text", "video");
my $baseurl = "http://www.iana.org/assignments/media-types/";

foreach my $contenttype (@contenttypes)
{
	my $url = "$baseurl$contenttype/";
	my $content = get $url;
	if (!defined($content)) { die "couldn't get $url"; }

	$content =~ s/\n//g;

	while ($content =~ /(<tr>.*?<td>.*?<\/td>.*?<td>(.*?)<\/td>.*?<\/tr>)/s)
	{
		my $type = $2;
		my $reg = quotemeta($1);
		if ($type =~ />(.*)</) { $type = $1; }
		if ($type !~ /&nbsp;/
			&& $type !~ /(obsolete|deprecated)/i) {
			#$type =~ y/[A-Z]/[a-z]/; # all lowercase
			print "$contenttype\/$type\n";
		}
		$content =~ s/$reg//;
	}
}




