Good news: There's an easy way to use YouTube to grow your business without creating videos. You can embed existing YouTube content on your site using the YouTube API.

→免费模板:如何使用YouTube进行业务[立即下载]

没有脚本,没有故事登机,也不需要拍摄。只需使用已经创建的内容即可。让我们看一下YouTube API是什么,如何获得API键以及如何将其用于品牌。

TheYouTube Data APIis valuable because it allows you to curate YouTube videos on your website. Additionally, it has a wide selection of features and functionalities that make it accessible to developers and valuable to businesses.

Not sure what an API is? Let’s take a look at the definition.

What’s an API?

An API (Application Programming Interface) is the connecting link between two applications that communicate with each other.

An API makes a programmer’s work easier by skipping the drudgery of writing every single line of code every time users need to access data. Instead, programmers can use predefined functions and protocols to quickly surface the information they need.

Benefits of Using the YouTube API

许多营销人士和企业老板失踪on the benefits of incorporating YouTube into theirdigital marketing strategy。Usually, it's a question of how much time it takes to create high-quality video content.

In a typicalYouTube marketingstrategy, you would consistently publish video content every week with the hopes of generating likes and subscribers — a portion of which you’d hope would convert into customers. Luckily, this is no longer the only way to use YouTube for your business. YouTube has created an API that allows you to integrate your website with the social platform.

Here are some of the greatest benefits of using the YouTube API.

1. You can take advantage of existing content.

With the YouTube API, you don’t have to spend valuable time and resources creating content. Instead, you can take advantage of the content that has already been published to increase user engagement on your site.

2. YouTube是顶级社交媒体平台之一。

YouTube is no run-of-the-mill platform with a dwindling user base. It boastsmore than two billionactive users and has some impressive stats to support that number. The social search engine is:

3. Featuring YouTube’s content can increase your dwell time.

Because the YouTube API can help you add YouTube content to your website, it will help users stay on the page for longer as they watch the content that you’ve specifically curated for them. This increase indwell time搜索引擎的信号表明您的内容很有价值,从而提高了目标关键字的排名。

4. Using the API can help you convert more website visitors.

Using the API is also valuable from a conversion rate and revenue standpoint. Prospects who engage with your content and stay on your website are more likely than not to make a purchase.

What kind of data can you feature using the YouTube API? Let’s take a look.

YouTube API Data

The YouTube API gives you access to YouTube’s data in a more comprehensive, scalable way than standaloneYouTube embed codes会。您可以检索整个播放列表,用户的uploads, and even search results using the YouTube API. You can also add YouTube functionalities to your website so that users can upload videos and manage channel subscriptions straight from your website or app.

对于许多营销人员来说,使用YouTube API是不费吹灰之力的,但是YouTube不允许任何人访问此有价值的工具或其数据。为了防止潜在的滥用,YouTube授予每个用户一个唯一的API密钥,使他们可以将其网站或应用程序连接到平台。

Each API key is designated for an individual project. If you’re using the API on two different websites, you should create two different API keys.

Now, let’s go over how to get a YouTube API key step-by-step.

1. Log in to Google Developers Console.

You can log in toGoogle Developers Consoleusing your Google account. If you don’t yet have one, you’ll need to create one.

2. Create a new project.

Once you log in, you’ll automatically be taken to an empty dashboard. On the upper right-hand corner, clickCreate Project

Google开发人员控制台仪表板

Image Source

您将被带到可以添加项目名称,选择组织的屏幕上,然后选择位置(URL)。

You can create a project without an organization. If you don’t have an organization, you won’t be prompted to select a location.

New project form in Google Developer Console

Image Source

Once you create a project, everything you do from here onwards, including creating the API key, will apply to that specific project. If you have multiple projects going at the same time, ensure that the correct one is selected by double-checking that the project is listed on the top navigation bar.

3. On the new project dashboard, click Explore & Enable APIs.

After creating a project, you’ll be taken to a brand new dashboard with different cards: Project Info, Resources, and so on.

