aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Hurst <julian.hurst92@gmail.com>2021-01-11 16:38:03 +0100
committerJulian Hurst <julian.hurst92@gmail.com>2021-01-11 16:38:03 +0100
commit1f719189887348093d84208ddcc26f3f22533b8b (patch)
treebf95f8c9e20cbae684aa2a43b247383a676b4447
parente3e7997de8aa61b7ce8e4478bd7f800592bfaa97 (diff)
downloadytparser-1f719189887348093d84208ddcc26f3f22533b8b.tar.gz
Add AtomUrl and ViewCountHEAD1.1.0master
-rw-r--r--ytparser.go14
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
}