Omegle IP to location and Watermark Remove

Shows IP, country, state, city, district, local time, and ISP. Also removes omegle watermark from stranger's video.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Omegle IP to location and Watermark Remove
// @description  Shows IP, country, state, city, district, local time, and ISP. Also removes omegle watermark from stranger's video.
// @version      1.0
// @match        https://omegle.com/*
// @match        https://www.omegle.com/*
// @grant        none
// @run-at       document-end
// @namespace    https://greasyfork.org/users/789058
// @license      MIT
// ==/UserScript==

const apiService = "ipinfo" // must be "ipinfo" or "ipapi"
const apiKey = "" // gets better results with ipinfo, and does nothing for ip-api
var tested = [];
if (localStorage.getItem('tests') !== null) {
	tested = JSON.parse(localStorage.getItem('tests'));
}
var session = 0;
var lastQuery = Date.now();
window.oRTCPeerConnection = window.oRTCPeerConnection || window.RTCPeerConnection;
window.RTCPeerConnection = function (...args) {
	const pc = new window.oRTCPeerConnection(...args);
	pc.oaddIceCandidate = pc.addIceCandidate;
	pc.addIceCandidate = function (iceCandidate, ...rest) {
		if (document.getElementById('videologo') instanceof Object) {
			document.getElementById('videologo').remove();
		}
		const fields = iceCandidate.candidate.split(' ');
		const ip = fields[4];
		if (fields[7] === 'srflx') {
			for (var i of tested) {
				if (i.query == ip) {
					makeTable(i);
				}
			}
			if (document.getElementsByTagName('table').length < 2 & lastQuery+1000 < Date.now()) {
				getLocation(ip);
			}
		}
		console.log(tested.length + ' - ' + ip);
		return pc.oaddIceCandidate(iceCandidate, ...rest);
	};
	return pc;
};
function getLocation(ip) {
	lastQuery = Date.now();
	var endpoint = `https://ipinfo.io/${ip}/json?token=${apiKey}`;
	if (apiService == "ipapi") {
		endpoint = `http://ip-api.com/json/${ip}?fields=18561529`;
	}
	var xhr = new XMLHttpRequest();
	xhr.onreadystatechange = function() {
		if (this.readyState == 4 && this.status == 200) {
			var response = JSON.parse(this.responseText);
			response.timezone = new Intl.DateTimeFormat([],{timeZone:response.timezone,year:'numeric',month:'numeric',day:'numeric',hour:'numeric',minute:'numeric',second:'numeric'}).format(new Date());
			response.total = tested.length;
			tested.push(response);
			localStorage.setItem('tests',JSON.stringify(tested));
			makeTable(response);
		}
	};
	xhr.open('GET', endpoint, true);
	xhr.send();
}
function makeTable(json) {
	session ++;
	json.session = session;
	var table = '<table border="2px">';
	for (const thing in json) {
		table += `<tr><td>${thing.charAt(0).toUpperCase()+thing.substring(1)}</td><td>${json[thing]}</td></tr>`;
	}
	table += '</table>';
	document.getElementsByClassName('statuslog')[0].innerHTML = table;
}