twhite96
6/17/2016 - 5:15 AM

Web Image Scraper

Web Image Scraper

import urllib2
resp = urllib2.urlopen('http://testurl.com')

from bs4 import BeautifulSoup

soup = BeautifulSoup(resp.read())

images = soup.find_all('img')

foreach images in image:
  filename = image.get('src');
  data = urllib2.urlopen(filename).read();

with open("myfile.jpeg", "wb") as code:
  code.write(data);