-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathcounty_boards.py
15 lines (11 loc) · 5.61 KB
/
county_boards.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import requests
from bs4 import BeautifulSoup
links = []
urls = ["https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Albany","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Allegany","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Broome","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Bronx","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Cattaraugus","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Cayuga","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Chautauqua","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Chemung","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Chenango","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Clinton","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Columbia","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Cortland","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Delaware","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Dutchess","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Erie","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Essex","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Franklin","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Fulton","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Genesee","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Greene","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Hamilton","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Herkimer","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Jefferson","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Kings","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Kings","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Lewis","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Livingston","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Madison","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Monroe","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Montgomery","https://cfapp.elections.ny.gov/ords/plsql_browser/COUNTY_BOARDS?county_in=Nassau","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=New+York","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Niagara","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Oneida","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Onondaga","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Ontario","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Orange","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Orleans","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Oswego","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Otsego","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Putnam","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Queens","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Queens","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Rensselaer","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Richmond","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Rockland","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Saratoga","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Schenectady","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Schenectady","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Schoharie","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Schuyler","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Seneca","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=St.Lawrence","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Steuben","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Suffolk","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Sullivan","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Tioga","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Tompkins","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Ulster","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Warren","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Washington","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Wayne","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Westchester","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Wyoming","https://cfapp.elections.ny.gov/ords/plsql_browser/county_boards?county_in=Yates"]
for url in urls:
r = requests.get(url)
soup = BeautifulSoup(r.text, "html.parser")
hrefs = soup.find_all('a')
num = len(hrefs)
links.append(hrefs[num-1]['href'])
print(links)