svlipatov commited on
Commit
dbf2566
·
unverified ·
1 Parent(s): 135a5c3

Update coordinates wikipedia_api.py

Browse files
Files changed (1) hide show
  1. wikipedia_api.py +4 -7
wikipedia_api.py CHANGED
@@ -17,13 +17,10 @@ def getWikipedia(pList):
17
  if not get is None:
18
 
19
  summary = wikipedia.summary(get[0])
20
-
21
- page = wikipedia.page(get[0])
22
- soup = bs(page.html(), 'html.parser')
23
- find = soup.find("a", {"class": "mw-kartographer-maplink"})
24
- if not find is None:
25
- latitude = find['data-lat']
26
- longitude = find['data-lon']
27
  else:
28
  summary = 'Ничего не найдено'
29
 
 
17
  if not get is None:
18
 
19
  summary = wikipedia.summary(get[0])
20
+ try:
21
+ latitude = wikipedia.page(get[0]).coordinates[0]
22
+ longitude = wikipedia.page(get[0]).coordinates[1]
23
+ except KeyError: 'coordinates'
 
 
 
24
  else:
25
  summary = 'Ничего не найдено'
26