Skip to content

Instantly share code, notes, and snippets.

@erikgregorywebb
Last active July 18, 2018 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erikgregorywebb/91256c08af01ed844c1235cef5ca2116 to your computer and use it in GitHub Desktop.
Save erikgregorywebb/91256c08af01ed844c1235cef5ca2116 to your computer and use it in GitHub Desktop.
def getListings(url):
links = getListingLinks(url)
listings = []
# Loop over each listing link
for i in range(0, 10):
time.sleep(3)
try:
listing = getListingContent(links[i])
listings.append(listing)
except:
print("An error occured:", links[i])
# Create DataFrame, clean variables
df = pd.DataFrame(listings, columns = ['title', 'location', 'price', 'views', 'favorites', 'description', 'name', 'link'])
return df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment