Created
November 1, 2020 03:18
-
-
Save sug0/ba30ca3e02a3c2bed8aabafce71d39ed to your computer and use it in GitHub Desktop.
Download the Old Testament in Portuguese from biblia.pt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| BOOK_GEN=50 | |
| BOOK_EXO=40 | |
| BOOK_LEV=27 | |
| BOOK_NUM=36 | |
| BOOK_DEU=34 | |
| BOOK_JOS=24 | |
| BOOK_JUI=21 | |
| BOOK_RUT=4 | |
| BOOK_1SA=31 | |
| BOOK_2SA=24 | |
| BOOK_1KI=22 | |
| BOOK_2KI=25 | |
| BOOK_1CH=29 | |
| BOOK_2CH=36 | |
| BOOK_EZR=10 | |
| BOOK_NEH=13 | |
| BOOK_EST=10 | |
| BOOK_JOB=42 | |
| BOOK_PSA=150 | |
| BOOK_PRO=31 | |
| BOOK_ECC=1 | |
| BOOK_SNG=8 | |
| BOOK_ISA=66 | |
| BOOK_JER=52 | |
| BOOK_LAM=5 | |
| BOOK_EZK=48 | |
| BOOK_DAN=12 | |
| BOOK_HOS=14 | |
| BOOK_JOL=4 | |
| BOOK_AMO=9 | |
| BOOK_OBA=1 | |
| BOOK_JON=4 | |
| BOOK_MIC=7 | |
| BOOK_NAM=3 | |
| BOOK_HAB=3 | |
| BOOK_ZEP=3 | |
| BOOK_HAG=2 | |
| BOOK_ZEC=14 | |
| BOOK_MAL=3 | |
| OUT=/tmp/bible_pt | |
| value_of() { | |
| printf $(eval 'echo $'$1) | |
| } | |
| download_chapter() { | |
| curl -sf "https://ibep.ubscloud.org/bibles/5c7cc7ee56becc2a-02/chapters/${1}.${2}?content-type=json&include-chapter-numbers=true&include-verse-numbers=true&include-notes=true&include-titles=true" -H 'user-token: anonymous' -H 'brand-id: SBP' -H 'x-api-key: 896f6f87-fc95-4605-b782-804b99b83800' -H 'Origin: https://biblia.pt' -H 'Referer: https://biblia.pt/' > ${OUT}/${1}/${2}.json | |
| } | |
| for b in \ | |
| GEN \ | |
| EXO \ | |
| LEV \ | |
| NUM \ | |
| DEU \ | |
| JOS \ | |
| JUI \ | |
| RUT \ | |
| 1SA \ | |
| 2SA \ | |
| 1KI \ | |
| 2KI \ | |
| 1CH \ | |
| 2CH \ | |
| EZR \ | |
| NEH \ | |
| EST \ | |
| JOB \ | |
| PSA \ | |
| PRO \ | |
| ECC \ | |
| SNG \ | |
| ISA \ | |
| JER \ | |
| LAM \ | |
| EZK \ | |
| DAN \ | |
| HOS \ | |
| JOL \ | |
| AMO \ | |
| OBA \ | |
| JON \ | |
| MIC \ | |
| NAM \ | |
| HAB \ | |
| ZEP \ | |
| HAG \ | |
| ZEC \ | |
| MAL; do | |
| n=`value_of BOOK_$b` | |
| mkdir -p $OUT/$b | |
| for i in `seq 1 $n`; do | |
| echo Downloading ${b}.${i} | |
| download_chapter $b $i & | |
| if [ `expr $i % 4` = 0 ]; then | |
| wait | |
| fi | |
| done | |
| done | |
| wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment