【发布时间】:2020-09-14 01:35:40
【问题描述】:
这是 iframe:
<iframe allow="autoplay; fullscreen" allowfullscreen="yes" frameborder="no" scrolling="no" src="https://www.example.com" style="width: 100%; height: 100%;"></iframe>
我的尝试:
print(soup.find("iframe")["src"])
此案例的其他信息:
from selenium import webdriver
from bs4 import BeautifulSoup
import time
driver = webdriver.Firefox()
driver.get("https://9anime.to/watch/puella-magi-madoka-magica.q1n/yqq3r9x")
time.sleep(5)
soup = BeautifulSoup(driver.page_source, "lxml")
print(soup.find("iframe"))
driver.quit()
如果您想找到确切的 html,“附加信息”代码可以复制/粘贴。 (也可以在整个 html 脚本的最后添加print(soup.prettify())。
【问题讨论】:
标签: python selenium-webdriver firefox iframe beautifulsoup