features/rss-job #6

Merged
jtom38 merged 13 commits from features/rss-job into main 2024-05-02 17:41:12 -07:00
2 changed files with 22 additions and 3 deletions
Showing only changes of commit f1f2142fdf - Show all commits

View File

@ -2,7 +2,7 @@ package input
import (
"crypto/tls"
"io/ioutil"
"io"
"log"
"net/http"
)
@ -35,7 +35,7 @@ func getHttpContent(uri string) ([]byte, error) {
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}

View File

@ -39,7 +39,11 @@ func (rc rssClient) GetArticles() ([]domain.ArticleEntity, error) {
Description: post.Content,
Url: post.Link,
PubDate: *post.PublishedParsed,
AuthorName: post.Author.Email,
//AuthorName: post.Authors[0].Email,
}
if len(post.Authors) != 0 {
article.AuthorName = post.Authors[0].Email
}
var postTags []string
@ -47,6 +51,21 @@ func (rc rssClient) GetArticles() ([]domain.ArticleEntity, error) {
postTags = append(postTags, post.Categories...)
article.Tags = strings.Join(postTags, ",")
/*
pageContent, err := getHttpContent(article.Url)
if err != nil {
continue
}
htmlNode, err := html.Parse(bytes.NewReader(pageContent))
if err != nil {
continue
}
htmlNode.
fmt.Println(htmlNode)
*/
if post.Image == nil {
article.Thumbnail = ""
}