Path: blob/master/node_modules/@bochilteam/scraper/lib/esm/images/sticker.js
1126 views
import cheerio from 'cheerio';1import got from 'got';2export async function stickerTelegram(query, page) {3const data = await got(`https://combot.org/telegram/stickers?q=${encodeURI(query)}&page=${page || 1}`).text();4const $ = cheerio.load(data);5const results = [];6$('body > div > main > div.page > div > div.stickers-catalogue > div.tab-content > div > div').each(function () {7var _a;8const title = (_a = $(this).find('.sticker-pack__title').text()) === null || _a === void 0 ? void 0 : _a.trim();9const icon = $(this)10.find('.sticker-pack__sticker > div.sticker-pack__sticker-inner > div.sticker-pack__sticker-img')11.attr('data-src');12const link = $(this)13.find('.sticker-pack__header > a.sticker-pack__btn')14.attr('href');15const stickers = [];16$(this)17.find('.sticker-pack__list > div.sticker-pack__sticker')18.each(function () {19const sticker = $(this)20.find('.sticker-pack__sticker-inner > div.sticker-pack__sticker-img')21.attr('data-src');22if (sticker)23stickers.push(sticker);24});25results.push({26title,27icon,28link,29stickers30});31});32return results;33}34export async function stickerLine(query) {35const data = await got(`https://store.line.me/api/search/sticker?query=${query}&offset=0&limit=36&type=ALL&includeFacets=true`).json();36return data.items.map(({ title, productUrl, id, description, payloadForProduct: { staticUrl, animationUrl, soundUrl }, authorId, authorName }) => {37return {38id,39title,40description,41url: encodeURI('https://store.line.me' + productUrl),42sticker: staticUrl,43stickerAnimated: animationUrl,44stickerSound: soundUrl,45authorId,46authorName47};48});49}50//# sourceMappingURL=sticker.js.map5152