Skip to content

Commit

Permalink
Fix feed content
Browse files Browse the repository at this point in the history
  • Loading branch information
dewey committed Aug 30, 2018
1 parent 623ede7 commit 5207ead
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions plugins/scmp/scmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,22 +124,27 @@ func (p *plugin) listHandler(doc *goquery.Document) ([]*feeds.Item, error) {
ds := s.Find("div.content-wrapper > div.caption-wrapper > h3.node-title > a")
item.Title = ds.Text()

is := s.Find("div.background-image > a > img")
val, exists = is.Attr("data-original")
if exists {
item.Description = fmt.Sprintf(`<img src="%s" width="300px">`, val)
}

var description string
ts := s.Find("span.rdf-meta")
val, exists = ts.Attr("property")
if exists {
if val == "dc:title" {
val, exists = ts.Attr("content")
ct, exists := ts.Attr("content")
if exists {
item.Description = fmt.Sprintf(`%s<p>%s`, item.Description, val)
description = ct
}
}
}

var image string
is := s.Find("div.background-image > a > img")
val, exists = is.Attr("data-original")
if exists {
image = fmt.Sprintf(`<img src="%s" height="300px" alt="Image for the article">`, val)
}

item.Description = fmt.Sprintf(`%s<p>%s`, description, image)

times := s.Find("time.updated")
val, exists = times.Attr("content")
if exists {
Expand Down

0 comments on commit 5207ead

Please sign in to comment.