skip to Main Content

I want to use the YouTube API to get the snippet of their description. However, I want it to be the primary text snippet describing the video YouTube uses as the snippet, which is different from the data api’s response.

Let me give an example to clear things up:

At the top of this description is the text "Compress Decades Into Days. Get Dan Lok’s World-Class Training Solutions to Grow Your Income, Influence and Wealth Today. Start Here ► [redacted]"

On the YouTube data API search snippet the response is: "Compress Decades Into Days. Get Dan Lok’s World-Class Training Solutions to Grow Your Income, Influence and Wealth Today.". This makes sense because they’re both at the start of the description. Now this is where I get confused.

If you search the title on YouTube (not the API), you’ll actually see that the description is "Have you ever thought of starting an exciting YouTube career on YouTube doing what you love? Or maybe you have started, but …"

This is the snippet I want. I want their video’s "Primary SEO Search Snippet", which describes the video. Is there anyway to calculate this or get this from the API using another method? I don’t want to use any non-official API/library to do this.

What this is not:

  • This is not any caching that has yet to expire/update
  • Unique to this video. There are plenty of videos where this happens

2

Answers


  1. Chosen as BEST ANSWER

    I wanted to add an answer for anyone trying to do this in 2023 and onwards.

    I opened a ticket on the Google Issue Tracker regarding this issue: This was their response.

    Hi Conor, I was able to reproduce this behavior, and also found that neither a search resource description nor a video resource description will display the "Primary SEO Search Snippet" that you are seeking. Thus, I have opened up a feature request with our internal team to request this functionality, but I can't guarantee this feature will be implemented. Thus for updates regarding this, I recommend keeping an eye on our revision history.

    You can use the unofficial API as per Benjamin's answer, but unfortunately, that can cause other issues depending on the scale you need to use this feature.


  2. As far as I know there isn’t any official API providing the data you are looking for. Anyway if you change your mind about not using unofficial APIs, then you can proceed as follows by trying out my open-source YouTube operational API. Indeed by fetching https://yt.lemnoslife.com/search?part=snippet&q=YOUR_QUERY, you will notably get the primary SEO search snippet you are looking for in item["snippet"]["detailedMetadataSnippet"].

    For instance with "How To Grow With 0 Views And 0 Subscribers" you would get:

    {
        "kind": "youtube#searchListResponse",
        "etag": "NotImplemented",
        "items": [
            {
                "kind": "youtube#searchResult",
                "etag": "NotImplemented",
                "id": {
                    "kind": "youtube#video",
                    "videoId": "ADPFEw-7FtU"
                },
                "snippet": {
                    "channelId": "UCs_6DXZROU29pLvgQdCx4Ww",
                    "title": "How To Grow With 0 Views And 0 Subscribers",
                    "thumbnails": [
                        {
                            "url": "https://i.ytimg.com/vi/ADPFEw-7FtU/hq720.jpg?sqp=-oaymwEjCOgCEMoBSFryq4qpAxUIARUAAAAAGAElAADIQj0AgKJDeAE=&rs=AOn4CLCKNA5T652tMTvnOw22llDniM9O6Q",
                            "width": 360,
                            "height": 202
                        },
                        ...
                    ],
                    "channelTitle": "Dan Lok",
                    "channelHandle": "DanLok",
                    "timestamp": "3 years ago",
                    "duration": 887,
                    "views": 4495095,
                    "badges": [
                        "CC"
                    ],
                    "channelApproval": "Verified",
                    "channelThumbnails": [
                        {
                            "url": "https://yt3.ggpht.com/ytc/AMLnZu_TXnQ07ufj6eGxco9yHndCCcV5KfAizZ9jbI8vmA=s68-c-k-c0x00ffffff-no-rj",
                            "width": 68,
                            "height": 68
                        }
                    ],
                    "detailedMetadataSnippet": "Have you ever thought of starting an exciting YouTube career on YouTube doing what you love? Or maybe you have started, butu00a0...",
                    "chapters": [
                        {
                            "title": "Intro",
                            "time": 0,
                            "thumbnails": [
                                {
                                    "url": "https://i.ytimg.com/vi/ADPFEw-7FtU/hqdefault_25933.jpg?sqp=-oaymwEjCNACELwBSFryq4qpAxUIARUAAAAAGAElAADIQj0AgKJDeAE=&rs=AOn4CLBVOtOt_jLJd1dRRt5_dj3SlGBtRA",
                                    "width": 336,
                                    "height": 188
                                }
                            ]
                        },
                        ...
                    ]
                }
            },
            ...
        ]
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search