Reputation: 3108
I need content of a html pages, but if a html page contains a iframe element, I need iframe content too. (in Python) Is it possible to load everything with a python function?
Upvotes: 4
Views: 9373
Reputation: 136141
Try using BeautifulSoup, which supports iframes out of the box.
Code snippet (full code here):
import re
from BeautifulSoup import BeautifulSoup, Comment
...
for iframe in mosoup("iframe"):
mosoup.iframe.extract()
UPDATE: Linked to current location of code (now in github).
Upvotes: 3