This repository has been archived by the owner on Jan 14, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathgetfromapi.php
141 lines (115 loc) · 5.93 KB
/
getfromapi.php
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<?php
header('Content-Type: application/json');
$curl = curl_init();
curl_setopt_array(
$curl,
array(
CURLOPT_URL => "https://sdk-os-static.mihoyo.com/hk4e_global/mdk/launcher/api/resource?channel_id=1&key=gcStgarh&launcher_id=10&sub_channel_id=0",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
)
);
$ResponcURL = json_decode(curl_exec($curl), true);
curl_close($curl);
// PEMBATAS
$CekAPI = array();
if ($ResponcURL['message'] != "OK") {
$CekAPI['name'] = 'Genshin Impact Data Links';
$CekAPI['site'] = 'genshin.mihoyo.com';
$CekAPI['error'] = true;
$CekAPI['message'] = 'Error fetching from API';
print_r(json_encode($CekAPI));
} else {
$CekAPI['name'] = 'Genshin Impact Data Links';
$CekAPI['site'] = 'genshin.mihoyo.com';
$CekAPI['error'] = false;
$CekAPI['message'] = 'success';
// PEMBATAS
$DataGameTerbaru = array(
'version' => $ResponcURL['data']['game']['latest']['version'],
'path' => $ResponcURL['data']['game']['latest']['path'],
'md5' => $ResponcURL['data']['game']['latest']['md5'],
);
$DataSuaraTerbaru = array();
foreach ($ResponcURL['data']['game']['latest']['voice_packs'] as $k => $v) {
$DataSuaraTerbaru['voice_packs'][$k]['language'] = $ResponcURL['data']['game']['latest']['voice_packs'][$k]['language'];
$DataSuaraTerbaru['voice_packs'][$k]['name'] = $ResponcURL['data']['game']['latest']['voice_packs'][$k]['name'];
$DataSuaraTerbaru['voice_packs'][$k]['path'] = $ResponcURL['data']['game']['latest']['voice_packs'][$k]['path'];
$DataSuaraTerbaru['voice_packs'][$k]['md5'] = $ResponcURL['data']['game']['latest']['voice_packs'][$k]['md5'];
};
$GabungGameSuaraTerbaru = array(
'latest' => array_merge($DataGameTerbaru, $DataSuaraTerbaru),
);
$DataUpgradeTerbaru = array();
foreach ($ResponcURL['data']['game']['diffs'] as $k0 => $v0) {
$DataUpgradeTerbaru[$k0]['version'] = $ResponcURL['data']['game']['diffs'][$k0]['version'];
$DataUpgradeTerbaru[$k0]['name'] = $ResponcURL['data']['game']['diffs'][$k0]['name'];
$DataUpgradeTerbaru[$k0]['path'] = $ResponcURL['data']['game']['diffs'][$k0]['path'];
$DataUpgradeTerbaru[$k0]['md5'] = $ResponcURL['data']['game']['diffs'][$k0]['md5'];
foreach ($ResponcURL['data']['game']['diffs'][$k0]['voice_packs'] as $k1 => $v1) {
$DataUpgradeTerbaru[$k0]['voice_packs'][$k1]['language'] = $ResponcURL['data']['game']['diffs'][$k0]['voice_packs'][$k1]['language'];
$DataUpgradeTerbaru[$k0]['voice_packs'][$k1]['name'] = $ResponcURL['data']['game']['diffs'][$k0]['voice_packs'][$k1]['name'];
$DataUpgradeTerbaru[$k0]['voice_packs'][$k1]['path'] = $ResponcURL['data']['game']['diffs'][$k0]['voice_packs'][$k1]['path'];
$DataUpgradeTerbaru[$k0]['voice_packs'][$k1]['md5'] = $ResponcURL['data']['game']['diffs'][$k0]['voice_packs'][$k1]['md5'];
}
}
$GabungDataUpgradeTerbaru = array(
'diffs' => array_merge($DataUpgradeTerbaru),
);
$GabungDataUpgradeTerbaru = array(
'game' => array_merge($GabungGameSuaraTerbaru, $GabungDataUpgradeTerbaru)
);
// PEMBATAS
$DataPlugin = array();
foreach ($ResponcURL['data']['plugin']['plugins'] as $k => $v) {
$DataPlugin['plugins'][$k]['name'] = $ResponcURL['data']['plugin']['plugins'][$k]['name'];
$DataPlugin['plugins'][$k]['path'] = $ResponcURL['data']['plugin']['plugins'][$k]['path'];
$DataPlugin['plugins'][$k]['md5'] = $ResponcURL['data']['plugin']['plugins'][$k]['md5'];
}
$GabungPlugin = array(
'plugin' => $DataPlugin
);
// PEMBATAS
$DataGamePraUnduh = array(
'version' => $ResponcURL['data']['pre_download_game']['latest']['version'],
'path' => $ResponcURL['data']['pre_download_game']['latest']['path'],
'md5' => $ResponcURL['data']['pre_download_game']['latest']['md5'],
);
$DataSuaraPraUnduh = array();
foreach ($ResponcURL['data']['pre_download_game']['latest']['voice_packs'] as $k => $v) {
$DataSuaraPraUnduh['voice_packs'][$k]['language'] = $ResponcURL['data']['pre_download_game']['latest']['voice_packs'][$k]['language'];
$DataSuaraPraUnduh['voice_packs'][$k]['name'] = $ResponcURL['data']['pre_download_game']['latest']['voice_packs'][$k]['name'];
$DataSuaraPraUnduh['voice_packs'][$k]['path'] = $ResponcURL['data']['pre_download_game']['latest']['voice_packs'][$k]['path'];
$DataSuaraPraUnduh['voice_packs'][$k]['md5'] = $ResponcURL['data']['pre_download_game']['latest']['voice_packs'][$k]['md5'];
};
$DataPraUnduh = array();
foreach ($ResponcURL['data']['pre_download_game']['diffs'] as $k0 => $v0) {
$DataPraUnduh[$k0]['version'] = $ResponcURL['data']['pre_download_game']['diffs'][$k0]['version'];
$DataPraUnduh[$k0]['name'] = $ResponcURL['data']['pre_download_game']['diffs'][$k0]['name'];
$DataPraUnduh[$k0]['path'] = $ResponcURL['data']['pre_download_game']['diffs'][$k0]['path'];
$DataPraUnduh[$k0]['md5'] = $ResponcURL['data']['pre_download_game']['diffs'][$k0]['md5'];
foreach ($ResponcURL['data']['pre_download_game']['diffs'][$k0]['voice_packs'] as $k1 => $v1) {
$DataPraUnduh[$k0]['voice_packs'][$k1]['language'] = $ResponcURL['data']['pre_download_game']['diffs'][$k0]['voice_packs'][$k1]['language'];
$DataPraUnduh[$k0]['voice_packs'][$k1]['name'] = $ResponcURL['data']['pre_download_game']['diffs'][$k0]['voice_packs'][$k1]['name'];
$DataPraUnduh[$k0]['voice_packs'][$k1]['path'] = $ResponcURL['data']['pre_download_game']['diffs'][$k0]['voice_packs'][$k1]['path'];
$DataPraUnduh[$k0]['voice_packs'][$k1]['md5'] = $ResponcURL['data']['pre_download_game']['diffs'][$k0]['voice_packs'][$k1]['md5'];
}
}
$GabungDataPraUnduh = array(
'diffs' => array_merge($DataPraUnduh),
);
$GabungGameSuaraPraUnduh = array(
'pre_download_game' => array_merge($DataGamePraUnduh, $DataSuaraPraUnduh, $GabungDataPraUnduh),
);
// PEMBATAS
$GabungSemua = array(
'data' => array_merge($GabungDataUpgradeTerbaru, $GabungPlugin, $GabungGameSuaraPraUnduh),
);
// PEMBATAS
$Hasil = array_merge($GabungSemua);
print_r(json_encode($Hasil));
}