Last active
June 19, 2016 04:14
-
-
Save twhite96/84479a7de272dde423697531af4a3c9d to your computer and use it in GitHub Desktop.
Link scraper
This file contains 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
import urllib2 | |
resp = urllib2.urlopen('http://testurl.com') | |
from bs4 import BeautifulSoup | |
soup = BeautifulSoup(resp.read()) | |
links = soup.find_all('a') | |
foreach links in link: | |
url = link.get('href'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Need BeautifulSoup library.
pip install beautifulsoup4
. Make sure to updatepip
before installing. For Python 2.6-3.