Wikipedia
Wikipedia copied to clipboard
How to get the URL of the returned simple summary?
For instance:
info = wikipedia.summary("Facebook", sentences=5)
url = ?
Thank you!
You can try to migrate to Wikipedia-API. It's very straightforward.
import wikipediaapi
wiki = wikipediaapi.Wikipedia('en')
p = wiki.page('Facebook')
print(p.fullurl)
print(wiki.extracts(p, exsentences=2))
Outputs
https://en.wikipedia.org/wiki/Facebook
Facebook, Inc. is an American online social media and social networking service company.
I think if you use .page(), it will load more data than simply using .summary(). Not sure.
@evilplanet There is a preload argument in the page method of the Wikipedia module. If it is set to True, only then the entire page is obtained by default. Else, I think the summary will be obtained only when the summary method is called (see this code for more info).