Coder Social home page Coder Social logo

Comments (15)

trenthm avatar trenthm commented on June 15, 2024 1

Not sure if this is helpful, but it turned out to be really easy to just move my YouTube brand account to a personal Google. Then the script worked great (minus hitting my quota). Thanks for making this tool.

YouTube Help: Move your YouTube channel to another account

from auto-youtube-subscription-playlist-2.

victorjzsun avatar victorjzsun commented on June 15, 2024

I removed that second step, as you're right, it is default now.

Regarding the error, according to documentation, the Forbidden error occurs when either The playlist already contains the maximum allowed number of items or The request is not properly authorized to insert the specified playlist item. Can you please check both of these?

from auto-youtube-subscription-playlist-2.

godspeedyou avatar godspeedyou commented on June 15, 2024

The new (target) playlist was empty. How do I check the proper authorization?

from auto-youtube-subscription-playlist-2.

victorjzsun avatar victorjzsun commented on June 15, 2024

As in make sure that you own the playlist (there might be some conflict if you're trying to add to another user's playlist). Make sure that the playlist ID you put into the first column of the sheet does indeed point to the right playlist by going to the link https://www.youtube.com/playlist?list=[yourplaylistIDhere] replacing [yourplaylistIDhere] with the actual ID.

from auto-youtube-subscription-playlist-2.

victorjzsun avatar victorjzsun commented on June 15, 2024

I've also pushed a new change to the sheets script (to log more details on API fail errors) so if you could update your script in the script editor and post the result, that'd be great.

from auto-youtube-subscription-playlist-2.

godspeedyou avatar godspeedyou commented on June 15, 2024

Thanks for the administration.

I copied the sheet freshly from the github starting page, granted access and the script ran. It failed with the following error.

Tue Nov 05 22:46:43 EET 2019 Acquired 1 videos
Tue Nov 05 22:46:43 EET 2019 Couldn't update playlist with video (XB8sV_DMFDE), ERROR: Message: [API call to youtube.playlistItems.insert failed with error: Forbidden] Details: {"message":"Forbidden","code":403,"errors":[{"domain":"youtube.playlistItem","reason":"playlistItemsNotAccessible","message":"Forbidden"}]}
Tue Nov 05 22:46:43 EET 2019 Added 0 videos to playlist. Error for 1 videos.

See the attachments for my setup.

Screenshot_20191105_215159
Screenshot_20191105_215255

from auto-youtube-subscription-playlist-2.

victorjzsun avatar victorjzsun commented on June 15, 2024

One thing I'm noting is that the account you're using for the sheet is not the same as the YT account with the playlist (Purple A vs Dog profile icon). Please use the same account as the one that owns the playlist since there might be some complications with using a different account to add videos

from auto-youtube-subscription-playlist-2.

godspeedyou avatar godspeedyou commented on June 15, 2024

That may be the issue. However, the dog profile is my brand account (under the A account) which I've been using for several years and I'm kind of dependent on it. I'd like to avoid a migration to the A account, since I've been using the dog account for many years (playlists, subscriptions, comments and so on are connected to it). I'm going to verify that this is the problem and think about migrating. On the other hand I'd appreciate it very much, if you could find a way to support brand accounts.

from auto-youtube-subscription-playlist-2.

victorjzsun avatar victorjzsun commented on June 15, 2024

That's interesting, and it seems like the reason why it's giving a forbidden error. Brand accounts are completely separate from the personal accounts associated with them, so permissions are not transferable.

According to this post, you can try logging into Google Drive/Sheets using that brand account and run the script under that account instead of the "A" account. This will be a temporary solution until I can figure out exactly how permissions work between playlists and if I can find a better solution than switching accounts. I'll see what I can do.

from auto-youtube-subscription-playlist-2.

godspeedyou avatar godspeedyou commented on June 15, 2024

I have the feeling the StackOverflow answer is outdated. I can't choose Google Drive as an product at https://myaccount.google.com when signed in as my brand. And I haven't found a way yet to log in with the mentioned @pages.plusgoogle.com address to Google Drive directly. It tells me I have the wrong password, when I'm using the A account's password. I contacted the StackOverflow user for advice.

from auto-youtube-subscription-playlist-2.

godspeedyou avatar godspeedyou commented on June 15, 2024

I have the feeling the StackOverflow answer is outdated. I can't choose Google Drive as an product at https://myaccount.google.com when signed in as my brand. And I haven't found a way yet to log in with the mentioned @pages.plusgoogle.com address to Google Drive directly. It tells me I have the wrong password, when I'm using the A account's password. I contacted the StackOverflow user for advice.

I can't find a way to login to google drive with the brand account. I assume google scrapped this feature together with google plus.

from auto-youtube-subscription-playlist-2.

jca2112 avatar jca2112 commented on June 15, 2024

I tried the method of generating a refresh token as mentioned in this Stackoverflow post about YouTube APIs, but I am a novice with regards to scripting, working with APIs, etc.

How would I incorporate a generated refresh token into this script to make it work for a YouTube brand account?

from auto-youtube-subscription-playlist-2.

victorjzsun avatar victorjzsun commented on June 15, 2024

That would be pretty difficult and hard to automate without creating a whole new standalone app. I was able to generate a token for a brand account and then use that token to request data from an API, but I cannot do so using a google app such as Google Apps Script, since such an app restricts the caller of the script to be the main account and not a brand account. Basically, since google doesn't allow anyone to sign into a script with a brand account, we'd need to create a whole sign-in architecture that allows for brand accounts.

For anyone who still wants to dive deeper into this issue, here's the process for creating a brand account token:

  • Set up an Desktop App oauth client id/secret to a project as described here
  • Send a request to https://accounts.google.com/o/oauth2/v2/auth as described here, passing the client id generated above and setting the redirect_uri to urn:ietf:wg:oauth:2.0:oob for manual copy and paste of auth code. Make sure to provide the API scopes you need and set request_type to code This can be done with a formatted request on a browser, an app like Postman won't work because the sign-in dialog box is returned
  • Sign in to the dialog provided using the brand account, accept all the conditions and then copy the auth code that's given to you.
  • Send a request to https://oauth2.googleapis.com/token as described here, passing in the auth code you got from above, as well as client id/secret, and specifying grant_type=authorization_code. Again, set redirect_uri to urn:ietf:wg:oauth:2.0:oob to get the token manually.
  • Copy the token from the response and now you have a valid auth token to use (for now).

In terms of how to use this token, at least to test if it works, just send a request to any Google API with an auth header with your token and it should work. To run an Apps Script, the only way I can see is by using something like clasp to run the script remotely using a certain set of credentials (your generated token), but I have yet to see if this works.

from auto-youtube-subscription-playlist-2.

victorjzsun avatar victorjzsun commented on June 15, 2024

Long story short, if we wanted to do something about it, we might as well be Google employees

from auto-youtube-subscription-playlist-2.

rid-x avatar rid-x commented on June 15, 2024

Hi, here is the solution https://stackoverflow.com/a/64902884/7484338

from auto-youtube-subscription-playlist-2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.