Skip to content

Instantly share code, notes, and snippets.

@Reyz2902
Last active December 9, 2025 12:24
Show Gist options
  • Select an option

  • Save Reyz2902/de389088daeb983549101393221e013e to your computer and use it in GitHub Desktop.

Select an option

Save Reyz2902/de389088daeb983549101393221e013e to your computer and use it in GitHub Desktop.
Uploaded via Theresa
case "ssweb": {
const url = args[0];
if (!url) {
m.reply('Please provide a URL to take a screenshot of.\n\nExample: .ssweb https://example.com');
break;
}
const targetUrl = url.startsWith('http://') || url.startsWith('https://') ? url : `https://${url}`;
try {
new URL(targetUrl);
} catch (_) {
m.reply('Invalid URL format. Please provide a valid URL.');
break;
}
try {
await m.reply(`Capturing screenshot for: ${targetUrl}...`);
const ssweb = async (url, {
width = 1280,
height = 720,
full_page = false,
device_scale = 1
} = {}) => {
const {
data
} = await axios.post('https://gcp.imagy.app/screenshot/createscreenshot', {
url: url,
browserWidth: parseInt(width),
browserHeight: parseInt(height),
fullPage: full_page,
deviceScaleFactor: parseInt(device_scale),
format: 'png'
}, {
headers: {
'content-type': 'application/json',
referer: 'https://imagy.app/full-page-screenshot-taker/',
'user-agent': 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Mobile Safari/537.36'
}
});
return data.fileUrl;
};
const imageUrl = await ssweb(targetUrl);
if (imageUrl) {
await conn.sendMessage(m.chat, {
image: {
url: imageUrl
},
caption: `Screenshot of: ${targetUrl}`
}, {
quoted: m
});
} else {
m.reply('Failed to retrieve screenshot. API did not return a valid URL.');
}
} catch (e) {
console.log(e);
m.reply('An error occurred while taking the screenshot. The website might be inaccessible or protected.');
}
}
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment