Reputation: 130
Since I don't know how it is called the name of the Friendly format of the Mime Types like for example:
image/bmp - > Bitmap
image/x-icon - > Icon
I would like to ask how I can retrieve that information in some kind of Map with Key->Value (I am using Java)
Or some library where I can get them from.
I am using apache tika and there with MimeTypes.forName("application/pdf").getDescription(); is not returning me anything.
Anyways I think this question is irrelevant for every programming language.
I've found one website where I can see them but it is made with Table and I cannot extract them so I can receive them in key->value type HERE
Upvotes: 0
Views: 955
Reputation: 6682
You could just scrape that page.
If you're using Firefox with Firebug or Chrome then paste the following Javascript into an eval window and run it.
(The right hand side panel in Firebug's Console tab, or in Chrome; Tools > Developer Tools and paste in Console tab)
jQuery('#mime-types-list tbody tr').each(function(i, tr){
var tds = jQuery(tr).children('td');
console.log("map.put(\"" + jQuery(tds[1]).text() + "\", \"" + jQuery(tds[0]).text() + "\");");
});
This will generate 684 entries, to copy 'n' paste, such as:
map.put("text/turtle", "Turtle (Terse RDF Triple Language)");
Just convert the string inside console.log
to suit your syntax/format needs.
Upvotes: 1