Microlink × FCA
Interact withfca.org.uk
fca.js
const mql = require('@microlink/mql')
const fca = async (url, opts) => {
const result = await mql(url, {
waitForSelector: '#profile-header',
meta: false,
prerender: true,
data: {
name: {
selector: 'h1'
},
updatedAt: {
attr: 'text',
selector:
'#who-is-this-details-content > div.stack.stack--direct.stack--medium > div.accordion__text > div > p:nth-child(2)'
},
address: {
selector:
'#who-is-this-details-content > div.stack.stack--direct.stack--medium > div.slds-grid.slds-wrap.gutters-large.gutters-medium_none > div.slds-col.slds-size_1-of-1.slds-medium-size_6-of-12.slds-p-around_none.slds-p-right_small > div > div > div:nth-child(1) > p',
attr: 'text'
},
firmReferenceNumber: {
type: 'number',
selector:
'#who-is-this-details-content > div.stack.stack--direct.stack--medium > div.slds-grid.slds-wrap.gutters-large.gutters-medium_none > div:nth-child(3) > div > div > div:nth-child(1) > p'
},
registeredCompanyNumber: {
selector: '.hide-href-print'
},
email: {
selector:
'#who-is-this-details-content > div.stack.stack--direct.stack--medium > div.slds-grid.slds-wrap.gutters-large.gutters-medium_none > div.slds-col.slds-size_1-of-1.slds-medium-size_6-of-12.slds-p-around_none.slds-p-right_small > div > div > div:nth-child(3) > p'
},
phone: {
type: 'text',
selector:
'#who-is-this-details-content > div.stack.stack--direct.stack--medium > div.slds-grid.slds-wrap.gutters-large.gutters-medium_none > div.slds-col.slds-size_1-of-1.slds-medium-size_6-of-12.slds-p-around_none.slds-p-right_small > div > div > div:nth-child(2) > p'
},
website: {
type: 'url',
selector:
'#who-is-this-details-content > div.stack.stack--direct.stack--medium > div.slds-grid.slds-wrap.gutters-large.gutters-medium_none > div.slds-col.slds-size_1-of-1.slds-medium-size_6-of-12.slds-p-around_none.slds-p-right_small > div > div > div:nth-child(3) > a > span:nth-child(1)'
}
},
...opts
})
if (result.data.registeredCompanyNumber) {
result.data.registeredCompanyNumber = Number(
result.data.registeredCompanyNumber.split('<')[0]
)
}
if (result.data.updatedAt) {
result.data.updatedAt = result.data.updatedAt
.split('firm details')[1]
.trim()
}
return result
}
const result = await fca(
'https://register.fca.org.uk/s/firm?id=001b000000NMdXdAAL'
)
mql.render(result)