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