@soymaycol/mayreplit
Version:
Mantén tu Replit activo 24/7 sin APIs - Creado por SoyMaycol
119 lines (90 loc) • 2.76 kB
Markdown
Mantén tu Replit activo 24/7 sin necesidad de APIs o servidores Express. Simple, eficiente y fácil de usar.
**Creado por:** SoyMaycol
**GitHub:** [SoySapo6](https://github.com/SoySapo6)
```bash
npm install @soymaycol/mayreplit
```
- Node.js 16+
- Un archivo de cookies de Replit (`cookies.json`)
## 🎯 Uso Básico
```javascript
import MayReplit from '@soymaycol/mayreplit'
const mayReplit = new MayReplit()
// Configurar tu Replit
mayReplit
.setReplitUrl('https://replit.com/@tuusuario/TuProyecto')
.setCookiesPath('./mis-cookies.json')
.setScreenshotInterval(5 * 60 * 1000) // 5 minutos
// Iniciar el mantener activo
mayReplit.start().catch(console.error)
```
```javascript
import MayReplit from '@soymaycol/mayreplit'
const mayReplit = new MayReplit({
replitUrl: 'https://replit.com/@tuusuario/TuProyecto',
cookiesPath: './cookies.json',
screenshotInterval: 3 * 60 * 1000, // 3 minutos
headless: true // false para ver el navegador
})
mayReplit.start().catch(console.error)
```
```javascript
// Después de iniciar
setTimeout(() => {
const screenshot = mayReplit.getScreenshot()
if (screenshot) {
console.log('📸 Screenshot disponible:', screenshot.length, 'bytes')
}
}, 10000) // Esperar 10 segundos
```
```javascript
// Para detener correctamente
process.on('SIGINT', async () => {
await mayReplit.stop()
process.exit(0)
})
```
1. Inicia sesión en Replit en tu navegador
2. Abre las herramientas de desarrollador (F12)
3. Ve a la pestaña "Application" → "Cookies"
4. Copia las cookies y guárdalas en un archivo JSON:
```json
[
{
"name": "nombre_cookie",
"value": "valor_cookie",
"domain": ".replit.com",
"path": "/",
"expires": 1234567890,
"httpOnly": false,
"secure": true,
"sameSite": "Lax"
}
]
```
```javascript
new MayReplit(options)
```
**Opciones:**
- `replitUrl` (string): URL de tu Replit
- `cookiesPath` (string): Ruta al archivo de cookies (default: `'./cookies.json'`)
- `screenshotInterval` (number): Intervalo de screenshots en ms (default: `5 * 60 * 1000`)
- `headless` (boolean): Ejecutar navegador sin interfaz (default: `true`)
### Métodos
- `setReplitUrl(url)`: Establece la URL del Replit
- `setCookiesPath(path)`: Establece la ruta de las cookies
- `setScreenshotInterval(ms)`: Establece el intervalo de screenshots
- `setHeadless(boolean)`: Configura modo headless
- `start()`: Inicia el servicio
- `getScreenshot()`: Obtiene el último screenshot
- `stop()`: Detiene el servicio
**Creado con ❤️ por SoyMaycol**