aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)
}