Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Beautifulsoup - How to open images and download them

import os
import urllib
import urllib2
from bs4 import BeautifulSoup

url = "http://icecat.biz/p/toshiba/pscbxe-01t00een/satellite-pro-notebooks-4051528049077-Satellite+Pro+C8501GR-17732197.html"
html = urllib2.urlopen(url)
soup = BeautifulSoup(html)

imgs = soup.findAll("div", {"class":"thumb-pic"})
for img in imgs:
        imgUrl = img.a['href'].split("imgurl=")[1]
        urllib.urlretrieve(imgUrl, os.path.basename(imgUrl))
Comment

PREVIOUS NEXT
Code Example
Python :: get current data with python 
Python :: how to disconnect wifi using python 
Python :: np.polyfit plot 
Python :: split a variable into multiple variables in python 
Python :: django create new project 
Python :: python list only files not directories 
Python :: django models integer field default value 
Python :: remove keys from dict python 
Python :: dataframe row print 
Python :: error handling in python using flask 
Python :: csv writer python 
Python :: python data structures 9.4 
Python :: how to capitalize the first letter in a list python 
Python :: pvm python 
Python :: python remove key from dict 
Python :: how to get current latitude and longitude in python 
Python :: matplotlib to pdf 
Python :: validate ip address python 
Python :: select a range of rows in pandas dataframe 
Python :: python list count() 
Python :: how to count backwards in for loop python 
Python :: regular expression to remove space python 
Python :: how to open a file with python 
Python :: python currency format locale 
Python :: softmax function python 
Python :: how to use pafy 
Python :: python scheduling 
Python :: create dataframe from two variables 
Python :: python web parse 
Python :: evaluate how much a python program memory 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =