Querying Wikipedia DB

Associate
Joined
28 Nov 2004
Posts
1,237
Location
Birmingham
Hi everyone,
Does anyone know if it's possible to 'embed' the wikipedia database into your site? I want to be able to pull back info on bands into the content of my website.

Any help would be greatly appreciated!

Ta!
 
There's no API currently available for Wikipedia to allow you to pull data off their DB in a clean manner; though there is apparently one in the works. Best you're going to have is to screen-scrape the relevant page, and then extract the relevant data from the HTML source. It should be fairly trivial depending on how competent you are as a programmer.

Wikipedia entry URIs are fairly standardised. Start with
Code:
http://en.wikipedia.org/wiki/
Then, keyword is upper-case first-letter, and spaces are converted to underscores:
Code:
http://en.wikipedia.org/wiki/The_Beatles
or the printable version might be better, e.g.
Code:
http://en.wikipedia.org/w/index.php?title=The_Beatles&printable=yes
Then extract all info in <div id="content"></div>.


Bear in mind the licensing of the data i.e. if you use the data, derivative works have to also be GFDL licensed (so I can scrape your site and use your derivative content ;)).
 
ah cool. I thought I saw some kind of API being used on another site the other day and it got me thinking.
Stripping out the relevant code wouldn't be a problem tho so I'll try that I think if the licensing side of things doesn't come into play!
Cheers dude!
 
Back
Top Bottom