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
- #
- cd "${HOME}/articls/manga/get-novel"
- 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" "$@"
- }
- chapter=$((chapter-1))
- while true ; do
- chapter=$((chapter+1))
- if [[ -f "$novel/chapter_$chapter.txt" ]]
- then continue
- fi
- 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
- )
- if (( ${#data} <= 5 )) ; then
- echo
- echo "no data."
- exit
- fi
- echo "$data" > "$novel/chapter_$chapter.txt"
- sleep 7
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement