Parse Iframe With Blank Src Using Bs4 January 31, 2024 Post a Comment Good time of day, SO community. Here's the problem I recently encountered: I got this HTML source code on main page: Copywhich would give you:<iframe frameborder="0" height="100%"id="contentsFrameID" marginheight="0" marginwidth="0" name="contentsFrame" scrolling="no" src="" width="100%"></iframe> CopyYou could also use the empty src attribute:ifr = soup.select_one("iframe[src=""]") CopyUse the name:ifr = soup.select_one("iframe[name=contentsFrame]") CopyIn the actual site you are scraping, the content inside contentsFrameID is dynamically created so you will need something like selenium, an example below getting dynamically created form:from selenium import webdriver from bs4 import BeautifulSoup dr = webdriver.PhantomJS() dr.get("http://encykorea.aks.ac.kr/Contents/Index?contents_id=E0000089") soup = BeautifulSoup(dr.page_source) print(soup.select_one("#contentFrameForm") Copy Share Post a Comment for "Parse Iframe With Blank Src Using Bs4"
Post a Comment for "Parse Iframe With Blank Src Using Bs4"