Atualização automática: 2026-05-23 22:02:28

This commit is contained in:
Hermes
2026-05-23 22:02:28 +00:00
parent 7cfc1724d3
commit bfa0ab4394
6 changed files with 152 additions and 14 deletions
+6 -3
View File
@@ -71,7 +71,7 @@ class SmartCloner {
}
}
async cloneSite(url, maxPages = 20) {
async cloneSite(url, maxPages = 20, customFolderName = null) {
console.log(`\n🚀 INICIANDO DEEP SMART CLONE: ${url}`);
console.log(`📂 Limite de páginas: ${maxPages}\n`);
@@ -82,7 +82,8 @@ class SmartCloner {
const urlObj = new URL(url);
const siteName = this.sanitizeFilename(urlObj.hostname);
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
const siteDir = path.join(this.baseOutputDir, `${siteName}_${timestamp}`);
const finalFolderName = customFolderName ? this.sanitizeFilename(customFolderName) : `${siteName}_${timestamp}`;
const siteDir = path.join(this.baseOutputDir, finalFolderName);
this.ensureDirectoryExists(siteDir);
browser = await chromium.launch({
@@ -368,10 +369,12 @@ if (require.main === module) {
const args = process.argv.slice(2);
const urlArg = args.find(arg => arg.startsWith('--url='));
const url = urlArg ? urlArg.split('=')[1] : args[0];
const folderArg = args.find(arg => arg.startsWith('--folderName='));
const folderName = folderArg ? folderArg.split('=')[1] : null;
if (url) {
const cloner = new SmartCloner();
cloner.cloneSite(url).then(res => {
cloner.cloneSite(url, 20, folderName).then(res => {
console.log(JSON.stringify(res, null, 2));
process.exit(res.success ? 0 : 1);
});