Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { axios, FormData } = require('./_')
- const { upload } = require('@neoxr/helper')
- module.exports = (url, device = 'desktop') => new Promise(async resolve => {
- try {
- if (!['desktop', 'tablet', 'phone'].includes(device)) return resolve({
- creator: global.creator,
- status: false,
- msg: 'Invalid device!'
- })
- const parse = await (await axios.get('https://www.screenshotmachine.com/', {
- headers: {
- "Accept": "*/*",
- "User-Agent": "Mozilla/5.0 (Linux; Android 6.0.1; SM-J500G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Mobile Safari/537.36",
- "Origin": "https://www.screenshotmachine.com",
- "Referer": "https://www.screenshotmachine.com/",
- "Referrer-Policy": "strict-origin-when-cross-origin",
- "sec-ch-ua": '"Chromium";v="107", "Not=A?Brand";v="24"',
- "sec-ch-ua-platform": "Android",
- "sec-fetch-dest": "empty",
- "sec-fetch-mode": "cors",
- "sec-fetch-site": "same-origin",
- "x-requested-with": "XMLHttpRequest"
- }
- }))
- const cookie = parse.headers['set-cookie'][0]
- let form = new FormData
- form.append('url', url)
- form.append('device', device)
- form.append('cacheLimit', 0)
- const json = await (await axios.post('https://www.screenshotmachine.com/capture.php', form, {
- headers: {
- "Accept": "*/*",
- "User-Agent": "Mozilla/5.0 (Linux; Android 6.0.1; SM-J500G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Mobile Safari/537.36",
- "Origin": "https://www.screenshotmachine.com",
- "Referer": "https://www.screenshotmachine.com/",
- "Referrer-Policy": "strict-origin-when-cross-origin",
- "sec-ch-ua": '"Chromium";v="107", "Not=A?Brand";v="24"',
- "sec-ch-ua-platform": "Android",
- "sec-fetch-dest": "empty",
- "sec-fetch-mode": "cors",
- "sec-fetch-site": "same-origin",
- cookie,
- ...form.getHeaders(),
- "x-requested-with": "XMLHttpRequest"
- }
- })).data
- if (json.status != 'success') return resolve({
- creator: global.creator,
- status: false,
- msg: 'Failed to screenshot!'
- })
- const buffer = await (await axios.get('https://www.screenshotmachine.com/serve.php?file=result&attachment', {
- responseType: "arraybuffer",
- headers: {
- cookie
- }
- })).data
- const proc = await upload(buffer)
- if (!proc.status) return resolve({
- creator: global.creator,
- status: false,
- msg: 'Failed to upload!'
- })
- delete proc.data.page
- return resolve(proc)
- } catch (e) {
- resolve({
- creator: global.creator,
- status: false,
- msg: e.message
- })
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement