我注意到我达到了 YouTube 数据 api 的 10,000 个单位配额限制,这似乎不正确,因为我只是为我的应用提取播放列表视频。 这就是我要说的。
我查看了 Google Developer 的控制台,发现我的单位使用率正在上升,所以我从 heroku 中删除了该应用程序并获得了一个新密钥,它似乎已经停止了。这是使用 API 的代码。
import React, { Component } from 'react'
import { gapi } from 'gapi-script';
import '../css/YouTube.css'
import {Animated} from "react-animated-css";
import Spinner from 'react-bootstrap/Spinner'
import Button from 'react-bootstrap/Button'
import { FiArrowUpCircle } from "react-icons/fi";
export default class YouTube extends Component {
constructor(props){
super(props);
this.state = {
videos: [],
loading: true
};
this.loadClient = this.loadClient.bind(this);
this.execute = this.execute.bind(this);
this.swap = this.swap.bind(this)
}
componentDidMount(){
gapi.load("client:auth2", function() { …Run Code Online (Sandbox Code Playgroud)