-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathinstall.sh
executable file
·51 lines (44 loc) · 1.68 KB
/
install.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
#!/bin/bash
GREEN='\033[0;32m'
BLUE='\033[0;34m'
RED='\033[0;31m'
NC='\033[0m'
echo -e "${BLUE}=== TikTok API Downloader & Stalker Installation Script ===${NC}\n"
echo -e "${BLUE}=== Created by TobyG74 / Tobz ===${NC}\n"
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
echo -e "${RED}Node.js is not installed. Please install Node.js first.${NC}"
echo "Visit https://nodejs.org to download and install Node.js"
exit 1
fi
# Check Node.js version
NODE_VERSION=$(node -v | cut -d 'v' -f 2)
if (( $(echo "$NODE_VERSION < 10" | bc -l) )); then
echo -e "${RED}Node.js version 10 or higher is required.${NC}"
echo "Current version: $NODE_VERSION"
echo "Please upgrade Node.js and try again."
exit 1
fi
echo -e "${GREEN}Node.js version $NODE_VERSION detected${NC}"
# Detect package manager
if command -v yarn &> /dev/null; then
echo -e "\n${BLUE}Installing using Yarn...${NC}"
yarn add @tobyg74/tiktok-api-dl
elif command -v npm &> /dev/null; then
echo -e "\n${BLUE}Installing using NPM...${NC}"
npm install @tobyg74/tiktok-api-dl
else
echo -e "${RED}Neither npm nor yarn is installed. Please install a package manager.${NC}"
exit 1
fi
# Installation complete
echo -e "\n${GREEN}Installation completed successfully!${NC}"
echo -e "\n${BLUE}Usage examples:${NC}"
echo "1. Import the library:"
echo " const Tiktok = require('@tobyg74/tiktok-api-dl')"
echo -e "\n2. Download TikTok video:"
echo " Tiktok.Downloader('https://vt.tiktok.com/xxxxxxxx', {"
echo " version: 'v1'"
echo " }).then((result) => console.log(result))"
echo -e "\n3. For more examples and documentation, visit:"
echo " https://github.com/TobyG74/tiktok-api-dl#examples"