r/learnprogramming • u/nelf86 • Oct 13 '17
I created a chrome plugin that automatically mutes youtube commercials
This is a chrome plugin that automatically mutes youtube commercials. After the commercial finished, the volume goes back up.
Thanks to this, casters can still be reworded by youtube, but you don't have to listen to crappy commercials.
https://chrome.google.com/webstore/detail/youmuter/hbhjkldledabllijjmnmfhhiejephibe
and you can checkout the source code here:
312
u/ashiningjewel Oct 13 '17
It's definitely useful for if you use it for music in the background
82
u/Nugenrules Oct 13 '17
I wonder if it would be annoying to have random silence and wonder if youtube couldn't load the next song, prompting a check.
55
u/imma_nice_boy Oct 13 '17
Still good for other people. Sometimes I'm so focused working that I forgot to even start the music after I put on my headset
25
u/Nugenrules Oct 13 '17
Me to. Just yesterday, I reached the end of a playlist and didn't realize for a long time.
I was just wondering how other people feel. If I'm driving and youtube background randomly errors (happens often), sometimes I get upset
8
6
162
u/lozy9604 Oct 13 '17
You should also post to r/ASMR. This is their biggest problem with youtube. They will love it!
7
u/HappyHappyBadger Oct 13 '17
Omg YES! That always messed me up with ASMR, made me consider enabling an AdBlock.
OP! This is really cool, thank you for sharing. I will try this out and I know quite a few people that would enjoy this too.
11
u/linus_rules Oct 13 '17
Hace you read Contact by Carl Sagan? One character solved this problem, making a fortune. Life imitating art.
4
2
1
27
u/Annndroid Oct 13 '17
Can you do this for Twitch? Would be appreciated
11
3
u/Synaxxis Oct 13 '17
Twitch, Hulu, Fox, NBC, TNT, ABC, USA, and every other video type service that has ads.
5
u/MozzyZ Oct 13 '17
Seriously hate Twitch for making it impossible to mute ads manually anymore unless the stream is muted beforehands.
1
u/Theyreillusions Oct 14 '17
If that is the case, then this code would be a bit tougher to manipulate for that purpose.
At least with my limited understanding. This script is checking if there is an ad, then checking for a mute button.
If there isn't a mute button anymore, it can't do anything. Unless somehow you can get Java Script to mute your browser entirely, rather than the web player?
This would interfere with, say, streaming Pandora and twitch simultaneously. I know some viewers like to have music and their streamer on in the background while gaming or doing whatever.
1
u/dothefandango Oct 14 '17
I'm going to look into this -- Safari has tab by tab muting so there must be a way to do it.
1
u/100percent_right_now Oct 14 '17
Chrome and Edge also have this. You can right click any tab that's making noise and silence it.
1
u/MozzyZ Oct 14 '17
The mute button is still there visually but when you try to click on it, you click on the ad instead. It's like the ad is covering the mute button.
1
u/Theyreillusions Oct 14 '17
Doesnt the FCC have rules against this sort of thing? Or is that just on the television.
Imagine hitting mute on your tv remote and it wont work because a commercial is playing
25
Oct 13 '17
Great way to support creators without hearing constant Nissan ads, love it!
1
Oct 14 '17
I usually yell at my screen while repeatedly clicking the button that turns into "skip".
This addin might be good for my blood pressure.
11
u/trethompson Oct 13 '17
Awesome! This (muting ads) has been my small protest against ads forever, nice to see someone automated the process for me. Now I don't even have to watch the timer
6
4
u/everybodysaysso Oct 13 '17
This is good stuff man. It works!!!!
Can you please take out sometime and explain what exactly you did? How do you figure out if a commercial is playing?
5
u/Deseao Oct 13 '17
So if you look at their code the extension is just clicking the mute button when it finds part of the site called 'ad-interrupting' which is apparently conveniently only there when there's an ad.
1
u/everybodysaysso Oct 14 '17
Oh that's pretty straightforward!! Still impressive though.
Thanks for sharing this, I will go through the code too!
3
u/apocryph Oct 13 '17
I haven't really tested it but there seems to be some bugs from reading your code:
Since you set muted because of commercial to true regardless if you actually muted or not, you cannot rely on it to know whether to unmute later on. It looks like after the first commercial, you can no longer mute the video because your script will always want to unmute.
Similarly, since you don't restore that value after you unmute a video after a commercial, you are now unable to distinguish whether the user has muted the video.
Nice work though!
4
Oct 13 '17
But AdBlock?
2
Oct 14 '17
This is probably for people who don't like ads, but don't want to support their favorite Youtubers with Patreon or similar services and want to see ads for support. A pretty niche userbase.
1
Oct 14 '17
Ah yeah that is understandable, I find watching ads just not worth it, it gives a YouTuber 1/10th of a cent, just not worth it.
2
Oct 14 '17
Oh I know, supporting them on Patreon or something is always a better way to support the creators.
1
Oct 14 '17
But thy builds up... I imagine at least 50% of users block ads, that’s half revenue cut which can be a lot
2
u/neo_marc Oct 13 '17
Thank you! Now I don't have to listen to that fucking Pot Pasta advert with the screeching opera singers anymore!
2
u/tristinDLC Oct 13 '17
Any recommended path to creating Chrome plugins? I have two in mind, but not sure the best resources to get started.
2
u/CaptainMoonman Oct 13 '17
Might there be something similar for Firefox, perhaps? Do you have any plans to port this over?
2
u/Sneezegoo Oct 13 '17
Awsome. I would honestly be happy if the comercials were just regular volume instead of 100x whatever your video is at.
2
2
u/EmeraldDS Oct 13 '17
People who are saying we should use adblock are missing the point. Creators miss out on money for what's free entertainment. Yeah, fuck Google and all that, but it's not YouTubers' fault and I still want to support content creators. I mean, unless you support them on Patreon or whatever. In that case I suppose they're still getting money so that's fine, but if I donated to the Patreon of every YouTuber I watched, I wouldn't be able to eat. Just much easier to do this.
2
2
u/Wellgoodmornin Oct 14 '17
I kinda feel like the people who paid for their ads on YouTube deserve to have their money pay for something. Every ridiculous sight that has ads play at full volume when you're just trying to read a "news" story while watching netflix? Fuck those people.
2
u/Modern_O Oct 14 '17
Love this! I use adblock except on YouTube and some other websites to support what they got going on but now I can support them and not have to listen to to ad. Will be adding that when I get home
2
u/Rorroh Oct 14 '17
Great job with this! Such a simple plugin with such wide-spread appreciation. Congrats on making Top of All Time here! Keep up the great work.
4
Oct 13 '17
Or use uBlock Origin and just not even worry about ads?
3
Oct 13 '17
No, because you won't see them if you do, youtube detects that and will count like you haven't watched. That's not what we want ; or at least that's what i and the author do not want.
2
2
2
u/Cigs77 Oct 13 '17
AdBlock exists. What is the purpose of this? This is why I cant ever find a programming project to "work on". This guy just spent god knows how long making a shit version of a thing that already exists. Why in the actual fuck would anyone waste their time on such an endeavor?
2
u/Yakkahboo Oct 13 '17
Sometimes people want to still hit up content creators with ad revenue without really having to pay attention to adverts. I can understand the reasoning, I had a similar plugin for spotify
-1
u/WildTilt Oct 13 '17
The problem he solves is that you have to click or fiddle with your headset to turn off the volume. Real first world problems there :)
1
1
1
1
1
1
1
1
1
1
1
u/Virgil_hawkinsS Oct 14 '17
The code is remarkably simple. I was expecting something more complicated. Good job
1
1
1
1
1
u/CantHugEveryCat Oct 14 '17
Instead of silence, could you make it play Human Music or African Dream Pop?
1
1
1
1
u/systemerrorone Feb 06 '18
Although I have to agree with everyone else.. I use Adblock for YouTube, this plugin is still useful for those who still want to credit content creators on YouTube. Either way great extension I posted it here http://addictedtochrome.com/extensions/youmuter/
-4
u/jussumman Oct 13 '17
Just get the Red so you watch without ads though.
9
Oct 13 '17
Or install uBlock Origin. Nice try YouTube.
0
u/jussumman Oct 14 '17
Sure, if I was Google / YouTube I'd use software to recognize you are using the most effective adblocker and send you a message that you are banned/account closed and TGFY.
1
0
Oct 13 '17
[deleted]
2
u/NarcoPaulo Oct 13 '17
In most countries
2
1
Oct 14 '17
It’s not available in the UK, it’s only available in 5 countries so unless you count US, Korea, Australia, New Zealand and Mexico as “most”, it’s barely available...
-60
u/prince_polka Oct 13 '17 edited Oct 13 '17
This is trash.
I do not want to support people who put ads on their videos
27
u/ScriptingInJava Oct 13 '17
You don't want the people who create content for you to watch for free to be able to profit off it? Fuck it lads just let them starve, just make sure you schedule a few playlists for me to watch while I take a shit first though.
19
u/tinverse Oct 13 '17
This is by far one of the stupidest comments I've ever seen. Congratulations on your complete lack of how the world works and your ability to completely fuck over someone who cares about entertaining you.
4
u/DefinitivelyNotMe Oct 13 '17
Or maybe he supports content creators through their patreon and through donations because he thinks the current advertising systems aren't healthy for the Internet ?
I don't know, but I don't think the reactions here are appropriate.
4
u/SiegeLion1 Oct 13 '17
But you can't just decide to try to fuck over someone for using ads, Youtube doesn't allow you to add a patreon link to the end of your video unless you have ads enabled now and most people don't check the description. So even if a content creator would rather use Patreon they're still more or less forced to use ads.
2
u/DefinitivelyNotMe Oct 13 '17
Well, didn't know that, that's interesting. See, your comment would've made so much more sense rather calling the parent stupid etc..
3
u/nemmera Oct 13 '17
He will figure it out when he grows up and has to support himself.
→ More replies (24)4
0
Oct 13 '17
[deleted]
7
u/GET_OUT_OF_MY_HEAD Oct 13 '17
I do on mobile. If they find a way to make this plugin work on Android without rooting, I'm installing it yesterday.
1
Oct 14 '17
I think Firefox can use plugins on mobile browser, which probably works for Adblock too (I didn't watch many Youtube on Firefox Browser but my Wikiwand plugin works the same)
I still use Youtube app itself, I don't know why, it is the worst app in the world and you can't minimize while listening or anything...
→ More replies (1)1
Oct 14 '17
Brave browser on mobile is just Chrome with ad block built in. Works on YouTube as well AFAIK
0
Oct 13 '17
[deleted]
0
Oct 13 '17
[deleted]
4
u/xian0 Oct 13 '17
You configure which whitelists/blacklists you use though, it's all on the same page.
4
5
u/Technycolor Oct 13 '17
Mine as in cryptomine?
→ More replies (1)10
u/mutatedllama Oct 13 '17
Mine as in cryptomine?
How on earth would that even make sense in that context?
8
u/Technycolor Oct 13 '17
it's just that it's becoming more commonplace for monero mining to occur in browser, with or without consent
→ More replies (1)
0
165
u/Logynymo Oct 13 '17
But i still have to wait 5 sec to skip... Adblock got me