Skip to content

Instantly share code, notes, and snippets.

@SamuelMarks
Created October 5, 2012 15:51
Show Gist options
  • Save SamuelMarks/3840646 to your computer and use it in GitHub Desktop.
Save SamuelMarks/3840646 to your computer and use it in GitHub Desktop.
Python makes scraping easy!
from bs4 import BeautifulSoup as bs
import urllib3
def scrape_industries(site='https://angel.co/markets'):
http = urllib3.PoolManager()
r = http.request('GET', site)
if r.status != 200:
return False
soup = bs(r.data)
return [link.get_text().encode('utf-8') for link in [line.find('a') for line in soup.find_all('div', {'class' :'item-tag'})]]
if __name__ == '__main__':
print sorted(scrape_industries())
@IngJeyson
Copy link

First Thanks for share your ideas but I got a error message

print scrape_industries()
^
SyntaxError: invalid syntax

Thanks

@Jebiel
Copy link

Jebiel commented Mar 7, 2018

IngJeyson, if you're running with Python3 the syntaxes is different and hence:

print(sorted(scrape_industries()))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment