Blog

Get Public Video Thumbnails With Fetch Endpoint

Get Public Video Thumbnails With Fetch Endpoint

Some of our users work a lot with publicly-facing videos and user generated content available on certain outlets such as YouTube. Today we deployed a set of features to the Optidash API which will make their daily work a little bit easier. Our Fetch Endpoint endpoint now supports fetching and transforming thumbnails of public videos.

To use this new feature simply modify image url passed to the Optidash API as a part of Image Fetch request. The pattern used for fetching thumbnails of public videos outlet:video_id. For example, to fetch and transform thumbnail image of YouTube video represented by ID dQw4w9WgXcQ use youtube:dQw4w9WgXcQ as url in the fetch parameters.

Those thumbnails can be easily transformed with the entire suite of high-precision operations the Optidash API offers. Say you would like to get a thumbnail of a YouTube video described by ID a6bBbTWgxCU, resize that image to a maximum width of 720px, adjust sharpness with unsharp mask, and lastly increase saturation just tiny bit. A cURL request would look like this:

curl https://api.optidash.ai/1.0/fetch -X POST -u your-api-key: \
-H "Content-Type: application/json" \
-d '{
    "url": "youtube:a6bBbTWgxCU",
    "resize": {
        "width": 720
    },
    "adjust": {
        "unsharp": 1.5,
        "saturation": 5.5
    }
}'

Here’s a quick example of said operation implemented with our official Node integration:

const Optidash = require("optidash");

/**
* Instantiate `pix`
*/

const pix = new Optidash("your-api-key");

/**
* Fetch thumbnail of YouTube's video `a6bBbTWgxCU`
* resize it to a maximum width of 720 pixels width,
* and adjust sharpness (1.5) and saturation (5.5)
*/

pix
    .fetch("youtube:a6bBbTWgxCU")
    .resize({
        width: 720
    })
    .adjust({
        unsharp: 1.5,
        saturation: 5.5
    })
    .toJSON((err, meta) => {
        if (err) {
            return console.log(err);
        }
    });

We currently support YouTube, Vimeo, and Dailymotion outlets with more to follow. For the full reference, please check out updated API docs for Thumbnails of Public Videos.

Should you have questions about the Fetch endpoint or requests for other features do not hesitate to contact us anytime.

Ready to try Optidash?

Start optimizing your images smarter. Integrate in minutes.

Create Free Account Get In Touch

This website uses cookiesBy using Optidash, you agree to our Cookie Policy.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.