Skip to main content

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.

Hatch project flake8 Build and Publish PyPI - Downloads PyPI Lines of code GitHub commit activity

Features

  • flexible has_illustration and divide_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

  1. Install this package from pypi:
pip install linovelib2epub
  1. 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


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

linovelib2epub-0.0.9-py3-none-any.whl (25.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page