Wikipedia icon indicating copy to clipboard operation
Wikipedia copied to clipboard

The "srsearch" parameter must be set.

Open mr-shubhamsinghal opened this issue 5 years ago • 9 comments

wikipedia.exceptions.WikipediaException: An unknown error occured: "The "srsearch" parameter must be set.". Please report it on GitHub!

mr-shubhamsinghal avatar Aug 28 '19 04:08 mr-shubhamsinghal

I received the same issue when using the wikipedia.page() method. I filled the parameter for the page method with a query/suggestion from the search for a Japanese film (Nekeddo burâddo: Megyaku) using wikipedia.search(). I didn't extensively test why the error occured as it was easier for me to remove this film from my list....however:

Wikipedia does not return any results or suggestions for this title. Google however, does direct to a page with the English title of this film.

I suspect the error is coming from what was passed to the wikipedia.page() method.

handychimp avatar Oct 31 '19 10:10 handychimp

I found this issue every-time whenever I created tkinter application using wikipedia

AnietieGodswill avatar Mar 05 '20 21:03 AnietieGodswill

I found the same error. i am trying to use wikipedia using tkinter application. For both wikipedia,page() and wikipedia.summary() it showing the same error.

Pradeep2427 avatar Sep 23 '20 06:09 Pradeep2427

I found the same error... please share solution

apetridis avatar Jan 06 '21 18:01 apetridis

I has the same issue with react. You get this error because searching is being done with "". Here how I solved it:

const Search = () => {
  const [term, setTerm] = useState("setDefaultSearchTerm");
  const [results, setResults] = useState([]);
  useEffect(() => {
    const search = async () => {
      const results = await axios.get("https://en.wikipedia.org/w/api.php", {
        params: {
          action: "query",
          list: "search",
          origin: "*",
          format: "json",
          srsearch: term ,
        },
      });
      setResults(results.data.query.search);
    };
    // this is when first time we rerender the component
    if (term && !results.length) {
      search();
    } else {
      const timeoutId = setTimeout(() => {
        if (term) {
          search();
        }
      }, 500);
      return () => {
        clearTimeout(timeoutId);
      };
    }
  }, [term]);
  const renderedResults =
    results.length > 0 &&
    results.map((result) => {
      return (
        <div key={result.pageid} className="result">
          <div className="content">
            <div className="header">{result.title}</div>
            {result.snippet}
          </div>
        </div>
      );
    });
  return (
    <div>
      
          <input
            value={term}
            onChange={(e) => setTerm(e.target.value)}
            className="input"
            type="text"
          />
     
      <div className="results">{renderedResults}</div>
    </div>
  );
};

export default Search;

yilmazbingo avatar Apr 13 '21 04:04 yilmazbingo

I found the error ocurrs when I try to summary ''. I just skip the'',and the problem can be solved! the mistake : wikipedia.summary("", sentences=1)

wspzm avatar Jun 28 '21 12:06 wspzm

I also got this error in tkinter

Rishaw-Developer avatar Aug 04 '21 09:08 Rishaw-Developer

Solution => You may have added brackets while calling a function, ex. btn = Button(app, text="Button", command=function).pack()

Rishaw-Developer avatar Aug 04 '21 20:08 Rishaw-Developer

If you wish to search a string on wikipedia, and it has an assigned variable 'query': wikipedia.summary([query], sentences=1) Use '[ ] ' brackets.

WeaponGr avatar Apr 17 '22 19:04 WeaponGr