CarlaVamp

Omegle location BorjaGalisteo Youtube

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