-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhatsunia.cfd.js
87 lines (80 loc) · 1.96 KB
/
hatsunia.cfd.js
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
83
84
85
86
87
const axios = require('axios');
const fs = require('fs');
const path = require('path');
const reactions = [
"wave",
"wink",
"tea",
"bonk",
"punch",
"poke",
"bully",
"pat",
"kiss",
"kick",
"blush",
"feed",
"smug",
"hug",
"cuddle",
"cry",
"cringe",
"slap",
"five",
"glomp",
"happy",
"hold",
"nom",
"smile",
"throw",
"lick",
"bite",
"dance",
"boop",
"sleep",
"like",
"kill",
"tickle",
"nosebleed",
"threaten",
"depression",
"wolf_arts",
"jahy_arts",
"neko_arts",
"coffee_arts",
"wallpaper",
"mobileWallpaper"
];
async function downloadGif(reaction) {
const apiUrl = `https://hmtai.hatsunia.cfd/v2/${reaction}`;
try {
const response = await axios.get(apiUrl);
const gifUrl = response.data.url;
const gifName = gifUrl.split('/').pop(); // Extracting the name from the URL
const folderPath = path.join(__dirname, 'hatsunia.cfd', reaction);
const filePath = path.join(folderPath, gifName);
if (!fs.existsSync(filePath)) {
if (!fs.existsSync(folderPath)) {
fs.mkdirSync(folderPath, { recursive: true });
}
const gifResponse = await axios.get(gifUrl, { responseType: 'arraybuffer' });
fs.writeFileSync(filePath, gifResponse.data);
console.log(`[${reaction}] Downloaded ${filePath}`);
} else {
console.log(`[${reaction}] File ${gifName} already exists. Skipping...`);
}
} catch (error) {
console.error('Error:', error);
}
}
async function downloadGifs() {
let init = 0;
for (let i = 0; i < 10000; i++) {
if(init >= reactions.length) init = 0;
const reaction = reactions[init];
await downloadGif(reaction);
await new Promise(resolve => setTimeout(resolve, 100)); // 1-second delay
init = init+1
}
}
downloadGifs();