Convert ebooks with few clicks on Telegram!

Overview

E-Book Converter Bot

Telegram Badge

Open Source Love made-with-python

PayPal Patreon Liberapay

A bot that converts e-books to various formats, powered by calibre! It currently supports 34 input formats and 19 output formats.

You can start using it or adding it to your group here on Telegram.

About the code:

This project is a modular bot, made using Python 3 and the following:

Bot features:

This bot aims to provide an easy way for telegram users to convert e-books from and to different formats.

It supports converting from the following formats:

['azw', 'azw3', 'azw4', 'azw8', 'cb7', 'cbc', 'cbr', 'cbz', 'chm', 'djvu', 'docx',
 'doc', 'epub', 'fb2', 'fbz', 'html', 'htmlz', 'kfx', 'kfx-zip', 'kpf', 'lit',
 'lrf', 'mobi', 'odt', 'opf', 'pdb', 'pml', 'prc', 'rb', 'rtf', 'snb', 'tcr',
 'txt', 'txtz']

To the following formats:

['azw3', 'docx', 'epub', 'fb2', 'htmlz', 'kfx', 'lit', 'lrf', 'mobi', 'oeb',
 'pdb', 'pmlz', 'rb', 'rtf', 'snb', 'tcr', 'txt', 'txtz', 'zip']

Some more features of the bot:

  • Force book direction to be RTL
  • Multilingual support, you can contribute and add your own languages if you want :).

Usage

  • Forward any supported file to the bot and choose the required format to convert to, and in few seconds the bot will reply you with the converted file.
  • The bot works in groups too. Reply with /convert to any file then do the same steps as in private.
  • You can change the preferences of the bot such as language using /settings or /preferences commands.

Before setting up the bot

  • Copy config.json.example file to config.json and fill the required information:
    {
      "tg_bot_token": "11111111:xxxxxxxxxxxxxxxxxx",
      "tg_bot_id": 111111111,
      "api_key": 1121221,
      "api_hash": "xxxxxxxxxxxxxxxxxxxx",
      "tg_bot_admins": [
        2222222
      ]
    }
  • Compile the translation files using the following command:
    make i18n-compile 

Setting up the bot

Before all, clone this repository.

Using Docker

  • Simply, run the following command:
docker-compose up --build -d

Without Docker [NOT RECOMMENDED]

Python dependencies

It requires Python 3.7 with pip v19+ installed or poetry if you use it.

Clone the repository and run any of the following commands:

Using poetry
poetry install
Using Pip
pip install .

Database

The bot depends on sqlite database. Make sure that your system has it installed.

Other requirements

You can go through the Dockerfile to see how the bot requirements are being installed.

  • The conversion process is done by utilizing Calibre and its ebook-convert, so make sure you have it installed.
  • To convert from and to KFX, you need to install KFX Input and KFX Output plugins in calibre, this can be done from the command line by using the following commands:
    # KFX Input
    wget https://plugins.calibre-ebook.com/291290.zip 
    calibre-customize -a 291290.zip
    # KFX Output
    wget https://plugins.calibre-ebook.com/272407.zip
    calibre-customize -a 272407.zip
  • Also, KFX Output plugin requires Kindle Previewer 3, which can run on linux under Wine.

Running the bot

If you finally managed to get all pieces in its place without using docker, run the bot using:

python3 -m ebook_converter_bot

Internationalization (i18n)

The bot uses gettext for internationalization and makefile for running i18n tasks easily.

  • First, generate .pot template using make i18n-generate-messages.
  • Update the current translation files using make i18n-merge, then edit the translation strings.
  • Compile the translation files using make i18n-compile.

To add a new language to the bot, run the following command (change 'ar' to your language code) then edit the new language file with translation and compile.

LANG=ar make i18n-init-lang
Owner
Youssif Shaaban Alsager
Python Developer, @XiaomiFirmwareUpdater Lead Developer, Open Source Enthusiast, and Technical Writer / Translator.
Youssif Shaaban Alsager
Text Summarizationcls app with python

Text Summarizationcls app This is the repo for the Text Summarization AI Project. It makes use of pre-trained Hugging Face models Packages Used The pa

Edem Gold 1 Oct 23, 2021
知乎评论区词云分析

zhihu-comment-wordcloud 知乎评论区词云分析 起源于:如何看待知乎问题“男生真的很不能接受彩礼吗?”的一个回答下评论数超8万条,创单个回答下评论数新记录? 项目代码说明 2.download_comment.py 下载全量评论 2.word_cloud_by_dt 生成词云 2

李国宝 10 Sep 26, 2022
Answer some questions and get your brawler csvs ready!

