D
D
Drovosek012021-02-20 13:09:52
JavaScript
Drovosek01, 2021-02-20 13:09:52

How to do this with an ad blocker?

There is a site for creating mirror links - https://multiup.org/

If you download a file, follow the generated link and click on the Download button there, a page with links to resources will open from where you can download this file.

Here is an example of such a file - https://multiup.org/download/78eb1a42294c2b3e2e94d...

The problem is that when we are under the resource icon (for example, Mega.co.nz) from which we want to download, we first click on the "Download" button ", then we are thrown to the left advertising site. If you go back by clicking the back button in the browser and click on this button again, it will already transfer you to the site we need from which you can download the file.

I looked at the page code in DevTools, this is what I saw:
6030dd77f1e49748151879.png

After experimenting, I found that the best option would be if the button from the form is moved one level higher, making it a child of the footer tag. Remove form tag. Replace the buton tag with the "a" tag and replace the link attribute in it with href.
It will turn out like this:
6030de3e754f6888325130.png

I read a little about creating my own filters and realized that these filters can only block certain parts of the page, but I need to do various manipulations with parts of the page.

Can the change described above be done using filters or some other features of ad blockers? (I'm using uBlock Origin, so it's advisable to use its features) If so, how? What to google, in what direction to "drip"?

I can write a javascript function that can do the above manipulations, but how can I make it run exactly on the site I need?

Maybe there are better ways to make it so that the multiup site does not transfer to advertising resources?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Tim, 2021-02-20
@Drovosek01

On the desired site, you can run scripts, for example, through Tampermonkey.
In the match parameter, specify on which site to run the script. More details can be found in the documentation https://www.tampermonkey.net/documentation.php
In this example, when you click, you will be redirected immediately to the link from the link attribute

// ==UserScript==
// @name         multiup
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://multiup.org/en/mirror/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    setTimeout(() => {
        $('form').on('submit', function(e) {
            e.preventDefault();
            console.log('click')
            window.location.href = $(this).find('button').attr('link');
        })
    })
})();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question