Does this library still work?
Closed this issue · 0 comments
sergeybok commented
Hi, I am running the following code based on the last bit from the documentation, and it's saving empty images, also when I follow the URL that gets created it's a blank page. Looking at the dates it's from 1.5 years ago, so I was wondering if bitmoji changed their APIs or am I not using the library correctly?
const fs = require('fs');
const https = require('https');
const libmoji = require('libmoji');
function saveImageToDisk(url, localPath) {
var fullUrl = url;
var file = fs.createWriteStream(localPath);
var request = https.get(url, function(response) {
response.pipe(file);
});
};
let comicId = libmoji.getComicId(libmoji.randTemplate(libmoji.templates));
let avatarId = libmoji.getAvatarId("https://render.bitstrips.com/v2/cpanel/8968038-316830037_35-s5-v1.png?transparent=1&palette=1");
let outfit = libmoji.randOutfit(libmoji.getOutfits(libmoji.randBrand(libmoji.getBrands("male"))));
const bitmojiUrl = libmoji.buildRenderUrl(comicId,avatarId,1,2,outfit);
console.log(bitmojiUrl);
saveImageToDisk(bitmojiUrl, 'sample.jpg');
saveImageToDisk(bitmojiUrl, 'sample.png');
Thanks for any help!