correct rss to null check the author
This commit is contained in:
parent
852db161c9
commit
f1f2142fdf
@ -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
|
||||
}
|
||||
|
@ -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 = ""
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user