seawolf2357 commited on
Commit
b98c4fb
·
verified ·
1 Parent(s): 12f3078

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -48,6 +48,11 @@ if not creds or not creds.valid:
48
  creds = flow.run_local_server(port=0)
49
  with open(token_path, 'w') as token:
50
  token.write(creds.to_json())
 
 
 
 
 
51
 
52
  youtube_service = build('youtube', 'v3', credentials=creds)
53
 
@@ -202,7 +207,7 @@ async def post_replies_to_youtube(video_id, comments, replies):
202
  """
203
  for (comment, comment_id), reply in zip(comments, replies):
204
  try:
205
- youtube_service.comments().insert(
206
  part='snippet',
207
  body={
208
  'snippet': {
@@ -211,9 +216,10 @@ async def post_replies_to_youtube(video_id, comments, replies):
211
  }
212
  }
213
  ).execute()
214
- logging.debug(f'Posted reply to comment: {comment_id}')
215
  except Exception as e:
216
  logging.error(f'Error posting reply to comment {comment_id}: {e}')
 
217
 
218
  if __name__ == "__main__":
219
  discord_client = MyClient(intents=intents)
 
48
  creds = flow.run_local_server(port=0)
49
  with open(token_path, 'w') as token:
50
  token.write(creds.to_json())
51
+ else:
52
+ flow = InstalledAppFlow.from_client_secrets_file(credentials_path, SCOPES)
53
+ creds = flow.run_local_server(port=0)
54
+ with open(token_path, 'w') as token:
55
+ token.write(creds.to_json())
56
 
57
  youtube_service = build('youtube', 'v3', credentials=creds)
58
 
 
207
  """
208
  for (comment, comment_id), reply in zip(comments, replies):
209
  try:
210
+ response = youtube_service.comments().insert(
211
  part='snippet',
212
  body={
213
  'snippet': {
 
216
  }
217
  }
218
  ).execute()
219
+ logging.debug(f'Posted reply to comment: {comment_id} with response: {response}')
220
  except Exception as e:
221
  logging.error(f'Error posting reply to comment {comment_id}: {e}')
222
+ logging.debug(f'Response: {e.resp} | Content: {e.content}')
223
 
224
  if __name__ == "__main__":
225
  discord_client = MyClient(intents=intents)