From 322b265d7aec7731f7fa703c9a74ceb61ae73f3f Mon Sep 17 00:00:00 2001 From: aniran Date: Thu, 26 Apr 2018 16:51:07 -0400 Subject: [PATCH] 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). --- reader/scraper/scraper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reader/scraper/scraper.go b/reader/scraper/scraper.go index 4f36d962..b90cc14d 100644 --- a/reader/scraper/scraper.go +++ b/reader/scraper/scraper.go @@ -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()