如何通过网络浏览器未经授权发布评论?

I want to post a comment via Youtube API.

Currently my working code does that, yet I need to authorize via web browser and after some repetition it says invalid credentials and the comments are not being posted any more.

What is the reason for the invalid credentials message and how do I post comments without authorization via web browser, i.e. by having my server run a php-script via cron every two days?

You need to be authorize to YouTube to perform this method. If you want to post a comment, then the CommentThreads: insert can help you to create a new top-level comment.

Here is the sample request on how to do that. Just replace the videoId to the videoId that you want to comment.

https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.commentThreads.insert?part=snippet&_h=24&resource=%257B%250A++%2522snippet%2522%253A+%250A++%257B%250A++++%2522topLevelComment%2522%253A+%250A++++%257B%250A++++++%2522snippet%2522%253A+%250A++++++%257B%250A++++++++%2522textOriginal%2522%253A+%2522your+comment+here%2522%252C%250A++++++++%2522videoId%2522%253A+%2522kmXXXLBL3Nk%2522%250A++++++%257D%250A++++%257D%250A++%257D%250A%257D&

You can check here the sample code on how to do this with PHP code.

Note that you need to be authorize to perform this.

For the invalid credentials that you got, check the PHP sample code here on how to solve that kind of error.

Hope this information helps you.