Giter Site home page Giter Site logo

ajayyy / sponsorblock Goto Github PK

View Code? Open in Web Editor NEW
8.7K 8.7K 287.0 13.69 MB

Skip YouTube video sponsors (browser extension)

Home Page: https://sponsor.ajay.app

License: GNU General Public License v3.0

JavaScript 2.00% CSS 8.79% HTML 6.20% TypeScript 83.01%
adblock adblocker chrome chrome-extension chromium firefox firefox-extension hacktoberfest opera sponsorblock sponsored-segments web-extension youtube youtube-videos

sponsorblock's People

Contributors

ajayyy avatar alecrust avatar argn0 avatar aronhk avatar bershanskiy avatar blueberryy avatar choromanski avatar dependabot[bot] avatar florianzahn avatar fosefx avatar github-actions[bot] avatar hanyaodong avatar isaackd avatar joe-dowd avatar joedowdcap avatar lartza avatar maximmax42 avatar mbledkowski avatar mchangrh avatar mini-bomba avatar mlnrdev avatar mruy avatar ndevtk avatar opl- avatar owendaprile avatar picklenik avatar ptalmeida avatar rafern avatar skyfrk avatar wilkmaciej avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sponsorblock's Issues

Remove "tabs" permission

Summary

Untitled

Currently, users are warned that extension can "Read your browsing history", but I believe you can remove this warning by using "activeTab" permission instead of "tabs" permission.

Details

Currently, the extension requires "tabs" permission which creates a rather offputting warning "Read your browsing history" (according to this table). This permission is necessary to populate url, title, and favIconUrl properties of Tab objects, which you never use in the scripts. I think, you use it only to infer the current tab to populate the popup interface. Instead, Chrome has "activeTab" permission that provides this information and does not display any warning message on install.

Switching to "activeTab" would require a small patch, not just removing "tabs" from the manifest. If you are interested, I can prepare this patch and make a PR.

Support YouTube "privacy-enhanced mode" (youtube-nocookie.com)

Summary

This extension already supports URLs like https://www.youtube.com/embed/* used for embedding YouTube in iframes on other pages, so I think it should also support URLs like https://www.youtube-nocookie.com/embed/* used for embedding videos in YouTube "privacy-enhanced mode".

Details

From official Google documentation (under "Turn on privacy-enhanced mode" dropdown):

Privacy Enhanced Mode allows you to embed YouTube videos without using cookies that track viewing behavior.
...
To use Privacy Enhanced Mode, change the domain for the embed URL in your HTML from https://www.youtube.com to https://www.youtube-nocookie.com...

youtube-nocookie.com is an official YouTube domain that serves videos for iframes without setting cookies. Some site administrators prefer these URLs over regular ones for simplifying compliance with EU regulations (e.g., cookie directive or GDPR). Some users install browser extensions or scripts that automatically switch the URL for a slight improvement in privacy (reducing behavioral tracking, but not the number of ads).

I believe it would be nice if this extension supported this mode as well, however, this feature might need to be optional because if users do not want to be tracked by YouTube, they might not want to be tracked by this extension. Note that it's already possible in modern Chrome/Chromium versions (user can individually disable sites under extension's permissions). Something similar should eventually land in Firefox.

Preview Submissions - Skip to right before the start to see if it is accurate

A button to help jump to just before an edit would help verify it. A one second ad is easy to test with the left arrow key a few times but long cuts are best seeked with a series of repeated keystrokes or clicking on the timebar. Could also have an option to decide how close to just before the edit tit will jump to as a general setting but a default short time (1-2s or so would likely be good).

After the jump, a loop over the same edit would be nice too but a repeatedly clickable button or something on hotkey would be very nice already.

In my experience, each playthrough doesn't comes out identical either so for my first edit I set the start a little earlier than I expected as sometimes frames of the sponsor appeared while other times they were missing. I do not know if that reliability changes by seeking back/forward different amounts or to different times but my quick left arrow previewing to approximately the same place caused variations in each playback.

Submitted times stop taking effect until a page refresh

When creating but before submitting, a complete block performs its function correctly. Clicking submit on the popup has it stop working until the page is refreshed. The popup also will not mention that there are any entries until that refresh. Possible solutions would be allowing continuation of editing the submission (maybe mark uploaded+unaltered lines), reread the dataset and refresh the popup to the newest data after submitting, or replace the message about what exists with a message that the changes were submitted and will be available on all future page loads.

