-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc93e09
commit 1ed7d52
Showing
5 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package templates | ||
|
||
import ( | ||
"github.com/PuerkitoBio/goquery" | ||
) | ||
|
||
func (t *Template) KotakuScrapContent(document *goquery.Document) string { | ||
contents := "" | ||
|
||
document.Find("div.js_related-stories-inset,div.js_ad-dynamic,div.instream-native-video,div.js_related-stories-inset-mobile").Each(func(i int, s *goquery.Selection) { | ||
RemoveNodes(s) | ||
}) | ||
document.Find("div.js_post-content").Each(func(i int, s *goquery.Selection) { | ||
var content string | ||
content, _ = goquery.OuterHtml(s) | ||
contents += content | ||
}) | ||
return contents | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package templates | ||
|
||
import ( | ||
"github.com/PuerkitoBio/goquery" | ||
) | ||
|
||
func (t *Template) MicrosoftScrapContent(document *goquery.Document) string { | ||
contents := "" | ||
|
||
document.Find("header").Each(func(i int, s *goquery.Selection) { | ||
RemoveNodes(s) | ||
|
||
}) | ||
document.Find("article.m-blog-post").Each(func(i int, s *goquery.Selection) { | ||
var content string | ||
content, _ = goquery.OuterHtml(s) | ||
contents += content | ||
}) | ||
return contents | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package templates | ||
|
||
import ( | ||
"github.com/PuerkitoBio/goquery" | ||
) | ||
|
||
func (t *Template) PolygonScrapContent(document *goquery.Document) string { | ||
contents := "" | ||
|
||
document.Find("aside,div.loopnav-a").Each(func(i int, s *goquery.Selection) { | ||
RemoveNodes(s) | ||
}) | ||
document.Find("figure.e-image--hero,div.c-entry-content").Each(func(i int, s *goquery.Selection) { | ||
var content string | ||
content, _ = goquery.OuterHtml(s) | ||
contents += content | ||
}) | ||
return contents | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package postExtractor | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/PuerkitoBio/goquery" | ||
) | ||
|
||
func (t PostExtractorTemplate) EspnPostExtractor(content, feedUrl string) string { | ||
templateData := strings.NewReader(content) | ||
|
||
doc, _ := goquery.NewDocumentFromReader(templateData) | ||
doc.Find("header,figcaption").Each(func(i int, s *goquery.Selection) { | ||
s.Remove() | ||
}) | ||
|
||
newContent, _ := doc.Html() | ||
return newContent | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package templates | ||
|
||
import ( | ||
"github.com/PuerkitoBio/goquery" | ||
) | ||
|
||
func (t *Template) TVLineScrapContent(document *goquery.Document) string { | ||
contents := "" | ||
|
||
document.Find("div[data-component=social-media],div[data-component=cards-related-content]").Each(func(i int, s *goquery.Selection) { | ||
RemoveNodes(s) | ||
|
||
}) | ||
|
||
document.Find("div[data-component=featured-media],div[data-component=gutenberg-content]").Each(func(i int, s *goquery.Selection) { | ||
var content string | ||
content, _ = goquery.OuterHtml(s) | ||
contents += content | ||
}) | ||
return contents | ||
} |