Handle feed items without images

This commit is contained in:
Pijus Kamandulis 2019-08-19 19:48:58 +03:00
parent 881f1aec48
commit 1d0fbff006
1 changed files with 7 additions and 5 deletions

12
main.go
View File

@ -47,11 +47,13 @@ func main() {
itemDetailsPath, itemDetailsPath,
GrabFeedItemJSON(item)) GrabFeedItemJSON(item))
itemImagePath := itemOutputDir + "/image" + RemoveGetParams(filepath.Ext(item.Image.URL)) if item.Image != nil {
LogInfo("Downloading image to " + itemImagePath) itemImagePath := itemOutputDir + "/image" + RemoveGetParams(filepath.Ext(item.Image.URL))
DownloadFile( LogInfo("Downloading image to " + itemImagePath)
itemImagePath, DownloadFile(
item.Image.URL) itemImagePath,
item.Image.URL)
}
for _, enclosure := range item.Enclosures { for _, enclosure := range item.Enclosures {
filename := RemoveGetParams(filepath.Base(enclosure.URL)) filename := RemoveGetParams(filepath.Base(enclosure.URL))