Skip to content

Commit

Permalink
Add thumbnail and outline to the description of the item
Browse files Browse the repository at this point in the history
  • Loading branch information
mono0x committed May 1, 2024
1 parent ad5bf1a commit e532398
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions scraper/source/impresswatchcolumn/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package impresswatchcolumn

import (
"fmt"
"html"
"net/http"
"net/url"
"regexp"
Expand Down Expand Up @@ -93,10 +94,22 @@ func (s *source) ScrapeFromDocument(doc *goquery.Document, siteURL string) (*fee
return
}

description := ""
src, exists := s.Find(".image img").Attr("src")
if exists {
description += `<img src="` + html.EscapeString(src) + `" width="360" height="270" /><br />`
}

outline := s.Find(".outline").Text()
if outline != "" {
description += `<p>` + html.EscapeString(outline) + `</p>`
}

items = append(items, &feeds.Item{
Title: title,
Created: t,
Link: &feeds.Link{Href: href},
Title: title,
Description: description,
Created: t,
Link: &feeds.Link{Href: href},
})
})

Expand Down

0 comments on commit e532398

Please sign in to comment.