Git Product home page Git Product logo

e-hentai-retriever's People

Contributors

s25g5d4 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

e-hentai-retriever's Issues

429 Too Many Request

Generally, retrieving more than 60 pages would result in a status code 429 error in "loadPage" of EhRetriever.retrieve(). Maybe we should add some sleeping mechanism.

A naive version:

function sleep(ms) {
  return new Promise(resolve => setTimeout(resolve, ms));
}
let fetchPage;
try {
    const url = `${this.ehentaiHost}/api.php`;
    const config = {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        // assign e = {'imgkey': ..., 'page': ...} to object literal {'method': ..., 'gid': ..., 'showkey': ...}
        // does not modify e
        body: JSON.stringify(Object.assign({
            method: 'showpage',
            gid: this.gallery.gid,
            showkey: this.showkey
        }, e))
    };
    let response = await this.fetch(url, config);
    while (response.status == 429) {
        await sleep(30000);
        response = await this.fetch(url, config);
    }
  
    if (!response.ok) {
       throw new Error(response.statusText);
    }
    fetchPage = await response.json();
} catch (error) {
    console.warn(error);
    throw error;
}

Archive Download

using JSZip
It is possible because GM_xmlhttpRequest supports cross origin request and responses with blob.

PTT User Report

see 8/10 abysszzz R: [推薦] e-hentai retriever 瀏覽器擴充腳本

g/891300/1776e1146d/

它有32張,我 e-hentai 的設定是只有 4 rows,我選大縮圖,
一row只能顯示5張,4 rows只有20張圖,所以總覽時會有兩頁 < 1 2 >
第一頁有20張圖,在第一頁點進隨便一張圖,

先按 Set Range, default 是 1 到 32 不動,按 Retrieve!

RangeError: invalid stop number: 31, start: 0(…)

trace

case 8:
if (!(stop < start || stop >= this.pages.length || isNaN(stop))) {
_context3.next = 10;
break;
}

throw new RangeError('invalid stop number: ' + stop + ', start: ' + start);

不合的原因是第二個,this.pages.length 是20 (見上述),stop是 31 >= 20

GM_xmlhttpRequest is not defined

My firefox version is 98.0.1(64 bit) and the e-hentai retriever version is 4.2.0. When I click the "Retrieve!" button, the firefox console shows "GM_xmlhttpRequest is not defined".

According to the StackOverflow, replacing the "GM_xmlhttpRequest " with "GM.xmlHttpRequest" fixed it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.