This repository has been archived by the owner on Sep 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
startp.sh
executable file
·82 lines (82 loc) · 1.44 KB
/
startp.sh
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
if [ ! -d Anime ]
then
echo "Making Anime directory.."
mkdir Anime
fi
cd Anime
pw=$(pwd)
IFS=$'\n'
if [ $# -ne 1 ]
then
echo "Enter link from https://twist.moe/"
read link
else
link=$1
fi
if [[ "$link" == "https://twist.moe/a/"* ]]
then
di=$(echo $link | cut -d "/" -f5)
else
di=$link
link="https://twist.moe/a/$link"
echo URL: $link
fi
if [ ! -d $di ]
then
echo "Creating $di"
mkdir $di
fi
if [ -f $di/list.txt ]
then
rm $di/list.txt
fi
string=$link
char="/"
sla=$(echo "${string}" | awk -F"${char}" '{print NF-1}')
x=$( echo $link | cut -d "/" -f6 )
if [[ $x == "" ]]
then
if [ $sla -eq 4 ]
then
one='/1'
link=$link$one
echo "making it $link"
fi
if [ $sla -eq 5 ]
then
one='1'
link=$link$one
echo "making it $link"
fi
fi
echo "Fetching info..."
slug=$di
# IFS=$' '
cd ..
for i in $(bash api.sh "${slug}")
do
if [[ $i == "https://"* || $i == "http://"* ]]; then
# already a url for some reason
j=$i
else
# j='https://twist.moe'
# j='https://twistcdn.bunny.sh'
j='https://cdn.twist.moe'
j=$j$i
fi
echo $j
echo $j >> $pw/$di/list.txt
done
cd Anime
echo "Creating $di/list.txt"
echo "copying download.sh to $di"
cp ../download.sh $di/
echo "Done"
echo "Check the Anime/$slug folder"
echo "Enjoy"
#rm $pw/.temp.txt
#rm $pw/$di/.t.txt
cd ../
chmod 777 list.sh
./list.sh $di