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