got(url, myOptions) .then(response => { return Promise.resolve(response.body); }) .catch(err => { debug(err); return Promise.reject( err.response && err.response.body ? err.response.body : err ); })
async function getUUID(username) { const res = await got(`https://mcuuid.net/?q=${username}`); const $ = cheerio.load(res.body); const input = $('input')[1]; if (!input) { return; } return input.attribs['value']; }
function _loadMeme(url) { return got(url).then(res => { let singleData = JSON.parse(res.body); templates.push({ name: url.replace(/https:\/\/memegen\.link\/api\/templates\/(.*)/, '$1'), url: url.replace('/api/templates', ''), styles: singleData.styles }); }); }
async function scrape(embedURL) { const response = await got(embedURL); const body = response.body; const packed = packedRegex.exec(body)[1]; const unpacked = unpacker.unPack(packed); const sources = jsonRegex.exec(unpacked); const parsed = json5.parse(sources[1]); return parsed; }
got.get(endpoints.api).then(async ok => { var json = JSON.parse(ok.body); var league = json['summoner-v3']; var updown = await upapi(league); resolve(updown) }).catch(reject);
got('https://memegen.link/templates/').then(res => { let data = JSON.parse(res.body); templates = []; let promises = []; for (let key in data) { promises.push(_loadMeme(data[key])); } Promise.all(promises).then(() => { templates = templates.filter(e => !!e); templates.sort((a, b) => a.name.localeCompare(b.name)); }).catch(console.error); }).catch(console.error);
got.head(`https://cdn.communitydragon.org/${patch}/champion/${champion}/square`, {cache: map}).then(data =>{ return resolve({ url: data.url }) }).catch(err => { reject({ status: { status_code: err.statusCode, message: err.statusMessage } }) });
async function scrape(url) { const response = await got(url); const body = response.body; // Dirty check to see if the file exists if (body.includes('We are unable to find the video you\'re looking for. There could be several reasons for this, for example it got removed by the owner.')) { return null; } return parse(body); }
got(`${registryUrl}${packageName}`) .then(result => { return Promise.resolve(JSON.parse(result.body)) }) .catch(error => { return Promise.reject(error) })
got.get(endpoints.api).then(async ok => { var json = JSON.parse(ok.body); var league = json['match-v3']; var updown = await troubledapi(league); resolve(updown) }).catch(reject);
got.get(endpoints.api).then(async ok => { var json = JSON.parse(ok.body); var league = json['match-v3']; var updown = await downapi(league); resolve(updown) }).catch(reject);
got.head(`https://cdn.communitydragon.org/${patch}/champion/${champion}/ability-icon/q`, {cache: map}).then(data =>{ return resolve({ url: data.url }) }).catch(err => { reject({ status: { status_code: err.statusCode, message: err.statusMessage } }) });
got.head(`https://cdn.communitydragon.org/${patch}/honor/${honorId}`, {cache: map}).then(data =>{ return resolve({ url: data.url }) }).catch(err => { reject({ status: { status_code: err.statusCode, message: err.statusMessage } }) });
got.head(`https://cdn.communitydragon.org/${patch}/honor/emblem/${honorId}/locked`, {cache: map}).then(data =>{ return resolve({ url: data.url }) }).catch(err => { reject({ status: { status_code: err.statusCode, message: err.statusMessage } }) });
got.head(`https://cdn.communitydragon.org/${patch}/ward/${wardId}`, {cache: map}).then(data =>{ return resolve({ url: data.url }) }).catch(err => { reject({ status: { status_code: err.statusCode, message: err.statusMessage } }) });