Skip to content

meta

Type:
<boolean> | <object>

Default: true
It enables normalized metadata detection over the target url.

The following examples show how to use the Microlink API with CLI, cURL, JavaScript, Python, Ruby, PHP & Golang, targeting 'https://www.youtube.com/watch?v=9P6rdqiybaw' URL with 'meta' API parameter:

CLI Microlink API example

microlink https://www.youtube.com/watch?v=9P6rdqiybaw&meta

cURL Microlink API example

curl -G "https://api.microlink.io" \
  -d "url=https://www.youtube.com/watch?v=9P6rdqiybaw" \
  -d "meta=true"

JavaScript Microlink API example

import mql from '@microlink/mql'

const { data } = await mql('https://www.youtube.com/watch?v=9P6rdqiybaw', {
  meta: true
})

Python Microlink API example

import requests

url = "https://api.microlink.io/"

querystring = {
    "url": "https://www.youtube.com/watch?v=9P6rdqiybaw",
    "meta": "true"
}

response = requests.get(url, params=querystring)

print(response.json())

Ruby Microlink API example

require 'uri'
require 'net/http'

base_url = "https://api.microlink.io/"

params = {
  url: "https://www.youtube.com/watch?v=9P6rdqiybaw",
  meta: "true"
}

uri = URI(base_url)
uri.query = URI.encode_www_form(params)

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
response = http.request(request)

puts response.body

PHP Microlink API example

<?php

$baseUrl = "https://api.microlink.io/";

$params = [
    "url" => "https://www.youtube.com/watch?v=9P6rdqiybaw",
    "meta" => "true"
];

$query = http_build_query($params);
$url = $baseUrl . '?' . $query;

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET"
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error #: " . $err;
} else {
    echo $response;
}

Golang Microlink API example

package main

import (
    "fmt"
    "net/http"
    "net/url"
    "io"
)

func main() {
    baseURL := "https://api.microlink.io"

    u, err := url.Parse(baseURL)
    if err != nil {
        panic(err)
    }
    q := u.Query()
    q.Set("url", "https://www.youtube.com/watch?v=9P6rdqiybaw")
    q.Set("meta", "true")
    u.RawQuery = q.Encode()

    req, err := http.NewRequest("GET", u.String(), nil)
    if err != nil {
        panic(err)
    }

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, err := io.ReadAll(resp.Body)
    if err != nil {
        panic(err)
    }

    fmt.Println(string(body))
}
Normalized data fields are enabled by default, so explicit setting to true is unnecessary.
"status": "success",
  "data": {
    "title": "Wormholes Explained – Breaking Spacetime",
    "description": "Are wormholes real or are they just magic disguised as physics and maths? And if they are real how do they work and where can we find them?Sources and furthe...",
    "lang": "en",
    "author": null,
    "publisher": "YouTube",
    "image": {
      "url": "https://img.youtube.com/vi/9P6rdqiybaw/maxresdefault.jpg",
      "type": "jpg",
      "size": 120116,
      "height": 720,
      "width": 1280,
      "size_pretty": "120 kB"
    },
    "date": "2021-12-17T23:29:01.000Z",
    "url": "https://www.youtube.com/watch?v=9P6rdqiybaw",
    "logo": {
      "url": "https://www.youtube.com/s/desktop/21ad9f7d/img/favicon_144x144.png",
      "type": "png",
      "size": 1664,
      "height": 145,
      "width": 145,
      "size_pretty": "1.66 kB"
    }
  }
}

Configurable detection

You can configure which specific metadata fields to detect by passing an object with field-specific settings:

Include specific fields

Detect only specific fields by setting them to true:

The following examples show how to use the Microlink API with CLI, cURL, JavaScript, Python, Ruby, PHP & Golang, targeting 'https://www.youtube.com/watch?v=9P6rdqiybaw' URL with 'meta' API parameter:

CLI Microlink API example

microlink https://www.youtube.com/watch?v=9P6rdqiybaw&meta.author&meta.title

cURL Microlink API example

curl -G "https://api.microlink.io" \
  -d "url=https://www.youtube.com/watch?v=9P6rdqiybaw" \
  -d "meta.author=true" \
  -d "meta.title=true"

JavaScript Microlink API example

import mql from '@microlink/mql'

const { data } = await mql('https://www.youtube.com/watch?v=9P6rdqiybaw', {
  meta: {
    author: true,
    title: true
  }
})

Python Microlink API example

import requests

url = "https://api.microlink.io/"

querystring = {
    "url": "https://www.youtube.com/watch?v=9P6rdqiybaw",
    "meta.author": "true",
    "meta.title": "true"
}

response = requests.get(url, params=querystring)

print(response.json())

Ruby Microlink API example

require 'uri'
require 'net/http'

base_url = "https://api.microlink.io/"

params = {
  url: "https://www.youtube.com/watch?v=9P6rdqiybaw",
  meta.author: "true",
  meta.title: "true"
}

uri = URI(base_url)
uri.query = URI.encode_www_form(params)

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
response = http.request(request)

puts response.body

PHP Microlink API example

<?php

$baseUrl = "https://api.microlink.io/";

$params = [
    "url" => "https://www.youtube.com/watch?v=9P6rdqiybaw",
    "meta.author" => "true",
    "meta.title" => "true"
];

$query = http_build_query($params);
$url = $baseUrl . '?' . $query;

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET"
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error #: " . $err;
} else {
    echo $response;
}

Golang Microlink API example

package main

import (
    "fmt"
    "net/http"
    "net/url"
    "io"
)

func main() {
    baseURL := "https://api.microlink.io"

    u, err := url.Parse(baseURL)
    if err != nil {
        panic(err)
    }
    q := u.Query()
    q.Set("url", "https://www.youtube.com/watch?v=9P6rdqiybaw")
    q.Set("meta.author", "true")
    q.Set("meta.title", "true")
    u.RawQuery = q.Encode()

    req, err := http.NewRequest("GET", u.String(), nil)
    if err != nil {
        panic(err)
    }

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, err := io.ReadAll(resp.Body)
    if err != nil {
        panic(err)
    }

    fmt.Println(string(body))
}
This will only extract author and title metadata, ignoring other fields like description, image, etc.

Exclude specific fields

Detect all fields except those explicitly set to false:

The following examples show how to use the Microlink API with CLI, cURL, JavaScript, Python, Ruby, PHP & Golang, targeting 'https://www.youtube.com/watch?v=9P6rdqiybaw' URL with 'meta' API parameter:

CLI Microlink API example

microlink https://www.youtube.com/watch?v=9P6rdqiybaw

cURL Microlink API example

curl -G "https://api.microlink.io" \
  -d "url=https://www.youtube.com/watch?v=9P6rdqiybaw" \
  -d "meta.image=false" \
  -d "meta.logo=false"

JavaScript Microlink API example

import mql from '@microlink/mql'

const { data } = await mql('https://www.youtube.com/watch?v=9P6rdqiybaw', {
  meta: {
    image: false,
    logo: false
  }
})

Python Microlink API example

import requests

url = "https://api.microlink.io/"

querystring = {
    "url": "https://www.youtube.com/watch?v=9P6rdqiybaw",
    "meta.image": "false",
    "meta.logo": "false"
}

response = requests.get(url, params=querystring)

print(response.json())

Ruby Microlink API example

require 'uri'
require 'net/http'

base_url = "https://api.microlink.io/"

params = {
  url: "https://www.youtube.com/watch?v=9P6rdqiybaw",
  meta.image: "false",
  meta.logo: "false"
}

uri = URI(base_url)
uri.query = URI.encode_www_form(params)

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
response = http.request(request)

puts response.body

PHP Microlink API example

<?php

$baseUrl = "https://api.microlink.io/";

$params = [
    "url" => "https://www.youtube.com/watch?v=9P6rdqiybaw",
    "meta.image" => "false",
    "meta.logo" => "false"
];

$query = http_build_query($params);
$url = $baseUrl . '?' . $query;

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET"
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error #: " . $err;
} else {
    echo $response;
}

Golang Microlink API example

package main

import (
    "fmt"
    "net/http"
    "net/url"
    "io"
)

func main() {
    baseURL := "https://api.microlink.io"

    u, err := url.Parse(baseURL)
    if err != nil {
        panic(err)
    }
    q := u.Query()
    q.Set("url", "https://www.youtube.com/watch?v=9P6rdqiybaw")
    q.Set("meta.image", "false")
    q.Set("meta.logo", "false")
    u.RawQuery = q.Encode()

    req, err := http.NewRequest("GET", u.String(), nil)
    if err != nil {
        panic(err)
    }

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, err := io.ReadAll(resp.Body)
    if err != nil {
        panic(err)
    }

    fmt.Println(string(body))
}
This will extract all metadata fields except image and logo, which can help reduce response size and improve performance when you don't need heavy assets.
If you don't need any of this, you can explicitly disable the default behavior

The following examples show how to use the Microlink API with CLI, cURL, JavaScript, Python, Ruby, PHP & Golang, targeting 'https://www.youtube.com/watch?v=9P6rdqiybaw' URL with 'meta' API parameter:

CLI Microlink API example

microlink https://www.youtube.com/watch?v=9P6rdqiybaw

cURL Microlink API example

curl -G "https://api.microlink.io" \
  -d "url=https://www.youtube.com/watch?v=9P6rdqiybaw" \
  -d "meta=false"

JavaScript Microlink API example

import mql from '@microlink/mql'

const { data } = await mql('https://www.youtube.com/watch?v=9P6rdqiybaw', {
  meta: false
})

Python Microlink API example

import requests

url = "https://api.microlink.io/"

querystring = {
    "url": "https://www.youtube.com/watch?v=9P6rdqiybaw",
    "meta": "false"
}

response = requests.get(url, params=querystring)

print(response.json())

Ruby Microlink API example

require 'uri'
require 'net/http'

base_url = "https://api.microlink.io/"

params = {
  url: "https://www.youtube.com/watch?v=9P6rdqiybaw",
  meta: "false"
}

uri = URI(base_url)
uri.query = URI.encode_www_form(params)

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
response = http.request(request)

puts response.body

PHP Microlink API example

<?php

$baseUrl = "https://api.microlink.io/";

$params = [
    "url" => "https://www.youtube.com/watch?v=9P6rdqiybaw",
    "meta" => "false"
];

$query = http_build_query($params);
$url = $baseUrl . '?' . $query;

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET"
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error #: " . $err;
} else {
    echo $response;
}

Golang Microlink API example

package main

import (
    "fmt"
    "net/http"
    "net/url"
    "io"
)

func main() {
    baseURL := "https://api.microlink.io"

    u, err := url.Parse(baseURL)
    if err != nil {
        panic(err)
    }
    q := u.Query()
    q.Set("url", "https://www.youtube.com/watch?v=9P6rdqiybaw")
    q.Set("meta", "false")
    u.RawQuery = q.Encode()

    req, err := http.NewRequest("GET", u.String(), nil)
    if err != nil {
        panic(err)
    }

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, err := io.ReadAll(resp.Body)
    if err != nil {
        panic(err)
    }

    fmt.Println(string(body))
}
Doing that you can speed up response timing for those cases you are not interested in consuming the metadata, like screenshot or video.
This will be reflected at x-fetch-mode response header whose value should be 'skipped'.
cache-control: public, immutable, max-age=86399
x-cache-status: MISS
x-cache-ttl: 86400000
x-fetch-mode: skipped
x-pricing-plan: free
x-rate-limit-limit: 50
x-rate-limit-remaining: 49
x-rate-limit-reset: 1751787476
x-request-id: iad:ba5a0c60-db4e-48c8-be6d-05ebaca22c61
x-response-time: 5.1s