microlink logo

Microlink Recipe

Interact with github.com

github.js
const mql = require('@microlink/mql')

const github = (url, opts) =>
  mql(url, {
    data: {
      stats: {
        selector: '.js-profile-editable-area',
        attr: {
          followers: {
            selector: 'a[href*="tab=followers"] span',
            type: 'number',
          },
          following: {
            selector: 'a[href*="tab=following"] span',
            type: 'number',
          },
          stars: {
            selector: 'a[href*="tab=stars"] span',
            type: 'number',
          },
        },
      },
    },
    ...opts,
  })

const result = await github('https://github.com/kikobeats')
console.log(result)