Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ReturnYoutubeDislikes as optional way to get video dislike counter #1982

Conversation

petaded
Copy link
Contributor

@petaded petaded commented Jan 5, 2022


Add ReturnYoutubeDislikes as optional way to get video dislike counter

Important note
We may remove your pull request if you do not use this provided PR template correctly.

Pull Request Type
Please select what type of pull request this is:

  • Bugfix
  • Feature Implementation

Related issue
Please link the issue your pull request is referring to. If this pull request fully resolves the relevant issue, put "closes" before the issue number. Example: "closes #123456".
closes #1927

Description
This PR adds the usage of the https://www.returnyoutubedislike.com/ api to get a videos dislike number. Note their service gets the dislike number via 'A combination of archived data from before the offical YouTube dislike API shut down, and extrapolated extension user behavior.'
Since this feature reaches out to a external service the PR also adds a toggle switch in the settings menu to enable/disable this functionality. It is set to false by default for the same reason.

To comply with the requirements of their service (see below) I added the website name to the text on the setting button.

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.
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.

Screenshots (if appropriate)
Please add before and after screenshots if there is a visible change.

Picture of the settings page - please point out the best place for this setting.
image
In the below picture you can see the dislike number now appears.
image

Testing (for code that is not small enough to be easily understandable)
Has this pull request been tested?
Please describe shortly how you tested it and whether there are any ramifications remaining.
I have tested the following:

  • Local api
    • With return dislikes setting true, checked dislike value showed up for a video pre dislike change, and post dislikes being removed
    • With return dislikes setting false, checked dislike counter was zero for same two videos
    • With Hide Video likes/dislikes enabled and return dislikes enabled. ( no like/dislikes were shown as expected )
    • With Hide Video likes/dislikes enabled and return dislikes disabled. ( no like/dislikes were shown as expected )
  • Invidious api
    • With return dislikes setting true, checked dislike value showed up for a video pre dislike change, and post dislikes being removed
    • With return dislikes setting false, checked dislike counter was zero for same two videos
    • With Hide Video likes/dislikes enabled and return dislikes enabled. ( no like/dislikes were shown as expected )
    • With Hide Video likes/dislikes enabled and return dislikes disabled. ( no like/dislikes were shown as expected )

Lastly running npm run lint

Desktop (please complete the following information):

  • OS: Manjaro
  • OS Version: 20
  • FreeTube version: 0.15.1

Additional context
I didn't know the best place to put the setting. So I've just added it to General for now, Please suggest the best place for it to go.

@PrestonN PrestonN enabled auto-merge (squash) January 5, 2022 15:12
@efb4f5ff-1298-471a-8973-3d47447115dc
Copy link
Member

Could u make this so that i will do this in its off state #1904

And show the ratio bar and dislikes when its enabled

auto-merge was automatically disabled January 5, 2022 16:35

Head branch was pushed to by a user without write access

@PrestonN PrestonN enabled auto-merge (squash) January 5, 2022 16:35
@petaded
Copy link
Contributor Author

petaded commented Jan 5, 2022

Have updated for #1904 the ratio bar is now hidden if either, hide video likes and dislikes is enabled, or return youtube dislikes is disabled.

Also checked the bar has the correct visual when return youtube dislikes is enabled. (used everyones favourite youtube rewind)

screenshot:
image

@efb4f5ff-1298-471a-8973-3d47447115dc
Copy link
Member

Is it possible to also hide dislikes in that state because it isnt really showing anything?

@@ -0,0 +1,34 @@

import $ from 'jquery'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it's only a question of preference on my part but why depend on jquery only to make a simple request when native js can do the job with the same complexity

https://developer.mozilla.org/en-US/docs/Web/API/Request

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went for the same as what was done in sponsorblock.js and invidious.js. Might as well use the same implementation across files than a different one in each.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right

@petaded
Copy link
Contributor Author

petaded commented Jan 5, 2022

@efb4f5ff-1298-471a-8973-3d47447115dc
For hiding the dislikes when its not enabled. I can go for hiding the whole thing (see image below) or do we still want the thumbs down but no 0 number?

With both number and thumbs removed
image

With just the number removed
image

Thoughts?

@efb4f5ff-1298-471a-8973-3d47447115dc

I think the first image is the best way to go.

When u'll enable the api u'll see the dislike icon, dislike stats and ratio bar again

auto-merge was automatically disabled January 5, 2022 18:09

Head branch was pushed to by a user without write access

@PrestonN PrestonN enabled auto-merge (squash) January 5, 2022 18:09
auto-merge was automatically disabled January 5, 2022 18:11

Head branch was pushed to by a user without write access

@PrestonN PrestonN enabled auto-merge (squash) January 5, 2022 18:11
@petaded
Copy link
Contributor Author

petaded commented Jan 5, 2022

Here is the current state:

Use dislikes disabled:
image

With use dislikes enabled:
image
With hide likes and dislikes
image

@efb4f5ff-1298-471a-8973-3d47447115dc

Looks great IMO. I'll test this tomorrow.

@PrestonN
Copy link
Member

PrestonN commented Jan 7, 2022

Hey there, please see my comment over on #1927.

Let's hold off on approving this PR for now until a few things are sorted out. It doesn't necessarily mean I don't want this feature to be included, but there are concerns with the project itself that I'd like to see addressed before moving forward.

Apologies for just now mentioning it. I appreciate you taking the time to work on this PR.

@FreeTubeApp FreeTubeApp deleted a comment from Git-Forked May 11, 2022
@PikachuEXE
Copy link
Collaborator

We are closing this for now but it does not mean we reject the idea entirely.
However as PrestonN said this project puts privacy at the top.
Thank you for you contribution and please let us know when you think the privacy concern is addressed.

@PikachuEXE PikachuEXE closed this May 30, 2022
auto-merge was automatically disabled May 30, 2022 01:57

Pull request was closed

@github-actions github-actions bot removed the PR: WIP label May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement 'Return YouTube Dislike' API as an optional setting
5 participants