forked from zammalhabe/userscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReturnInvidiousDislike.user.js
56 lines (50 loc) · 2.59 KB
/
ReturnInvidiousDislike.user.js
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT
/* eslint-env browser, greasemonkey */
/* jshint asi: true, esversion: 11 */
// ==UserScript==
// @name ReturnInvidiousDislike
// @name:de ReturnInvidiousDislike
// @name:en ReturnInvidiousDislike
// @namespace https://github.com/TheLastZombie/
// @version 1.1.0
// @description Displays the dislike count of videos accessed via Invidious.
// @description:de Zeigt die Dislike-Anzahl von Videos auf Invidious an.
// @description:en Displays the dislike count of videos accessed via Invidious.
// @homepageURL https://thelastzombie.github.io/userscripts/
// @supportURL https://github.com/TheLastZombie/userscripts/issues/new?labels=ReturnInvidiousDislike
// @contributionURL https://ko-fi.com/rcrsch
// @downloadURL https://raw.github.com/TheLastZombie/userscripts/main/user/ReturnInvidiousDislike.user.js
// @updateURL https://raw.github.com/TheLastZombie/userscripts/main/meta/ReturnInvidiousDislike.meta.js
// @author TheLastZombie <[email protected]>
// @match *://*/watch?v=*
// @connect returnyoutubedislikeapi.com
// @grant GM.xmlHttpRequest
// @grant GM_xmlhttpRequest
// @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js
// @icon https://raw.githubusercontent.com/TheLastZombie/userscripts/main/icons/ReturnInvidiousDislike.png
// @copyright 2021-2022, TheLastZombie (https://github.com/TheLastZombie/)
// @license MIT; https://github.com/TheLastZombie/userscripts/blob/main/LICENSE
// ==/UserScript==
// ==OpenUserJS==
// @author TheLastZombie
// ==/OpenUserJS==
(function () {
"use strict";
const video = new URLSearchParams(window.location.search).get("v");
const views = document.getElementById("views")?.childNodes[1];
const likes = document.getElementById("likes")?.childNodes[1];
const dislikes = document.getElementById("dislikes")?.childNodes[1];
const rating = document.getElementById("rating");
if (video && views && likes && dislikes && rating) {
GM.xmlHttpRequest({
url: "https://returnyoutubedislikeapi.com/Votes?videoId=" + video,
onload: (response) => {
const data = JSON.parse(response.responseText);
views.textContent = " " + data.viewCount.toLocaleString();
likes.textContent = " " + data.likes.toLocaleString();
dislikes.textContent = " " + data.dislikes.toLocaleString();
rating.textContent = "Rating: " + data.rating.toFixed(4) + " / 5";
},
});
}
})();