General feedback, suggestions and design concept

I have some thoughts about possible enhancements to the user experience which I'd like to share from using it for a while, plus a design concept which can serve as inspiration. Feel free to do whatever with this.

  1. Reskip button after unskipping
    It'd make a lot easier to check if an actual advertisement is happening if you could reskip after you clicked to unskip ('go back' button). Keep the window open for a bit more time to allow for that.

  2. Close timer - pausing/resetting it
    It'd be nice to see the time ticking down. As a bonus, that allows for you to pause time when the user hovers the screen, as you could show that visually with a pause icon (and pausing when hovering is good as it gives you some time to think).

  3. Instead of not showing at all, at least show an icon
    I'd definitely recommend having an option for a cirular icon instead of all or nothing. It lets you know that, "yes, this sudden skip was the ad being skipped", while not being as intrusive. It also gives the person a chance to click it and dislike/unskip the ad.

  4. Improve window layout, look simpler/smaller
    Below you can see my take on it, plus using the suggestions above (feel free to do whatever with that, you can copy it fully if you want). I also decided to put the window inside the player, in the top-right, as I felt the current location was awkward (and breaks in fullscreen).

Regardless, I'm a big fan of this extension; it's a brilliant idea. Keep it up man

Mark the timeline

We have gray for buffered and a different for unbuffered, yellow for ad, red for watched. Can we get green for go...er, I mean skipmarked? Option to jump to the end of a skip if seeking within and display skippable details (count/time) either on icon hover or skip time detail if over its spot on the timeline could be neat. Please don't noticeably hurt browsing performance just to implement any of this though and thanks again for the great addon.

Sponsorship popup doesn't refresh details for next video

Clicked on the next video at the end of watching one from a thumbnail within the video player window while the popup was open on the right and the popup does not refresh even though skips perform from the new video's rulesets. Closing+reopening the popup does refresh it. Issue was also present on video list to the right and autoplay.

Load database from VideoSegments?

This might not be a good idea, but it could be helpful. It is not meant for sponsor blocking but for clutter blocking in general such as talking during a music video.

Use non-persistent background page

The persistent background page is loaded persistently, so even when there are no events to handle and even no YouTube videos (tabs or embedded frames) are open. This is wasteful since most of the time user does not watch videos let alone constantly actively interact with the server.

How to do it.

I think this refactoring might simplify #87.

A lot of loose ideas

This is a good extension, but there is no perfect software, so here are some thoughts about SponsorBlock and how to make it better. At this point, I don't know which of these are worthy of opening actual bugs and which are "won't fix".

Potential Bugs

Extension prompts me to vote on my own submission

Or is this a feature?

Technical debt

These are purely technical issues that do not affect the UX too much but would be nice to resolve going forward.

Overall

Does not declare "strict mode"

I'm not sure if browsers assume strict mode in extensions or not. Better not to risk it.

Does not use const/let when it can

Also, uses var.

Embeds popup into the YouTube sidebar with innerHTML

This code is fragile, as demonstrated by popup.css needing to reset styles:

reset some properties to default (youtube messes with them

It's not YouTube messing with styles, it's the extension messing with YouTube. Why not use an iframe? Is this some kind of optimization to reuse tabs' own process? If so, is it really worth potential breakage on every minor YouTube update?

Needs linter

Come on, man... the tabs vs. spaces thing. Choose a side. :)

Video times are stored as floats

I'm not sure this is a big deal, but this might be important later on for more advanced things I describe later (which require precise timing). Floating-point numbers have an inconsistent resolution on the number line (are logarithmically distributed). I personally would use integers just scaled appropriately to have required resolution. E.g., store the number milliseconds from the beginning of the video, then just convert them to floats or whatever YouTube needs.

Client-Server API

Uses "GET" HTTP method for submitting data to server

"GET" is supposed to be a "safe" method, so it should not change the server state.

/api/postVideoSponsorTimes

TL;DR: Use JSON instead of URL decorations when appropriate.

  1. API can submit only one sponsor at a time, so extension makes multiple requests if a video has multiple sponsor sections.
    background.js literally has a for loop making request for each reported video segment.
  2. If you send a JSON, you can submit an object containing an array of videos (all at once); also, you won't need to "unpack" every parameter individually on the server.
  3. Poor error handling
    What happens if the user submits multiple times, some of which succeed and one fails? Currently, you just drop the error message into the DOM. If there are multiple errors only the last one will be seen. Also, what is the user supposed to do with this information?
  4. If you use JSON, you can make submit operations atomic: either all videos are reported or none are and you can try to resubmit the videos.
  5. Is there a way to remove previously reported sponsor?
    What if the user reports a video and submits it, then realizes timing was just a bit off and fixes one segment and then submits it. As far as I see, the server can only record more segments, not delete old ones.

With a JSON format, you can make one request, delete the obsolete reports, and consistently handle errors because it is just one event.

User experience

Button sizes and positioning

Popup buttons "Delete [sponsor spot]", "Edit" (sponsor spot) and "Clear [sponsor spot] times" are too close for comfort. User can easily miss and click "Clear times" and loose information.

Popup is useless most of the time

  1. Popup just shows a placeholder message on most pages
  2. Popup does show a useful interface on https://www.youtube.com/watch?v=* pages, but there you have an option to display popup contents in the sidebar (more convenient)

Possible solution:

  1. On non-YouTube pages, popup might show "general info" like statistics of how many videos user submitted, skipped, etc. and options.
  2. On YouTube video pages show the current popup.

Submitting sponsor spots at the very beginning or the very end of the video

If the sponsor spot starts with at 0:0, the user has to record the sponsor spot and then manually edit time.

Hard to submit exact timings

I can not conveniently preview the video without segments I just labeled reloading the page and after I reloaded the page I can no longer conveniently edit my submissions.

What does skip section vote mean?

How should user vote if a video is skipped but the timings are incorrect? There should be an option equivalent to "this is an add, but the skip starts too early" and "this is an add, but the skip ends too soon".

Not all sections I want to skip are "sponsor spots"

Ideally, I would be able to skip or mute repeating long intros with channel logos or outros with "Comment, Like, Subscribe!". Of course, these should have their own setting on the settings panel.

Core problems (and far fetched solutions)

Challenges inherent to the idea of skipping portions of the video no matter what extension you use. The solutions are really far fetched at this point in the extension development.

Imprecise timings

It's hard to submit exact timings because the user can click a button only with specific precision and accuracy. Users, of course, could slow the video down and mark the spot exactly, but in practice, no one does this.

Need good data, if ever plan to automatically classify video segments

A good solution is to allow users to manually report spam text, not just video timings. E.g., present users with text (from subtitles/captions API) and let them select spam sentences.

Video and audio might have slightly different perfect "cut" spot

This can be fixed with a few image transitions added on top of the video.

Solution: Cut at perfect audio times and add fill-in frames or transitions
E.g., cut when the audio is playing without regard to video but then fill in the visual portion with frames sampled just before or just after the audio cut.

Example: https://www.youtube.com/watch?v=h97fXhDN5qE
  • The audio is timed almost perfectly: It starts exactly on words "Imagine a $2000 car..." right after
  • The video timing is a bit off: It blinks the channel logo that fades into the stock footage.

Solution (freeze frame displayed before main content audio start):

  1. Start playback with perfect audio timing
  2. Freeze frame with channel logo (sampled before the transition) and display it on top of the stock footage for a few seconds. No annoying blinking.
Another example: https://www.youtube.com/watch?v=wdU1WTBJMl0
  • The intro sponsor times are OK (the fade transition is complete).
  • The audio literally cuts off "Airports are incredibly..." and starts with "... complex and challenging businesses.

Solution (freeze frame displayed before main content audio start):

  1. Start playing with perfect audio timing
  2. Freeze the first frame after the transition from sponsor spot
Another example: https://www.youtube.com/watch?v=jzFTwBkIC5o

(Does not have sponsor spots reported at the time of writing)

Solution (freeze frame displayed after main content audio start):

  1. Start playing with perfect audio timing
  2. Freeze frame with Uber logo (after the transition from sponsor spot but before crown appears).

Use a dedicated option page

Did you put the extension options onto the popup intentionally or do you plan to use opions_ui? This might be just a preference thing, but all extensions I have use it and thus feel well-integrated with the browser.

