Created
July 23, 2014 05:53
-
-
Save walshie4/104532193d292d8ecf3a to your computer and use it in GitHub Desktop.
Creates a list of countries names scraped from State.gov
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#Written by: Adam Walsh | |
#Written on 7/23/14 | |
#Gets a current list of countries from state.gov | |
from selenium import webdriver | |
sel = webdriver.Firefox() | |
sel.get("http://www.state.gov/misc/list/") | |
content = sel.find_element_by_id('tier3-landing-content-wide') | |
content = content.find_element_by_tag_name('table') | |
content = content.find_element_by_tag_name('div') | |
content = content.find_element_by_tag_name('div') | |
content = content.find_element_by_tag_name('div') | |
content = content.find_element_by_tag_name('div') | |
countries = [] | |
for item in content.find_elements_by_tag_name('blockquote'): | |
for link in item.find_elements_by_tag_name('a'): | |
countries.append(link.text.encode('ascii','ignore')) | |
print countries | |
sel.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that this list does not include the US.