Created
August 26, 2012 18:08
-
-
Save kimmel/3482211 to your computer and use it in GitHub Desktop.
python Beautiful Soup regexp 1
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 datetime import datetime | |
import BeautifulSoup as soup | |
import requests | |
... | |
r = requests.get(host + page) | |
doc = soup.BeautifulSoup(r.content) | |
titles = doc.table.findAll(True, {'class': 'title'}) | |
articles = titles[:-1] | |
for no, title in chunks(articles, 2): | |
acc.append( (title.a.string, title.a['href']) ) | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment