Skip to content

Commit

Permalink
new post added
Browse files Browse the repository at this point in the history
  • Loading branch information
downIoads committed Oct 15, 2023
1 parent 8034508 commit 7bcb55b
Show file tree
Hide file tree
Showing 19 changed files with 256 additions and 53 deletions.
30 changes: 30 additions & 0 deletions content/posts/twitch-adblock-streamlink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: "Blocking Twitch Ads by using streamlink to stream to VLC"
date: 2023-10-14T08:00:23+02:00
description: Your Browser adblocker is not working on Twitch? Read this.
draft: false
tags: [windows, tutorial]
---

## Introduction
Twitch keeps changing their backend, and it recently became more difficult to block ads. A few years ago, any ad blocker seemed to work just fine. Then they changed their code, and uBlock Origin, Adblock Plus, etc. all fail to remove ads. While there are still browser plugins that promise to block Twitch ads, many of them are potentially shady, as they route your traffic over some proxy server that does who-knows-what. Since I don't like routing my traffic over shady servers and I want to avoid testing browser extensions that have way too many privileges, I tried to find a different approach. IMO, the best way is to use [Streamlink](https://github.com/streamlink/streamlink), which is an excellent tool for routing a stream to a video player you have installed locally. It supports plugins, and there are [many plugins](https://streamlink.github.io/plugins.html#twitch) available.

## Setup
The setup on Windows is simple: install the required Python version, download the binary for your version, add VLC to the path, and then just use the following command in the terminal:
```cmd
streamlink.exe -p vlc <twitch-channel-url> best --twitch-disable-ads
```
This will automatically open VLC with the Twitch stream playing at the highest quality. The last parameter "--twitch-disable-ads" is taken from the Twitch Plugin documentation and sadly does not work as it should: while an ad is playing, the stream stops (frame freezes) and only continues after the ad is over (you don't see or hear anything of the ad). The same behavior happens if you don't use the "--twitch-disable-ads" flag. The only difference here is that the frozen frame shown is not the last frame of the stream you are watching, but instead the Twitch banner shown below:

![targets](/images/twitch-stream-adblocking.png "Screenshot")

Okay, but why does the "--twitch-disable-ads" flag not work as expected? I did read in the documentation that VLC is not a recommended video player because of how it handles stream discontinuities. If you look at the CMD output during an ad, it will show:

![targets](/images/streamlink-adblock-error.png "Screenshot")

If you read through the [Twitch Plugin Documentation](https://streamlink.github.io/cli/plugins/twitch.html#embedded-ads), you will notice that the authors mention this problem. While VLC did not crash for me, there were stream discontinuity warnings shown in the command line. But using a different player than VLC will not fix this issue, the authors of the documentation write: "Unfortunately, entirely preventing embedded ads is not possible unless a loophole on Twitch gets discovered which can be exploited. This has been the case a couple of times now and ad-workarounds have been implemented in Streamlink (see #3210) and various ad-blockers, but the solutions did only last for a couple of weeks or even days until Twitch patched these exploits."

The only hope seems to be to set special API request headers using the "--twitch-access-token-param" flag that might or might not prevent embedded ads. However, even if you find a value that works, it is likely that Twitch will patch the workaround shortly after. Since my goal was to not be annoyed by repetitive ads, I am happy with the current solution of having an automatically paused stream.

## Conclusion
Streamlink is a good tool for using locally installed video players like VLC instead of having to visit bloated streaming websites. While it does allow you to mute ads (by stopping the video and silencing audio), Twitch does all it can to make it difficult to remove embedded ads. If you truly care about an ad-free Twitch experience, subscribing to Twitch Prime is the easiest and most boring solution.
Binary file added public/images/streamlink-adblock-error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/twitch-stream-adblocking.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/twitch-stream-adbreak.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 11 additions & 11 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@



<section class="list-item">
<h1 class="title"><a href="/posts/twitch-adblock-streamlink/">Blocking Twitch Ads by using streamlink to stream to VLC</a></h1>
<time>Oct 14, 2023</time>
<br><div class="description">

Your Browser adblocker is not working on Twitch? Read this.

</div>
<a class="readmore" href="/posts/twitch-adblock-streamlink/">Read more ⟶</a>
</section>

<section class="list-item">
<h1 class="title"><a href="/posts/hackintosh-ventura-rx6650xt/">Hackintosh #2: Running Ventura using Haswell CPU and a spoofed AMD RX 6650 XT</a></h1>
<time>Oct 10, 2023</time>
Expand Down Expand Up @@ -129,17 +140,6 @@ <h1 class="title"><a href="/posts/nfc-mifare-acr122u/">How to authenticate and w
<a class="readmore" href="/posts/nfc-mifare-acr122u/">Read more ⟶</a>
</section>

<section class="list-item">
<h1 class="title"><a href="/posts/nfc-overview-and-playing-around/">NFC in 2023</a></h1>
<time>Jul 9, 2023</time>
<br><div class="description">

Learn how to use NFC with your smartphone or dedicated NFC USB device.

</div>
<a class="readmore" href="/posts/nfc-overview-and-playing-around/">Read more ⟶</a>
</section>



<ul class="pagination">
Expand Down
11 changes: 10 additions & 1 deletion public/index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@
<description>Recent content on Blog for Tech Enjoyers</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-us</language>
<lastBuildDate>Tue, 10 Oct 2023 08:00:23 +0200</lastBuildDate><atom:link href="https://example.com/index.xml" rel="self" type="application/rss+xml" />
<lastBuildDate>Sat, 14 Oct 2023 08:00:23 +0200</lastBuildDate><atom:link href="https://example.com/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Blocking Twitch Ads by using streamlink to stream to VLC</title>
<link>https://example.com/posts/twitch-adblock-streamlink/</link>
<pubDate>Sat, 14 Oct 2023 08:00:23 +0200</pubDate>

<guid>https://example.com/posts/twitch-adblock-streamlink/</guid>
<description>Introduction Twitch keeps changing their backend, and it recently became more difficult to block ads. A few years ago, any ad blocker seemed to work just fine. Then they changed their code, and uBlock Origin, Adblock Plus, etc. all fail to remove ads. While there are still browser plugins that promise to block Twitch ads, many of them are potentially shady, as they route your traffic over some proxy server that does who-knows-what.</description>
</item>

<item>
<title>Hackintosh #2: Running Ventura using Haswell CPU and a spoofed AMD RX 6650 XT</title>
<link>https://example.com/posts/hackintosh-ventura-rx6650xt/</link>
Expand Down
11 changes: 11 additions & 0 deletions public/page/2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@



<section class="list-item">
<h1 class="title"><a href="/posts/nfc-overview-and-playing-around/">NFC in 2023</a></h1>
<time>Jul 9, 2023</time>
<br><div class="description">

Learn how to use NFC with your smartphone or dedicated NFC USB device.

</div>
<a class="readmore" href="/posts/nfc-overview-and-playing-around/">Read more ⟶</a>
</section>

<section class="list-item">
<h1 class="title"><a href="/posts/how-to-calculate-any-weekday/">How to calculate any weekday</a></h1>
<time>Jul 4, 2023</time>
Expand Down
2 changes: 2 additions & 0 deletions public/posts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ <h1 class="page-title">All articles</h1>


<ul class="posts"><li class="post">
<a href="/posts/twitch-adblock-streamlink/">Blocking Twitch Ads by using streamlink to stream to VLC</a> <span class="meta">Oct 14, 2023</span>
</li><li class="post">
<a href="/posts/hackintosh-ventura-rx6650xt/">Hackintosh #2: Running Ventura using Haswell CPU and a spoofed AMD RX 6650 XT</a> <span class="meta">Oct 10, 2023</span>
</li><li class="post">
<a href="/posts/hackintosh-project1/">Hackintosh in 2023</a> <span class="meta">Oct 2, 2023</span>
Expand Down
11 changes: 10 additions & 1 deletion public/posts/index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@
<description>Recent content in Posts on Blog for Tech Enjoyers</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-us</language>
<lastBuildDate>Tue, 10 Oct 2023 08:00:23 +0200</lastBuildDate><atom:link href="https://example.com/posts/index.xml" rel="self" type="application/rss+xml" />
<lastBuildDate>Sat, 14 Oct 2023 08:00:23 +0200</lastBuildDate><atom:link href="https://example.com/posts/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Blocking Twitch Ads by using streamlink to stream to VLC</title>
<link>https://example.com/posts/twitch-adblock-streamlink/</link>
<pubDate>Sat, 14 Oct 2023 08:00:23 +0200</pubDate>

<guid>https://example.com/posts/twitch-adblock-streamlink/</guid>
<description>Introduction Twitch keeps changing their backend, and it recently became more difficult to block ads. A few years ago, any ad blocker seemed to work just fine. Then they changed their code, and uBlock Origin, Adblock Plus, etc. all fail to remove ads. While there are still browser plugins that promise to block Twitch ads, many of them are potentially shady, as they route your traffic over some proxy server that does who-knows-what.</description>
</item>

<item>
<title>Hackintosh #2: Running Ventura using Haswell CPU and a spoofed AMD RX 6650 XT</title>
<link>https://example.com/posts/hackintosh-ventura-rx6650xt/</link>
Expand Down
117 changes: 117 additions & 0 deletions public/posts/twitch-adblock-streamlink/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<!DOCTYPE html>
<html><head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"><title>Blocking Twitch Ads by using streamlink to stream to VLC - Blog for Tech Enjoyers</title><link rel="icon" type="image/png" href=https://www.pngmart.com/files/23/Nerd-Emoji-PNG.png /><meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Your Browser adblocker is not working on Twitch? Read this." />
<meta property="og:image" content=""/>
<meta property="og:title" content="Blocking Twitch Ads by using streamlink to stream to VLC" />
<meta property="og:description" content="Your Browser adblocker is not working on Twitch? Read this." />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://example.com/posts/twitch-adblock-streamlink/" /><meta property="article:section" content="posts" />
<meta property="article:published_time" content="2023-10-14T08:00:23+02:00" />
<meta property="article:modified_time" content="2023-10-14T08:00:23+02:00" />
<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="Blocking Twitch Ads by using streamlink to stream to VLC"/>
<meta name="twitter:description" content="Your Browser adblocker is not working on Twitch? Read this."/>
<script src="https://example.com/js/feather.min.js"></script>

<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@1,500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Fira+Sans&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">


<link rel="stylesheet" type="text/css" media="screen" href="https://example.com/css/main.11f18f89079b6a945895b72d837341dfd89f35ac277810cdb01c507ea0faeb47.css" />
<link id="darkModeStyle" rel="stylesheet" type="text/css" href="https://example.com/css/dark.c95c5dcf5f32f8b67bd36f7dab66680e068fce2b303087294114aabf7a7c080b.css" disabled />



</head><body>
<div class="content"><header>
<div class="main">
<a href="https://example.com/">Blog for Tech Enjoyers</a>
</div>
<nav>

<a href="/posts">Posts</a>

<a href="/about">About</a>

<a href="/tags">Tags</a>

| <a id="dark-mode-toggle" onclick="toggleTheme()" href=""></a>
<script src="https://example.com/js/themetoggle.js"></script>

</nav>
</header>
<main>

<article>
<div class="title">
<h1 class="title">Blocking Twitch Ads by using streamlink to stream to VLC</h1>
<div class="meta">Posted on Oct 14, 2023</div>
</div>


<aside>
<hr>
Table of Contents:
<nav id="TableOfContents">
<ul>
<li><a href="#introduction">Introduction</a></li>
<li><a href="#setup">Setup</a></li>
<li><a href="#conclusion">Conclusion</a></li>
</ul>
</nav>
<hr>
</aside>


<section class="body">
<h2 id="introduction">Introduction</h2>
<p>Twitch keeps changing their backend, and it recently became more difficult to block ads. A few years ago, any ad blocker seemed to work just fine. Then they changed their code, and uBlock Origin, Adblock Plus, etc. all fail to remove ads. While there are still browser plugins that promise to block Twitch ads, many of them are potentially shady, as they route your traffic over some proxy server that does who-knows-what. Since I don&rsquo;t like routing my traffic over shady servers and I want to avoid testing browser extensions that have way too many privileges, I tried to find a different approach. IMO, the best way is to use <a href="https://github.com/streamlink/streamlink">Streamlink</a>, which is an excellent tool for routing a stream to a video player you have installed locally. It supports plugins, and there are <a href="https://streamlink.github.io/plugins.html#twitch">many plugins</a> available.</p>
<h2 id="setup">Setup</h2>
<p>The setup on Windows is simple: install the required Python version, download the binary for your version, add VLC to the path, and then just use the following command in the terminal:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cmd" data-lang="cmd"><span style="display:flex;"><span>streamlink.exe -p vlc &lt;twitch-channel-url&gt; best --twitch-disable-ads
</span></span></code></pre></div><p>This will automatically open VLC with the Twitch stream playing at the highest quality. The last parameter &ldquo;&ndash;twitch-disable-ads&rdquo; is taken from the Twitch Plugin documentation and sadly does not work as it should: while an ad is playing, the stream stops (frame freezes) and only continues after the ad is over (you don&rsquo;t see or hear anything of the ad). The same behavior happens if you don&rsquo;t use the &ldquo;&ndash;twitch-disable-ads&rdquo; flag. The only difference here is that the frozen frame shown is not the last frame of the stream you are watching, but instead the Twitch banner shown below:</p>
<p><img src="/images/twitch-stream-adblocking.png" alt="targets" title="Screenshot"></p>
<p>Okay, but why does the &ldquo;&ndash;twitch-disable-ads&rdquo; flag not work as expected? I did read in the documentation that VLC is not a recommended video player because of how it handles stream discontinuities. If you look at the CMD output during an ad, it will show:</p>
<p><img src="/images/streamlink-adblock-error.png" alt="targets" title="Screenshot"></p>
<p>If you read through the <a href="https://streamlink.github.io/cli/plugins/twitch.html#embedded-ads">Twitch Plugin Documentation</a>, you will notice that the authors mention this problem. While VLC did not crash for me, there were stream discontinuity warnings shown in the command line. But using a different player than VLC will not fix this issue, the authors of the documentation write: &ldquo;Unfortunately, entirely preventing embedded ads is not possible unless a loophole on Twitch gets discovered which can be exploited. This has been the case a couple of times now and ad-workarounds have been implemented in Streamlink (see #3210) and various ad-blockers, but the solutions did only last for a couple of weeks or even days until Twitch patched these exploits.&rdquo;</p>
<p>The only hope seems to be to set special API request headers using the &ldquo;&ndash;twitch-access-token-param&rdquo; flag that might or might not prevent embedded ads. However, even if you find a value that works, it is likely that Twitch will patch the workaround shortly after. Since my goal was to not be annoyed by repetitive ads, I am happy with the current solution of having an automatically paused stream.</p>
<h2 id="conclusion">Conclusion</h2>
<p>Streamlink is a good tool for using locally installed video players like VLC instead of having to visit bloated streaming websites. While it does allow you to mute ads (by stopping the video and silencing audio), Twitch does all it can to make it difficult to remove embedded ads. If you truly care about an ad-free Twitch experience, subscribing to Twitch Prime is the easiest and most boring solution.</p>

</section>

<div class="post-tags">


<nav class="nav tags">
<ul class="tags">

<li><a href="/tags/windows">windows</a></li>

<li><a href="/tags/tutorial">tutorial</a></li>

</ul>
</nav>


</div>
</article>



</main>
<footer>
<div style="display:flex"></div>
<div class="footer-info">
2023 <a
href="https://github.com/athul/archie">Archie Theme</a> | Built with <a href="https://gohugo.io">Hugo</a>
</div>
</footer>


</div>
</body>
</html>
29 changes: 16 additions & 13 deletions public/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,23 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://example.com/posts/twitch-adblock-streamlink/</loc>
<lastmod>2023-10-14T08:00:23+02:00</lastmod>
</url><url>
<loc>https://example.com/</loc>
<lastmod>2023-10-10T08:00:23+02:00</lastmod>
<lastmod>2023-10-14T08:00:23+02:00</lastmod>
</url><url>
<loc>https://example.com/posts/</loc>
<lastmod>2023-10-14T08:00:23+02:00</lastmod>
</url><url>
<loc>https://example.com/tags/</loc>
<lastmod>2023-10-14T08:00:23+02:00</lastmod>
</url><url>
<loc>https://example.com/tags/tutorial/</loc>
<lastmod>2023-10-14T08:00:23+02:00</lastmod>
</url><url>
<loc>https://example.com/tags/windows/</loc>
<lastmod>2023-10-14T08:00:23+02:00</lastmod>
</url><url>
<loc>https://example.com/tags/hackintosh/</loc>
<lastmod>2023-10-10T08:00:23+02:00</lastmod>
Expand All @@ -13,12 +28,6 @@
</url><url>
<loc>https://example.com/tags/macos/</loc>
<lastmod>2023-10-10T08:00:23+02:00</lastmod>
</url><url>
<loc>https://example.com/posts/</loc>
<lastmod>2023-10-10T08:00:23+02:00</lastmod>
</url><url>
<loc>https://example.com/tags/</loc>
<lastmod>2023-10-10T08:00:23+02:00</lastmod>
</url><url>
<loc>https://example.com/posts/hackintosh-project1/</loc>
<lastmod>2023-10-02T08:00:23+02:00</lastmod>
Expand Down Expand Up @@ -58,9 +67,6 @@
</url><url>
<loc>https://example.com/tags/gaming/</loc>
<lastmod>2023-07-27T22:50:00+02:00</lastmod>
</url><url>
<loc>https://example.com/tags/windows/</loc>
<lastmod>2023-07-27T22:50:00+02:00</lastmod>
</url><url>
<loc>https://example.com/tags/wxwidgets/</loc>
<lastmod>2023-07-27T22:50:00+02:00</lastmod>
Expand All @@ -85,9 +91,6 @@
</url><url>
<loc>https://example.com/posts/how-to-calculate-any-weekday/</loc>
<lastmod>2023-07-04T20:00:00+02:00</lastmod>
</url><url>
<loc>https://example.com/tags/tutorial/</loc>
<lastmod>2023-07-04T20:00:00+02:00</lastmod>
</url><url>
<loc>https://example.com/tags/hashing/</loc>
<lastmod>2023-07-03T21:50:00+02:00</lastmod>
Expand Down
Loading

0 comments on commit 7bcb55b

Please sign in to comment.