What are we voting for?

My current understanding is we are trying to just say good edit or not so bad edits get filtered out of community view and good edits get a stronger footing but am I right and how should others know what is?
Skipping a sponsor has a thumbs up/down but doesn't clarify what you are saying by that. The homepage does not provide documentation. It should be more clear what the feedback is such as the following: the starttime was too early or too late or endtime (...) or wasn't smooth/clean (and not sure that can ever be smooth if skipping to an area outside bufferd content). Was it a sponsor or not something you thought should be blocked. Are we just saying "thanks for skipping 'something' for me"?
Once categories/properties are added then it could be for if a block needs such details changed/refined. Without categories I was planning to block blatent unrelated ads that cut into programming without targeting self sponsorship. Would also likely block the misleading ones where it sounds like they talk of a product/service as if they are a user when its just a paid promo. I could see even on 'sponsor' blocking that people will have different preferences on what is worthy of a block and vote on their decision until either a formal decision is made for what is desired for community blocking standards, what is meant exactly by the vote, or more detailed feedback can be given.

confirmation and optional edit of start / end time before submitting

I really like the idea of this extension and have added a few video sponsors to it. While doing this I found the interface for reporting a sponsor confusing.

I found the interface to be a real pain to use. Is the stop button stop or pause? When I click play again am I resuming or starting again? Is there some way to clear what I've already recorded?

After trying a few times I think I ended up somehow making the recorded sponsor far too small (video in question https://www.youtube.com/watch?v=odscT429m-g).

I think that an easy (I think) solution to this would be to have a dialog come up whenever you push submit which says the times you've selected, and gives you an option to change it before submitting.

Also a couple of other points of feedback while I'm here, don't use browser notifications (or at least make them opt-out), they suck. I've already gotten dozens of "Do you want to submit the sponsor time" notifications flooding me. If I wanted to submit the sponsor time I already would have. The Chrome extension link is broken (or maybe removed from the web store).

Thank you.

Sponsor Indicator before watching the video

image

A little overlay that displays the health of the video would be nice, for example little red dot means no skips submitted, orange would be new or with just not enough thumbs up, blue would indicate no sponsors.
I envision something like this

From USA_G

Use frame count instead of decimals on seconds when editing

The fields to edit the seconds are too small to show the whole value. Sometimes can be confusing seeing most significant digits (left digits) incorrectly due to the view having panned right while editing it. Not sure if the player will ever support proper jumping to thousandths of a second but external uses may.
Another option could be to display fractional seconds as framecount within that second. Don't know if YouTube allows large framerate differences but smaller edit precision can be useful for cleaner cuts on audio and some podcasts and similar audio only content is present on YouTube.

Make global settings/stats popup

Maybe replace popup.html to allow users to change stuff like hotkeys, "onekey" view stats and a place to whitelist channels for #38 (Maybe as a right click option)

option to block seeking within a block

Blocking works correctly when playback reaches the start of a block to jump to the end but if already inside the block it just plays. May be nice to have an option to autoskip outside that area again. For example if clicking on the timeline puts you inside the block, autojump to a point outside it.

It may be beneficial to consider seeking to a moment shortly before the block so it will then have autoskip kick in. It would seem like a nuisance glitch for a short moment if not a clean transition but would even make left arrow reversing through a video supported instead of reaching a point the keyboard cannot rewind before.

If implemented, this may impact the 'go back' feature of the popup mentioning it skipped a section that offers to watch the skipped portion so the content block would need to be temporarily disabled when this happens.

Support tabs out of focus

Why does the background script need to know the video id anyway? Can't it be sent with the requests?

Prevent editing sponsor with no end time

I have been working with video in another editor to try to get precision on my edits. Clicking start+stop gives an edit with both times being the same but clicking on start will make an entry with a start but no end and has a delete button but no edit button. Clicking on its time does open it for editing but gives NAN for endtime and delete below it but no save button even after filling in an end time. Clicking sponsor stop and start on the video closes the popup (as does start, kind of annoying) and when reopened it will have a complete and editable entry.
Using the 'Sponsorship starts/stops now' buttons work from the popup to complete it without closing the popup but always closes any times editors that are open without saving or prompting to do so.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.