Navigate to theGetting Startedcard and click onExplore & Enable APIs

New project dashboard in Google Developers Console

Image Source

Alternatively, on the sidebar, navigate toAPIs & Services>Library

4.在库中,在YouTube API下导航到YouTube数据API V3。

Once you’ve reached the library, you’ll see a page divided into sections. Navigate to the section titled YouTube APIs and select YouTube Data API v3.

Google's API library, where the YouTube API is located

Image Source

另外,您可以在搜索栏上搜索YouTube数据API。

5。Enable the API.

After you arrive at the YouTube Data API page, click a blue button with the wordEnable

YouTube API page on the Google Developers Console's API library

Image Source

6.创建一个凭据。

单击启用后,您将被带到概述页面。

Dashboard for the YouTube Data API, where you can then create a credential

Image Source

On the top right corner, clickCreate Credentials

在“凭据”窗口上,为第一个空白空间选择YouTube数据API V3,第二个空白服务器(例如NodeJS。Tomcat),然后在第三个提示符上选中“公共数据框”。

Credential configurations for creating a YouTube API key

Image Source

在此下方,单击标题为蓝色按钮What credentials do I need?

After that, your API key will automatically load.

YouTube API created after clicking

Image Source

ClickDone

7. A screen will appear with the API key.

Finished! You’ve got your API key. It’s saved in your credentials for easy retrieval.

YouTube API key created and listed on the API & Services dashboard in Google Developers Console

Image Source

YouTube API密钥常见问题解答

Still have questions about using the YouTube API? We have answers below.

Is the YouTube API Free?

The YouTube API is free if you don’t exceed your daily API request quota. Eachrequest costs a predetermined amount of points。您每天得到10,000点。

How Much Does the YouTube API Cost?

访问YouTube数据API的费用是基于quota usage。For each project, you're given 10,000 free points per day and all requests cost at least one point.

YouTube Data API quota calculator

Image Source

您可以使用Quota Calculator,如果您需要更多查询,则可以apply for higher quotas。The pricing may not remain the same.

Where is My YouTube API Key?

Have you created an API key but don’t know how to find it? We’ll walk you through the process of finding it step-by-step.

    • Step 1: Log in toGoogle Developers Console
    • Step 2:您将自动带到项目仪表板,在那里您会看到一系列卡片。在下面APIscard, click转到API概述
APIs card on Google Developers Console dashboard

Image Source

  • Step 3:You’ll be taken to a dashboard with a sidebar. On this sidebar, clickCredentials

Credentials sidebar that allows you to find your YouTube API key

Image Source


    • Step 4:All done! You’ll find the YouTube API key you created.
YouTube API key dashboard

Image Source

My YouTube API Key is Not Working

Glitches happen all the time, especially when it comes to APIs.

Your API key may not be working because you’re using it for the wrong project. Be sure you’re using the key for the project that you created it for, especially if you created multiple projects at the same time.

如果它仍然不起作用,请考虑完全创建一个新的API密钥。

How to Use the YouTube API on Your WordPress Website

通过视频营销,不自己创建视频,就是策划YouTube内容。在YouTube上已经创建了很多内容(每分钟300小时的视频),在平台上浏览可能会使用户感到不知所措。

使用插件和YouTube API键,您可以介入并制定独立的内容或有关行业内特定主题的视频列表。这将使您的观众更容易在免费推广内容创建者的同时发现优质的YouTube内容。您的付款方式是网站流量不断增长的形式。

Video is also a great way to illustrate your points when writing blog posts. It delivers the message faster, can cover more depth, and is the preferred content consumption method for many.

Youtube videos embedded in blog post

Image Source

Here are someWordPress pluginsyou can use to engage your visitors on yourWordPress website。对于这些插件,您需要一个YouTube API键。

1.WonderPlugin

WonderPlugin lets you embed a playlist gallery on your website using a YouTube API key. You can also embedYouTube carousels

2.VideographyWP

摄影WP是一个方便的插件,可让您用特色视频替换特色图像。将YouTube API键输入插件的设置后,插件为您检索视频而无需将其编码为主题或页面。

