Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

Youtube Data API fetch in JS isnt returning all of the contents

$
0
0

so im using the youtube api to grab information about the live status of a channel. If you use this type of link normaly:https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=(CHANNELID)&eventType=live&type=video&key=(APIKEY)

you get no important information, but if the specified channel is live it gives alot of information like the status that it is indeed live. I am grabbing that information but it doesnt change, so i still get the return json like the channel isnt live but if i click the link i can clearly see all the information but it isnt grabbing it

client.on('message', async message => {    if(message.content=="!cat"){        let getData= async () =>{            let response= await fetch("https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCvaTdHTWBGv3MKj3KVqJVCw&eventType=live&type=video&key=(APIKey")            console.log(response)            let Data=await response.json()            console.log(Data)            return Data        }        let FinalData= await getData()        console.log(FinalData.liveBroadcastContent)        message.reply(FinalData.liveBroadcastContent)    }}); 

this is what shows up in my fetch:

  kind: 'youtube#searchListResponse',  etag: 'Byi7iAkYUIpWKxdVS-MPyYo1_sY',  regionCode: 'DE',  pageInfo: { totalResults: 1, resultsPerPage: 1 },  items: [    {      kind: 'youtube#searchResult',      etag: 'jTlF5DKseNmUsYji3o253M32ZhA',      id: [Object],      snippet: [Object]    }  ]} 

this is what shows when i go onto the same link in my browser:

"kind": "youtube#searchListResponse","etag": "Byi7iAkYUIpWKxdVS-MPyYo1_sY","regionCode": "DE","pageInfo": {"totalResults": 1,"resultsPerPage": 1  },"items": [    {"kind": "youtube#searchResult","etag": "jTlF5DKseNmUsYji3o253M32ZhA","id": {"kind": "youtube#video","videoId": "2DacDYB6jVs"      },"snippet": {"publishedAt": "2021-11-29T06:00:03Z","channelId": "UCvaTdHTWBGv3MKj3KVqJVCw","title": "【シャイニングパール】地上へ戻ってきました#3【#スバおか対決 /ホロライブ】","description": "_ 3つ目のバッチ目指してゴー!✨スバルちゃん:https://www.youtube.com/channel/UCvzGlP9oQwU--Y0r9id_jnA この放送は株式会社ドワンゴの実施するニコニコ ...","thumbnails": {"default": {"url": "https://i.ytimg.com/vi/2DacDYB6jVs/default_live.jpg","width": 120,"height": 90          },"medium": {"url": "https://i.ytimg.com/vi/2DacDYB6jVs/mqdefault_live.jpg","width": 320,"height": 180          },"high": {"url": "https://i.ytimg.com/vi/2DacDYB6jVs/hqdefault_live.jpg","width": 480,"height": 360          }        },"channelTitle": "Okayu Ch. 猫又おかゆ","liveBroadcastContent": "live","publishTime": "2021-11-29T06:00:03Z"      }    }  ]}

Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>