dembrandt 0.7.2 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/lib/extractors.js +15 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -21,7 +21,7 @@ import { join } from "path";
|
|
|
21
21
|
program
|
|
22
22
|
.name("dembrandt")
|
|
23
23
|
.description("Extract design tokens from any website")
|
|
24
|
-
.version("0.7.
|
|
24
|
+
.version("0.7.3")
|
|
25
25
|
.argument("<url>")
|
|
26
26
|
.option("--browser <type>", "Browser to use (chromium|firefox)", "chromium")
|
|
27
27
|
.option("--json-only", "Output raw JSON")
|
package/lib/extractors.js
CHANGED
|
@@ -157,9 +157,22 @@ export async function extractBranding(
|
|
|
157
157
|
300 + Math.random() * 400,
|
|
158
158
|
200 + Math.random() * 300
|
|
159
159
|
);
|
|
160
|
-
|
|
160
|
+
// Scroll through entire page to trigger lazy-loaded content
|
|
161
|
+
await page.evaluate(async () => {
|
|
162
|
+
const delay = (ms) => new Promise(r => setTimeout(r, ms));
|
|
163
|
+
const scrollStep = 600;
|
|
164
|
+
const maxHeight = Math.min(document.body.scrollHeight, 30000);
|
|
165
|
+
let y = 0;
|
|
166
|
+
while (y < maxHeight) {
|
|
167
|
+
y = Math.min(y + scrollStep, maxHeight);
|
|
168
|
+
window.scrollTo(0, y);
|
|
169
|
+
await delay(150 + Math.random() * 100);
|
|
170
|
+
}
|
|
171
|
+
// Scroll back to top
|
|
172
|
+
window.scrollTo(0, 0);
|
|
173
|
+
});
|
|
161
174
|
spinner.stop();
|
|
162
|
-
console.log(chalk.hex('#50FA7B')(` ✓
|
|
175
|
+
console.log(chalk.hex('#50FA7B')(` ✓ Full page scrolled (lazy content triggered)`));
|
|
163
176
|
|
|
164
177
|
// Final hydration wait
|
|
165
178
|
spinner.start("Final content stabilization...");
|