0

I am trying to upload videos using the YouTube API. This code worked 7-8 months ago and I haven't made changes to it. I haven't uploaded any videos (or even done any other YouTube operations that would have used my rate limit) today or even this month, yet I get the following error:

googleapi: Error 403: The request cannot be completed because you have exceeded your <a href="/youtube/v3/getting-started#quota">quota</a>., quotaExceeded *googleapi.Error

My OAuth2 client has the following permission: Manage your YouTube videos

My code:

func (y *Youtube) Upload(vid Video) (resp *youtube.Video, err error) {
    upload := &youtube.Video{
        Snippet: &youtube.VideoSnippet{
            Title:       vid.Title,
            Description: vid.Description,
            CategoryId:  vid.Category,
            Tags: "my-tag",
        },
        Status: &youtube.VideoStatus{PrivacyStatus: "public"},
    }


    call := y.Service.Videos.Insert([]string{"snippet,status"}, upload)
    var file *os.File
    file, err = os.Open(vid.ABS)
    if err != nil {
        return
    }
    defer file.Close()

    resp, err = call.Media(file).Do()
    if err != nil {
        return
    }

    return resp, err
}
user_78361084
  • 3,538
  • 22
  • 85
  • 147
  • 4
    This is the answer to your question: [YouTube Data API: The request cannot be completed because you have exceeded your quota, INSUFFICIENT\_TOKENS](https://stackoverflow.com/questions/63211098/youtube-data-api-the-request-cannot-be-completed-because-you-have-exceeded-your). – stvar Aug 17 '21 at 19:46
  • I've updated my credentials json file and it has a new client_secret. I've also deleted my `~/.credentials/youtube-go.json`, which prompted me to reauthorize the client. Still, no luck. – user_78361084 Aug 17 '21 at 19:46
  • @stvar Yep that was it. Ended up deleting my old project and creating a new project. So stupid. If you'd like to make an answer then I'll accept it or you can mark this question as a duplicate - whatever you want! – user_78361084 Aug 17 '21 at 20:15
  • Then, @user_78361084, you may consider voting that answer up. (That answer is mine.) Yes, I marked this question as duplicate of that; and you may do likewise. – stvar Aug 17 '21 at 20:43

0 Answers0