-
Notifications
You must be signed in to change notification settings - Fork 1
/
tools.bash
executable file
·56 lines (44 loc) · 1.27 KB
/
tools.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env bash
# Functions related to making new scrapers and other misc stuff
# shellcheck disable=SC2016
_usage() {
printf "%b" "Lol, something else.\n"
exit 0
}
main() {
[[ $# = 0 ]] && _usage
NAME="${1:?1 - Provide name.}"
read -rd '' SCRIPT << 'EOF'
#!/usr/bin/env bash
# Functions related to dummymanga
# shellcheck disable=SC2016
_search_manga_dummymanga() {
declare input="${1}" num_of_search="${2}"
export TOTAL_SEARCHES OPTION_NAMES NAMES SLUGS
}
_set_manga_variables_dummymanga() {
declare option="${1}"
SLUG="${SLUGS[$((option - 1))]}"
NAME="${NAMES[$((option - 1))]}"
export SLUG NAME
}
_fetch_manga_details_dummymanga() {
declare url="${1:-${URL}}" fetch_name="${2:-}"
export SLUG PAGES REFERER="dummymanga"
}
_download_chapter_dummymanga() {
curl -s -L --compressed "${rest_of_the_url}${page}" -w "\n%{http_code}\n"
}
_count_images_dummymanga() {
TOTAL_IMAGES="$(: "$(for page in "${PAGES[@]}"; do
{
printf "%s\n" "${images}" >| "${page}/${page}"_images
_count < "${page}/${page}"_images
} &
done)" && printf "%s\n" "$((${_//$'\n'/ + }))")"
export TOTAL_IMAGES
}
EOF
printf "%s\n" "${SCRIPT//dummymanga/${NAME}}" >| utils/"${NAME}"-scraper.bash
}
main "${@}"