Created
November 26, 2011 12:57
-
-
Save akkartik/1395622 to your computer and use it in GitHub Desktop.
Generate URLs for the pages containing the covers of all editions of Time Magazine
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 BeautifulSoup import BeautifulSoup | |
from urllib2 import urlopen | |
url = '/time/magazine/current' | |
while 1: | |
url='http://www.time.com'+url | |
soup = BeautifulSoup(urlopen(url)) | |
print url, '--', soup.find('time').renderContents() | |
url = soup.find(text='Previous Issue').parent['href'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment