Last active
August 29, 2015 14:11
-
-
Save theanti9/6b5e3481c7528c2e6ddd to your computer and use it in GitHub Desktop.
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
import requests | |
import BeautifulSoup | |
html = requests.get("http://en.wikipedia.org/wiki/Python_(programming_language)").content | |
soup = BeautifulSoup.BeautifulSoup(html) | |
a_tags = soup.findAll("a") | |
links = [tag['href'] for tag in a_tags if tag.has_key('href') and tag['href'] is not None] | |
img_tags = soup.findAll("img") | |
images = [tag['src'] for tag in img_tags if tag.has_key('src') and tag['src'] is not None] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment