ReturnInvidiousDislike

Displays the dislike count of videos accessed via Invidious.

Від 29.11.2021. Дивіться остання версія.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT
/* eslint-env browser, greasemonkey */

// ==UserScript==
// @name            ReturnInvidiousDislike
// @name:de         ReturnInvidiousDislike
// @name:en         ReturnInvidiousDislike
// @namespace       https://github.com/TheLastZombie/
// @version         1.0.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://github.com/TheLastZombie/userscripts#returninvidiousdislike-
// @supportURL      https://github.com/TheLastZombie/userscripts/issues/new?labels=ReturnInvidiousDislike
// @contributionURL https://ko-fi.com/rcrsch
// @author          TheLastZombie
// @match           *://*/watch?v=*
// @connect         return-youtube-dislike-api.azurewebsites.net
// @grant           GM.xmlHttpRequest
// @grant           GM_xmlhttpRequest
// @require         https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js
// @icon            https://raw.githubusercontent.com/TheLastZombie/userscripts/master/icons/ReturnInvidiousDislike.png
// @copyright       2021, TheLastZombie (https://github.com/TheLastZombie/)
// @license         MIT; https://github.com/TheLastZombie/userscripts/blob/master/LICENSE
// ==/UserScript==

// ==OpenUserJS==
// @author          TheLastZombie
// ==/OpenUserJS==

(function () {
  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://return-youtube-dislike-api.azurewebsites.net/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'
      }
    })
  }
})()