update geo tools
This commit is contained in:
parent
4a635c4038
commit
b689a4013b
1 changed files with 3 additions and 1 deletions
|
@ -38,6 +38,8 @@ def encode_wikipedia_id(id):
|
||||||
return id.replace(' ', '_').encode('utf8')
|
return id.replace(' ', '_').encode('utf8')
|
||||||
|
|
||||||
def get_countries():
|
def get_countries():
|
||||||
|
def exclude(country):
|
||||||
|
return country['name'] in ['Federation of Bosnia and Herzegovina', 'Republika Srpska']
|
||||||
def exists(country):
|
def exists(country):
|
||||||
for c in countries:
|
for c in countries:
|
||||||
if c['name'] == country['name']:
|
if c['name'] == country['name']:
|
||||||
|
@ -74,7 +76,7 @@ def get_countries():
|
||||||
# List of sovereign states
|
# List of sovereign states
|
||||||
html = read_wikipedia_url('List of sovereign states')
|
html = read_wikipedia_url('List of sovereign states')
|
||||||
matches = re.compile('> </span><a href="/wiki/(.*?)"', re.DOTALL).findall(html)
|
matches = re.compile('> </span><a href="/wiki/(.*?)"', re.DOTALL).findall(html)
|
||||||
countries += filter(lambda x: not exists(x), map(lambda x: parse(x), matches))
|
countries += filter(lambda x: not exists(x) and not exclude(x) , map(lambda x: parse(x), matches))
|
||||||
'''
|
'''
|
||||||
for year in range(1970, 2020, 10):
|
for year in range(1970, 2020, 10):
|
||||||
html = read_wikipedia_url('List of sovereign states in the %ds' % year)
|
html = read_wikipedia_url('List of sovereign states in the %ds' % year)
|
||||||
|
|
Loading…
Reference in a new issue