Git Product home page Git Product logo

eh-downloader's Introduction

E站本子下载脚本

作为全局命令使用

$ npm install -g https://github.com/Chocolatl/ehentai-downloader.git

$ git clone https://github.com/Chocolatl/ehentai-downloader.git
$ npm install -g ehentai-downloader

注意:在Windows下请使用管理员身份运行PowerShell执行以上命令

完整下载

$ eget <url> [path]

  参数
    url  本子详情页面的URL
    path 存放目录路径,不存在会自动创建,默认为当前工作目录

  示例
    $ eget https://e-hentai.org/g/1008611/abcdefghij/
    $ eget https://e-hentai.org/g/1008611/abcdefghij/ D:\

范围下载

$ eget <url> <path> <range>

  参数
    range 下载范围

  示例
    $ eget https://e-hentai.org/g/1008611/abcdefghij/ . 0-2,7,8,9
    $ eget https://e-hentai.org/g/1008611/abcdefghij/ D:\ 120-140
    $ eget https://e-hentai.org/g/1008611/abcdefghij/ D:\ 20-10000

注意:downloadLog选项优先级更高,如果开启downloadLog且下载目录存在download.json,范围下载会被忽略

配置文件

配置文件config.yml中包含所有下载配置项,及配置项的详细说明

eget --config命令打印配置文件路径,通过以下方式编辑配置文件:

Linux
  $ vi $(eget --config)

Windows PowerShell
  $ $config = eget --config
  $ explorer $config

作为项目依赖使用

$ npm install --save https://github.com/Chocolatl/ehentai-downloader.git
const CONFIG = {
  download: {
    threads: 5,
    // ...
  }
  login: {
    // ...
  }
}   // 可用的配置项请参照config.yml

const downloadGallery = require('ehentai-downloader')(CONFIG);

downloadGallery('https://e-hentai.org/g/1008611/abcdefghij/', 'D:\\doujinshi').then(ev => {
  
  console.log(ev.dirPath);  // 下载位置
  console.log(ev.dirName);  // 目录名
  console.log(ev.length);   // 总长度

  ev.on('download', info => {
    // 一张图片下载成功
  });

  ev.on('fail', (err, info) => {
    // 一张图片下载失败
  });

  ev.on('done', _ => {
    // 下载结束
  });

  ev.on('error', err => {
    // 下载过程中出现异常
    // 如果发生此事件,本次下载的完整性将无法保证
  });

}).catch(err => {
  // 解析过程中出现异常
});

已知问题

该脚本在某大型局域网环境中即使正确配置config.yml中的Proxy选项可能依然无法使用,这时需要关闭Proxy配置并使用全局代理,如使用Proxifier

TODO

  • 使用作品名自动创建文件夹
  • 账号登录
  • 下载原图
  • 范围下载
  • 保存下载进度记录
  • 使用进度记录继续下载
  • 通过SOCKS(5)代理下载
  • 对exhentai的支持
  • 解决图片有时下载不完整的问题
  • 使用原文件名保存图片
  • 貌似有点..坏了?..有空需要修一下
  • 重写重试逻辑

License

GLWT(Good Luck With That) 公共授權條款
版權所有 (c) 任何人,除了開發者

任何人都有權複制、發行、修改、合併、出售、出版、再授權本軟
件,或用作任何其他用途,但一切風險需自行負擔。

開發者對本轉案內的原始碼一無所知。
它可能可以運行也可能不可以,沒有其他情況。


        GOOD LUCK WITH THAT 公共授權條款
            複制、發行及修改的條款與約束

零:在不導致開發者被指責或追究的情況下,你想做什麼都可以。

在任何情況下,無論是因合同、侵權行為還是由本軟件或使用本軟
件或其他交易所衍生或與之相關,開發者一概不負責任何索償、損
壞或其他責任。

祝你好運及一帆風順。

eh-downloader's People

Contributors

chocolatl 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  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

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.