3.自动YouTube画廊

自动YouTube画廊听起来很自动。要在WP网站上创建视频库,只需在插件的设置中输入频道,用户,搜索术语或播放列表的名称即可。您需要一个YouTube API键才能使该插件自动检索数据。

4.WP YouTube Lite

WP YouTube Lite允许您在网站上嵌入视频,而不会降低页面速度。使用YouTube API,它将YouTube视频加载到一个较轻的视频播放器中,该视频播放器将使您的页面的加载时间快。

5。Feed Them Social

The Feed Them Social plugin allows you to create and embed social media feeds on your website. It interfaces with the YouTube API to retrieve all of YouTube’s data and create a custom feed. To activate a YouTube feed, you’ll navigate to the YouTube Options page on your plugin settings and enter your API key.

YouTube API Examples

YouTube API示例:代码样本您可以在网站或应用程序上使用YouTube API的其他方法?在下面,您会找到常见YouTube API用例的有用代码示例。

1.检索上传

The following code samples allow you to retrieve your own or another user’s uploads. Choose the one that aligns with the coding language or platform you’re using.

AppsScript

See the PenYouTube API Example: Retrieving Uploadsby Christina Perricone (@hubspot) onCodepen

Go

See the PenYouTube API Example: Retrieving Uploads (Go)by Christina Perricone (@hubspot) onCodepen

。网

See the PenYouTube API示例:检索上传(.net)by Christina Perricone (@hubspot) onCodepen

Ruby

See the PenYouTube API示例:检索上传(Ruby)by Christina Perricone (@hubspot) onCodepen

2.检索某个关键字的搜索结果

You can use the YouTube API to retrieve search results for a certain keyword. Use the code samples below to do so.

AppsScript

See the PenYouTube API Example: Search (AppsScript)by Christina Perricone (@hubspot) onCodepen

Go

See the PenYouTube API Example: Search (Go)by Christina Perricone (@hubspot) onCodepen

。网

See the PenYouTube API Example: Search (.NET)by Christina Perricone (@hubspot) onCodepen

Ruby

See the PenYouTube API Example: Search (Ruby)by Christina Perricone (@hubspot) onCodepen

For more AppsScript, Go, .NET, and Ruby code samples,click here

Custom YouTube API Code Samples

YouTube API示例:用例和代码段

If you’re using Java, JavaScript, PHP, Python, or curl to connect your website or app to the YouTube API,click here to access code samples you can customize

要为您的特定用例创建代码示例,请采取以下步骤。

  1. Choose a resource。This refers to the data you want to retrieve using the API. For example, you can choose “channels,” “videos,” “playlists,” and “search.”
  2. 选择一种与您通常要做的事情保持一致的方法。For “videos,” for example, you can choose “list,” “getRating,” or “insert.”
  3. Find the use case that aligns with what you specifically want to do。例如,在选择“视频”作为您的资源和“列表”作为方法之后,您可以获取列出YouTube最受欢迎的视频的代码示例,或者列出您喜欢的视频。
  4. Click the next to the use case。This will open up a “Try this API” window where you can customize the request parameters, such as the videoCategoryId and regionCode.
  5. After you’re finished customizing, click Execute.You’ll be prompted to log in and provide access to the API Explorer. You’ll then be taken back to the previous window, where your code snippet has been generated.

Use the YouTube API to Grow Better

YouTube can help you reach a larger audience and grow your customer base. It has an established user base, providing the perfect environment for businesses, marketers, creatives, and virtually anyone who wants to reach the public to do so easily.

Consistently creating high quality, original content can be difficult to incorporate into most marketing strategies. But with access to the YouTube Data API, you can take the second-best route to use YouTube for marketing: sharing video on your website.

Editor's note: This post was originally published in March 2020 and has been updated for comprehensiveness.

New call-to-action

New call-to-action

最初于2021年9月14日上午7:00 am,更新于10月8日2021年

Topics:

Application Programming Interface (API)