diff options
| author | Julian Hurst <julian.hurst92@gmail.com> | 2020-11-13 00:23:24 +0100 |
|---|---|---|
| committer | Julian Hurst <julian.hurst92@gmail.com> | 2020-11-13 00:23:24 +0100 |
| commit | 141b32e5970bda1942182f50242c219540db7350 (patch) | |
| tree | 6918ecbf27388aade777e6b783d78b3a35983a74 /ytparser.go | |
| parent | 5f211df7cfbbc25de172340b1c204fb987060e47 (diff) | |
| download | ytparser-141b32e5970bda1942182f50242c219540db7350.tar.gz | |
Add channel ids
Diffstat (limited to 'ytparser.go')
| -rw-r--r-- | ytparser.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ytparser.go b/ytparser.go index 7da87f1..dc6f986 100644 --- a/ytparser.go +++ b/ytparser.go @@ -25,6 +25,7 @@ type Item struct { Title string Url string // The url of the video ThumbUrl string // The thumbnail url + ChannelId string ChannelTitle string ChannelUrl string Published string // The published date provided by youtube as is. @@ -130,6 +131,14 @@ func parsejson(data string) ([]Item, error) { names[depth-1] == "simpleText" { item.Published = t } + if depth >= 5 && + names[depth-5] == "longBylineText" && + names[depth-4] == "runs" && + names[depth-3] == "navigationEndpoint" && + names[depth-2] == "browseEndpoint" && + names[depth-1] == "browseId" { + item.ChannelId = t + } isValue = false } } |
