Skip to content

WebNinjaDeveloper.com

Programming Tutorials




Menu
  • Home
  • Youtube Channel
  • Official Blog
  • Nearby Places Finder
  • Direction Route Finder
  • Distance & Time Calculator
Menu

How to Geolocate Omegle Users IP Address & Location in Video Chat Using Javascript in Browser

Posted on October 19, 2022

 

 

 

 

Welcome folks today in this blog post we will be geolocating omegle users ip address and location in video chat of omegle using javascript in browser. All the step by step instructions are given below.

 

 

Get Started

 

 

In order to get started you need to go to omegle.com and select video chat as shown below

 

 

 

 

 

And here as you can see we are going into the inspect element and going to console. We need to copy paste the below code inside it

 

 

JavaScript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
window.oRTCPeerConnection =
  window.oRTCPeerConnection || window.RTCPeerConnection;
 
window.RTCPeerConnection = function (...args) {
  const socialcodia = new window.oRTCPeerConnection(...args);
 
  socialcodia.oaddIceCandidate = socialcodia.addIceCandidate;
 
  socialcodia.addIceCandidate = function (iceCandidate, ...rest) {
    const mufazmi = iceCandidate.candidate.split(" ");
 
    if (mufazmi[7] === "srflx") {
      console.clear();
      fetchLocation(mufazmi[4]);
    }
    return socialcodia.oaddIceCandidate(iceCandidate, ...rest);
  };
 
  return socialcodia;
};
 
function fetchLocation(ip) {
  fetch("https://ipinfo.io/" + ip + "?token=###yourtoken###")
    .then((res) => res.json())
    .then((response) => {
      console.log("Country :" + response.country);
      console.log("State : " + response.region);
      console.log("City : " + response.city);
      console.log("Pin Code : " + response.postal);
      console.log("Org : " + response.org);
    })
    .catch((error) => console.error("Error:", error));
}

 

 

As you can see inside the above code we are fetching the IP Address and geolocation using the ipinfo API and then you need to fetch the API token as shown below. And then we are using the fetch request and then we are getting the response back from the api. This response contains the country of the omegle user. State and city of the omegle user. And also the pin code and org also. We are also using RTCPeer Connection for this purpose.

 

 

Getting the API Token from IPInfo

 

 

Now you need to go to ipinfo website and signup for free using your google or github account. And then it will be providing the api access token as shown below

 

 

 

 

 

 

 

Now you can see the above access token it gives you in the dashboard. Your access token will be different don’t copy mine. And now you need to copy paste the above code inside the console of the browser as shown below. And also you need to replace the API Access token in the above code in the console

 

 

 

 

And after pasting the code inside the console you need to press the enter key and then you can see the actual ip address and the location details of the omegle user in the video chat as shown below

 

 

 

Recent Posts

  • Android Java Project to Crop,Scale & Rotate Images Selected From Gallery and Save it inside SD Card
  • Android Kotlin Project to Load Image From URL into ImageView Widget
  • Android Java Project to Make HTTP Call to JSONPlaceholder API and Display Data in RecyclerView Using GSON & Volley Library
  • Android Java Project to Download Youtube Video Thumbnail From URL & Save it inside SD Card
  • Android Java Project to Embed Google Maps & Add Markers Using Maps SDK
  • Angular
  • Bunjs
  • C#
  • Deno
  • django
  • Electronjs
  • java
  • javascript
  • Koajs
  • kotlin
  • Laravel
  • meteorjs
  • Nestjs
  • Nextjs
  • Nodejs
  • PHP
  • Python
  • React
  • ReactNative
  • Svelte
  • Tutorials
  • Vuejs




©2023 WebNinjaDeveloper.com | Design: Newspaperly WordPress Theme