instance01 / twitch-hls-adblock Goto Github PK
View Code? Open in Web Editor NEWBlock advertisements that are inserted in Twitch streams directly.
License: MIT License
Block advertisements that are inserted in Twitch streams directly.
License: MIT License
I tried out the latest release in the latest 64-bit Firefox nightly on Windows. The result is that streams never start. The player just stays black but the controls for it "work" in that the play/pause/volume UI act as expected, there's just no video or audio. In a new, empty profile with only this extension (and turning off some content/tracker blocking off to get rid of some log messages), my browser console has only the following when trying to view a stream:
Injected Twitch Ad Blocker. injected.js:1:9
failed to resolve properties promise <unavailable> twitch-player-ui-9992686ce9d56394e1e1.js:37:57307
Autoplay is only allowed when approved by the user, the site is activated by the user, or media is muted. mediaplayer.min.js:7:23287
Content Security Policy: Ignoring ‘x-frame-options’ because of ‘frame-ancestors’ directive.
<unavailable> apstag.js:2:12743
p https://c.amazon-adsystem.com/aax2/apstag.js:2
<anonymous> https://c.amazon-adsystem.com/aax2/apstag.js:2
r https://c.amazon-adsystem.com/aax2/apstag.js:2
<anonymous> https://c.amazon-adsystem.com/aax2/apstag.js:2
r https://c.amazon-adsystem.com/aax2/apstag.js:2
<anonymous> https://c.amazon-adsystem.com/aax2/apstag.js:2
<anonymous> https://c.amazon-adsystem.com/aax2/apstag.js:2
The "unavailable" line and trace below it is an error, but I don't know why there isn't actually a message attached. Maybe it's supposed to be with the earlier line about the promise, but that line is marked as warning level. I have no idea if it's related, anyway. I tried a few different streams at random with the same result.
is there any chance to get this working for opera browers 1 day
See #10.
I have a tough time actually getting a midroll ad to debug this. It'd a great help if someone encounters such an ad and could attach debug output as described in #8 by @stoically.
Video doesnt play and returns a black screen. may need modification
Hey, I think twitch found a work around for ublock origin because it stopped working for me last night. I found this and tried it out but the screen stays black with a loading symbol in the middle and never ends up showing the stream (tried waiting ~5 minutes)
I'm not sure if this is related but when I view my extensions, I noticed the extension had errors and it were these:
I seem to be getting a black loading screen for around a minute on streams when the ads would normally load.
Chrome version: 78.0.3904.97
Let me know if I can provide anything else to help.
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
Stack Trace
lib.js:214 (getWasmBinaryVersion)
Line 214: req.open('GET', twitchBlobUrl, false);
Twitch-HLS-Ad-Block
0.6.0
Screenshot:
https://imgur.com/a/KMsRwPK
A side-effect of self._seq
and self._wasAd
keeping their values when switching streams (through xhr website-navigation which doesnt reload the wasmworker) is that the sequence can "always" get set to 0 - if the sequence of the new stream is smaller than the already set _seq
- resulting in a stream-freeze (even if no Ad plays).
Manifest version 2 is deprecated, and support will be removed in 2023. See https://developer.chrome.com/blog/mv2-transition/ for more details.
Win 10, Chrome 76.0.3809.132
Installed as indicated, extension seems to have loaded fine but I'm still getting ads before streams. Is there a way to access logging so I can understand if anything is getting blocked/if there are errors being generated?
After unpacking the extension into Vivaldi (A Chromium browser) and loading a stream, this error is thrown on the Externsions page: http://prntscr.com/n0bdw7
doesn't seem to work anymore
With this loaded, when I try to set a stream's video quality, the settings gear spins continuously unless I select Auto or Source, and changes to lower qualities don't take effect. Upon a stream's loading or refresh, the preferred quality setting is applied for a few seconds, after which Auto is applied. The stream I've observed this on is TwitchPresents, and I have noticed it happen on other streams, but am not sure if it applies to all streams or not.
hey
can we get this working for the opera browser as well please
Tried opening Forsen. Pre-roll ads open immediately and load/play -- nothing is blocked. Here's my console:
lib.js:227 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
getWasmBinaryVersion | @ | lib.js:227
-- | -- | --
| Worker | @ | injected.js:7
| v | @ | player-core-variant-…2eb7469728bd35.js:1
| (anonymous) | @ | core-c7103c2….js:1
| (anonymous) | @ | vendor-b62d9c6….js:1
| (anonymous) | @ | vendor-b62d9c6….js:1
| a | @ | vendor-b62d9c6….js:1
| Promise.then (async) | |
| u | @ | vendor-b62d9c6….js:1
| (anonymous) | @ | vendor-b62d9c6….js:1
| l | @ | vendor-b62d9c6….js:1
| A | @ | core-c7103c2….js:1
| t.maybeLoadPlayer | @ | core-c7103c2….js:1
| t.componentDidMount | @ | core-c7103c2….js:1
| Ws | @ | vendor-b62d9c6….js:1
| t.unstable_runWithPriority | @ | vendor-b62d9c6….js:1
| po | @ | vendor-b62d9c6….js:1
| Hs | @ | vendor-b62d9c6….js:1
| Ms | @ | vendor-b62d9c6….js:1
| du | @ | vendor-b62d9c6….js:1
| pu | @ | vendor-b62d9c6….js:1
| (anonymous) | @ | vendor-b62d9c6….js:1
| Us | @ | vendor-b62d9c6….js:1
| _u | @ | vendor-b62d9c6….js:1
| render | @ | vendor-b62d9c6….js:1
| e.mount | @ | core-c7103c2….js:1
| n | @ | core-c7103c2….js:1
| (anonymous) | @ | core-c7103c2….js:1
| d | @ | vendor-b62d9c6….js:1
| (anonymous) | @ | vendor-b62d9c6….js:1
| dispatch | @ | vendor-b62d9c6….js:1
| (anonymous) | @ | core-c7103c2….js:1
| (anonymous) | @ | vendor-b62d9c6….js:1
| (anonymous) | @ | vendor-b62d9c6….js:1
| a | @ | vendor-b62d9c6….js:1
| Promise.then (async) | |
| u | @ | vendor-b62d9c6….js:1
| a | @ | vendor-b62d9c6….js:1
| Promise.then (async) | |
| u | @ | vendor-b62d9c6….js:1
| (anonymous) | @ | vendor-b62d9c6….js:1
| l | @ | vendor-b62d9c6….js:1
| (anonymous) | @ | core-c7103c2….js:1
| (anonymous) | @ | vendor-b62d9c6….js:1
| e.dispatch | @ | core-c7103c2….js:1
| d | @ | core-c7103c2….js:1
| sNlA | @ | core-c7103c2….js:1
| m | @ | forsen?twitch5=0:1
| 202 | @ | core-c7103c2….js:1
| m | @ | forsen?twitch5=0:1
| i | @ | forsen?twitch5=0:1
| e | @ | forsen?twitch5=0:1
| (anonymous) | @ | core-c7103c2….js:1
injected.js:29 [Report Only] Refused to create a worker from 'blob:https://www.twitch.tv/46c0bc96-e34f-4c81-a512-a5b51921c220' because it violates the following Content Security Policy directive: "worker-src 'none'".
Worker | @ | injected.js:29
-- | -- | --
| v | @ | player-core-variant-…2eb7469728bd35.js:1
| (anonymous) | @ | core-c7103c2….js:1
| (anonymous) | @ | vendor-b62d9c6….js:1
| (anonymous) | @ | vendor-b62d9c6….js:1
| a | @ | vendor-b62d9c6….js:1
| Promise.then (async) | |
| u | @ | vendor-b62d9c6….js:1
| (anonymous) | @ | vendor-b62d9c6….js:1
| l | @ | vendor-b62d9c6….js:1
| A | @ | core-c7103c2….js:1
| t.maybeLoadPlayer | @ | core-c7103c2….js:1
| t.componentDidMount | @ | core-c7103c2….js:1
| Ws | @ | vendor-b62d9c6….js:1
| t.unstable_runWithPriority | @ | vendor-b62d9c6….js:1
| po | @ | vendor-b62d9c6….js:1
| Hs | @ | vendor-b62d9c6….js:1
| Ms | @ | vendor-b62d9c6….js:1
| du | @ | vendor-b62d9c6….js:1
| pu | @ | vendor-b62d9c6….js:1
| (anonymous) | @ | vendor-b62d9c6….js:1
| Us | @ | vendor-b62d9c6….js:1
| _u | @ | vendor-b62d9c6….js:1
| render | @ | vendor-b62d9c6….js:1
| e.mount | @ | core-c7103c2….js:1
| n | @ | core-c7103c2….js:1
| (anonymous) | @ | core-c7103c2….js:1
| d | @ | vendor-b62d9c6….js:1
| (anonymous) | @ | vendor-b62d9c6….js:1
| dispatch | @ | vendor-b62d9c6….js:1
| (anonymous) | @ | core-c7103c2….js:1
| (anonymous) | @ | vendor-b62d9c6….js:1
| (anonymous) | @ | vendor-b62d9c6….js:1
| a | @ | vendor-b62d9c6….js:1
| Promise.then (async) | |
| u | @ | vendor-b62d9c6….js:1
| a | @ | vendor-b62d9c6….js:1
| Promise.then (async) | |
| u | @ | vendor-b62d9c6….js:1
| (anonymous) | @ | vendor-b62d9c6….js:1
| l | @ | vendor-b62d9c6….js:1
| (anonymous) | @ | core-c7103c2….js:1
| (anonymous) | @ | vendor-b62d9c6….js:1
| e.dispatch | @ | core-c7103c2….js:1
| d | @ | core-c7103c2….js:1
| sNlA | @ | core-c7103c2….js:1
| m | @ | forsen?twitch5=0:1
| 202 | @ | core-c7103c2….js:1
| m | @ | forsen?twitch5=0:1
| i | @ | forsen?twitch5=0:1
| e | @ | forsen?twitch5=0:1
| (anonymous) | @ | core-c7103c2….js:1
Then the worker errors:
t.sendFetchRequest | @ | wasmworker.min-aee4d9f….js:1
-- | -- | --
| sendFetchRequest | @ | wasmworker.min-aee4d9f….js:1
| w | @ | wasmworker.min-aee4d9f….js:1
| (anonymous) | @ | wasm-0066869e-1502:1
| (anonymous) | @ | wasm-0066869e-1504:1
| (anonymous) | @ | wasm-0066869e-541:1
| (anonymous) | @ | wasm-0066869e-334:1
| (anonymous) | @ | wasm-0066869e-874:1
| (anonymous) | @ | wasm-0066869e-2662:1
| (anonymous) | @ | wasm-0066869e-796:1
| (anonymous) | @ | wasm-0066869e-580:1
| (anonymous) | @ | wasm-0066869e-303:1
| (anonymous) | @ | wasm-0066869e-1361:1
| (anonymous) | @ | wasm-0066869e-1679:1
| (anonymous) | @ | wasm-0066869e-991:1
| (anonymous) | @ | wasm-0066869e-302:1
| (anonymous) | @ | wasm-0066869e-613:1
| (anonymous) | @ | wasm-0066869e-1374:1
| (anonymous) | @ | wasm-0066869e-1948:1
| (anonymous) | @ | wasm-0066869e-2523:1
| (anonymous) | @ | wasm-0066869e-448:1
| (anonymous) | @ | wasm-0066869e-1546:1
| n.dynCall_viii | @ | wasmworker.min-aee4d9f….js:1 |
| dynCall_viii_108 | @ | VM145:4 |
| WebMediaPlayer$onClientSinkUpdate | @ | VM147:10 |
| e.onClientMessage | @ | wasmworker.min-aee4d9f….js:1 |
| e.dispatch | @ | wasmworker.min-aee4d9f….js:1 |
| e.onmessage | @ | wasmworker.min-aee4d9f….js:1 |
It appears this same issue has returned some time in the past week, only this time it is in the main Firefox release. Streams and VODs never load on Firefox with the extension enabled, they just sit in a black screen.
Extension does not work for me on Chromium Version 69 Linux (64-bit). Initialization fails with the following error:
Refused to create a worker from 'blob:https://www.twitch.tv/eb0de64b-1bbe-4a30-8aed-629568a05928' because it violates the following Content Security Policy directive: "worker-src 'none'".
I tried diabling CSP headers with the "Disable Content-Security-Policy" extension.
Also tried adding "content_security_policy": "worker-src 'blob'; script-src 'self'; object-src 'self'" to manifest.json
The CSP seems to be overwritten somewhere else.
There's this extension called "Alternate Player for Twitch.tv" (https://chrome.google.com/webstore/detail/alternate-player-for-twit/bhplkbgoehhhddaoolmakpocnenplmhf). Can you possibly add the URL it uses to block ADs in there aswell?
Hey, the extensions works fine but I have too issues.
When the extension is waiting for the non-ad playlist, it floods playlist requests to Twitch at a rate which could be considered a DoS attack. While waiting 30 seconds for an ad, I saw over 3400 requests and almost 100MB of playlist files downloaded.
Thanks for your work on THA!
I was wondering, would it maybe be possible to use webRequest.filterResponseData on the m3u8 playlist urls and filter out the SCTE-35 flags from the response that way, instead of monkey patching? (Would of course only be an option for Firefox since Chrome can't modify response bodys yet) Sorry if that's an ignorant question and I'm missing the parts of what THA does besides filtering the flags.
Me again, I seem to be getting pre-roll and mid-roll ads again; based on #25 I think I understand how to create a PR to update the ad chunk defs, but if someone could tell me how to find those new definitions in a stream I'd be grateful.
If that refers to the Player Core Version, they are up to 2.13.3 and are testing 2.14.0. I don't know if this is important but there it is
Thanks for creating this. It worked at first, but now, in Firefox at least, when switching streams, the screen goes black and the loading icon appears. It seems to last as long as the ad would have, then the stream starts.
I think userscript will be a better than manually installing this as extension.
Greetings,
I like what you're trying to do with this. I wanted to report that this extension is indeed preventing the ads from playing. (0.6.0) But instead of it taking 5 seconds to play video, I get black video that says it's live for about 30 seconds. (Same amount of time as the ad.) This happens even for situations I wouldn't normally see an add.
Keep up the good work!
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.