So far my code is:
year = range(1958,2013)
randomYear = random.choice(year)
randomYear = str(randomYear)
page = range(1,5)
randomPage = random.choice(page)
randomPage = str(randomPage)
print(randomPage, randomYear)
url = 'http://www.billboard.com/artists/top-100/'+randomYear+'?page='+randomPage
url1 = urlopen(url)
htmlSource = url1.read()
url1.close()
soup = BeautifulSoup(htmlSource)
listm = soup.findAll('article', {'class': 'masonry-brick','style' : 'position; absolute; top; 0px; left: 0px;'})
for listm in soup.findAll('div',{'class': 'thumbnail'}):
for listm in soup.find('img alt')(''):
print(listm)
What I want to do is get the img alt='' text. I think I have it correct, somewhat but it displays nothing.
url = 'http://www.billboard.com/artists/top-100/{year}?page={page}'.format(year=random.randint(1958, 2013), page=random.randint(1, 5))
Note: this code, unlike yours includes both end points.