Skip to content
This repository has been archived by the owner on Feb 25, 2022. It is now read-only.

isaackogan/OmeglePy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OmeglePy (NON-OPERABLE)

Python API for Omegle. Compatible with Python 3. This is an unofficial api wrapper for the popular WebChat service Omegle, written in Python. With this API you can basically fully interact with Omegle as a regular user.

Note: I'm aware this API is in a bit of a state of disrepair. Fixes coming when I have the time!

LinkedIn GitHub release (latest by date) Issues GitHub Downloads Support Server

Table of Contents

Installation

$ pip install OmeglePy

Quick Start Guide

To get started using the API follow the instructions below.

Examples

For more examples, check the examples folder.

from OmeglePy import OmegleClient, EventHandler

client = OmegleClient(EventHandler(), topics=['tiktok'], debug=False)
client.start()

while True:

    # Get input
    message = input()
    
    # Go to the next person
    if message.lower() == "/next":
        client.loop.creatae_task(client.skip())
        continue
    
    # Send a message
    client.loop.create_task(client.send(message))

Events

List of events accessible by the default provided EventHandler.

  • identDigests - Identification received from the server
  • systemError - When a critical error happens & an event can't be retrieved (typically proxy stuff)
  • statusInfo - When status info is received from the server
  • onlineCount - When a count of all online people is received from the Client
  • waiting - When the server states you are waiting for a connection
  • connected - When you connect to someone
  • commonLikes - A list of the common likes between you and a stranger
  • strangerDisconnected - When a stranger disconnects
  • typing - When a stranger starts typing
  • stoppedTyping - When a stranger stops typing
  • clientTyping - When you start typing
  • clientStoppedTyping - When you stop typing
  • gotMessage - When you receive a message
  • clientMessage - When you send a message
  • clientChangedTopics - When you change your topics
  • clientSkip - When you skip
  • recaptchaRequired - When the server requests a captcha (You got Blocked!)
  • antinudeBanned - When the server sends an antinude ban (You got Blocked!)
  • softBanned - When the server sends no data back (You got Blocked!)

Inherit the AbstractEventHandler class to implement your own custom events, or (my suggestion) inheret the EventHandler class and just edit specific events you want different from the ones already handled. Remember, you can add on by calling the super of that method too, instead of copy-pasting code await super(EventHandler, self).<method_name>(data) if you're trying to add to a handled event instead of edit it.

class MyCustomHandler(EventHandler):
    
    async def connected(self, data):
        """
        Run what the inherited handler does, but also send a message...
        """
        await super(EventHandler, self).connected(data)
        await self.instance.send('You should know, I'm super cool...')
    
    async def softBanned(self, data):
        """
        Ignore what the inherited handler does, run my own code...
        """
        await self.instance.stop()  # Stops the bot
    

OmeglePy

OmeglePy uses some optional initial parameters, these are them:

  • event_handler=EventHandler() - The event handler for events to be passed into
  • event_frequency=5 - The frequency in which requests are made to retrieve events
  • loop=YourLoopHere - An asyncio loop if you want to pass one in if one has already been created
  • server=1 - The omegle server (integer #) to connect to
  • topics=['tiktok'] - A list of topics you want to search for in common with others
  • language='en' - The two-letter language code (e.g: en)
  • debug=False - Whether or not you want debug logs in the console
  • proxy=http://user:pass@hostname:port - An optional proxy if you want one of those
  • mobile=False - Whether or not to connect as a mobile client
  • unmonitored=False - Whether or not to enter the unmonitored section
  • socket_connect_timeout=15 - The max time (seconds) to connect to the socket during a request
  • socket_read_timeout=45 - The max time (seconds) to read from a socket during a request

Visit the provided documentation (included directly via DocStrings) for a list of methods.

OmegleClient (Inherits OmeglePy)

OmegleClient uses some optional initial parameters, these are them:

  • get_status=True for to get the # of online people on the first connection
  • wpm=42 set the words per minutes typing speed

Visit the provided documentation (included directly via DocStrings) for a list of methods.

License

pyomegle is released under the MIT License.