randydev commited on
Commit
e603f58
·
verified ·
1 Parent(s): 2f8c185

Update lib/all.js

Browse files
Files changed (1) hide show
  1. lib/all.js +13 -9
lib/all.js CHANGED
@@ -180,28 +180,32 @@ async function TeraboxV4Downloader(url) {
180
  "User-Agent": "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Mobile Safari/537.36",
181
  "Referer": `https://teraboxdownloaderonline.com/player?url=${encodeURIComponent(url)}`,
182
  };
183
- const response = await axios.get(apiUrl, { headers });
184
- const match = response.data.match("/#EXTINF:\d+,\s*(https[^\s]+)/");
 
 
185
  if (match && match[1]) {
186
- const result = {
 
 
 
 
 
187
  status: "success",
188
- video_url: match[1],
189
  };
190
- return result;
191
  } else {
192
- const errorResult = {
193
  status: "error",
194
  message: "Video URL tidak ditemukan.",
195
  };
196
- return errorResult;
197
  }
198
  } catch (error) {
199
- const errorResult = {
200
  status: "error",
201
  message: "Terjadi kesalahan saat mengambil data.",
202
  error: error.message,
203
  };
204
- return errorResult;
205
  }
206
  }
207
 
 
180
  "User-Agent": "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Mobile Safari/537.36",
181
  "Referer": `https://teraboxdownloaderonline.com/player?url=${encodeURIComponent(url)}`,
182
  };
183
+ const response = await axios.get(apiUrl, { headers });
184
+ const dataString = response.data;
185
+ const match = dataString.match(/#EXTINF:\d+,\s*(https[^\s]+)/);
186
+
187
  if (match && match[1]) {
188
+ return {
189
+ status: "success",
190
+ video_url: match[1],
191
+ };
192
+ } else if (response.data.video_url) {
193
+ return {
194
  status: "success",
195
+ video_url: response.data.video_url,
196
  };
 
197
  } else {
198
+ return {
199
  status: "error",
200
  message: "Video URL tidak ditemukan.",
201
  };
 
202
  }
203
  } catch (error) {
204
+ return {
205
  status: "error",
206
  message: "Terjadi kesalahan saat mengambil data.",
207
  error: error.message,
208
  };
 
209
  }
210
  }
211