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:
parent
920dda79b7
commit
322b265d7a
1 changed files with 1 additions and 1 deletions
|
@ -72,7 +72,7 @@ func scrapContent(page io.Reader, rules string) (string, error) {
|
||||||
var content string
|
var content string
|
||||||
|
|
||||||
// For some inline elements, we get the parent.
|
// For some inline elements, we get the parent.
|
||||||
if s.Is("img") {
|
if s.Is("img") || s.Is("iframe") {
|
||||||
content, _ = s.Parent().Html()
|
content, _ = s.Parent().Html()
|
||||||
} else {
|
} else {
|
||||||
content, _ = s.Html()
|
content, _ = s.Html()
|
||||||
|
|
Loading…
Reference in a new issue