Skip to main content

libert

CLI instantânea para download de livros do welib — o "yt-dlp dos livros": cola o link (ou lista), e o livro chega em segundos.

Instale via PyPI:

pip install libert

Uso rápido

libert <URL_DO_WELIB>
libert -f pdf <URL_DO_WELIB>
libert --format epub <URL_DO_WELIB>
libert -l links.txt
libert --list ./meus-links.txt
libert            # abre o menu interativo

Exemplo:

libert https://pt.welib.st/md5/55d053185d2b4871c7a0549b997135f9

Como fica instantâneo (v0.3)

O libert resolve o arquivo sem esperar, por rotas paralelas — a primeira que responder vale o download:

  1. CDN direta (partner) — encontra o js-partner-download-link (📚 Download) dentro das páginas slow_download/fast_download e baixa o arquivo original imediatamente (a espera de minutos não existe: o link já vem pronto no HTML); com validação anti-livro-diferente (o md5 do livro precisa estar no URL do CDN);
  2. IPFS em corrida (race) — 10+ gateways disparados em paralelo; o primeiro que devolver bytes reais (não HTML) ganha o download;
  3. libgen — link direto do file.php, último recurso.

Extras de robustez:

  • Sessão cloudscraper aquecida passa o desafio Cloudflare sem browser; challenge → retry espelhado e escalonado automaticamente.
  • Rate-limit não aborta: o libert respira (8s → 20s) e resolve de novo, sozinho — você não precisa re-executar o comando.
  • Lote em pipeline: enquanto baixa o livro atual, o próximo já está sendo resolvido em background. Zero segundo morto entre livros; sem pausa fixa de 3s e sem "educar" o servidor quando ele não reclama.
  • Link partner que vira HTML (token expirado) é re-resolvido na hora.
  • Validação de conteúdo: PDF/EPUB/MOBI checados por magic bytes; se o servidor devolver HTML, nada é salvo.
  • URLs de download coladas direto (.../slow_download/<md5>/...) viram página do livro automaticamente.
  • Espelhos automáticos (welib.org, welib.st, pt/en/es.welib.st).
  • Arquivos salvos em ~/Downloads (Linux) ou ~/storage/downloads (Termux); nunca sobrescreve (adiciona (1), (2)…).
  • Barra de progresso com tamanho, % e velocidade.

Menu interativo (libert sem argumentos)

=== libert - Gerenciador de Downloads do welib ===

  [1] Baixar um único livro (inserir URL)
  [2] Baixar múltiplos livros (colar lista de URLs)
  [3] Baixar a partir de arquivo de texto (ex: links.txt)
  [0] Sair

Escolha uma opção (0-3):

Lote (batch)

[1/3] https://pt.welib.st/md5/aaa...
[+] Livro: "Nome do Livro"
[+] Link direto do arquivo resolvido.
                     Baixando Nome do Livro.pdf ━━━━━ 100% ...
[+] Concluído em 6.4s → ~/Downloads/Nome do Livro.pdf
[2/3] https://pt.welib.st/md5/bbb...
...
[+] Resumo: 3 baixado(s) com sucesso, 0 falha(s) de 3.

Arquivo .txt de exemplo (links.txt):

# meus livros
https://pt.welib.st/md5/55d053185d2b4871c7a0549b997135f9
https://welib.org/md5/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Linhas vazias e # são ignoradas; texto extra antes da URL é aceito.

Opções

libert [-f FORMATO] [-o PASTA] [-l ARQUIVO.txt] [URL]
libert -V

Notas

  • O welib limita ritmo por IP; o libert já respeita isso de forma adaptativa (sem pausas fixas) e recupera sozinho quando esbarra no limite.
  • Formatos conversão (convert/epub, etc.) usados quando você pede -f.

Desenvolvimento

pip install -e .
python -m build

Licença

MIT

Metadata

Release files for libert 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for libert 0.3.0
File Size Uploaded Provenance
libert-0.3.0.tar.gz 16.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for libert 0.3.0
File Interpreter ABI Platform
libert-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 33.9 kB

Release files / libert-0.3.0.tar.gz

Download URL libert-0.3.0.tar.gz
Size 16.7 kB
Tags Source
SHA-256 checksum
How to use checksums
60483227da2102d93985ba8ae9dceb9c7d3c2f732e4b1868cd1b32bf9241ab48
BLAKE2b-256 checksum
How to use checksums
f10fe57a12dbb2988259cd01a7cdf9f342bc4964994146fe4a2c6c0c20f24a89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / libert-0.3.0-py3-none-any.whl

Download URL libert-0.3.0-py3-none-any.whl
Size 17.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4a4102e67ec183821fb73944ce0d72f96aaf556212fddde22b4dbc292464e37b
BLAKE2b-256 checksum
How to use checksums
9902c60f1d1fc9f9a814909a56de329417b0ff32d0ec706f3c960d613e33f814
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Security for libert 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page