favicon-server/api/grabber/ogimage.js

22 lines
379 B
JavaScript
Raw Normal View History

2019-02-13 08:49:10 +00:00
const selectors = [
"meta[property='og:image']",
];
module.exports = ($) => {
const icons = [];
selectors.forEach((selector) => {
$(selector).each((i, elem) => {
const { content } = elem.attribs;
if (content && content !== '#') {
const icon = {
src: content
};
icons.push(icon);
}
});
});
return icons;
};