python beautifulsoup iframe document html extract

Browsers load the iframe content in a separate request. You’ll have to do the same:

for iframe in iframexx:
    response = urllib2.urlopen(iframe.attrs['src'])
    iframe_soup = BeautifulSoup(response)

Remember: BeautifulSoup is not a browser; it won’t fetch images, CSS and JavaScript resources for you either.

Leave a Comment