Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Anarios/return-youtube-dislike.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthereaper90917 <42868546+thereaper90917@users.noreply.github.com>2021-12-27 20:46:13 +0300
committerGitHub <noreply@github.com>2021-12-27 20:46:13 +0300
commit13c5681c95999cf4433732c059831de7c2320979 (patch)
treed1fa8ce854bfa996b8b701497fece95c02ecad97
parentc9a82df03b6e7265967e5bdb253e98e9f9153b22 (diff)
parentcb2b100a18c86419131d94f881d1cb49800a5e5f (diff)
Merge branch 'Anarios:main' into main
-rw-r--r--.gitignore7
-rw-r--r--Extensions/UserScript/Return Youtube Dislike.user.js18
-rw-r--r--Extensions/combined/popup.html1
-rw-r--r--Extensions/combined/popup.js10
-rw-r--r--Extensions/combined/readme.md16
-rw-r--r--Extensions/combined/ryd.content-script.js6
-rw-r--r--README.md37
-rw-r--r--Website/pages/install.vue3
-rw-r--r--package.json5
9 files changed, 84 insertions, 19 deletions
diff --git a/.gitignore b/.gitignore
index 85f9dce..d0c5794 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
*cert
*Backend
.DS_Store
+package-lock.json
# Website node modules and build output
Website/package-lock.json
@@ -31,4 +32,8 @@ yarn-error.log*
node_modules
# Build files
-Extensions/combined/bundled-content-script.js \ No newline at end of file
+Extensions/combined/bundled-content-script.js
+
+# Dist Files
+Extensions/combined/dist/*
+package-lock.json
diff --git a/Extensions/UserScript/Return Youtube Dislike.user.js b/Extensions/UserScript/Return Youtube Dislike.user.js
index 6b3e576..71e926d 100644
--- a/Extensions/UserScript/Return Youtube Dislike.user.js
+++ b/Extensions/UserScript/Return Youtube Dislike.user.js
@@ -311,22 +311,22 @@ function roundDown(num) {
}
function numberFormat(numberState) {
- let localeURL = Array.from(document.querySelectorAll("head > link[rel='search']"))
- ?.find((n) => n?.getAttribute("href")?.includes("?locale="))
- ?.getAttribute("href");
-
- const userLocales = localeURL ? new URL(localeURL)?.searchParams?.get("locale") : document.body.lang;
-
+ let userLocales;
+ try {
+ userLocales = new URL(
+ Array.from(document.querySelectorAll("head > link[rel='search']"))
+ ?.find((n) => n?.getAttribute("href")?.includes("?locale="))
+ ?.getAttribute("href")
+ )?.searchParams?.get("locale");
+ } catch {}
const formatter = Intl.NumberFormat(
document.documentElement.lang || userLocales || navigator.language,
{
notation: "compact",
- minimumFractionDigits: 1,
- maximumFractionDigits: 1,
}
);
- return formatter.format(roundDown(numberState)).replace(/\.0|,0/, "");
+ return formatter.format(roundDown(numberState));
}
function setEventListeners(evt) {
diff --git a/Extensions/combined/popup.html b/Extensions/combined/popup.html
index 617cc0c..c59c103 100644
--- a/Extensions/combined/popup.html
+++ b/Extensions/combined/popup.html
@@ -25,6 +25,7 @@
<i id="server-status" class="fas fa-server fa-5x"></i>
<p>API Status: <span id="status"></span></p>
<p>by Dmitrii Selivanov & Community</p>
+ <p id="ext-version"></p>
<button id="link_website">Website</button>
<button id="link_github">GitHub</button>
diff --git a/Extensions/combined/popup.js b/Extensions/combined/popup.js
index 8927813..7217e9c 100644
--- a/Extensions/combined/popup.js
+++ b/Extensions/combined/popup.js
@@ -4,7 +4,17 @@ const config = {
showAdvancedMessage: "Show Settings",
hideAdvancedMessage: "Hide Settings",
disableVoteSubmission: false,
+}
+
+ function initConfig() {
+ initializeVersionNumber();
+ }
+ function initializeVersionNumber() {
+ const version = chrome.runtime.getManifest().version;
+ document.getElementById('ext-version').innerHTML = 'v' + version;
+}
+
links: {
website: "https://returnyoutubedislike.com",
github: "https://github.com/Anarios/return-youtube-dislike",
diff --git a/Extensions/combined/readme.md b/Extensions/combined/readme.md
new file mode 100644
index 0000000..ee827c0
--- /dev/null
+++ b/Extensions/combined/readme.md
@@ -0,0 +1,16 @@
+# Extension Source
+## Guide to Compiling
+
+## Compiling to Development (Testing)
+<ol>
+ <li>Go to the root directory of the project</li>
+ <li>Run <code>npm i</code> to install all project dependancies (if not done so already)</li>
+ <li>run <code>npm run dev</code> to compile the extension to the <code>~/Extensions/combined/dist/</code> folder.</li>
+</ol>
+
+## Compiling to Production (Final Release)
+<ol>
+ <li>Go to the root directory of the project</li>
+ <li>Run <code>npm i</code> to install all project dependancies (if not done so already)</li>
+ <li>run <code>npm run build</code> to compile the extension to the <code>~/Extensions/combined/dist/</code> folder.</li>
+</ol>
diff --git a/Extensions/combined/ryd.content-script.js b/Extensions/combined/ryd.content-script.js
index d1bd9b5..3614fe3 100644
--- a/Extensions/combined/ryd.content-script.js
+++ b/Extensions/combined/ryd.content-script.js
@@ -1,9 +1,12 @@
+//--- Import Button Functions ---//
import {
getButtons,
getLikeButton,
getDislikeButton,
checkForSignInButton,
} from "./src/buttons";
+
+//--- Import State Functions ---//
import {
isMobile,
isVideoDisliked,
@@ -19,10 +22,13 @@ import {
NEUTRAL_STATE,
initExtConfig,
} from "./src/state";
+
+//--- Import Video & Browser Functions ---//
import { numberFormat, getBrowser, getVideoId, isVideoLoaded, cLog } from "./src/utils";
import { createRateBar } from "./src/bar";
import { sendVideoIds, sendVote, likeClicked, dislikeClicked, addLikeDislikeEventListener, storageChangeHandler } from "./src/events"
+
initExtConfig()
let jsInitChecktimer = null;
diff --git a/README.md b/README.md
index eb81915..ed35ee6 100644
--- a/README.md
+++ b/README.md
@@ -21,13 +21,11 @@
On November 10th, 2021, Google [announced](https://blog.youtube/news-and-events/update-to-youtube/) that the YouTube dislike count would be removed.
-Additionally, the `dislike` field in the YouTube API will be [removed](https://support.google.com/youtube/thread/134791097/update-to-youtube-dislike-counts) on December 13th, 2021, removing any ability to judge the quality of content before watching.
+Additionally, the `dislike` field in the YouTube API was [removed](https://support.google.com/youtube/thread/134791097/update-to-youtube-dislike-counts) on December 13th, 2021, removing any ability to judge the quality of content before watching.
## What it Does
-This plugin will re-enable the visibility of the dislike count, fetching the total number of dislikes via our API, which in turn relies upon YouTube's [Data API](https://developers.google.com/youtube/v3).
-
-With the removal of dislike stats from the YouTube API, our backend will switch to using a combination of scraped dislike stats, estimates extrapolated from extension user data
+With the removal of dislike stats from the YouTube API, our backend switched to using a combination of scraped dislike stats, estimates extrapolated from extension user data
and estimates based on view\like ratios.
[FAQ](https://github.com/Anarios/return-youtube-dislike/blob/main/FAQ.md)
@@ -36,6 +34,37 @@ and estimates based on view\like ratios.
You can learn more at our website at: [returnyoutubedislike.com](https://www.returnyoutubedislike.com/)
+## API documentation
+
+Third party use of this open API is allowed with the following restrictions:
+
+- **Attribution**: This project should be clearly attributed with either a link to this repo or a link to [returnyoutubedislike.com](https://returnyoutubedislike.com/).
+- **Rate Limiting**: There are per client rate limits in place of 100 per minute and 10'000 per day. This will return a *429* status code indicating that your application should back off.
+
+The API is accessible over the following base URL:
+https://returnyoutubedislikeapi.com
+
+List of available endpoints is available here:
+https://returnyoutubedislikeapi.com/swagger/index.html
+
+### Get votes
+Example to get votes of a given YouTube video ID:
+`/votes?videoId=kxOuG8jMIgI`
+
+```json
+{
+ "id": "kxOuG8jMIgI",
+ "dateCreated": "2021-12-20T12:25:54.418014Z",
+ "likes": 27326,
+ "dislikes": 498153,
+ "rating": 1.212014408444885,
+ "viewCount": 3149885,
+ "deleted": false
+}
+```
+
+None existing YouTube ID will return status code *404* "Not Found".
+Wrong formed YouTube ID will return *400* "Bad Request".
## HELP WANTED
diff --git a/Website/pages/install.vue b/Website/pages/install.vue
index ba84b06..e3a77af 100644
--- a/Website/pages/install.vue
+++ b/Website/pages/install.vue
@@ -3,9 +3,6 @@
<h1 class="title-text">Select Your Platform</h1>
<div style="color: #999">
- <p style="margin-top: 0.5rem; margin-bottom: 0">
- This is an <b>ALPHA version!</b> It may be slow. It may be buggy.
- </p>
<p style="margin-bottom: 1rem">
Available for Firefox and all Chromium browsers
(Chrome/Edge/Opera/Brave).
diff --git a/package.json b/package.json
index 07388b7..276e730 100644
--- a/package.json
+++ b/package.json
@@ -4,8 +4,9 @@
"description": "Chrome extension to return youtube dislikes",
"main": "ryd.content-script.js",
"scripts": {
- "start": "webpack \"./Extensions/combined/ryd.content-script.js\" -o \"./Extensions/combined/dist/\" --watch",
- "build": "webpack \"./Extensions/combined/ryd.content-script.js\" -o \"./Extensions/combined\"",
+ "start": "echo To build for development, please use \"npm run dev\". To build for production, please use \"npm run build\".",
+ "dev": "webpack --mode=development \"./Extensions/combined/ryd.content-script.js\" -o \"./Extensions/combined/dist/\" --watch",
+ "build": "webpack --mode=production \"./Extensions/combined/ryd.content-script.js\" -o \"./Extensions/combined\"",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {