In previous articles Set 2 we discussed three methods: p>
In this article, we will discuss the following two methods —
Before proceeding, we will first discuss how to create OAuth credentials ... Follow the steps below to create a Client ID and Secret.
client_secret.jsonand move it to your working directory.
Install additional libraries using the pip command:
pip install –upgrade google -auth google-auth-oauthlib google-auth-httplib2
Note We need to know the channel ID to insert and remove a subscription. Follow these steps to find the channel ID:
Code to insert a subscription. This example shows how to insert a subscription to a Youtube channel identified by the channel ID specified in the parameter list. You can change the subscription by changing the snippet.resourceId.channelId property. This example adds a subscription to Derek Banas` channel.
During the execution of the code, you will be prompted to enter an authorization code. To get the code, you must follow the link indicated on the command line screen above the line: Enter the authorization code.
Now follow the link and copy and paste the authorization code that you will receive by granting permission.
If you can see from the above output it is clear that I am successful subscribed to the channel.
Code to remove the subscription. this example shows how to delete a subscription. The id parameter is the subscription identifier, i.e. you can write on the command line while inserting the subscription, or alternatively run the code to list all subscriptions and write down the subscription ID for the subscription you want. In this example, I am deleting the subscription that I added in the code above.