ちょっと必要になったので
import urllib2,os from BeautifulSoup import BeautifulSoup url = "http://oreilly.com/javascript/excerpts/javascript-good-parts/syntax-diagrams.html" soup = BeautifulSoup(urllib2.urlopen(url).read()) for _img in soup.findAll('img'): if 'excerpts' in _img.get('src'): img_url = _img.get('src') with open(os.path.basename(img_url), 'wb') as f: f.write(urllib2.urlopen(img_url).read())