scnario commited on
Commit
e58dba9
·
verified ·
1 Parent(s): a430a55

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +9 -1
server.js CHANGED
@@ -3,6 +3,11 @@ const axios = require('axios')
3
  const cheerio = require('cheerio')
4
  const app = express()
5
 
 
 
 
 
 
6
  async function mediaFire(url) {
7
  try {
8
  const response = await fetch('https://r.jina.ai/' + url);
@@ -44,9 +49,12 @@ async function mediaFire(url) {
44
 
45
  app.all('/download', async(req, res) => {
46
  const { url } = req.query || req.body
47
- if(/https:\/\/www.mediafire.com\/file/.test(url)) {
48
  const _mediaf = await mediaFire(url)
49
  res.json(_mediaf)
 
 
 
50
  }
51
  })
52
 
 
3
  const cheerio = require('cheerio')
4
  const app = express()
5
 
6
+ async function Spotify(q){
7
+ const r = await fetch('https://spotifydown.app/api/download?link='+q, {headers:{Referer:'https://spotifydown.app/'}})
8
+ return r.json();
9
+ }
10
+
11
  async function mediaFire(url) {
12
  try {
13
  const response = await fetch('https://r.jina.ai/' + url);
 
49
 
50
  app.all('/download', async(req, res) => {
51
  const { url } = req.query || req.body
52
+ if(/https:\/\/www.mediafire.com\/file/i.test(url)) {
53
  const _mediaf = await mediaFire(url)
54
  res.json(_mediaf)
55
+ } else if(/https:\/\/spotify.com\/track\//i.test(url)) {
56
+ const _spot = await Spotify(url)
57
+ res.json(_spot)
58
  }
59
  })
60