diff options
| -rw-r--r-- | ytparser.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/ytparser.go b/ytparser.go index 689ff84..a3e9544 100644 --- a/ytparser.go +++ b/ytparser.go @@ -30,6 +30,8 @@ type Item struct { ChannelUrl string Published string // The published date provided by youtube as is. LengthText string // The length of the video rendered as text by youtube. + AtomUrl string + ViewCount string } // Executes a given template on an item and returns the resulting string. @@ -143,11 +145,17 @@ func parsejson(data string) ([]Item, error) { names[depth-2] == "browseEndpoint" && names[depth-1] == "browseId" { item.ChannelId = t + item.AtomUrl = fmt.Sprintf("https://www.youtube.com/feeds/videos.xml?channel_id=%s", t) } if depth >= 2 && - names[depth-2] == "lengthText" && - names[depth-1] == "simpleText" { - item.LengthText = t + names[depth-2] == "lengthText" && + names[depth-1] == "simpleText" { + item.LengthText = t + } + if depth >= 2 && + names[depth-2] == "viewCountText" && + names[depth-1] == "simpleText" { + item.ViewCount = t } isValue = false } |
