Last active
March 30, 2023 16:35
-
-
Save mhay10/9e905f016b1ad3e119f1a613089773bb to your computer and use it in GitHub Desktop.
Downloads audiobooks from sites like https://goldenaudiobooks.com, https://hdaudiobook.com, and https://bigaudiobooks.net
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/bash | |
| function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; } | |
| if [ "$1" = "" ]; then | |
| echo "Usage: $(basename $0) <audiobook url> <output dir - optional>" | |
| exit 1 | |
| fi | |
| book_url=$1 | |
| [ "$2" != "" ] && output_dir=$2 || output_dir="." | |
| book_res=$(curl -s $book_url) | |
| audio_urls=($(echo $book_res | grep -Po '(?<=><a href=")https:\/\/ipaudio\.club\/.*?(?=">)')) | |
| count=1 | |
| for url in ${audio_urls[@]}; do | |
| filename="$(urldecode $(echo $url | perl -n -e ' /(?<=uploads)(\/.*?\/)(.*)(?=\/)/ && print $2'))_$count.mp3" | |
| mkdir -p $output_dir &> /dev/null | |
| echo "Now downloading file $count of ${#audio_urls[@]}" | |
| curl -s $url -o "$output_dir/$filename" | |
| ((count++)) | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment