Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@tzahi12345/twitch-emoticons
Advanced tools
Gets Twitch, BTTV, FFZ and 7TV emotes as well as parsing text to emotes!
You must now use a Twitch user ID instead of the username to fetch user's emotes.
You can use this page to quickly grab it.
To fetch Twitch emotes you need to get a client and secret from Twitch here, it's free.
If you are only using BetterTTV, FrankerFaceZ and 7TV you don't need to provide Twitch app keys as they are independent from the Twitch API.
npm install @mkody/twitch-emoticons
# or
yarn add @mkody/twitch-emoticons
// With ESM import
import TwitchEmoticons from '@mkody/twitch-emoticons';
const { EmoteFetcher, EmoteParser } = TwitchEmoticons;
// ... or require()
const { EmoteFetcher, EmoteParser } = require('@mkody/twitch-emoticons');
// Your Twitch app keys
const clientId = '<your client id>';
const clientSecret = '<your client secret>';
const fetcher = new EmoteFetcher(clientId, clientSecret);
const parser = new EmoteParser(fetcher, {
type: 'markdown',
match: /:(.+?):/g
});
fetcher.fetchTwitchEmotes(null).then(() => {
const kappa = fetcher.emotes.get('Kappa').toLink();
console.log(kappa);
// https://static-cdn.jtvnw.net/emoticons/v2/25/default/dark/1.0
const text = 'Hello :CoolCat:!';
const parsed = parser.parse(text);
console.log(parsed);
// Hello ![CoolCat](https://static-cdn.jtvnw.net/emoticons/v2/58127/default/dark/1.0 "CoolCat")!
});
const { EmoteFetcher, EmoteParser } = require('@mkody/twitch-emoticons');
// Your channel ID
const channelId = 44317909;
// Your Twitch app keys
const clientId = '<your client id>';
const clientSecret = '<your client secret>';
const fetcher = new EmoteFetcher(clientId, clientSecret);
const parser = new EmoteParser(fetcher, {
// Custom HTML format
template: '<img class="emote" alt="{name}" src="{link}">',
// Match without :colons:
match: /(\w+)+?/g
});
Promise.all([
// Twitch global
fetcher.fetchTwitchEmotes(),
// Twitch channel
fetcher.fetchTwitchEmotes(channelId),
// BTTV global
fetcher.fetchBTTVEmotes(),
// BTTV channel
fetcher.fetchBTTVEmotes(channelId),
// 7TV global
fetcher.fetchSevenTVEmotes(),
// 7TV channel
fetcher.fetchSevenTVEmotes(channelId),
// FFZ global
fetcher.fetchFFZEmotes(),
// FFZ channel
fetcher.fetchFFZEmotes(channelId)
]).then(() => {
const globalEmotes = parser.parse('EZ Clap way too easy LUL now for the last boss monkaS LaterSooner');
console.log(globalEmotes);
// <img class="emote" alt="EZ" src="https://cdn.7tv.app/emote/63071b80942ffb69e13d700f/1x.webp"> <img class="emote" alt="Clap" src="https://cdn.7tv.app/emote/62fc0a0c4a75fd54bd3520a9/1x.webp"> way too easy <img class="emote" alt="LUL" src="https://static-cdn.jtvnw.net/emoticons/v2/425618/default/dark/1.0"> now for the last boss <img class="emote" alt="monkaS" src="https://cdn.betterttv.net/emote/56e9f494fff3cc5c35e5287e/1x.webp"> <img class="emote" alt="LaterSooner" src="https://cdn.frankerfacez.com/emote/149346/1">
const channelEmotes = parser.parse('KEKW that was 3Head TeriPoint');
console.log(channelEmotes);
// <img class="emote" alt="KEKW" src="https://cdn.betterttv.net/emote/5e9c6c187e090362f8b0b9e8/1x.webp"> that was <img class="emote" alt="3Head" src="https://cdn.frankerfacez.com/emote/274406/1"> <img class="emote" alt="TeriPoint" src="https://cdn.7tv.app/emote/61dc299b600369a98b38ebef/1x.webp">
}).catch(err => {
console.error('Error loading emotes...');
console.error(err);
});
7TV v3 delivers emotes in either WEBP or AVIF.
By default we'll return WEBP emotes but you can override this.
const { EmoteFetcher } = require('@mkody/twitch-emoticons');
const fetcher = new EmoteFetcher();
// Fetch global emotes in AVIF (channel id has to be `null` for global)
fetcher.fetchSevenTVEmotes(null, 'avif');
// Fetch 0kody's emotes with the package's default format (WEBP)
fetcher.fetchSevenTVEmotes(44317909);
// ... which is currently the same as
fetcher.fetchSevenTVEmotes(44317909, 'webp');
// Fetch Anatole's emotes in AVIF
fetcher.fetchSevenTVEmotes(24377667, 'avif');
This library uses the following:
FAQs
Fork of twitch-emoticons
The npm package @tzahi12345/twitch-emoticons receives a total of 7 weekly downloads. As such, @tzahi12345/twitch-emoticons popularity was classified as not popular.
We found that @tzahi12345/twitch-emoticons demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.