I was using Freebase to get all movies/films there for my website, but it's getting shut down soon. so I was searching for another free database for movies and came across Wikidata. To be honest it's too complicated to understand how to query all the movies.
So I thought you guys could help me to get all the movies in Wikidata. In the future I want to include TV shows and series as well.
Programming language doesn't matter, I want to use web query with a link.
you can look for all the entities that are an instance of film, which in Wikidata is translated as:
P31 (instance of) -> Q11424 (film)
For the moment, the best way to do this query is to use the wdq.wmflabs.org API, where this query translate as: http://wdq.wmflabs.org/api?q=claim[31:11424]
(avoid making this query in a browser as it will probably make it crash due to the ). At the moment I'm writting, this requests returns 157038 items in the form of numeric ids (ex: 125
). To get the Wikidata ids, just add a leading Q
-> Q125
.
To get the labels and data from all those Wikidata ids, use the Wikidata API wbgetentities
action: https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q180736&format=json&languages=en
.
Beware of the 50 entities per-query limit though
[UPDATE] Wikidata now offers a SPARQL endpoints: the same query in SPARQL or even this same query but also including subclasses of films
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With