Skip to content

Commit

Permalink
[IMP] do not search the top image if it is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
advancedlogic committed Jul 29, 2017
1 parent abf59b1 commit 3ae7c15
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crawler.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ func (c Crawler) Crawl() (*Article, error) {
}
article.FinalURL = c.url
article.Doc = document

article.Title = extractor.GetTitle(document)
article.MetaLang = extractor.GetMetaLanguage(document)
article.MetaFavicon = extractor.GetFavicon(document)
Expand All @@ -156,10 +157,13 @@ func (c Crawler) Crawl() (*Article, error) {
cleaner := NewCleaner(c.config)
article.Doc = cleaner.Clean(article.Doc)

article.TopImage = OpenGraphResolver(document)
if article.TopImage == "" {
article.TopImage = WebPageResolver(article)
article.TopImage = OpenGraphResolver(document)
if article.TopImage == "" {
article.TopImage = WebPageResolver(article)
}
}

article.TopNode = extractor.CalculateBestNode(document)
if article.TopNode != nil {
article.TopNode = extractor.PostCleanup(article.TopNode)
Expand Down

0 comments on commit 3ae7c15

Please sign in to comment.