0

I want to report comments using markAsSpam to YouTube comments where its ID's were extracted beforehand. The code below works but only in the terminal.

from google_auth_oauthlib.flow import InstalledAppFlow
from googleapiclient.discovery import build

flow = InstalledAppFlow.from_client_secrets_file('client_secret.json', ["https://www.googleapis.com/auth/youtube.force-ssl"])
credentials = flow.run_console()
youtube = build('youtube', 'v3', credentials=credentials)
request = youtube.comments().markAsSpam(id='some_id')
request.execute()

The flow.run_console() shows a link in the terminal where the user visits to copy a string, so it can be entered in the terminal where the process continues and the comment is finally marked as spam. How do I make this work in the browser?

teduniq
  • 57
  • 7

1 Answers1

0

There's a complete example from Google that I found:

https://developers.google.com/identity/protocols/oauth2/web-server#python_5

For disabling the OAuthlib's HTTPS verification when running locally, there are several options answered in this other SO post:

Testing flask-oauthlib locally without https

teduniq
  • 57
  • 7