Skip to content

Instantly share code, notes, and snippets.

@Amerr
Last active June 17, 2020 19:54
Show Gist options
  • Save Amerr/ee34f79f2289ee2d3c1e84c3bdb171aa to your computer and use it in GitHub Desktop.
Save Amerr/ee34f79f2289ee2d3c1e84c3bdb171aa to your computer and use it in GitHub Desktop.
Free Download customised icons from icons8.
// Capture id of the icons of https://icons8.com/ from a particular page or categories
// Code to run in chrome console
const ids = [];
document.querySelectorAll('a.icon-link').forEach((element) => {
const href = element.attributes.href.value
const [, id] = href.match(/\/([\d]+)\//);
ids.push[id];
});
// to copy array of ids in your system (in chrome console)
copy(ids)
// index.js create a node script to download all icons to a folder
const https = require('https');
const fs = require('fs');
const ids = [81126, ..] // paste from the ids copied from chrome console
ids.forEach(function (id) {
const file = fs.createWriteStream(`icons/${id}.png`);
// Alter the value to your needs
const request = https.get(`https://img.icons8.com/?id=${id}&size=250&token=&format=png&color=000000`, function(response) {
response.pipe(file);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment