favicon-server/api/grabber/ogimage.js
2019-02-13 16:49:10 +08:00

22 lines
379 B
JavaScript

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;
};