Import YouTube video transcripts into AI-generated WordPress articles

Import YouTube video transcripts into AI-generated WordPress articles

With the latest update, the CyberSEO Pro and RSS Retriever plugins have introduced a powerful new tool that allows you to import YouTube transcripts directly into WordPress-generated posts. This is achieved using the %youtube_transcript[…]% placeholder, which is designed for use within post templates. Let’s dive into its features.

The %youtube_transcript[…]% placeholder

The placeholder has a parameter that expects a link to a YouTube video, an embed URL, or just the video ID. For example:

%youtube_transcript[https://www.youtube.com/watch?v=3vCCfNQMEi4]%

or

%youtube_transcript[3vCCfNQMEi4]%

When importing YouTube videos from Atom feeds or CSV files, you’ll often need a link to the current video being imported. By default, this is available through the %link% placeholder. Therefore, your transcript import placeholder for the current video will typically look like this:

%youtube_transcript[%link%]%

If you’re importing a YouTube feed, such as a playlist like https://www.youtube.com/feeds/videos.xml?channel_id=UC_UqGjJSDND2t7jhKIj3PPA, and you place the above shortcode in the “Post content” field of the import template settings, the post generated by the plugin will include the full transcript of the video.

However, you’re unlikely to want to use this raw format, as YouTube’s automatic transcripts are often poorly formatted, broken into lines without punctuation. This is where AI models come into play, implemented by the CyberSEO Pro and RSS Retriever plugins through shortcodes such as [openai_gpt], [claude], [gemini], [or_text], and [gpt_article], which can process the %youtube_transcript[…]% placeholder as part of any string parameter.

YouTube transcripts to formatted text

For example, to import YouTube transcripts into WordPress posts and convert them into properly formatted, readable text with punctuation and beautiful HTML formatting, you might use a template like this:

%link%

[openai_gpt model="gpt-4o-mini" prompt="Transform the following unformatted transcript into a well-structured HTML-formatted block suitable for insertion into the body of a WordPress post. Ensure that the text is properly punctuated, divided into coherent paragraphs, and logically structured. Use appropriate HTML tags like <p>, <h3>, <strong>, <em>, and <ul> where necessary. Divide the text into larger, more substantial sections, ensuring that each section flows naturally and covers a significant portion of the content. Avoid using too many subheadings, and only use them when absolutely necessary to indicate a major shift in topic or focus. Do not add a 'conclusion' or any similar headings that signal the end of the article. The resulting HTML should be clear, logically organized, and suitable for publishing.

Text to transform:
%youtube_transcript[%link%]%"]

This template includes the %link% placeholder and the [openai_gpt] shortcode. During the import process, the plugin will replace %link% with the YouTube video link, which WordPress will automatically turn into an embed code. Thus, the corresponding video will appear above the text of each generated post. You can also place it below the text or choose not to include it at all, focusing solely on the transcript text generated by the [openai_gpt] shortcode.

The [openai_gpt] shortcode can, of course, be replaced with any other AI model shortcode available within the plugin. Similarly, feel free to modify the prompt text to tailor it to your needs.

💡Here is a tip to make your YouTube video responsive in any WordPress theme. Inside your prompt, place the %link% placeholder in a <div> block with the name “video-container”:

<div class="video-container">
%link%
</div>

Now go to Customize -> Additional CSS settings of your theme, add the following style and save the settings:

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

There’s no need to explain why copying YouTube transcripts verbatim won’t benefit your site, neither from an SEO perspective nor in terms of potential legal issues. Therefore, let’s explore a more practical way to use imported transcripts.

Unique posts based on YouTube transcripts

Modern AI models, with their vast knowledge bases, can use YouTube video transcripts as the foundation for creating new, unique articles that offer additional informational value.

To encourage the AI model to use its creative abilities and share its knowledge and ideas, you’ll need a more complex prompt. A template for such a shortcode might look like this:

[openai_gpt model="gpt-4o-mini" prompt="Transform the information from the following unformatted transcript into a well-structured, detailed, and engaging informational article. The article should be a new, original piece that expands on the ideas presented in the transcript, providing additional context, analysis, and entertainment value. The text should be comprehensive and thorough, significantly expanding on the content of the transcript by including relevant information, useful tips, ideas, examples, quotes, real-life cases, and insights from your broader knowledge base. Imagine that you are a journalist or writer tasked with creating an in-depth piece that not only informs, but also engages the reader.

Make sure the article is substantive and longer than the original transcript, allowing for a deeper exploration of the topics discussed. Divide the text into larger, more substantial sections, with each section large enough to cover at least a full page of text (approximately 800-1000 words). Use subheadings only when absolutely necessary to indicate a major change in topic or focus. Avoid using too many subheadings, and make sure the text flows naturally between sections.

Avoid adding any 'conclusion' or similar headings that signal the end of the article, as they are not appropriate for this context. Use appropriate HTML tags like <p>, <h3>, <strong>, <em>, <blockquote> and <ul> where necessary. Avoid generating unnecessary or irrelevant headings. The resulting HTML-formatted block should be clear, logically organized, and suitable for insertion into the body of a WordPress post.

Text to transform:
%youtube_transcript[%link%]%"]

Consider this prompt as a proof of concept when creating your own. Also, note that in both shortcodes above, the most affordable OpenAI GPT-4o mini model (gpt-4o-mini) is used.

If the quality of the generated text is more important to you than API cost, it is recommended to use the more powerful OpenAI GPT-4o (chatgpt-4o-latest) model or the [claude] shortcode with its default model, which currently is Anthropic Claude 3.5 Sonnet. Also, remember that all these models and over a hundred others are available through the OpenRouter service via the [or_text] shortcode.

The [gpt_article] shortcode for long YouTube transcripts

If you want to import a transcript of a large video, the output window size of the GPT-4o mini, GPT-4o and Anthropic Claude Sonnet 3.5 models may not be sufficient, as it is limited to 16k tokens. In this case, it is recommended to use the Mistral Large 2 model (mistralai/mistral-large) or Meta Llama 3.1 405B Instruct (meta-llama/llama-3.1-405b-instruct), which have an output window size of 128k.

Alternatively, you can use shortcode [gpt_article], which allows you to generate very large texts using models with a relatively “small” output window like GPT-4o mini. E.g.:

[gpt_article topic="%post_title%" engine="openai-gpt-4o-mini" sections="5" structure="Before you create the section names, analyze the YouTube script below and use it as a reference for your new article section structure to make sure you include all the important information.

The transcript for your inspiration:
%youtube_transcript[%link%]%" directives="Write a new, exciting article/story in a blog post format. Ensure that the article is rich in content and longer than the original transcript, offering deeper exploration of the topics discussed. The article should be a new, original piece that expands on the ideas presented in the transcript, providing additional context, analysis, and entertainment value. The text should be comprehensive and thorough, significantly expanding upon the content of the transcript by incorporating relevant information, examples, and insights from your broader knowledge base. Imagine yourself as a journalist or writer tasked with creating an in-depth piece that not only informs but also captivates the reader.

Use appropriate HTML tags like <p>, <strong>, <em> and <ul> where necessary. Avoid generating unnecessary or irrelevant headings. The resulting HTML-formatted block should be clear, logically organized, and suitable for insertion into the body of a WordPress post.

The transcript for your inspiration:
%youtube_transcript[%link%]%" language="English" heading="h3"]

Note that in the example shortcode above, the transcript is given to the AI model for inspiration twice – once to compile a list of article sections (structure), and a second time to generate the text of those sections (directives).

Unique illustrations

It is not recommended to use YouTube video thumbnails as they may be copyright-protected content. Instead, use the tools on the “Media enrichment” tab or the post template shortcodes for generating unique images using DALL-E ([dalle]), Stable Diffusion ([stable_diffusion]) and Midjourney ([midjourney]).

For generating images, it is recommended to use the %gpt_image_prompt% placeholder, which will be replaced with a relevant text prompt for the chosen graphical AI model, generated by the CyberSEO Pro and RSS Retriever plugins based on the content of each of your articles. This is a simple yet powerful tool that should not be overlooked.

Unique images for articles (Midjourney)

Post excerpts

Finally, a few words about the “Post excerpt” template, which by default contains the %post_excerpt% placeholder, including the textual description (not a transcript!) of the imported video. You will likely want to delete it and leave the post excerpt empty or insert a shortened version of the text description (%post_excerpt_notags[50]%) or generate a brief post description based on the article’s text using the same shortcodes [openai_gpt], [claude], [gemini], [or_text], and [gpt_article].

In summary, the %youtube_transcript[…]% shortcode can be yet another valuable tool in your extensive autoblogging arsenal provided by the CyberSEO Pro and RSS Retriever plugins.

How to humanize AI content

Source: https://www.cyberseo.net/blog/import-youtube-video-transcripts-into-ai-generated-wordpress-articles/