Skip to content

solution-libre/yt-tags

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YT default tags

Table of Contents

Requirements

  • python
  • pip
pip install -r requirements.txt

Connect to the YouTube Api

  1. Enable the YouTube Data API v3

  2. Create a new PROJECT, I called mine yt-find-replace

  3. Visit APIs & Services > Credentials > Create credentials, and generate a OAuth 2.0 Client ID. Select Desktop App as the Application type. Download it, rename it to oauth_client.json, and save it in the root of this repo. It should look something like this:

    {
      "installed": {
        "client_id": "123456.googleusercontent.com",
        "project_id": "xxx-123",
        "auth_uri": "https://accounts.google.com/o/oauth2/auth",
        "token_uri": "https://oauth2.googleapis.com/token",
        "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
        "client_secret": "123456",
        "redirect_uris": [
          ...
        ]
      }
    }
  4. You should also set up the OAuth consent screen, leave it as "testing", and add your YouTube email to the test users.

  5. Create a new Service Account key from IAM & Admin > Service Accounts > Keys, rename it as client_secrets.json and save it in the root of this repo. It should look something like this:

    {
      "type": "service_account",
      "project_id": "xxx-123",
      "private_key_id": "123456",
      "private_key": "-----PRIVATE KEY-----",
      "client_email": "[email protected]",
      "client_id": "123456",
      "auth_uri": "https://accounts.google.com/o/oauth2/auth",
      "token_uri": "https://oauth2.googleapis.com/token",
      "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
      "client_x509_cert_url": "https://www.googleapis.com/"
    }

Running the project

If you are running in a production environment, be sure to change/remove this line:

os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"

Then run the project:

python ./main.py

It will ask for your find/replace inputs. For example:

$ Find: We are fundraising for The Trevor Project from April 1, 2021 - June 30, 2021.
$ Replace: We are fundraising for American Foundation for Suicide Prevention from July 1, 2021 - September 30, 2021.

You will be asked to visit a URL to authorize the application. Follow the steps to get the authorization code, and hit enter to continue. After some time, you should see "Done! thanks."

The changes should appear on the video page, but it takes a while to update in YouTube Studio.

Have fun!

Contributing

Feature suggestion? Bug to report?

Before opening any issue, please search for existing issues (open and closed).

Also visit the living to do kanban board and discussions page.

License

Released under the Apache License 2.0, as extended by the YouTube Data API samples

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages

  • Python 95.4%
  • Dockerfile 4.6%