# Craigslist City Scraper
# By Marshall Ehlinger
# For sp2015 Systems Analysis and Design

from bs4 import BeautifulSoup
import re

fh = open("sites.htm", "r")
soup = BeautifulSoup(fh, "html.parser")

for columnDiv in soup.h1.next_sibling.next_sibling:
	for state in columnDiv:
		for city in state:
			print(city)

#print(soup.text)
print("\n----Done----\n\n")

#!/usr/bin/python3.4

# Craigslist City Scraper
# By Marshall Ehlinger
# For sp2015 Systems Analysis and Design

# Returns dictionary of 'city name string' : 'site url'
# for all American cities in states/territories @ CL

from bs4 import BeautifulSoup
import re

def getCities():

	fh = open("sites.htm", "r")
	soup = BeautifulSoup(fh, "html.parser")
	placesDict = {}

	for columnDiv in soup.h1.next_sibling.next_sibling:
		for state in columnDiv:
			for city in state:
				m = (re.search('<li><a href="(.+)">(.+)</a>', str(city)))
				if m:			
					placesDict[m.group(2)] = m.group(1)

	return(placesDict)

getCities()

Complete site scraper for all American cities
Complete site scraper for all American cities

areaScraper.py contains the getCities() function, which will
return a dictionary of 'city name string' : 'url string'
for each Craigslist "site", corresponding to American cities,
regions, etc.
