Craw light novel from [哔哩轻小说(linovelib)](https://w.linovelib.com/) and convert to epub.
Project description
linovelib2epub
Craw light novel from 哔哩轻小说(linovelib) and convert to epub.
Features
- flexible
has_illustration
anddivide_volume
option for epub output - built-in http request retry mechanism to improve network fault tolerance
- built-in random browser user_agent through fake_useragent library
- built-in strict integrity check about image download
- built-in mechanism for saving temporary book data by pickle library
- use multi-thread to download images
- support add custom css style to epub
Usage
- Install this package from pypi:
pip install linovelib2epub
- create a python file and edit the content as follows:
from linovelib2epub.linovel import Linovelib2Epub
# warning!: must run within __main__ module guard due to process spawn issue.
if __name__ == '__main__':
linovelib_epub = Linovelib2Epub(book_id=3279)
linovelib_epub.run()
If it finished without errors, you can see the epub file is under the folder where your python file is located.
Options
Parameters | type | required | default | description |
---|---|---|---|---|
book_id | number | YES | None | 书籍ID。 |
base_url | string | NO | 'https://w.linovelib.com/novel' | 哔哩轻小说主页URL |
divide_volume | boolean | NO | False | 是否分卷 |
has_illustration | boolean | NO | True | 是否下载插图 |
image_download_folder | string | NO | "images" | 图片下载临时文件夹. 不允许以相对路径../开头。 |
pickle_temp_folder | string | NO | "pickle" | pickle临时数据保存的文件夹。 |
http_timeout | number | NO | 10 | 一个HTTP请求的超时等待时间(秒)。代表connect和read timeout。 |
http_retries | number | NO | 5 | 当一个HTTP请求失败后,重试的最大次数。 |
http_cookie | string | NO | '' | 自定义HTTP cookie。 |
custom_style_cover | string | NO | [See source code] | 自定义cover.xhtml的样式 |
custom_style_nav | string | NO | [See source code] | 自定义nav.xhtml的样式 |
custom_style_chapter | string | NO | [See source code] | 自定义每章(?.xhtml)的样式 |
Todo
- (improvement) logging level: info or succinct
- (feat) enable a download certain chapter of one book.
- (quality) setup pytests and codecov
Acknowledgements
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for linovelib2epub-0.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54888c179fd721b0b79f72118e4935a095aaa58e4839ba00a7f308790f5d8036 |
|
MD5 | c9843a078b23ea85c7a603aee299c4a9 |
|
BLAKE2b-256 | f80655355f0fbdd68c560b69953069e3193bb0f6a44dd04862902e4e95b746be |