Wikidata API wbsearchentities: why are results not the same in Python than in Wikidata?
I'm using wbsearchentities (wikidata api) in a python request and I'm wondering why returned results are not the same that those seen on Wikidata. For example, the following command in Python:
url = "https://www.wikidata.org/w/api.php?action=wbsearchentities&search=%s&format=json&limit=50&formatversion=2&language=en" % ('New York Landmarks Preservation Commission')
r = requests.post(url,headers={"User-Agent" : "Magic Browser"})
returns nothing but the same search in the search box of Wikidata returns 2 results (one is the good one: New York City Landmarks Preservation Commission.
Ideally, I would like to have all these results returned from my python request.
python python-requests wikidata-api
add a comment |
I'm using wbsearchentities (wikidata api) in a python request and I'm wondering why returned results are not the same that those seen on Wikidata. For example, the following command in Python:
url = "https://www.wikidata.org/w/api.php?action=wbsearchentities&search=%s&format=json&limit=50&formatversion=2&language=en" % ('New York Landmarks Preservation Commission')
r = requests.post(url,headers={"User-Agent" : "Magic Browser"})
returns nothing but the same search in the search box of Wikidata returns 2 results (one is the good one: New York City Landmarks Preservation Commission.
Ideally, I would like to have all these results returned from my python request.
python python-requests wikidata-api
What are you expecting to see?
– Padraic Cunningham
May 11 '16 at 22:36
Same results as those returned when you enter 'New York Landmarks Preservation Commission' in the Wikidata search box, in this case: New York City Landmark (Q19825927) and New York City Landmarks Preservation Commission (Q967276).
– Patrick
May 12 '16 at 17:47
add a comment |
I'm using wbsearchentities (wikidata api) in a python request and I'm wondering why returned results are not the same that those seen on Wikidata. For example, the following command in Python:
url = "https://www.wikidata.org/w/api.php?action=wbsearchentities&search=%s&format=json&limit=50&formatversion=2&language=en" % ('New York Landmarks Preservation Commission')
r = requests.post(url,headers={"User-Agent" : "Magic Browser"})
returns nothing but the same search in the search box of Wikidata returns 2 results (one is the good one: New York City Landmarks Preservation Commission.
Ideally, I would like to have all these results returned from my python request.
python python-requests wikidata-api
I'm using wbsearchentities (wikidata api) in a python request and I'm wondering why returned results are not the same that those seen on Wikidata. For example, the following command in Python:
url = "https://www.wikidata.org/w/api.php?action=wbsearchentities&search=%s&format=json&limit=50&formatversion=2&language=en" % ('New York Landmarks Preservation Commission')
r = requests.post(url,headers={"User-Agent" : "Magic Browser"})
returns nothing but the same search in the search box of Wikidata returns 2 results (one is the good one: New York City Landmarks Preservation Commission.
Ideally, I would like to have all these results returned from my python request.
python python-requests wikidata-api
python python-requests wikidata-api
asked May 11 '16 at 18:02
PatrickPatrick
7462922
7462922
What are you expecting to see?
– Padraic Cunningham
May 11 '16 at 22:36
Same results as those returned when you enter 'New York Landmarks Preservation Commission' in the Wikidata search box, in this case: New York City Landmark (Q19825927) and New York City Landmarks Preservation Commission (Q967276).
– Patrick
May 12 '16 at 17:47
add a comment |
What are you expecting to see?
– Padraic Cunningham
May 11 '16 at 22:36
Same results as those returned when you enter 'New York Landmarks Preservation Commission' in the Wikidata search box, in this case: New York City Landmark (Q19825927) and New York City Landmarks Preservation Commission (Q967276).
– Patrick
May 12 '16 at 17:47
What are you expecting to see?
– Padraic Cunningham
May 11 '16 at 22:36
What are you expecting to see?
– Padraic Cunningham
May 11 '16 at 22:36
Same results as those returned when you enter 'New York Landmarks Preservation Commission' in the Wikidata search box, in this case: New York City Landmark (Q19825927) and New York City Landmarks Preservation Commission (Q967276).
– Patrick
May 12 '16 at 17:47
Same results as those returned when you enter 'New York Landmarks Preservation Commission' in the Wikidata search box, in this case: New York City Landmark (Q19825927) and New York City Landmarks Preservation Commission (Q967276).
– Patrick
May 12 '16 at 17:47
add a comment |
1 Answer
1
active
oldest
votes
The search box in the top right of Wikidata uses the wbsearchentities API module to provide the auto suggestion dropdown search.
If you press enter after entering your search instead of clicking on one of the suggestions you will end up on the Special:Search page.
As you can see they API result returns no results but the special page does.
That is due to these searches working in entirely different ways.
- The Special:Search page is a MediaWiki concept that Wikibase provides
data to. - The wbsearchentities API module provided by Wikibase itself.
So there is no way to get the special:search results with an API?
– Patrick
May 16 '16 at 14:24
1
See action=query&list=search wikidata.org/w/…
– Addshore
May 19 '16 at 9:30
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f37170179%2fwikidata-api-wbsearchentities-why-are-results-not-the-same-in-python-than-in-wi%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The search box in the top right of Wikidata uses the wbsearchentities API module to provide the auto suggestion dropdown search.
If you press enter after entering your search instead of clicking on one of the suggestions you will end up on the Special:Search page.
As you can see they API result returns no results but the special page does.
That is due to these searches working in entirely different ways.
- The Special:Search page is a MediaWiki concept that Wikibase provides
data to. - The wbsearchentities API module provided by Wikibase itself.
So there is no way to get the special:search results with an API?
– Patrick
May 16 '16 at 14:24
1
See action=query&list=search wikidata.org/w/…
– Addshore
May 19 '16 at 9:30
add a comment |
The search box in the top right of Wikidata uses the wbsearchentities API module to provide the auto suggestion dropdown search.
If you press enter after entering your search instead of clicking on one of the suggestions you will end up on the Special:Search page.
As you can see they API result returns no results but the special page does.
That is due to these searches working in entirely different ways.
- The Special:Search page is a MediaWiki concept that Wikibase provides
data to. - The wbsearchentities API module provided by Wikibase itself.
So there is no way to get the special:search results with an API?
– Patrick
May 16 '16 at 14:24
1
See action=query&list=search wikidata.org/w/…
– Addshore
May 19 '16 at 9:30
add a comment |
The search box in the top right of Wikidata uses the wbsearchentities API module to provide the auto suggestion dropdown search.
If you press enter after entering your search instead of clicking on one of the suggestions you will end up on the Special:Search page.
As you can see they API result returns no results but the special page does.
That is due to these searches working in entirely different ways.
- The Special:Search page is a MediaWiki concept that Wikibase provides
data to. - The wbsearchentities API module provided by Wikibase itself.
The search box in the top right of Wikidata uses the wbsearchentities API module to provide the auto suggestion dropdown search.
If you press enter after entering your search instead of clicking on one of the suggestions you will end up on the Special:Search page.
As you can see they API result returns no results but the special page does.
That is due to these searches working in entirely different ways.
- The Special:Search page is a MediaWiki concept that Wikibase provides
data to. - The wbsearchentities API module provided by Wikibase itself.
answered May 14 '16 at 10:38
AddshoreAddshore
401311
401311
So there is no way to get the special:search results with an API?
– Patrick
May 16 '16 at 14:24
1
See action=query&list=search wikidata.org/w/…
– Addshore
May 19 '16 at 9:30
add a comment |
So there is no way to get the special:search results with an API?
– Patrick
May 16 '16 at 14:24
1
See action=query&list=search wikidata.org/w/…
– Addshore
May 19 '16 at 9:30
So there is no way to get the special:search results with an API?
– Patrick
May 16 '16 at 14:24
So there is no way to get the special:search results with an API?
– Patrick
May 16 '16 at 14:24
1
1
See action=query&list=search wikidata.org/w/…
– Addshore
May 19 '16 at 9:30
See action=query&list=search wikidata.org/w/…
– Addshore
May 19 '16 at 9:30
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f37170179%2fwikidata-api-wbsearchentities-why-are-results-not-the-same-in-python-than-in-wi%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What are you expecting to see?
– Padraic Cunningham
May 11 '16 at 22:36
Same results as those returned when you enter 'New York Landmarks Preservation Commission' in the Wikidata search box, in this case: New York City Landmark (Q19825927) and New York City Landmarks Preservation Commission (Q967276).
– Patrick
May 12 '16 at 17:47