Wikipedia icon indicating copy to clipboard operation
Wikipedia copied to clipboard

Error

Open lxianl455 opened this issue 1 year ago • 2 comments

I just try: import wikipedia print(wikipedia.summary("google", sentences=1))

but i got the follow error:

raise PageError(self.title) wikipedia.exceptions.PageError: Page id "google" does not match any pages. Try another id!

What should i do?

lxianl455 avatar Mar 15 '23 12:03 lxianl455

Now I try another word, like apple. But the result is wrong:

search_params {'list': 'search', 'srprop': '', 'srlimit': 1, 'limit': 1, 'srsearch': 'apple', 'srinfo': 'suggestion'} In mathematics and computer science, apply is a function that applies a function to arguments.

lxianl455 avatar Mar 15 '23 12:03 lxianl455

For "google" the suggestion is google\\ (but not sure why) Screenshot 2024-08-21 at 4 00 57 PM

The error seems to stem from here.

Someone should just make a PR that changes that priority.

Its right here: https://github.com/goldsmith/Wikipedia/blob/1554943e8ab463cef5e93081def48fafbdef324e/wikipedia/wikipedia.py#L272

    if auto_suggest:
      results, suggestion = search(title, results=1, suggestion=True)
      try:
        title = suggestion or results[0]
      except IndexError:
        # if there is no suggestion or search results, the page doesn't exist
        raise PageError(title)

theptrk avatar Aug 21 '24 23:08 theptrk