Skip to content

Commit f85eadd

Browse files
authored
wikipedia page option
get title,images,content
1 parent 9e77c42 commit f85eadd

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
'''
2+
created by:Ravishankar Chavare
3+
4+
We alredy Learn Basic of wikipedia keywords and short description now we are here to learn the full
5+
page parsing of wikipedia
6+
'''
7+
import wikipedia
8+
9+
#To get full page details and data use wikipedia.page("keyword")
10+
11+
simple_page=wikipedia.page("India");
12+
13+
#now simple_page is wikipedia object you can extact data from it
14+
15+
#1.Get The Title Of page
16+
title=simple_page.title
17+
print("Title of Page: ",title)
18+
19+
20+
#2.Get The url of wikipedia Page
21+
url=simple_page.url
22+
print("url of searched page : ",url)
23+
24+
25+
#3.To Get the Content Of Page
26+
content=simple_page.content
27+
print("Content: ",content)
28+
29+
30+
#4.To Get the Image of page
31+
32+
image_url=simple_page.images #This will Collect All Images url into list
33+
34+
#To print simple first image url You can use
35+
print("First Image Url:",image_url[0])
36+
37+
38+
39+
'''
40+
To change the language of the Wikipedia you are accessing,
41+
use wikipedia.set_lang. Remember to search
42+
for page titles in the language that you have set, not English!:
43+
'''
44+
45+
#To set Language as english
46+
wikipedia.set_lang("en")
47+
print(wikipedia.summary("india"))
48+
49+
50+
#To Get Available languages list
51+
languages=wikipedia.languages()
52+
53+
#To Check That Language is avilable in wikipedia or not
54+
print('en' in wikipedia.languages()) #this will give true or false
55+
56+
57+
58+
59+
'''
60+
for more tutorial Visit
61+
https://wikipedia.readthedocs.io/en/latest/quickstart.html
62+
63+
'''
64+

0 commit comments

Comments
 (0)