diff --git a/README.md b/README.md index 6439526..29596b0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# ickabog-ebook ![](https://img.shields.io/badge/Chapters%20Published-64-yellow) +# ickabog-ebook ![](https://img.shields.io/badge/Chapters%20Published-64-green) -Generates ebooks for The Ickabog by J.K Rowling. Original text from https://www.theickabog.com/. Supports all 9 languages. Note that not all languages have the complete book translated yet, but the english variants are now complete. +Generates ebooks for The Ickabog by J.K Rowling. Uses original text from https://www.theickabog.com/. Supports all 9 languages. ## Dependencies: diff --git a/generate.sh b/generate.sh index 3a7ee53..e156798 100755 --- a/generate.sh +++ b/generate.sh @@ -13,11 +13,17 @@ LC=${LC:-""} if [[ "$LC" != "" ]]; then LC="/$LC" fi -MAIN_STORY_URL="https://web.archive.org/web/20200713135719/https://www.theickabog.com$LC/read-the-story/" + +if [[ "$LC" == "" || "$LC" == "en-US" ]]; then + MAIN_STORY_URL="https://web.archive.org/web/20200713135650/https://www.theickabog.com/$LC/read-the-story/" +else + # Non-english editions are still accessible on the original website. + MAIN_STORY_URL="https://www.theickabog.com$LC/read-the-story/" +fi echo "[+] Fetching $MAIN_STORY_URL" -wget --quiet "$MAIN_STORY_URL" --output-document "$MAIN_STORY_OUTPUT_FILE" +wget --quiet --timeout=10 "$MAIN_STORY_URL" --output-document "$MAIN_STORY_OUTPUT_FILE" LANG=$(cat "$MAIN_STORY_OUTPUT_FILE"| pup 'html attr{lang}') echo "[+] Language set to $LANG" @@ -31,8 +37,18 @@ echo "$MAIN_TITLE$3" >> "$HTML_FILE" cat "html/$2.html" | pup -p --charset UTF-8 'article div.row:nth-child(2) div.entry-content' >> "$HTML_FILE" }