parser
parser copied to clipboard
feat: Add transform function to selector
If the array includes a callback function as 3rd element, all the results pass through that transformer. Returned values are the result of selector. For example:
date_published: {
selectors: [[
'meta[name="article:published_time"]',
'value',
(item) => moment.from(convertNumbersToEnglish(item), 'fa',
'YYYY/MM/DD - HH:mm').toISOString();
]]
}
extend: {
tags: {
selectors: [[
'meta[name=\'article:tag\']', 'value', (item) => {
return item.split(/\s*,\s*/);
}]],
allowMultiple: true
}
}