aboutsummaryrefslogtreecommitdiff
path: root/ytparser.go
diff options
context:
space:
mode:
authorJulian Hurst <julian.hurst92@gmail.com>2020-12-02 10:42:02 +0100
committerJulian Hurst <julian.hurst92@gmail.com>2020-12-02 10:42:02 +0100
commit6118566d444ee0dc2f31bd9e0443ca39828c1c05 (patch)
treeb19417ae5cc17e5f8d2d7f0a37101eed7159cb91 /ytparser.go
parentc20c90f3068f0d3bc827c75133e7c7412b246e32 (diff)
downloadytparser-6118566d444ee0dc2f31bd9e0443ca39828c1c05.tar.gz
Fix videoIds
Diffstat (limited to 'ytparser.go')
-rw-r--r--ytparser.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/ytparser.go b/ytparser.go
index 0382479..91e63b2 100644
--- a/ytparser.go
+++ b/ytparser.go
@@ -95,7 +95,8 @@ func parsejson(data string) ([]Item, error) {
isValue = true
} else {
//fmt.Println(names[len(names) - 1])
- if names[depth-1] == "videoId" {
+ if depth >= 2 && names[depth-2] == "videoRenderer" &&
+ names[depth-1] == "videoId" {
item.Id = t
item.Url = fmt.Sprintf("https://youtube.com/watch?v=%s", t)
}