问题描述
我只想从 youtube api v3 中提取带有反应的 videoId https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UC******Q3oeA&type=video&eventType=live&key=AIzaSyCw***********Kuijwy41JQ
在组件上我获取 api
import React,{ useEffect,useState } from 'react'
const cc= () => {
const [chain,setChain] = useState([]);
useEffect(() => {
fetch("https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCQS3******D9Q3oeA&type=video&eventType=live&key=AIzaSyCwsQ3********41JQ")
.then(res => res.json())
.then(res => setChain(res))
},[]);
console.log(chain)
return (
<div>
{chain.etag} =====>it return the etag but i want to return the videoId under items
</div>
)
}
export default cc
kind: "youtube#searchListResponse",etag: ""m2yskBQFythfE4irbTIeOgYYfBU/j2Px-5q--mgJEsrfjg4L0Mgn_L8",地区代码:“ES”, 页面信息:{ 总结果: 1,结果每页:5 },项目: [ { 种类:“youtube#searchResult”, etag: ""m2yskBQFythfE4irbTIeOgYYfBU/_1gFVi_i_djlS4OZWPGtcZ3iSLQ"",ID: { 种类:“youtube#video”, 视频ID:“M7lc1UVf-VE” },片段:{ 发布时间:“2013-04-10T17:25:04.000Z”, channelId: "UC_x5XG1OV2P6uZZ5FSM9Ttw",标题:“YouTube 开发者直播:嵌入式 Web 播放器自定义”, 描述:“在本周的节目中,Jeff Posnick 涵盖了您需要了解的有关使用玩家参数进行自定义的所有信息 YouTube iframe 嵌入式播放器。",缩略图:{ 默认: { url: "https://i.ytimg.com/vi/M7lc1UVf-VE/default.jpg",宽度:120, 身高:90 },中等的: { url: "https://i.ytimg.com/vi/M7lc1UVf-VE/mqdefault.jpg",宽度:320, 身高:180 },高的: { url: "https://i.ytimg.com/vi/M7lc1UVf-VE/hqdefault.jpg",宽度:480, 高度:360 } },channelTitle: "谷歌开发者",livebroadcastContent:“无” } } ]
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)