How can I understand the this part of Freebase? - wikipedia-api

enter image description here
"(m/0m48smv)" Based on my knowledge, this should response page title from Wikipedia which has a specific id. How can I know the page title?

m/0m48smv is the identifier of an entry in the former Freebase database.
The entry has the name "!" and types "relase track" and "topic".
While some Freebase entries have an associated Wikipedia artice, this is missing for the m/0m48smv entry.

Related

How to get all Wikipedia page links with their pageIDs?

Starting a request like that:
https://en.wikipedia.org/w/api.php?action=query&format=json&titles=Title&prop=links&pllimit=500
provides me a list of links (that the page contains) where every link consists of the title and the ns (namespace)
Is there a way to also get the PageID together with title & ns? (the less work it is for the sever the better of course)
You need to use generator parameter. Here is an example for Cobra Wikipedia page.
https://en.wikipedia.org/w/api.php?action=query&generator=links&titles=Cobra&prop=info&gpllimit=500

Section content using MediaWiki API

I'm using the MediaWiki API to get the content of a Wikipedia page like this in JSON.
http://en.wikipedia.org/w/api.php?format=json&action=query&titles=New_York&prop=extracts
I'd like each section to be separated out instead of having the entire content of the page as one value. I know you can get each section like this but I want it to also include the content with each section.
http://en.wikipedia.org/w/api.php?format=json&action=parse&prop=sections&page=New_York
Is this possible to do with the API?
If you know the number of the section which you want you can get the contents through action=parse with the section parameter. E.g. the "19th century" section of the New_York article would be:
https://en.wikipedia.org/w/api.php?action=parse&page=New_York&format=json&prop=wikitext&section=4
To get the section number you can use
http://en.wikipedia.org/w/api.php?format=json&action=parse&prop=sections&page=New_York
and then find the index corresponding to your section title (line). In this case "line":"19th century","index":"4".

Search iTunes by artist and song title

I found that I can search for a song term like so:
https://itunes.apple.com/search?media=music&entity=musicTrack&attribute=songTerm&term=xxxx
But what I really want to do is search by song title and the artist. I can't seem to find syntax that would allow for that. Is it possible? I'm doing this from inside an iOS audio streaming application so I want to keep the returned results as small as possible so as to not use up much of a person's data plan.
Basically itunes search api sucks, a lot.
I was trying to do the same, but there isn't a direct way to search by song and artist, it searches both, and if your user misspelled the name of the song or the artist, the search can give you bad results.
So my solution was basically use a prefilter first to correct that, using echonest, to search by artist name and song name, then show a dropdown (you can choose other method like "Do you mean: ...?" with links to correct url for search) and then use what Fahad says, putting first the name of the artist and then the name of the song. Don't forget to encode those.
There are a few ways of doing this, the simplest would be something like
https://itunes.apple.com/search?term=slipknot+duality
For further information regarding the iTunes Search API
you can concatinate artist name and song title using + sign inplace of space between those words as given below:
https://itunes.apple.com/search?term=the+beatles+let+it+be
in the above url "the beatles" is the artist name and "let it be" is the track name.
That's it your done.

How to get the result of "all pages with prefix" using Wikipedia api?

I wish to use Wikipedia api to extract the result of this page:
http://en.wikipedia.org/wiki/Special:PrefixIndex
When searching "something" on it, for example this:
http://en.wikipedia.org/w/index.php?title=Special%3APrefixIndex&prefix=tal&namespace=4
Then, I would like to access each of the resulting pages and extract their information.
What api call might I use?
You can use list=allpages and specify apprefix. For example:
http://en.wikipedia.org/w/api.php?format=xml&action=query&list=allpages&apprefix=tal&aplimit=max
This query will give you the id and title of each article that starts with tal. If you want to get more information about each page, you can use this list as a generator:
http://en.wikipedia.org/w/api.php?format=xml&action=query&generator=allpages&gapprefix=tal&gaplimit=max&prop=info
You can give different values to the prop parameter to get different information about the page.

How to get content from the Wikipedia API for a movie?

I tried to get the description of the movie "Your Highness" from the Wikipedia API but it gives me nothing.
http://en.wikipedia.org/w/api.php?format=xml&action=query&titles=your%20highness&prop=revisions&rvprop=content
When I google "Your Highness" wikipedia shows up as the third result, that's the page that I want the API to give me.
Also I just want the text of the description of the movie, no wiki-syntax mixed in or anything.
I was wrong before about the problem being a space - it looks like it was just capitalization. If we just change your URL to use Your%20Highness instead of your%20highness it works:
http://en.wikipedia.org/w/api.php?format=xml&action=query&titles=Your%20Highness&prop=revisions&rvprop=content
EDIT: While not all titles are title-cased (such as "The Name of the Rose") if you use the &redirects query parameter, it sometimes helps - it certainly helps in "the name of the rose" but not for "your highness" for some reason. Wouldn't like to say why, but it's probably worth more investigation...