chore: scripts Dokploy/BPS (cron secret, Ads MCC, sync y probes)
Incluye utilidades de ops para CRON_SECRET, login customer Google Ads, sync de seguimiento BPS y probes de conexiones. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
41
scripts/probe_seguimiento_html.ts
Normal file
41
scripts/probe_seguimiento_html.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { config } from 'dotenv';
|
||||
import { resolve } from 'path';
|
||||
config({ path: resolve(process.cwd(), '.env.local') });
|
||||
|
||||
import {
|
||||
exportGoogleDocHtml,
|
||||
splitHtmlNotesByDay,
|
||||
splitNotesByDay,
|
||||
} from '../src/lib/superhuman-docs';
|
||||
|
||||
const FILE = '1uDnRPWf1Dqx5b9L3TuhfvutyZpSaifz7YFNrRy_eBhw';
|
||||
|
||||
async function main() {
|
||||
const html = await exportGoogleDocHtml(FILE);
|
||||
console.log('html len', html.length);
|
||||
console.log('sample', html.slice(0, 1500));
|
||||
// find date-like patterns
|
||||
const dates = html.match(/\d{1,2}[\/\-.]\d{1,2}[\/\-.]\d{2,4}/g) || [];
|
||||
console.log('date-like', [...new Set(dates)].slice(0, 40));
|
||||
const headings = html.match(/<h[1-6][^>]*>[\s\S]*?<\/h[1-6]>/gi) || [];
|
||||
console.log(
|
||||
'headings',
|
||||
headings.slice(0, 20).map((h) => h.replace(/<[^>]+>/g, ' ').replace(/\s+/g, ' ').trim())
|
||||
);
|
||||
const secs = splitHtmlNotesByDay(html);
|
||||
console.log('html sections', secs.length, secs.slice(0, 3).map((s) => s.label));
|
||||
const plain = html
|
||||
.replace(/<style[\s\S]*?<\/style>/gi, '')
|
||||
.replace(/<[^>]+>/g, '\n');
|
||||
const plainSecs = splitNotesByDay(plain);
|
||||
console.log(
|
||||
'plain sections',
|
||||
plainSecs.length,
|
||||
plainSecs.slice(0, 5).map((s) => s.label)
|
||||
);
|
||||
console.log('plain sample\n', plain.slice(0, 2000));
|
||||
}
|
||||
main().catch((e) => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user