diff options
| author | Julian Hurst <julian.hurst92@gmail.com> | 2020-12-02 10:42:02 +0100 |
|---|---|---|
| committer | Julian Hurst <julian.hurst92@gmail.com> | 2020-12-02 10:42:02 +0100 |
| commit | 6118566d444ee0dc2f31bd9e0443ca39828c1c05 (patch) | |
| tree | b19417ae5cc17e5f8d2d7f0a37101eed7159cb91 | |
| parent | c20c90f3068f0d3bc827c75133e7c7412b246e32 (diff) | |
| download | ytparser-6118566d444ee0dc2f31bd9e0443ca39828c1c05.tar.gz | |
Fix videoIds
| -rw-r--r-- | ytparser.go | 3 |
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) } |
