ComicRead

Add enhanced features to the comic site for optimized experience, including dual-page reading and translation. E-Hentai (Associate nhentai, Quick favorite, Colorize tags, Floating tag list, etc.) | nhentai (Totally block comics, Auto page turning) | hitomi | hdoujin | SchaleNetwork | nude-moon | HentaiZap | IMHentai | HentaiEra | HentaiEnvy | kemono | nekohouse | MangaDex | welovemanga

< Feedback on ComicRead

Review: Good - script works

§
Posted: 2024-11-26

创作者大佬,我提一个任性的请求
我一直使用该插件的8.4.3版本,最近发现 E-hentai 网站使用不了
所以恳请大佬帮忙修一下8.4.3版本 E-hentai 无法加载图片的问题

hymbzAuthor
§
Posted: 2024-11-26

可以问下为什么不升级吗(

将9472行到9487行的

  /** 从详情页获取图片页的地址的正则 */
  const getImgFromDetailsPageRe = /(?<=<a href=").{20,50}(?="><img alt="\d+")/gm;

  /** 从详情页获取图片页的地址 */
  const getImgFromDetailsPage = async (pageNum = 0) => {
    const res = await main.request(`${window.location.pathname}${pageNum ? `?p=${pageNum}` : ''}`, {
      errorText: main.t('site.ehentai.fetch_img_page_url_failed')
    });

    // 从详情页获取图片页的地址
    const imgPageList = res.responseText.match(getImgFromDetailsPageRe);
    if (imgPageList === null) {
      if (res.responseText.includes('Your IP address has been temporarily banned for excessive')) throw new Error(main.t('site.ehentai.ip_banned'));
      throw new Error(main.t('site.ehentai.fetch_img_page_url_failed'));
    }
    return imgPageList;
  };

这段代码替换成

  /** 从详情页获取图片页的地址 */
  const getImgFromDetailsPage = async (pageNum = 0) => {
    const res = await main.request(`${window.location.pathname}${pageNum ? `?p=${pageNum}` : ''}`, {
      fetch: true,
      errorText: main.t('site.ehentai.fetch_img_page_url_failed')
    });
    const pageUrlList = [...res.responseText.matchAll(
    // 缩略图有三种显示方式:
    // 使用 img 的旧版,不显示页码的单个 div,显示页码的嵌套 div
     /<a href="(.{20,50})"><(img alt=.+?|div><div |div )title=".+?: (.+?)"/gm)].map(([, url]) => url);
    if (pageUrlList.length === 0) {
      if (res.responseText.includes('Your IP address has been temporarily banned for excessive')) throw new Error(main.t('site.ehentai.ip_banned'));
      throw new Error(main.t('site.ehentai.fetch_img_page_url_failed'));
    }
    return pageUrlList;
  };

就可以了。

§
Posted: 2024-11-27

修好了
感谢大佬!ヾ(≧▽≦*)o

Post reply

Sign in to post a reply.