Skip to content

Instantly share code, notes, and snippets.

@keikubo
Created May 25, 2012 16:29
Show Gist options
  • Save keikubo/2789065 to your computer and use it in GitHub Desktop.
Save keikubo/2789065 to your computer and use it in GitHub Desktop.
Beautiful Soup Example to parse URLs from Hatena Hotentry
#!/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