Created
October 5, 2012 15:51
-
-
Save SamuelMarks/3840646 to your computer and use it in GitHub Desktop.
Python makes scraping easy!
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 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, 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
First Thanks for share your ideas but I got a error message
print scrape_industries()
^
SyntaxError: invalid syntax
Thanks