BRAWL-STARS-V11-BRAWLER-MAKER-TOOL Answer some questions and get your brawler csvs ready! HOW TO RUN on android: Install pydroid3 from playstore, and

9 Jan 07, 2023
一款高性能敏感词(非法词/脏字)检测过滤组件,附带繁体简体互换,支持全角半角互换,汉字转拼音,模糊搜索等功能。

一款高性能非法词(敏感词)检测组件,附带繁体简体互换,支持全角半角互换,获取拼音首字母,获取拼音字母,拼音模糊搜索等功能。

ToolGood 3.6k Jan 07, 2023
Wikipedia Extractive Text Summarizer + Keywords Identification (entropy-based)

Wikipedia Extractive Text Summarizer + Keywords Identification (entropy-based)Wikipedia Extractive Text Summarizer + Keywords Identification (entropy-based)

Kevin Lai 1 Nov 08, 2021
Bidirectionally transformed strings

bistring The bistring library provides non-destructive versions of common string processing operations like normalization, case folding, and find/repl

Microsoft 352 Dec 19, 2022
Auto translate Localizable.strings for multiple languages in Xcode

auto_localize Auto translate Localizable.strings for multiple languages in Xcode Usage put your origin Localizable.strings file in folder pip3 install

Wesley Zhang 13 Nov 22, 2022
Repository containing the code for An-Gocair text normaliser

Scottish Gaelic Text Normaliser The following project contains the code and resources for the Scottish Gaelic text normalisation project. The repo can

3 Jun 28, 2022
A minimal python script for generating multiple onetime use bip39 seed phrases

seed_signer_ontimes WARNING This project has mainly been used for local development, and creation should be ran on a air-gapped machine. A minimal pyt

CypherToad 4 Sep 12, 2022
Fuzzy string matching like a boss. It uses Levenshtein Distance to calculate the differences between sequences in a simple-to-use package.

Fuzzy string matching like a boss. It uses Levenshtein Distance to calculate the differences between sequences in a simple-to-use package.

SeatGeek 1.2k Jan 01, 2023
A slugifier that works in unicode

Unicode Slugify Unicode Slugify is a slugifier that generates unicode slugs. It was originally used in the Firefox Add-ons web site to generate slugs

Mozilla 315 Nov 21, 2022
Parse Any Text With Python

ParseAnyText A small package to parse strings. What is the work of it? Well It's a module to creates parser that helps to parse a text easily with les

Sayam Goswami 1 Jan 11, 2022
The Levenshtein Python C extension module contains functions for fast computation of Levenshtein distance and string similarity

Contents Maintainer wanted Introduction Installation Documentation License History Source code Authors Maintainer wanted I am looking for a new mainta

Antti Haapala 1.2k Dec 16, 2022
PyNews 📰 Simple newsletter made with python 🐍🗞️

PyNews 📰 Simple newsletter made with python Install dependencies This project has some dependencies (see requirements.txt) that are not included in t

Luciano Felix 4 Aug 21, 2022
Shows twitch pay for any streamer from Twitch leaked CSV files.

twitch_leak_csv_reader Shows twitch pay for any streamer from Twitch leaked CSV files. Requirements: You need python3 (you can install python 3 from o

5 Nov 11, 2022
Translate .sbv subtitle files

deepl4subtitle Deeplを使って字幕ファイル(.sbv)を翻訳します。タイムスタンプも含めて出力しますが、翻訳時はタイムスタンプは文の一部とは切り離されるので、.sbvファイルをそのまま翻訳機に突っ込むよりも高精度な翻訳ができるはずです。 つかいかた 入力する.sbvファイルの前処理

Yasunori Toshimitsu 1 Oct 20, 2021
Returns unicode slugs

Python Slugify A Python slugify application that handles unicode. Overview Best attempt to create slugs from unicode strings while keeping it DRY. Not

Val Neekman 1.3k Jan 04, 2023
TextStatistics - Get a text file wich contains English text

TextStatistics This program get a text file wich contains English text. The program analyses the text, and print some information. For this program I

2 Nov 15, 2021
Fixes mojibake and other glitches in Unicode text, after the fact.

ftfy: fixes text for you print(fix_encoding("(ง'⌣')ง")) (ง'⌣')ง Full documentation: https://ftfy.readthedocs.org Testimonials “My life is li

Luminoso Technologies, Inc. 3.4k Jan 08, 2023
A Python package to facilitate research on building and evaluating automated scoring models.

Rater Scoring Modeling Tool Introduction Automated scoring of written and spoken test responses is a growing field in educational natural language pro

ETS 59 Oct 10, 2022