Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function foundStickers(item) {
- // stringnick.pro
- const stickers = [];
- let stickerString = null;
- if (item && item.descriptions) {
- for (let k = 0; k < item.descriptions.length; k++) {
- if (item.descriptions[k].value.includes('sticker')) {
- stickerString = item.descriptions[k].value;
- break;
- }
- }
- }
- if (stickerString) {
- const regex = /<img width=64 height=48 src="(.*?)">/g;
- let m;
- while ((m = regex.exec(stickerString)) !== null) {
- // This is necessary to avoid infinite loops with zero-width matches
- if (m.index === regex.lastIndex) {
- regex.lastIndex++;
- }
- m.forEach((match, groupIndex) => {
- if (groupIndex === 1) {
- stickers.push(match);
- }
- });
- }
- }
- return stickers;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement