streamer.info
v2.2.0
Published
A Node.js library for fetching streamer information from various platforms.
Maintainers
Readme
Streamer.Info
A comprehensive Node.js library for fetching live stream information from Kick, Twitch, YouTube, and TikTok platforms. Get live stream data, user profiles, and video information with a simple and unified API.
Features
- 🎮 Multi-platform support: Kick, Twitch, YouTube, and TikTok
- 🔴 Live stream detection: Real-time streaming status
- 📹 Video data: Latest videos and YouTube Shorts
- 🛡️ Error handling: Robust error management with standardized responses
- ⚡ Modular architecture: Clean, maintainable code structure
- 🔧 Configurable: Centralized configuration for easy customization
Installation
npm install streamer.infoInstall Required Dependencies
# Install required npm modules
npm install axios cheerio puppeteer
# Install Chrome browser for Puppeteer
npx puppeteer browsers install chromeQuick Start
const { Kick, Twitch, YouTube, TikTok, checkUpdate } = require('streamer.info');
// Check for updates
checkUpdate();
// Initialize services
const kick = new Kick();
const twitch = new Twitch();
const youtube = new YouTube();
const tiktok = new TikTok();API Reference
Kick
kick.getStream(username)
Fetches live stream information from Kick.
const streamInfo = await kick.getStream('username');
console.log(streamInfo);Response (Live):
{
success: true,
live: true,
error: false,
id: 12345,
title: "Stream Title",
language: "en",
isMature: false,
viewers: 150,
category: "Gaming",
thumbnail: "https://...",
urls: {
stream: "https://kick.com/username"
},
start: {
date: "2024-01-01",
time: "12:00:00",
timezone: "UTC"
}
}Response (Not Live):
{
success: false,
error: false
}kick.getStreamerProfile(username)
Fetches streamer profile information.
const profile = await kick.getStreamerProfile('username');
console.log(profile);Response:
{
success: true,
error: false,
avatar: "https://...",
bio: "Streamer biography",
verified: true,
socials: {
instagram: { row: "username", link: "https://instagram.com/username" },
x: { row: "username", link: "https://x.com/username" },
youtube: { row: "username", link: "https://youtube.com/username" },
discord: { row: "username" },
tiktok: { row: "username", link: "https://tiktok.com/username" },
facebook: { row: "username", link: "https://facebook.com/username" }
}
}Twitch
twitch.getStream(username)
Fetches live stream information from Twitch.
const streamInfo = await twitch.getStream('username');
console.log(streamInfo);Response (Live):
{
success: true,
live: true,
error: false,
name: "Streamer Name",
avatar: "https://...",
title: "Stream Title",
thumbnail: {
src: ["https://..."],
bestResolution: "https://..."
},
urls: {
stream: "https://twitch.tv/username",
fullScreen: "https://player.twitch.tv/?channel=username"
},
start: {
date: "2024-01-01",
time: "12:00:00",
timezone: "UTC"
}
}Response (Not Live):
{
success: false,
error: false
}YouTube
youtube.getLatestVideo(username)
Fetches the latest video from a YouTube channel.
const video = await youtube.getLatestVideo('username');
console.log(video);Response:
{
success: true,
error: false,
title: "Video Title",
avatar: "https://...",
thumbnail: "https://...",
urls: {
video: "https://youtube.com/watch?v=..."
}
}youtube.getLatestShorts(username)
Fetches the latest YouTube Shorts from a channel.
const shorts = await youtube.getLatestShorts('username');
console.log(shorts);Response:
{
success: true,
error: false,
title: "Shorts Title",
avatar: "https://...",
thumbnail: "https://...",
urls: {
video: "https://youtube.com/watch?v=..."
}
}youtube.getStream(username)
Fetches live stream information from YouTube.
const streamInfo = await youtube.getStream('username');
console.log(streamInfo);Response (Live):
{
success: true,
error: false,
live: true,
title: "Live Stream Title",
avatar: "https://...",
thumbnail: "https://...",
viewerCount: "1.2K",
urls: {
stream: "https://youtube.com/watch?v=..."
}
}Response (Not Live):
{
success: true,
error: false,
live: false
}TikTok
tiktok.getStream(username)
Fetches live stream information from TikTok.
const streamInfo = await tiktok.getStream('username');
console.log(streamInfo);Response (Live):
{
success: true,
error: false,
live: true,
title: "Live Stream Title",
avatar: "https://...",
viewerCount: "5.2K",
urls: {
stream: "https://tiktok.com/@username/live"
}
}Response (Not Live):
{
success: true,
error: false,
live: false
}Error Handling
All methods return standardized error responses:
{
success: false,
error: "Error message or error object"
}Configuration
The library uses a centralized configuration system. You can customize browser settings, endpoints, and selectors by modifying the config file.
Browser Settings
- Headless mode (default: false)
- User agent
- Timeout settings (30 seconds)
- Wait conditions (networkidle2)
Rate Limiting
- Request delays (1 second)
- Maximum retries (3 times)
- Backoff strategies
Project Structure
streamer.info/
├── index.js # Main entry point
├── stream.js # Test runner
├── stream-test.js # Test file
├── package.json # Package configuration
├── package-lock.json # Dependency lock
├── README.md # Documentation
└── src/
├── config.js # Central configuration
├── functions/
│ └── helpers.js # Helper functions
└── services/
├── checkUpdate.js # Update checker
├── kick.js # Kick platform service
├── twitch.js # Twitch platform service
├── youtube.js # YouTube platform service
└── tiktok.js # TikTok platform serviceDependencies
- axios: HTTP client for API requests
- cheerio: Server-side HTML parsing
- puppeteer: Browser automation for dynamic content
Requirements
- Node.js 14.0.0 or higher
- Internet connection to fetch stream data
- Sufficient system resources for Puppeteer
Examples
Checking Multiple Platforms
const { Kick, Twitch, YouTube, TikTok } = require('streamer.info');
async function checkAllPlatforms(username) {
const kick = new Kick();
const twitch = new Twitch();
const youtube = new YouTube();
const tiktok = new TikTok();
const [kickStream, twitchStream, youtubeStream, tiktokStream] = await Promise.all([
kick.getStream(username),
twitch.getStream(username),
youtube.getStream(username),
tiktok.getStream(username)
]);
return {
kick: kickStream,
twitch: twitchStream,
youtube: youtubeStream,
tiktok: tiktokStream
};
}
checkAllPlatforms('username').then(console.log);Error Handling Example
const kick = new Kick();
try {
const result = await kick.getStream('username');
if (result.success) {
if (result.live) {
console.log('Live stream data:', result);
} else {
console.log('User is not currently live');
}
} else {
console.error('Error:', result.error);
}
} catch (error) {
console.error('Unexpected error:', error);
}Getting Kick Profile Information
const kick = new Kick();
async function getProfileInfo(username) {
try {
const profile = await kick.getStreamerProfile(username);
if (profile.success) {
console.log('Profile information:', {
avatar: profile.avatar,
bio: profile.bio,
verified: profile.verified,
socialMedia: profile.socials
});
} else {
console.log('Profile not found');
}
} catch (error) {
console.error('Error:', error);
}
}
getProfileInfo('combatry');🤝 Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
📞 Support
If you have any questions or need help:
- 🐛 Create an issue on GitHub
- 📚 Check the documentation
- 💬 Contact the developer
Note: This library collects publicly available data from streaming platforms. Please respect the platforms' terms of service and rate limits when using this library.
⭐ Don't forget to star this repository if you find it useful!
