MCPcopy Index your code
hub / github.com/geekcomputers/Python / wiki

Function wiki

WikipediaModule.py:13–45  ·  view source on GitHub ↗

Search Anything in wikipedia

()

Source from the content-addressed store, hash-verified

11
12
13def wiki():
14 """
15 Search Anything in wikipedia
16 """
17
18 word = input("Wikipedia Search : ")
19 results = wk.search(word)
20 for i in enumerate(results):
21 print(i)
22 try:
23 key = int(input("Enter the number : "))
24 except AssertionError:
25 key = int(input("Please enter corresponding article number : "))
26
27 page = wk.page(results[key])
28 url = page.url
29 # originalTitle=page.original_title
30 pageId = page.pageid
31 # references=page.references
32 title = page.title
33 # soup=BeautifulSoup(page.content,'lxml')
34 pageLength = input("""Wiki Page Type : 1.Full 2.Summary : """)
35 if pageLength == 1:
36 soup = fullPage(page)
37 print(soup)
38 else:
39 print(title)
40 print("Page Id = ", pageId)
41 print(page.summary)
42 print("Page Link = ", url)
43 # print "References : ",references
44
45 pass
46
47
48def fullPage(page):

Callers

nothing calls this directly

Calls 2

fullPageFunction · 0.85
searchMethod · 0.45

Tested by

no test coverage detected