-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'm3u-prune' does not work in AdGuard for MacOS #471
Comments
I can reproduce it in Safari only and the same problem occurs with
So if I understand correctly, Safari natively download it, so it cannot be intercepted by scriptlet (only by |
As a workaround we could override For example: adultswim.com#%#(()=>{const e=new Set(["application/vnd.apple.mpegURL","application/x-mpegURL","audio/mpegurl","audio/x-mpegurl"]),p={apply:(p,o,a)=>{const n=a[0];return location.href.includes("/streams")&&e.has(n)?"":Reflect.apply(p,o,a)}};window.HTMLVideoElement.prototype.canPlayType=new Proxy(window.HTMLVideoElement.prototype.canPlayType,p)})(); Code:(() => {
const streamLocation = '/streams';
const notAllowedTypes = new Set([
'application/vnd.apple.mpegURL',
'application/x-mpegURL',
'audio/mpegurl',
'audio/x-mpegurl',
]);
const wrapper = (target, thisArg, args) => {
const type = args[0];
// Override the return value of canPlayType to empty string if the type is not allowed
// and only if the location is the stream location.
// For some reason it breaks not live videos in Safari, on "adultswim.com/videos/"
if (location.href.includes(streamLocation) && notAllowedTypes.has(type)) {
return '';
}
return Reflect.apply(target, thisArg, args);
};
const handler = {
apply: wrapper,
};
window.HTMLVideoElement.prototype.canPlayType = new Proxy(
window.HTMLVideoElement.prototype.canPlayType,
handler,
);
})(); But it should be done only for live streams, because for some reason it breaks video player on |
US IP is required.
AdGuard for Mac 2.16.1.1862 nightly.
Steps to reproduce
Actual behaviour
Ad preroll (with the ad label. They also have unblockable video ad in the stream).
Example of
m3u8
filehttps://regex101.com/r/jYclr1/1
Details
I also checked in Chrome with the browser extension - with following unblocking rules I see ads:
When I disable the first unblocking rule, ads are blocked.
The text was updated successfully, but these errors were encountered: