Created
April 24, 2016 16:28
-
-
Save anonymous/e2a5b61cf0379b419f79a54c81e07a1f to your computer and use it in GitHub Desktop.
parse craigslist apartments in vermont
This file contains hidden or 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
from lxml.html import fromstring as html, tostring as tos | |
from requests import get | |
import xmltodict | |
import json | |
results = [] | |
URL = 'http://vermont.craigslist.org/search/apa' | |
for el in html(get(URL).text).xpath("//p[@class='row']"): | |
results.append(xmltodict.parse(tos(el))) | |
print json.dumps(results, indent=1) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment