Create server.js
Browse files
server.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const express = require('express');
|
| 2 |
+
const axios = require('axios')
|
| 3 |
+
const cheerio = require('cheerio')
|
| 4 |
+
|
| 5 |
+
const bypass = async (url) => {
|
| 6 |
+
axios.get(url)
|
| 7 |
+
.then(res => {
|
| 8 |
+
const $ = cheerio.load(res.data)
|
| 9 |
+
const data = JSON.parse($('#app').attr('data-page'))
|
| 10 |
+
const hasil = data.props.link.finish.map(item => ({
|
| 11 |
+
name: item.name,
|
| 12 |
+
url: item.url
|
| 13 |
+
}))
|
| 14 |
+
return hasil
|
| 15 |
+
})
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
app.all('/b', async (req, res) => {
|
| 19 |
+
const { url } = req.query || req.body
|
| 20 |
+
const regex = /https:\/\/link2unlock\.com\/[a-zA-Z0-9]+/g
|
| 21 |
+
if(!regex.test(url)) return res.json({ success: false, error: 'invalid link'})
|
| 22 |
+
res.json(await bypass(url))
|
| 23 |
+
})
|
| 24 |
+
|
| 25 |
+
app.listen(7860)
|