mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-12-02 19:01:21 +01:00
Removed calls to youtube from userscript
This commit is contained in:
1 parent
78c7563410
commit
2b7ef364ff
1 file changed
+1
-44
@@ -2,7 +2,7 @@
|
|||||||
// @name Return YouTube Dislike
|
// @name Return YouTube Dislike
|
||||||
// @namespace https://www.returnyoutubedislike.com/
|
// @namespace https://www.returnyoutubedislike.com/
|
||||||
// @homepage https://www.returnyoutubedislike.com/
|
// @homepage https://www.returnyoutubedislike.com/
|
||||||
// @version 0.6.1
|
// @version 0.9.0
|
||||||
// @encoding utf-8
|
// @encoding utf-8
|
||||||
// @description Return of the YouTube Dislike, Based off https://www.returnyoutubedislike.com/
|
// @description Return of the YouTube Dislike, Based off https://www.returnyoutubedislike.com/
|
||||||
// @icon https://github.com/Anarios/return-youtube-dislike/raw/main/Icons/Return%20Youtube%20Dislike%20-%20Transparent.png
|
// @icon https://github.com/Anarios/return-youtube-dislike/raw/main/Icons/Return%20Youtube%20Dislike%20-%20Transparent.png
|
||||||
@@ -217,49 +217,6 @@ function createRateBar(likes, dislikes) {
|
|||||||
function setState() {
|
function setState() {
|
||||||
cLog("Fetching votes...");
|
cLog("Fetching votes...");
|
||||||
let statsSet = false;
|
let statsSet = false;
|
||||||
if (isMobile) {
|
|
||||||
GM.xmlHttpRequest({
|
|
||||||
method: "GET",
|
|
||||||
url: `https://www.youtube.com/watch?v=${getVideoId()}`,
|
|
||||||
headers: {
|
|
||||||
"User-Agent":
|
|
||||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.3674",
|
|
||||||
},
|
|
||||||
onload: (response) => {
|
|
||||||
let result = getDislikesFromYoutubeResponse(response.responseText);
|
|
||||||
if (result) {
|
|
||||||
cLog("response from youtube:");
|
|
||||||
cLog(JSON.stringify(result));
|
|
||||||
if ("likes" in result && "dislikes" in result) {
|
|
||||||
const formattedDislike = numberFormat(result.dislikes);
|
|
||||||
setDislikes(formattedDislike);
|
|
||||||
likesvalue = result.likes
|
|
||||||
dislikesvalue = result.dislikes
|
|
||||||
createRateBar(result.likes, result.dislikes);
|
|
||||||
statsSet = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
fetch(`https://www.youtube.com/watch?v=${getVideoId()}`).then((response) => {
|
|
||||||
response.text().then((text) => {
|
|
||||||
let result = getDislikesFromYoutubeResponse(text);
|
|
||||||
if (result) {
|
|
||||||
cLog("response from youtube:");
|
|
||||||
cLog(JSON.stringify(result));
|
|
||||||
if ("likes" in result && "dislikes" in result) {
|
|
||||||
const formattedDislike = numberFormat(result.dislikes);
|
|
||||||
setDislikes(formattedDislike);
|
|
||||||
likesvalue = result.likes;
|
|
||||||
dislikesvalue = result.dislikes;
|
|
||||||
createRateBar(result.likes, result.dislikes);
|
|
||||||
statsSet = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
fetch(
|
fetch(
|
||||||
`https://returnyoutubedislikeapi.com/votes?videoId=${getVideoId()}`
|
`https://returnyoutubedislikeapi.com/votes?videoId=${getVideoId()}`
|
||||||
|
|||||||
Reference in new issue
Block a user