Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieve music artist data from wikipedia? [closed]

Tags:

wikipedia

When it comes to classifying music by genre, I've found wikipedia to have more interesting genre information than most other data sources.

I seem to remember a database that collected this sort of information from Wikipedia and made it more easily accessible, but I couldn't google anything up today.

If I was to attempt to retrieve this data, what are my options? Is there anything like what I described or do I need to go a-screen-scraping?

like image 907
Kenny Avatar asked Jan 19 '09 04:01

Kenny


1 Answers

You should look into Freebase (see, for example, their musical artists table). If you do choose Wikipedia, then you should probably download a database dump.

Example comparing genre listings of Freebase and Wikipedia for the band Radiohead:

  • Freebase: alternative rock, art rock, electronic music, progressive rock, electronica, and experimental rock.
  • Wikipedia: alternative rock, electronic, and experimental rock.

Edit: More importantly, I've included a working example using mjt, a Javascript framework designed for Freebase. Copy-paste this into a file, open with your browser, enter an artist's name, and see which genres Freebase has for them.

Less importantly, I've changed my examples and default to Radiohead. =)

<html>
<head>
  <script type="text/javascript" src="http://mjtemplate.org/dist/mjt-0.6/mjt.js"></script>
</head>
<body onload="mjt.run()">
<pre mjt.script="">
var name = mjt.urlquery.name ? mjt.urlquery.name : 'Radiohead';
</pre>
<div mjt.task="q">
mjt.freebase.MqlRead([{
  type: '/music/artist',
  name: {
    value:name,
    lang:{name:{value:'English'}}
  },
  genre: [{
    name: {
      value:null,
      lang:{name:{value:'English'}}}
  }]
}])
</div>

<form method="get" action="">
<input type="text" name="name" value="$name" />
<input type="submit" value="search" />
</form>

<table mjt.for="topic in q.result">
  <tr mjt.for="(var rowi = 0; rowi &lt; topic.genre.length; rowi++)">
    <td><pre mjt.script="">var gname = topic.genre[rowi].name;</pre>$gname.value</td>
  </tr>
</table>
</body></html>

You're most likely using another language, but hopefully you can easily translate the above query.

like image 136
A. Rex Avatar answered Dec 18 '22 18:12

A. Rex