Traceback (most recent call last):
File "c:\Users\Frost\Desktop\CodingProjects\youtube-analytics-bot\main.py", line 138, in get_stats
response = execute_api_request(
File "c:\Users\Frost\Desktop\CodingProjects\youtube-analytics-bot\main.py", line 85, in execute_api_request
return client_library_function(**kwargs).execute()
File "C:\Python310\lib\site-packages\googleapiclient\_helpers.py", line 130, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\Python310\lib\site-packages\googleapiclient\http.py", line 923, in execute
resp, content = _retry_request(
File "C:\Python310\lib\site-packages\googleapiclient\http.py", line 191, in _retry_request
resp, content = http.request(uri, method, *args, **kwargs)
File "C:\Python310\lib\site-packages\oauth2client\transport.py", line 186, in new_request
credentials._refresh(orig_request_method)
File "C:\Python310\lib\site-packages\oauth2client\client.py", line 761, in _refresh
self._do_refresh_request(http)
File "C:\Python310\lib\site-packages\oauth2client\client.py", line 819, in _do_refresh_request
raise HttpAccessTokenRefreshError(error_msg, status=resp.status)
oauth2client.client.HttpAccessTokenRefreshError: invalid_grant: Token has been expired or revoked.
Find a way to prevent token from having to be refreshed / re-authenticated every couple of weeks manually when credentials.json expire.
python main.py --noauth_local_webserver
2023-02-09 23:23:02 INFO discord.client logging in using static token
2023-02-09 23:23:03 INFO discord.gateway Shard ID None has connected to Gateway (Session ID: XX).
Updating dates to 2023-02-01 - 2023-02-09
Go to the following link in your browser:
https://accounts.google.com/o/oauth2/auth?client_id=XX-XX.apps.googleusercontent.com&redirect_uri=urn%X%X%X%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyoutube.readonly+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyt-analytics-monetary.readonly&access_type=offline&response_type=code
Enter verification code:
An ideal potential middle ground solution would be to retrieve the URL from the terminal, send it as a message on discord, allow the user to authenticate, and send the code inside of discord for the bot to receive, parse, and push to terminal as input.