youtube-apiyoutube-data-apiyoutube-analytics-api

How to retrieve video including paid promotion by YouTube API


We want to retrieve video data including promotions.
Is there a way to get it with the YouTube Data API or the YouTube Analytics API?
Is there any other way?

A video that includes a promotion is a video that displays something like the image below.

enter image description here

Click to move to the following page.

https://support.google.com/youtube/answer/154235


Solution

  • Since you are only interested in knowing whether or not a video (based on its id) includes paid promotion, as far as I know there isn't any official YouTube Data API v3 endpoint answering your question.

    However you can check if the video includes paid promotion by checking whether or not the YouTube webpage contains paidContentOverlayRenderer. You can proceed this way for instance:

    curl -s https://www.youtube.com/watch?v=VIDEO_ID | grep "paidContentOverlayRenderer"
    

    If something is returned it means that the video includes paid promotion otherwise it doesn't.

    Another similar answer that I have written is available here.