-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpipeline.html
More file actions
374 lines (336 loc) · 12.1 KB
/
Copy pathpipeline.html
File metadata and controls
374 lines (336 loc) · 12.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Build Pipeline Architecture v2</title>
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: #f5f5f5;
padding: 24px;
max-width: 1100px;
margin: 0 auto;
}
h1 {
font-size: 22px;
color: #333;
}
h2 {
font-size: 18px;
color: #555;
margin-top: 32px;
border-bottom: 2px solid #e0e0e0;
padding-bottom: 8px;
}
.mermaid {
background: #fff;
border-radius: 12px;
padding: 24px;
margin: 16px 0;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}
.section {
margin-bottom: 32px;
}
code {
background: #e8e8e8;
padding: 2px 6px;
border-radius: 4px;
font-size: 13px;
}
pre {
background: #1e1e1e;
color: #d4d4d4;
padding: 16px;
border-radius: 8px;
overflow-x: auto;
font-size: 13px;
}
.badge {
display: inline-block;
padding: 4px 10px;
border-radius: 12px;
font-size: 12px;
font-weight: 600;
margin: 2px;
}
.done {
background: #e6f4ea;
color: #137333;
}
.todo {
background: #fce8e6;
color: #c5221f;
}
.partial {
background: #fef7e0;
color: #ea8600;
}
table {
width: 100%;
border-collapse: collapse;
background: #fff;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
margin: 12px 0;
}
th {
background: #1a73e8;
color: #fff;
padding: 10px;
font-size: 12px;
text-align: left;
}
td {
padding: 8px 10px;
font-size: 13px;
border-bottom: 1px solid #eee;
}
</style>
</head>
<body>
<h1>🔨 Build Pipeline v2 — Full Picture</h1>
<div class="section">
<h2>📦 Complete Pipeline</h2>
<div class="mermaid">
graph TD
URL["🌐 Google Sites URL"] --> S1
subgraph "Step 1: Crawl"
S1["Puppeteer opens main page"] --> S1b["Parse sidebar treeitem links"]
S1b --> PM["📋 page-map.json<br />titles, urls, depth, files"]
end
subgraph "Step 2: SingleFile"
PM --> S2["SingleFile CLI per page"]
S2 --> SF["📦 _pages/<br />Full HTML + CSS + base64 images<br />NO navigation"]
end
subgraph "Step 3: Puppeteer"
PM --> S3["Puppeteer per page<br />scroll for lazy load"]
S3 --> PP["📄 _content/<br />Clean content + iframe src"]
end
subgraph "Step 4: Images"
SF --> S4["Decode base64 from SF"]
S4 --> IMG["🖼️ site/images/<br />46 local files"]
end
subgraph "Step 4b: Video — TODO"
PP --> S4v["Scan PP for YouTube/Vimeo/GDrive iframes"]
S4v --> VID_LIST["📺 video-map.json<br />page → video IDs + types"]
VID_LIST --> THUMB["Download YouTube thumbnails<br />maxresdefault.jpg"]
THUMB --> VID_IMG["🎬 site/thumbnails/<br />yt-VIDEOID.jpg"]
end
subgraph "Step 5: Build"
PM --> NAV["Generate sidebar nav"]
SF --> COPY["Copy SF pages as-is"]
IMG --> REWRITE["Rewrite base64 → local images<br />in SF pages"]
VID_LIST --> REPLACE["Replace iframe placeholders<br />with clickable thumbnails"]
VID_IMG --> REPLACE
NAV --> INDEX["index.html<br />sidebar + iframe"]
PM --> REPORT["📊 report.html<br />Site map + SF vs PP comparison"]
SF --> REPORT
PP --> REPORT
COPY --> SITE
REWRITE --> SITE
REPLACE --> SITE
INDEX --> SITE["📁 site/<br />index.html + report.html<br />+ 34 pages + images/ + thumbnails/<br />+
sitemap.xml + robots.txt"]
REPORT --> SITE
end
INDEX -. "footer link:<br />Built with google-sites-clone" .-> REPORT
style S4v fill:#fce8e6,color:#c5221f
style VID_LIST fill:#fce8e6,color:#c5221f
style THUMB fill:#fce8e6,color:#c5221f
style VID_IMG fill:#fce8e6,color:#c5221f
style REPLACE fill:#fce8e6,color:#c5221f
style REWRITE fill:#fef7e0,color:#ea8600
</div>
</div>
<div class="section">
<h2>📂 Folder Structure</h2>
<div class="mermaid">
graph LR
subgraph "clone-output/"
PM2["📋 page-map.json"]
subgraph "_pages/"
SF2["shematizatiy.html<br />lektoriy.html<br />... 32 files × 7MB<br /><i>SingleFile full HTML</i>"]
end
subgraph "_content/"
PP2["shematizatiy.html<br />lektoriy.html<br />... 34 files × 9KB<br /><i>Puppeteer clean content</i>"]
end
subgraph "site/"
IDX["index.html — sidebar + iframe"]
RPT["report.html — clone report"]
PAGES2["shematizatiy.html<br />... 34 SF copies"]
subgraph "images/"
IMGS["img-001.jpg ... img-046.jpg<br /><i>decoded from base64</i>"]
end
subgraph "thumbnails/"
THUMBS["yt-VIDEO_ID.jpg<br /><i>downloaded from YouTube</i>"]
end
SMAP["sitemap.xml + robots.txt"]
end
end
style SF2 fill:#e8f0fe
style PP2 fill:#fef7e0
style IDX fill:#e6f4ea
style RPT fill:#e6f4ea
style THUMBS fill:#fce8e6
</div>
</div>
<div class="section">
<h2>📊 Step Status</h2>
<table>
<tr>
<th>Step</th>
<th>Script</th>
<th>Status</th>
<th>What it does</th>
</tr>
<tr>
<td>1. Crawl</td>
<td><code>lib/crawl.js</code></td>
<td><span class="badge done">✅ Done</span></td>
<td>Discovers pages from sidebar → page-map.json</td>
</tr>
<tr>
<td>2. SingleFile</td>
<td><code>lib/singlefile.js</code></td>
<td><span class="badge done">✅ Done</span></td>
<td>Downloads full HTML with CSS + base64 images</td>
</tr>
<tr>
<td>3. Puppeteer</td>
<td><code>lib/puppeteer.js</code></td>
<td><span class="badge done">✅ Done</span></td>
<td>Extracts clean content + iframe sources</td>
</tr>
<tr>
<td>4. Images</td>
<td><code>lib/images.js</code></td>
<td><span class="badge partial">⚠️ Partial</span></td>
<td>Decodes base64 → local files. Doesn't rewrite URLs in SF pages yet</td>
</tr>
<tr>
<td>4b. Video</td>
<td><code>lib/video.js</code></td>
<td><span class="badge done">✅ Done</span></td>
<td>Scan PP for iframes → download YT thumbnails → replace in SF pages</td>
</tr>
<tr>
<td>5. Build</td>
<td><code>lib/build.js</code></td>
<td><span class="badge done">✅ Done</span></td>
<td>Copies SF as-is + index.html with iframe nav + video grid + report link</td>
</tr>
</table>
</div>
<div class="section">
<h2>📺 Step 4b: Video Processing — Proposed</h2>
<div class="mermaid">
graph LR
PP["_content/ Puppeteer HTML"] --> SCAN["Scan for iframe patterns"]
SCAN --> YT["YouTube<br />youtube.com/embed/ID"]
SCAN --> VM["Vimeo<br />player.vimeo.com/video/ID"]
SCAN --> GD["Google Drive<br />drive.google.com/file/ID"]
YT --> DL_YT["Download 1280×720<br />img.youtube.com/vi/ID/maxresdefault.jpg<br />fallback: hqdefault.jpg
480×360"]
DL_YT["Download 1280×720<br />img.youtube.com/vi/ID/maxresdefault.jpg<br />fallback: hqdefault.jpg 480×360"]
VM --> DL_VM["Download<br />vumbnail.com/ID.jpg"]
GD --> SKIP["No thumbnail available"]
DL_YT --> STORE["site/thumbnails/"]
DL_VM --> STORE
STORE --> BUILD["Build: replace iframes in SF HTML<br />with clickable thumbnail + play button"]
</div>
<h3>Input: Puppeteer HTML contains</h3>
<pre>
<div data-iframe-src="https://www.youtube.com/embed/VIDEO_ID"></div>
</pre>
<h3>Output: SingleFile HTML gets</h3>
<pre>
<a href="https://youtube.com/watch?v=VIDEO_ID" target="_blank">
<img src="thumbnails/yt-VIDEO_ID.jpg" alt="YouTube">
<span class="play-btn">▶</span>
</a>
</pre>
</div>
<div class="section">
<h2>🔧 Files to Create/Modify</h2>
<table>
<tr>
<th>File</th>
<th>Action</th>
<th>Purpose</th>
</tr>
<tr>
<td><code>lib/video.js</code></td>
<td><span class="badge todo">NEW</span></td>
<td>Scan _content/ for video iframes, download thumbnails, create video-map.json</td>
</tr>
<tr>
<td><code>lib/build.js</code></td>
<td><span class="badge partial">MODIFY</span></td>
<td>Replace iframe placeholders in SF HTML with downloaded thumbnails</td>
</tr>
<tr>
<td><code>lib/index.js</code></td>
<td><span class="badge partial">MODIFY</span></td>
<td>Add Step 4b call between images and build</td>
</tr>
</table>
</div>
<div class="section">
<h2>🎫 Usage Tiers</h2>
<table>
<tr>
<th>Tier</th>
<th>Auth</th>
<th>Clones</th>
<th>Max ZIP</th>
</tr>
<tr>
<td><strong>Free</strong></td>
<td>Google OAuth</td>
<td>1 total</td>
<td>250 MB</td>
</tr>
<tr>
<td><strong>Starred</strong></td>
<td>Google + GitHub + ⭐ repo</td>
<td>5/day, 20/month</td>
<td>250 MB (~5 GB/month)</td>
</tr>
<tr>
<td><strong>Unlimited</strong></td>
<td>Email offer only</td>
<td>∞</td>
<td>∞ ($99/month)</td>
</tr>
</table>
<p>Clone count tracked in <strong>Upstash Redis</strong>. Star check via GitHub API. Unlimited offered via email
when Starred user exhausts monthly limit.</p>
</div>
<div class="section">
<h2>☁️ R2 Lifecycle Rules (auto-cleanup)</h2>
<table>
<tr>
<th>Prefix</th>
<th>Auto-delete after</th>
</tr>
<tr>
<td><code>zips/</code></td>
<td>7 days</td>
</tr>
<tr>
<td><code>previews/</code></td>
<td>7 days</td>
</tr>
<tr>
<td><code>reports/</code></td>
<td>360 days</td>
</tr>
</table>
</div>
<script>mermaid.initialize({ startOnLoad: true, theme: 'default' });</script>
</body>
</html>