xuzhengyi1995 / Manga_downloader

A Manga download framework using selenium.
607 stars 57 forks source link

bw的自动翻页代码求更新 #138

Open dlsx000 opened 1 year ago

dlsx000 commented 1 year ago

之前的失效了,不知该怎么改

jawsh1102 commented 1 year ago

I'm getting the same error, the page turn function won't work. Hopefully it can be fixed soon

xuzhengyi1995 commented 1 year ago

Updated, please use:

  window.i=0;setInterval(()=>{NFBR.a6G.Initializer.d9M.menu.options.a6l.moveToPage(window.i);console.log(window.i);window.i++;},3000)
jawsh1102 commented 1 year ago

Updated, please use:

  window.i=0;setInterval(()=>{NFBR.a6G.Initializer.d9M.menu.options.a6l.moveToPage(window.i);console.log(window.i);window.i++;},3000)

Thank you! Works perfectly again.

jawsh1102 commented 1 year ago

The same error is happening again with the new command image

ww9592447 commented 1 year ago

新函數 NFBR.a6G.Initializer.L7v.menu.options.a6l.moveToPage

xuzhengyi1995 commented 1 year ago

新函數 NFBR.a6G.Initializer.L7v.menu.options.a6l.moveToPage

Thanks! Will consider adding an auto click turn pages feature in the browser, so we could auto turn pages no matter how they update the script.

chierinyan commented 10 months ago

新函數 NFBR.a6G.Initializer.L7v.menu.options.a6l.moveToPage

Thanks! Will consider adding an auto click turn pages feature in the browser, so we could auto turn pages no matter how they update the script.

Before we implement that, here's a workaround to detect updated javascript, rewritten from website_actions.

I've also added the check_is_loading function which avoids missing pages.

It's tested on bookwalker.com.tw, and should also work for bookwalker.jp

I'd appreciate others testing it and letting me know if it works for you as well.

function isLoaded() {
    for (e of document.querySelectorAll('.loading')) {
        if (getComputedStyle(e).visibility === "visible") return false;
    }
    return true;
}

let options;
for (key of Object.keys(NFBR.a6G.Initializer)) {
    if (Object.keys(NFBR.a6G.Initializer[key]).includes('menu')) {
        options = NFBR.a6G.Initializer[key].menu.options.a6l;
        break;
    }
}

options.setSpreadDouble(false);

const total = parseInt(document.querySelector('#pageSliderCounter').innerText.split('/')[1])

const checkLoading = setInterval(function() {
    const current = parseInt(document.querySelector('#pageSliderCounter').innerText.split('/')[0])
    console.log('Waiting for page', current);
    if (isLoaded()) {
        console.log('Page loaded');
        if (current < total) {
            options.moveToNext();
        } else {
            console.log('Finished!');
            clearInterval(checkLoading);
        }
    }
}, 1000);