Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # this script will download all available chapters
- # of the light novel starting from a given chapter
- # get the novel id from the website
- # example : 888141268 is the id of:
- # this hero is overpowred but overly cautious
- #
- novel="$1"
- chapter="$2"
- [[ -z "$chapter" ]] && chapter=1
- if ! [[ -d "$novel" ]] ; then
- mkdir "$novel"
- fi
- function CURL (){
- userAgent="Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:48.0) "
- userAgent+="Gecko/20100101 Firefox/48.0"
- curl -s -A "$userAgent" "$@"
- }
- while true ; do
- echo "getting chapter $chapter"
- echo -en "\e[1A"
- data=$(
- CURL "https://bestlightnovel.com/novel_$novel/chapter_$chapter"|
- sed -n '/<div id="vung_doc" class="vung_doc">/,/<\/div>/p' |
- sed 's/<div id="vung_doc" class="vung_doc">//' |
- sed 's/<p>/\n\n/g'|sed 's/<[^>]*>//g'|fmt -w 75
- )
- (( ${#data} <= 5 )) && exit
- echo "$data" > "$novel/chapter_$chapter.txt"
- chapter=$(($chapter+1))
- sleep 7
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement