Created
May 25, 2012 16:29
-
-
Save keikubo/2789065 to your computer and use it in GitHub Desktop.
Beautiful Soup Example to parse URLs from Hatena Hotentry
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
#!/usr/bin/env python | |
from bs4 import BeautifulSoup as bs | |
import urllib | |
url = "http://b.hatena.ne.jp/hotentry" | |
content = urllib.urlopen(url).read() | |
soup = bs(content) | |
links = soup.find_all("a",{"class":"entry-link"}) | |
for link in links: | |
print link["href"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment