data

Type: <object>
it enables specific data extraction over the target url.
  • CLI
  • JavaScript
  • Shell
  • Python
  • Ruby
const mql = require('@microlink/mql')

const { status, data } = await mql('https://kikobeats.com', {
  data: { avatar: { selector: '#avatar', type: 'image', attr: 'src' } }
})

mql.render(data)
The data extraction need to be defined at least with a CSS selector.
As a result, the extracted data will be part of the data payload in the response:
{
  "data": {
    "avatar": {
      "url": "https://d33wubrfki0l68.cloudfront.net/ad0e96f5e30e3c65b7ff31e5a637fea070356f0b/eaa58/images/avatar.jpg",
      "width": 500,
      "height": 500,
      "type": "jpg",
      "size": 53310,
      "size_pretty": "53.3 kB"
    }
  },
  "status": "success"
}
You can read Microlink Query Language section to know more about how to define data extraction.