title: Python download multiple files from links on pages
body: <p>I'm trying to download all the <a href="https://www.wikiwand.com/en/Portable_Game_Notation" rel="nofollow noreferrer">PGN</a>s from this <a href="http://www.chessgames.com/perl/chesscollection?cid=1014492" rel="nofollow noreferrer">site</a>.</p>
  <p>I think I have to use <code>urlopen</code> to open each url and then use <code>urlretrieve</code> to download each pgn by accessing it from the download button near the bottom of each game. Do I have to create a new <code>BeautifulSoup</code> object for each game? I'm also unsure of how <code>urlretrieve</code> works.</p>
  <pre><code>import urllib
  from urllib.request import urlopen, urlretrieve, quote
  from bs4 import BeautifulSoup
  
  url = 'http://www.chessgames.com/perl/chesscollection?cid=1014492'
  u = urlopen(url)
  html = u.read().decode('utf-8')
  
  soup = BeautifulSoup(html, &quot;html.parser&quot;)
  for link in soup.find_all('a'):
      urlopen('http://chessgames.com'+link.get('href'))
  </code></pre>