randydev commited on
Commit
f94769f
·
1 Parent(s): e65559b
Files changed (1) hide show
  1. lib/all.js +16 -16
lib/all.js CHANGED
@@ -24,7 +24,7 @@ import { igdl } from 'ruhend-scraper'
24
  import fs from "fs";
25
  import * as uuid from 'uuid';
26
 
27
- import {
28
  TwitterDownloader,
29
  InstagramDownloader,
30
  PinterestDL,
@@ -35,15 +35,15 @@ import {
35
  import { trbtoken, trburl } from '../config.js';
36
 
37
  async function audioContent(url) {
38
- const filePath = `${uuid.v4()}.mp3`;
39
- try {
40
- const response = await axios.get(url, { responseType: "arraybuffer" });
41
- fs.writeFileSync(filePath, response.data);
42
- return filePath;
43
- } catch (error) {
44
- console.error("Error downloading audio file:", error.message);
45
- return null;
46
- }
47
  }
48
 
49
  async function InstagramDLV2(url) {
@@ -51,7 +51,7 @@ async function InstagramDLV2(url) {
51
  const data = await igdlv2.instagramGetUrl(url);
52
  console.log(data);
53
  return data;
54
- } catch(err) {
55
  console.error(err);
56
  return null;
57
  }
@@ -63,7 +63,7 @@ async function TelegramUseLog(user_id, api_key, text_log) {
63
  const options = {
64
  method: "GET",
65
  url: "https://randydev-meta-ai.hf.space/user/tg/send_message",
66
- params: {
67
  user_id: UserID,
68
  api_key: api_key,
69
  text_log: text_log,
@@ -85,7 +85,7 @@ async function InstagramDLV3(url) {
85
  const data = await igdl(url);
86
  console.log(data);
87
  return data;
88
- } catch(err) {
89
  console.error(err);
90
  return null;
91
  }
@@ -100,7 +100,7 @@ async function InstagramDLV4(url) {
100
  return data;
101
  }
102
  // return {"message": "ok"};
103
- } catch(err) {
104
  console.error(err);
105
  return null;
106
  }
@@ -125,14 +125,14 @@ function generateRandomTimestamp() {
125
  async function TwitterDownloaderV2(url) {
126
  try {
127
  const result = await lubacotscaper.default.twdl(url);
128
- if typeof(result === "object") {
129
  result.owner = "xtdevs";
130
  delete result.issues;
131
  return result;
132
  }
133
  } catch (error) {
134
  console.error("Error fetching data:", error.message);
135
- return null;
136
  }
137
  }
138
 
 
24
  import fs from "fs";
25
  import * as uuid from 'uuid';
26
 
27
+ import {
28
  TwitterDownloader,
29
  InstagramDownloader,
30
  PinterestDL,
 
35
  import { trbtoken, trburl } from '../config.js';
36
 
37
  async function audioContent(url) {
38
+ const filePath = `${uuid.v4()}.mp3`;
39
+ try {
40
+ const response = await axios.get(url, { responseType: "arraybuffer" });
41
+ fs.writeFileSync(filePath, response.data);
42
+ return filePath;
43
+ } catch (error) {
44
+ console.error("Error downloading audio file:", error.message);
45
+ return null;
46
+ }
47
  }
48
 
49
  async function InstagramDLV2(url) {
 
51
  const data = await igdlv2.instagramGetUrl(url);
52
  console.log(data);
53
  return data;
54
+ } catch (err) {
55
  console.error(err);
56
  return null;
57
  }
 
63
  const options = {
64
  method: "GET",
65
  url: "https://randydev-meta-ai.hf.space/user/tg/send_message",
66
+ params: {
67
  user_id: UserID,
68
  api_key: api_key,
69
  text_log: text_log,
 
85
  const data = await igdl(url);
86
  console.log(data);
87
  return data;
88
+ } catch (err) {
89
  console.error(err);
90
  return null;
91
  }
 
100
  return data;
101
  }
102
  // return {"message": "ok"};
103
+ } catch (err) {
104
  console.error(err);
105
  return null;
106
  }
 
125
  async function TwitterDownloaderV2(url) {
126
  try {
127
  const result = await lubacotscaper.default.twdl(url);
128
+ if (typeof result === "object") {
129
  result.owner = "xtdevs";
130
  delete result.issues;
131
  return result;
132
  }
133
  } catch (error) {
134
  console.error("Error fetching data:", error.message);
135
+ return null;
136
  }
137
  }
138