goldsmith / Wikipedia

A Pythonic wrapper for the Wikipedia API
https://wikipedia.readthedocs.org/
MIT License
2.88k stars 519 forks source link

the input is chage?? #291

Open SebastiaanDenHertog opened 3 years ago

stevenmz commented 3 years ago

@anonymous0230 I think this has to do with the suggestions parameter to the Wikipedia web service.

Looking at the wikipedia python code, I think this is the web-service call that gets sent for a summary() call: https://en.wikipedia.org/w/api.php?action=query&list=search&srprop&srlimit=1&limit=1&srsearch=tony%20stark&srinfo=suggestion&format=json which returns the JSON

{
    "warnings": {
        "main": {
            "*": "Unrecognized parameter: limit."
        }
    },
    "batchcomplete": "",
    "continue": {
        "sroffset": 1,
        "continue": "-||"
    },
    "query": {
        "searchinfo": {
            "suggestion": "tony start",
            "suggestionsnippet": "tony start"
        },
        "search": [
            {
                "ns": 0,
                "title": "Iron Man",
                "pageid": 67055
            }
        ]
    }
}

You can see it is the Wikipedia web service that provides the bad suggestion which the python code uses.

Removing the suggestions parameter to the web service call does not remove the suggestion from the resulting JSON output:

{
    "warnings": {
        "main": {
            "*": "Unrecognized parameter: limit."
        }
    },
    "batchcomplete": "",
    "continue": {
        "sroffset": 1,
        "continue": "-||"
    },
    "query": {
        "searchinfo": {
            "totalhits": 5169,
            "suggestion": "tony start",
            "suggestionsnippet": "tony start"
        },
        "search": [
            {
                "ns": 0,
                "title": "Iron Man",
                "pageid": 67055
            }
        ]
    }
}

Hope this helps, -Steven