fullpwerr commited on
Commit
16bd39e
·
1 Parent(s): 70399c1
Files changed (9) hide show
  1. lib/fb.js +2 -2
  2. lib/ig.js +1 -1
  3. lib/kuaishou.js +2 -1
  4. lib/qqm.js +1 -1
  5. lib/qqmusic.js +2 -1
  6. lib/skrep.js +4 -0
  7. lib/snapchat.js +1 -0
  8. lib/soundcloud.js +4 -0
  9. lib/spotify.js +3 -4
lib/fb.js CHANGED
@@ -79,10 +79,10 @@ async function fbdl(url) {
79
  return { status: 200, title: "", thumbnail, video }
80
  } catch (e) {
81
  if (!(e instanceof SyntaxError)) throw e
82
- return { error: true, message: eval(js.split(" = ")[1]) }
83
  }
84
  } catch (error) {
85
- return { error: true, message: "Failed to fetch data" }
86
  }
87
  }
88
 
 
79
  return { status: 200, title: "", thumbnail, video }
80
  } catch (e) {
81
  if (!(e instanceof SyntaxError)) throw e
82
+ return { status: 401, error: true, message: eval(js.split(" = ")[1]) }
83
  }
84
  } catch (error) {
85
+ return { status: 401, error: true, message: "Failed to fetch data" }
86
  }
87
  }
88
 
lib/ig.js CHANGED
@@ -64,7 +64,7 @@ async function igdl(url) {
64
  return res;
65
  } catch (err) {
66
  console.error("[ERROR IG]\n\n", e);
67
- return null;
68
  }
69
  }
70
  module.exports = igdl;
 
64
  return res;
65
  } catch (err) {
66
  console.error("[ERROR IG]\n\n", e);
67
+ return { status: 401, message: err.message};
68
  }
69
  }
70
  module.exports = igdl;
lib/kuaishou.js CHANGED
@@ -56,6 +56,7 @@ async function scrapeKuaishou(url) {
56
  const x_1a = decodedResult[photoKey];
57
 
58
  const res = {
 
59
  userInfo: {
60
  id: x_1a.photo.userId,
61
  username: x_1a.photo.kwaiId,
@@ -104,7 +105,7 @@ async function validasi(url, maxRetries = 3) {
104
  console.log("Gagal, mencoba ulang...");
105
  }
106
  console.error("Scraping gagal setelah 3 kali percobaan.");
107
- return null;
108
  }
109
 
110
  module.exports = validasi;
 
56
  const x_1a = decodedResult[photoKey];
57
 
58
  const res = {
59
+ status: 200,
60
  userInfo: {
61
  id: x_1a.photo.userId,
62
  username: x_1a.photo.kwaiId,
 
105
  console.log("Gagal, mencoba ulang...");
106
  }
107
  console.error("Scraping gagal setelah 3 kali percobaan.");
108
+ return { status: 401, message: "eror"};
109
  }
110
 
111
  module.exports = validasi;
lib/qqm.js CHANGED
@@ -80,7 +80,7 @@ async function getInfo(url) {
80
  }))
81
  });
82
  } catch (e) {
83
- reject(`Parsing Error: ${e.message}`);
84
  }
85
  });
86
  });
 
80
  }))
81
  });
82
  } catch (e) {
83
+ reject({ status: 401, message: e.message});
84
  }
85
  });
86
  });
lib/qqmusic.js CHANGED
@@ -21,6 +21,7 @@ function getInfo(url) {
21
  const info = JSON.parse(stdout);
22
 
23
  resolve({
 
24
  title: info.title,
25
  artist: info.creators[0],
26
  duration: info.duration,
@@ -33,7 +34,7 @@ function getInfo(url) {
33
  }))
34
  });
35
  } catch (e) {
36
- reject(`Parsing Error: ${e.message}`);
37
  }
38
  });
39
  });
 
21
  const info = JSON.parse(stdout);
22
 
23
  resolve({
24
+ status: 200,
25
  title: info.title,
26
  artist: info.creators[0],
27
  duration: info.duration,
 
34
  }))
35
  });
36
  } catch (e) {
37
+ reject({ status: 401, message: e.message});
38
  }
39
  });
40
  });
lib/skrep.js CHANGED
@@ -5,6 +5,7 @@ const fs = require("fs");
5
  const { exec } = require("child_process");
6
 
7
  async function ttt(link) {
 
8
  const form = new FormData();
9
  form.append("url", link);
10
  form.append("count", "12");
@@ -57,6 +58,9 @@ async function ttt(link) {
57
  }
58
  */
59
  return res;
 
 
 
60
  }
61
 
62
  async function downloadAudio(audioUrl, outputFile) {
 
5
  const { exec } = require("child_process");
6
 
7
  async function ttt(link) {
8
+ try {
9
  const form = new FormData();
10
  form.append("url", link);
11
  form.append("count", "12");
 
58
  }
59
  */
60
  return res;
61
+ } catch (e) {
62
+ return { status: 404, message: e.message}
63
+ }
64
  }
65
 
66
  async function downloadAudio(audioUrl, outputFile) {
lib/snapchat.js CHANGED
@@ -41,6 +41,7 @@ async function spotlight(url) {
41
  console.log("Tidak ditemukan data JSON yang sesuai.");
42
  }
43
  } catch (error) {
 
44
  console.error("Gagal mengambil data:", error.message);
45
  }
46
  }
 
41
  console.log("Tidak ditemukan data JSON yang sesuai.");
42
  }
43
  } catch (error) {
44
+ return { status: 404, message: error.message}
45
  console.error("Gagal mengambil data:", error.message);
46
  }
47
  }
lib/soundcloud.js CHANGED
@@ -116,6 +116,7 @@ async function metadata(url) {
116
  }
117
 
118
  async function soundcloud(query, type) {
 
119
  if(type === "search") {
120
  const search_result = await search(query)
121
  return search_result
@@ -137,6 +138,9 @@ async function soundcloud(query, type) {
137
  console.log(resd)
138
  return resd
139
  }
 
 
 
140
  }
141
 
142
  module.exports = {
 
116
  }
117
 
118
  async function soundcloud(query, type) {
119
+ try {
120
  if(type === "search") {
121
  const search_result = await search(query)
122
  return search_result
 
138
  console.log(resd)
139
  return resd
140
  }
141
+ } catch (e) {
142
+ return { status: 404, message: e.message}
143
+ }
144
  }
145
 
146
  module.exports = {
lib/spotify.js CHANGED
@@ -93,10 +93,9 @@ async function spotifyTrack(trackUrl) {
93
  };
94
  console.log(res)
95
  return res
96
- } catch (error) {
97
- console.error(error);
98
- return null;
99
- }
100
  }
101
 
102
  async function spotifyPlaylist(playlistUrl) {
 
93
  };
94
  console.log(res)
95
  return res
96
+ } catch (e) {
97
+ return { status: 404, message: e.message}
98
+ }
 
99
  }
100
 
101
  async function spotifyPlaylist(playlistUrl) {