randydev commited on
Commit
b2978ed
·
verified ·
1 Parent(s): 8e6f2c8

Update lib/all.js

Browse files
Files changed (1) hide show
  1. lib/all.js +16 -0
lib/all.js CHANGED
@@ -21,6 +21,9 @@ import * as happykntl from 'happy-dl';
21
 
22
  import { igdl } from 'ruhend-scraper'
23
 
 
 
 
24
  import {
25
  TwitterDownloader,
26
  InstagramDownloader,
@@ -31,6 +34,18 @@ import {
31
 
32
  import { trbtoken, trburl } from '../config.js';
33
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  async function InstagramDLV2(url) {
35
  try {
36
  const data = await igdlv2.instagramGetUrl(url);
@@ -131,4 +146,5 @@ export {
131
  XsearchDownloaderV2,
132
  XInfoDownloaderV2,
133
  TelegramUseLog,
 
134
  };
 
21
 
22
  import { igdl } from 'ruhend-scraper'
23
 
24
+ import fs from "fs";
25
+ import * as uuid from 'uuid';
26
+
27
  import {
28
  TwitterDownloader,
29
  InstagramDownloader,
 
34
 
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) {
50
  try {
51
  const data = await igdlv2.instagramGetUrl(url);
 
146
  XsearchDownloaderV2,
147
  XInfoDownloaderV2,
148
  TelegramUseLog,
149
+ audioContent,
150
  };