Parse Iframe With Blank Src Using Bs4 November 28, 2022 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: Copy which would give you: <iframe frameborder="0" height="100%" id="contentsFrameID" marginheight="0" marginwidth="0" name="contentsFrame" scrolling="no" src="" width="100%"></iframe> Copy You could also use the empty src attribute: ifr = soup.select_one("iframe[src=""]") Copy Use the name: ifr = soup.select_one("iframe[name=contentsFrame]") Copy In 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"