npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

omegle-node

v1.1.4

Published

Node.js API for Omegle

Downloads

27

Readme

omegle-node - Unofficial node.js API for Omegle

NPM

npm version

omegle-node is an unofficial API for Omegle which can be used to connect and interact with people on omegle without actually going to the website.

Installation

npm install omegle-node

Usage

Check out examples/omegle.js to get a hang of how this works.

cd examples

node omegle

Events

  • gotID: emitted when you're connected to Omegle's server (note that you're not connected to a stranger yet). Argument: id - The ID assigned to you by Omegle.

  • waiting: emitted when you're looking for strangers to connect to.

  • connected: emitted when you're connected to a stranger.

  • typing: emitted when the stranger starts typing.

  • stoppedTyping: emitted when the stranger stops typing.

  • gotMessage: emitted when you receive a message. Argument: msg - Received message.

  • commonLikes: emitted when you're connected to a stranger with matching interests. Argument: likes - Array of matching interests.

  • disconnected: emitted when you disconnect from the chat. This will be emitted when you call disconnect(). If you want to reconnect, call connect() again only on disconnected and strangerDisconnected event.

  • strangerDisconnected: emitted when the stranger disconnects.

  • connectionDied: emitted when connection to the server is lost. Results in disconnection.

  • omegleError: emitted when there's an error on Omegle's side. Results in disconnection. (Note: this is different from omerror).Argument: errorMsg - Error message.

  • antinudeBanned: emitted when you get banned for bad behavior. Bans usually last for 1 to 48 hours. Results in disconnection.

  • recaptchaRequired: emitted when you're required to solve a ReCAPTCHA. Argument: challenge - Link to the ReCAPTCHA image.

  • recaptchaRejected: emitted when your answer to the ReCAPTCHA challenge is rejected. Argument: challenge - Link to the new ReCAPTCHA image.

  • omerror: emitted when there's an error on client-side. For instance, calling send() before calling connect().Argument: errorMsg - Error description. Error messages follow this pattern: functionName(): error message.

Functions

  • connect([topics]): Connect to a random stranger. Argument: topics - Optional. An array of interests.

  • updateServer(): Update the server to which all the requests are made. This is called every time connect() is called.

  • send(msg): Send a message to the stranger. Argument: msg - Message to send.

  • startTyping(): Set your status to typing.

  • stopTyping(): Set your status to stoppedTyping.

  • stopLookingForCommonLikes(): Pretty self explanatory - Stop looking for common likes. If you hate long ungodly function names, you can use slfcl(), which does the same thing too.

  • disconnect(): Disconnect from the chat.

  • solveReCAPTCHA(answer): Send the answer to the ReCAPTCHA challenge to Omegle. Argument: answer - Answer to the challenge.

  • connected(): Returns a boolean value specifying whether you're currently connected to a stranger.

  • reloadReCAPTCHA(): It seems like Omegle has gotten rid of recaptchaRejected, so the only way to know whether your ReCAPTCHA answer has been rejected is if you don't get connected to a stranger within a few seconds of submitting your answer. Use this function to reload ReCAPTCHA.

Variables

  • useragent: Set or get the useragent.

  • language: Set or get the language you speak. Default is en.

Example

var Omegle = require('omegle-node');
var om = new Omegle(); //create an instance of `Omegle`

//This will print any errors that might get thrown by functions
om.on('omerror',function(err){
	console.log('error: ' + err);
});

//gotID is emitted when you're connected to Omegle 
om.on('gotID',function(id){
	console.log('connected to the server as: ' + id);
});

//waiting is emitted when you're waiting to connect to a stranger
om.on('waiting', function(){
	console.log('waiting for a stranger.');
});

//emitted when you're connected to a stranger
om.on('connected',function(){
	console.log('connected');
});

//emitted when you get a message
om.on('gotMessage',function(msg){
	console.log('Stranger: ' + msg);
	om.send('Hi'); //used to send a message to the stranger
});

//emitted when the stranger disconnects
om.on('strangerDisconnected',function(){
	console.log('stranger disconnected.');
});

//Once you're subscribed to all the events that you wish to listen to, 
//call connect() to connect to Omegle and start looking for a stranger.
om.connect();

Example scripts

The examples/ folder contains three scripts:

  • omegle.js - A full-fledged script to demonstrate how the module works.
  • mitm.js - Script showcasing the MITM attack to eavesdrop on two strangers' conversation.
  • reverse-bot.js - An Omegle bot that reverses the received messages and sends them back to the stranger.

Please do not use this to create spam bots, there are already enough of those on Omegle.