Last active
December 9, 2025 12:24
-
-
Save Reyz2902/de389088daeb983549101393221e013e to your computer and use it in GitHub Desktop.
Uploaded via Theresa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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