Fetching Image from URL using BeautifulSoup
I am trying to fetch important images and not thumbnail or other gifs from the Wikipedia page and using following code. However the "img" is coming as length of "0". any suggestion on how to rectify it. Code : import urllib import urllib2 from bs4 import BeautifulSoup import os html = urllib2.urlopen("http://en.wikipedia.org/wiki/Main_Page") soup = BeautifulSoup(html) imgs = soup.findAll("div",{"class":"image"}) Also if someone can explain in detail that how to use the findAll by looking at "source element" in webpage. That will be awesome. The a tags on the page have an image class, not div :