ajayyy / sponsorblock Goto Github PK
View Code? Open in Web Editor NEWSkip YouTube video sponsors (browser extension)
Home Page: https://sponsor.ajay.app
License: GNU General Public License v3.0
Skip YouTube video sponsors (browser extension)
Home Page: https://sponsor.ajay.app
License: GNU General Public License v3.0
It is possible to detect an advert with isAd = (document.getElementsByClassName("ytp-ad-player-overlay").length == 1)
Want to know from @ajayyy if this is a good idea or not
What are your target browser versions? Do you plan to add them to the manifests?
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.
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.
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".
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 fromhttps://www.youtube.com
tohttps://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.
Either change the color or add a number adblock style.
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.
To reduce clutter on video player controls
Right now it just shows view numbers. Convert this to minutes or hours.
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.
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.
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.
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).
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.
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
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.
For some reason it looks worse. Is there no custom font or no anti-aliasing?
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.
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.
Ideally using a JSON array.
This would help fix UUID issue that has been fixed with the temporary fix.
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.
I think this refactoring might simplify #87.
Keep it in the popup to vote, but put (hidden)
beside it. Also, don't skip it.
Instead of using the default browser one, a custom one would be nice.
Right now it only saves it to chrome saves, but doesn't update the popup.
Right now that only happens for hiding them. This would involve setting up a message for when the show button is pressed.
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".
Or is this a feature?
These are purely technical issues that do not affect the UX too much but would be nice to resolve going forward.
"strict mode"
I'm not sure if browsers assume strict mode in extensions or not. Better not to risk it.
const
/let
when it canAlso, uses var
.
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?
Come on, man... the tabs vs. spaces thing. Choose a side. :)
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.
"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.
background.js
literally has a for loop making request for each reported video segment.With a JSON format, you can make one request, delete the obsolete reports, and consistently handle errors because it is just one event.
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.
https://www.youtube.com/watch?v=*
pages, but there you have an option to display popup contents in the sidebar (more convenient)Possible solution:
If the sponsor spot starts with at 0:0, the user has to record the sponsor spot and then manually edit time.
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.
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".
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.
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.
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.
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.
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.
Solution (freeze frame displayed before main content audio start):
Solution (freeze frame displayed before main content audio start):
(Does not have sponsor spots reported at the time of writing)
Solution (freeze frame displayed after main content audio start):
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.
Might be slightly less precise but could be more intuitive to some.
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.
They produce links like this:
https://www.youtube.com/watch?time_continue=470&v=uqKGREZs6-w
Notice the extra query:time_continue=470
This would require changing the regex a bit.
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.
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.
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)
Have people select a username and show the top contributors.
Due to the original not being a square, this version is cut off.
Seems easy to mark a start/stop initially but after that its either delete and do it again or edit times by typing numbers. Did I miss something?
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.
If a computer is too slow, and a channel page with a channel trailer is loaded first, the buttons will be added to the channel player instead of the video. It is supposed to wait for an actual video to be loaded, but on slow PCs it doesn't wait long enough.
Some are good content and non deceptive even if they are sponsored.
Why does the background script need to know the video id anyway? Can't it be sent with the requests?
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.
Demonstrated here. A reload fixes it, could be to do with youtube's 'dynamic' loading of pages
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.