From ccbe3d031e17a9f61b107e160b04b550636f97b7 Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 13 Jul 2021 13:36:14 +0200 Subject: [PATCH] fix download icons in blacklist --- app.js | 30 +++--- blacklist.csv | 261 ++------------------------------------------------ 2 files changed, 22 insertions(+), 269 deletions(-) diff --git a/app.js b/app.js index f2d833e3..620d5f83 100644 --- a/app.js +++ b/app.js @@ -36,7 +36,7 @@ cmlog.start('Start generator'); if (!_.isEmpty(config.apikey)) { axios .get('https://pro-api.coinmarketcap.com/v1/cryptocurrency/map', { - headers: { 'X-CMC_PRO_API_KEY': config.apikey }, + headers: { 'X-CMC_PRO_API_KEY': config.apikey } }) .then((res) => { res.data.data.map((crypto, index) => { @@ -49,57 +49,53 @@ if (!_.isEmpty(config.apikey)) { (o) => !_.includes(filesIconsExists, o) && !_.includes(blacklist, o) ); - cmlog.success( - `Retrieving the list of cryptos Total: [${cryptosData.length}]` - ); + cmlog.success(`Retrieving the list of cryptos Total: [${cryptosData.length}]`); if (cryptosData && cryptosData.length === 0) { cmlog.done('All icons have been updated !'); } else { cryptosData.forEach((crypto, index) => { + const cryptoName = crypto.replace(/\s+/g, ''); + setTimeout(() => { axios .get( - `https://pro-api.coinmarketcap.com/v1/cryptocurrency/info?symbol=${crypto}`, + `https://pro-api.coinmarketcap.com/v1/cryptocurrency/info?symbol=${cryptoName}`, { - headers: { 'X-CMC_PRO_API_KEY': config.apikey }, + headers: { 'X-CMC_PRO_API_KEY': config.apikey } } ) .then((o) => { - const imageUrl = o.data.data[_.upperCase(crypto)].logo; + const imageUrl = o.data.data[_.upperCase(cryptoName)].logo; const options = { url: imageUrl, - dest: `${folderPatch}/icons/${crypto}.png`, + dest: `${folderPatch}/icons/${cryptoName}.png` }; download .image(options) .then(({ filename }) => { cmlog.success(`Icon saved ${filename}`); - cmlog.waitting( - `PROGRESS [${index + 1}/${cryptosData.length}]` - ); + cmlog.waitting(`PROGRESS [${index + 1}/${cryptosData.length}]`); }) .catch((err) => cmlog.error(new Error(err))); }) .catch((err) => { if (err && err.response && err.response.status === 400) { - cmlog.error( - new Error(`Crypto icon not found => "${crypto}"`) - ); + cmlog.error(new Error(`Crypto icon not found => "${cryptoName}"`)); const csvWriter = createCsvWriter({ path: 'blacklist.csv', header: [{ id: 'name', title: 'NAME' }], - append: true, + append: true }); - const records = [{ name: crypto }]; + const records = [{ name: cryptoName }]; csvWriter .writeRecords(records) // returns a promise .then(() => { - cmlog.info(`Crypto add blacklist => ${crypto}"`); + cmlog.info(`Crypto add blacklist => ${cryptoName}"`); }); } }); diff --git a/blacklist.csv b/blacklist.csv index 4d2e5c2a..f6deadd7 100644 --- a/blacklist.csv +++ b/blacklist.csv @@ -1,265 +1,22 @@ NAME -xbtc 21 -2 give -nlc 2 -erc 20 -b 2 b -c 20 -j 8 t -1 wo -ac 3 -0 x btc -tm 2 -rock 2 -x 8 x -x 12 -f 1 c -plus 1 -d 4 rk -b 2 g -s 4 f -1 sg -1 x 2 -rc 20 -e 2 c -p 2 px -btc 2 -b 91 -7 e -cix 100 -x 42 -mb 8 -1 up -1 mt -1 gold -et lyte t -on le xpa -1 ai -afro x -ifx 24 -ak 12 -r 2 r -im btc -i own -b 1 p -ff 1 -ag 8 -2 key -ly xe -sac 1 -t 69 -mo co -btc 3 l -btc 3 s -eth 3 s -eth 3 l -gom 2 -3 cs -4 art -l 2 p -ydai yusdc yusdt ytusd -eth 20 smaco -ethrsi 6040 -s trx -s link -s btc -fx 1 -based -e mtrg -yamv 2 -dacc 2 -yi 12 -yf dai -g kimchi -i 9 c -yfi 2 -p 2 p -po sh -y tsla -x btc -rope -c 2 o -yf 4 -defi s -defi l -milk 2 -wvg 0 -wg 0 -y ban -pxusd mar 2021 -kp 3 r -x dot -st firo -n 0031 -kp 4 r -yfb 2 -7 up -nyan 2 +yvaultlpycurveyycrv +yfdai +defil +nyan2 noob -bst 1 -ib eth -sav 3 -c fi -sup 8 eme -cp 3 r -api 3 -kp 2 r -lk 3 r -7 add -l 2 -yfi 3 -c 0 in -emc 2 -lburst -c 2 -n 8 v -lc 4 -vec 2 -reb 2 -w cres -wav 3 -a 5 t -v sxp -z 502 -v usdt -v usdc -v busd -v xvs -v bnb -v btc -v eth -v ltc -v xrp -v bch -v link -v dot -m aapl -m googl -m tsla -m nflx -m baba -dj 15 pir -n 3rd z -m amzn -m msft -m twtr -m iau -m qqq -m slv -m uso -m vixy -r 34 p anrx -b 21 -2 based -xeth g -n 0001 -3 xt -a eth -1 inch -kp 3 rb -808 ta -v fil -v dai -xdef 2 -p btc 35 a -aria 20 -zzzv 2 -r 3 fi -ar nxm -u 8 d -gst 2 trdl md -s yfl -mp 3 -defi 5 -g 999 -gfarm 2 -b 20 -rit 20 -y panda -punk basic -slnv 2 -d 100 -w szo -naruto 2 -a enj -mp 4 -x dai -a 2 a -x moon -a wsb -b 26 -mco 2 -l 3 p -50 x -cc 10 -orcl 5 -creth 2 -y vault lp y curve yycrv -m fb -co 2 -wx dai -hve 2 -co 2 b -p eth 18 c -8 pay -delta rlp -10 set -b 360 -mo fi -x blzd -k 21 -moon stop -chz 006 -d art -bcmc 1 -1 mil -ec 2 -v doge -v ada -100 x -cbix p -2 goshi -poly moon -w sienna -o 3 -g 9 tro -b priva -420 x -eth 2 x fli -0 x mr -x 2 p -football stars -x token -burn 1 -kei -polarv 3 -2 lc -n 1 +cbixp +eth2xfli +xtoken wntr -c 3 -v bit +kei peepo hina -charix token -dao 1 -baby doge -x sat +charixtoken bite -b 2 x -4 stc avatar -hunny pawg -yfih 2 clit -sak 3 -e rsdl -2 crz -n 1 ce -fan 8 -burnx 20 -z usd