Nexchan commited on
Commit
1081c21
1 Parent(s): 8e47f93

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +2 -2
index.js CHANGED
@@ -462,7 +462,7 @@ async function GetId(data) {
462
  async function addAudioTags(media, title, artist, year, imagecover) {
463
  try {
464
  let audioBuffer = (typeof media === 'string') ? Buffer.from((await axios.get(media, { responseType: 'arraybuffer', maxContentLength: -1 })).data) : (media instanceof Buffer) ? media : (() => { throw new Error('Media harus berupa URL string atau Buffer.'); })();
465
- const randomFilename = title.replace(/[^\w\s\#\$\&\-\+\(\)\/\[\]\`\×\{\}\\\\\~\•]/g, '') + '.mp3';
466
  const tmpFilePath = path.join(tempDir, randomFilename);
467
  fs.writeFileSync(tmpFilePath, audioBuffer);
468
  const tags = { title, artist, year };
@@ -545,4 +545,4 @@ app.get('/ytmp3', async (req, res) => {
545
 
546
  app.listen(PORT, () => {
547
  console.log(`Server is running on port https://localhost:${PORT}`);
548
- });
 
462
  async function addAudioTags(media, title, artist, year, imagecover) {
463
  try {
464
  let audioBuffer = (typeof media === 'string') ? Buffer.from((await axios.get(media, { responseType: 'arraybuffer', maxContentLength: -1 })).data) : (media instanceof Buffer) ? media : (() => { throw new Error('Media harus berupa URL string atau Buffer.'); })();
465
+ const randomFilename = generateRandomName(10) + '.mp3';
466
  const tmpFilePath = path.join(tempDir, randomFilename);
467
  fs.writeFileSync(tmpFilePath, audioBuffer);
468
  const tags = { title, artist, year };
 
545
 
546
  app.listen(PORT, () => {
547
  console.log(`Server is running on port https://localhost:${PORT}`);
548
+ });