sazumiviki-api
Advanced tools
Comparing version 1.0.2 to 1.0.3
const axios = require('axios'); | ||
const cheerio = require('cheerio'); | ||
@@ -43,3 +44,3 @@ async function fbdl(url) { | ||
if (urls.length === 0) { | ||
throw new Error('No se encontraron enlaces de descarga'); | ||
throw new Error('Erorr'); | ||
} | ||
@@ -46,0 +47,0 @@ |
@@ -11,12 +11,25 @@ const axios = require('axios'); | ||
form.append('cacheLimit', 0); | ||
try { | ||
const resp = await axios('https://www.screenshotmachine.com/capture.php', { | ||
method: 'post', | ||
data: form, | ||
headers: { | ||
'origin': 'https://www.screenshotmachine.com', | ||
'referer': 'https://www.screenshotmachine.com/', | ||
'sec-fetch-dest': 'empty', | ||
'sec-fetch-mode': 'cors', | ||
'sec-fetch-site': 'same-origin', | ||
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.52', | ||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', | ||
'Cookie': '' | ||
} | ||
}); | ||
try { | ||
const resp = await axios.post('https://www.screenshotmachine.com/capture.php', form); | ||
const cookies = resp.headers['set-cookie']; | ||
const buffer = await axios({ | ||
url: 'https://www.screenshotmachine.com/' + resp.data.link, | ||
const buffer = await axios(`https://www.screenshotmachine.com/${resp.data.link}`, { | ||
headers: { | ||
'cookie': cookies.join('') | ||
}, | ||
responseType: 'arraybuffer' | ||
responseType: 'arraybuffer' | ||
}); | ||
@@ -26,3 +39,3 @@ | ||
} catch (error) { | ||
throw new Error(`Error saat mengambil tangkapan layar: ${error.message}`); | ||
throw new Error(`Error while capturing screenshot: ${error.message}`); | ||
} | ||
@@ -29,0 +42,0 @@ } |
26
index.js
const express = require('express'); | ||
const bodyParser = require('body-parser'); | ||
const app = express(); | ||
const fbdl = require('./api/fbdl'); | ||
const ssweb = require('./api/ssweb'); | ||
const app = express(); | ||
const PORT = 3000; | ||
app.use(bodyParser.urlencoded({ extended: true })); | ||
app.use(bodyParser.json()); | ||
app.get('/api/fbdl', async (req, res) => { | ||
const url = req.query.url; | ||
try { | ||
const { url } = req.query; | ||
if (!url) { | ||
throw new Error('URL harus disediakan'); | ||
} | ||
const result = await fbdl(url); | ||
@@ -27,10 +18,6 @@ res.json(result); | ||
app.get('/api/ssweb', async (req, res) => { | ||
const url = req.query.url; | ||
try { | ||
const { url } = req.query; | ||
if (!url) { | ||
throw new Error('URL harus disediakan'); | ||
} | ||
const result = await ssweb(url); | ||
res.send(result); | ||
res.type('png').send(result); | ||
} catch (error) { | ||
@@ -41,4 +28,5 @@ res.status(500).json({ error: error.message }); | ||
const PORT = 3000; | ||
app.listen(PORT, () => { | ||
console.log(`Server berjalan di http://localhost:${PORT}`); | ||
console.log(`Server is running on port ${PORT}`); | ||
}); |
{ | ||
"name": "sazumiviki-api", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "sazumiviki-api adalah salah satu modul yang membuat kode Anda bekerja dengan mudah, sehingga Anda dapat menghasilkan apa yang Anda inginkan dengan mudah", | ||
@@ -28,8 +28,8 @@ "main": "index.js", | ||
"dependencies": { | ||
"axios": "^1.4.0", | ||
"axios": "^0.24.0", | ||
"cheerio": "^1.0.0-rc.12", | ||
"express": "^4.18.2", | ||
"node-fetch": "^3.3.1" | ||
"node-fetch": "^3.0.0" | ||
}, | ||
"type": "commonjs" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
4685
111
0
+ Addedaxios@0.24.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaxios@1.7.7(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedform-data@4.0.1(transitive)
- Removedproxy-from-env@1.1.0(transitive)
Updatedaxios@^0.24.0
Updatednode-fetch@^3.0.0