1
0
Fork 0

Scrape parent element for iframe

Current behavior: if you have an `iframe` scraper rule, `scrapContent`
tries to return the inner HTML of the `iframe`, which turns up blank.

New behavior: like `img` elements, if an `iframe` is matched by a scraper rule,
the parent element's inner HTML (i.e. the `iframe` is returned).
This commit is contained in:
aniran 2018-04-26 16:51:07 -04:00 committed by Frédéric Guillot
parent 920dda79b7
commit 322b265d7a

View file

@ -72,7 +72,7 @@ func scrapContent(page io.Reader, rules string) (string, error) {
var content string
// For some inline elements, we get the parent.
if s.Is("img") {
if s.Is("img") || s.Is("iframe") {
content, _ = s.Parent().Html()
} else {
content, _ = s.Html()