0

I have two Youtube channels (A & B), each with a different Google account. Then, I have a third Google account (C) with all my Google Apps Script files in Drive. I want to write a script in account C to retrieve data with a Google Apps Script from the Youtube channels using the Youtube Analytics API provided in Google Script. But, using the example given here (https://developers.google.com/apps-script/advanced/youtube-analytics?hl=es) I can only access the channel of my current account. Since what I want is to retrieve data from channels set in accounts A and B from Drive set in account C, it obviously fails.

I guess the solution would be to use something related to OAuth 2 but I don't really know how to start. So, if there's a explicit solution or you could give me some tips, I'd be most grateful.

Thank you for your time!

user3058709
  • 31
  • 1
  • 1
  • 3

1 Answers1

0

Here the options I can propose you:

  • if you can use some spreadsheet, you could build a script in each account that get the data for is own account and append it to a spreadsheet owned by account C with write right for A&B.
  • if your informations are not too sensitive you can build a script in account A & B that can be triggered anonimously and in the account C build an other script that fetch the data from the scripts A&B.
  • The really non easy solution will be to use oauth2 authentified request from the script in account C to retrieve the data from A & B, but that's tough google apps script.
Harold
  • 3,297
  • 1
  • 18
  • 26
  • In fact, what I'm interested in is the third option, as I'll add the script to a larger program once it's solved, and i need an option like that. Is it really that difficult? – user3058709 Mar 21 '14 at 10:21
  • well it's not easy, I tried to make it easier with a dedicated library: https://sites.google.com/a/ousset.net/harold-s-pages/stuff/minioauth2-library, maybe it will help you – Harold Mar 21 '14 at 13:04