How to Install the YouTube Add-on in Kodi

In a previous tutorial, we explained how you can install LibreELEC on a Raspberry Pi to set up a home media server and replace your smart TV OS. This tutorial is going to show you how to install the YouTube add-on and set up YouTube API in Kodi.

Step 1: Install the YouTube Add-on in Kodi

Go to Kodi Settings -> Add-ons -> Install from repository -> All repositories. There are many add-ons in the repository, such as subtitle add-on, the movie database add-on, etc. You will find YouTube in the video add-on category.

libreelec youtube add-on

Once the YouTube add-on is installed, the setup wizard will appear. Select Yes to execute the setup wizard.

youtube-setup-wizard

If you need to use another language or region, select Yes to choose.

youtube-add-on-language

You also have the option to enable geolocation.

youtube-add-on-geo-location

Then, go back to the Kodi home screen, select Add-ons from the left sidebar, and choose the YouTube add-on. Before using this add-on, you need to enter your YouTube API key.

Step 2: Create YouTube API Key in Your Google Account

You need to set up your YouTube API key before you can use this add-on to watch videos on YouTube. Go to your Google API dashboard, and click the drop-down menu on the upper-left corner to create a new project.

kodi google api dashboard

If you have created other projects before, then click the New Project button.

google apis & service create new project kodi

Enter a project name such as Kodi-YouTube, then click the create button.

kodi youtube

Once the project is created, select the project in the notification bar.

youtube kodi

Next, click the Enable APIs and Service button.

youtube on kodi

Select YouTube Data API v3.

kodi youtube add-on

Click the Enable button to enable this API.

YouTube Data API v3

Once it’s enabled, you will be brought back to the API dashboard. Click the Create Credentials button.

youtube api credentials

Choose the following items.

  • YoutTube Data API v3,
  • Other UI (e.g. Windows, CLI tools)
  • Public data

add credentials to your project kodi youtube

Then click the What credentials do I need? button. You will see your credential, i.e, your API key. Copy the API key to your clipboard, or save it to a file. Then click the Done button.

kodi youtube api key

Next, click the Configure Consent Screen button.

configure consent screen youtube kodi libreelec

Tick on External and click the Create button.

kodi youtube oauth consent screen

Give the App a name such as Kodi-Youtube, and select a contact email address. You also need to enter the developer’s email address (Simply enter your email address). Click Save and Continue button.

how to set up youtube api key in kodi

Go back to your API dashboard. Select Credentials on the left sidebar and click the Create Credentials button, select OAuth client ID.

youtube api key oauth client ID

Choose TVs and Limited Input devices as the application type. Give the client ID a name such as Kodi. Click the create button.

kodi youtube oauth client id

Once the OAuth client is created, the Client ID and Client Secret will be displayed on the screen. Save them to a file. Then click the OK button.

youtube data api client id & client secret

Step 3: Set Up API in the Kodi YouTube Add-on

Go to the Kodi home screen, select Add-ons on the left sidebar and choose YouTube.

kodi add-ons youtube video

Select Settings.

kodi add-ons youtube settings

Choose API in the left sidebar and enter your API key, client ID, and client secret. Click the OK button.

kodi youtube api key api id api secrect

Next, select Sign In.

kodi youtube sign-in

If your API key, client ID, and client secret are entered correctly, it will tell you to visit a URL and enter a code.

watch youtube videos on kodi

Once you entered the code, click the Allow button so Kodi will be able to access your YouTube account.

libreelect play youtube videos

Now you should be able to watch YouTube videos on your Kodi media server. (Sometimes, you may need to enter two verification codes in order to sign in to your YouTube account.)

Troubleshooting Tips

Unauthorized Access

If you see the following error when trying to authenticate in your Google account,

The developer hasn’t given you access to this app. It’s currently being tested and it hasn’t been verified by Google.

then you need to go to the app verification page to add your Google user account (your email address) to the allowed user.

The developer hasn’t given you access to this app. It’s currently being tested and it hasn’t been verified by Google.

Can’t Play YouTube Videos

If your Kodi can’t play YouTube videos and you see the following error in the Kodi log, it’s probably because you didn’t correctly configure your DNS server, or you need to disable IPv6 in your Raspberry Pi.

ConnectionError: HTTPSConnectionPool(host='www.youtube.com', port=443): Max retries exceeded with url: /feeds/videos.xml?channel_id=UC3BGlwmI-Vk6PWyMt15dKGw (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xffff0960e350>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))

YouTube Account Automatically Logged Out

This may happen when you log into your YouTube account for the first time. You need to login twice, then it should be fine. This is also true when you need to add multiple YouTube accounts in Kodi.

YouTube Video Unavailable

If a YouTube video can’t be played in Kodi, it’s probably because the video owner restricts access to certain countries and you are not in those countries. You can use a VPN to bypass the restriction.

Adding YouTube Playlist to Kodi Favorites

You can create a playlist in your YouTube account and add it to the Kodi Favorites, so you can easily watch the videos. Note that playlists saved from other YouTube users can’t be displayed in Kodi, you must create the playlist yourself.

You can also add a subscribed YouTube channel to the Kodi favorites.

Wrapping Up

I hope this tutorial helped you install the YouTube add-on in Kodi. As always, if you found this post useful, then subscribe to our free newsletter to get more tips and tricks. Take care 🙂

Rate this tutorial
[Total: 7 Average: 5]

5 Responses to “How to Install the YouTube Add-on in Kodi

  • If you follow it exactly it works great! I kept the API in test and didn’t publish it. That’s the only thing for me that’s not clear but even in test it works if you add yourself as the test user. Thx a lot for this tutorial!

  • I ran into a weird problem. I get prompted to login a second time on kodi youtube, but it flashes away before I get a chance to auth. I dont have time to write it down or type it in on the other PC. WTH do I do? Its like the youtube app needs a wait setting for the second auth.

    I end up getting an API error because of this. Can I preauthorize the app from the regular PC in the Google Cloud console?

    • I followed an additional step at this site ( https://raspberrytips.com/youtube-api-keys-kodi/) where they mention that you can go to the api config webpage of your kodi install. http:\\{ip of your kodi box}: {port on youtube app on kodi}/api
      So in my case it was http:\\10.0.0.xx:50152\api and I was able to then copy/paste the API key, client ID and secret all from the regular PC over to the kodi on Pi. I must have had a wrong character somewhere from typing. this time it paused on the second google device sign in.

  • Xiao, Excellent and very easy to follow. The only problem I had was the Unauthorized Access which you already solve it so I just did what you said and I’m playing YouTube. You deserve a Beer be sure is a Belgium beer 🙂

  • Amit Raja
    11 months ago

    I AM VERY HAPPY AND GRATEFUL THAT I GOT MY HANDS ON SUCH A BEAUTIFUL PROCESS AND EXPLANATION!
    It really seems like there is a god who knows what problems are going to be there for his fellow comrades!

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here