Coder Social home page Coder Social logo

novel_theft's Introduction

轻文解析器 (重新启动)

爬取轻小说,并打包成 EUPB,插图只嵌入开头,这次的目标是尽量做出 gui 界面,能够输入轻小说文库的某本小说的网址,就直接打包成 eupb。

第一步 爬取 txt 与 图片

之前没有吸取教训,下载的时候开了太多的线程,应该使用线程池来管理线程,而且 python 的 requests 模块实在不太好,这一次应该换用其他的 http 模块,更加鲁棒的。
首先来捋一捋思路,首先打开的是首页,而后需要获取的信息有:

  1. 小说名字,小说作者,小说封面 (小说封面一般被包含在插图中),这一方面主要是除开内容以外的信息。
  2. 小说目录,即每一卷的卷名,这主要是因为获取的文件都是以卷名为文件夹存储的,可能会有特殊卷,例如短篇什么的等等,这些特殊卷一般没有插图,需要特殊考虑。
  3. 每一卷下的章节内容以及插图,插图获取先获取 url,因为插图获取的时候会有一系列问题。 获取了以上信息之后,就可以根据 material 中的模板来将内容打包成 eupb 了。

第二步 打包成 eupb

首先需要理解 eupb 的文件结构:
|--META-INF
|----container.xml
|--OPS
|----css
|------main.css
|----images
|------xxx.jpg
|------yyy.jpg
|------...
|----chapter1.html
|----chapter2.html
|----...
|----coverpage.html
|----sen.ncx
|----sen.opf
|--mimetype

除了 .html 的内容需要生成以外,其他的都只要按照模板填写相关内容即可。

使用

使用参数 --url--txt 来使用该仓库:

--url [轻小说文库某小说主页]

使用示例:
python main.py --url https://www.wenku8.net/book/2285.htm

novel_theft's People

Contributors

clownrat6 avatar

Stargazers

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

Watchers

 avatar  avatar

novel_theft's Issues

参数输入

我虽然不太清楚arg_parser()这个方法为什么我这里没有,但稍微改一下就发现可以用了!
感谢大佬,真的很方便!

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.