-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
405 lines (368 loc) · 19.9 KB
/
index.html
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
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DigestBox</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Ibarra+Real+Nova:ital@0;1&display=swap" rel="stylesheet">
<style>
/* Custom CSS */
.module.in-progress:before {
content: "";
position: absolute;
top: 0; left: 0; right: 0; bottom: 0;
background-color: #b5402d;
opacity: 0.1;
border-radius: 0.375rem; /* 6px */
}
#progress-bar > div {
transition: width 10s ease-in-out;
}
.module > .fas {
float: right;
}
.module .hidden-area {
height: 0px;
overflow: hidden;
transition: height 500ms ease-in-out;
}
#output-pane:hover .module .hidden-area {
height: 50px;
}
#input-area img.favicon {
display: inline-block;
width: 36px;
height: 36px;
border: 3px solid #333;
border-radius: 50%;
vertical-align: -23px;
margin-right: 3px;
padding: 0px;
transition: 900ms ease-in-out;
}
#input-area img.favicon[src="data:,"] {
display: none;
}
h1 {
font-family: 'Ibarra Real Nova', serif;
}
.intro-description {
font-size: 22px;
font-family: 'Ibarra Real Nova', serif;
text-shadow: 4px 4px 4px rgba(0,0,0,0.02);
color: #ffdada;
}
.module h3 {
border-bottom: 1px dashed rgba(0,0,0,0.05);
margin-bottom: 10px;
}
.module .fa-download {
display: none;
}
#digest-btn {
font-size: 24px;
font-family: 'Ibarra Real Nova', serif;
}
button:hover, a.button:hover {
box-shadow: 4px 4px 4px rgba(0,0,0,0.2);
}
</style>
</head>
<body class="bg-gray-100 h-screen flex flex-col">
<header class="py-6 shadow-md text-center">
<h1 class="text-center text-5xl font-bold" style="margin-bottom: 22px">DigestBox</h1>
<i class="text-center" style="color: #333; opacity: 0.6">A free tool brought to you by <a href="https://archivebox.io" target="_blank" class="hover:shadow-md">ArchiveBox.io</a></i>
</header>
<main class="flex-1 p-4 md:p-8">
<div class="max-w-6xl mx-auto">
<div class="text-center bg-red-600 text-white rounded" style="color: #e0efef">
<br/>
<b class="intro-description">Get all the inner <u>content</u> out from <u>any webpage</u> in 1 click.</b>
<br/><br/>
<center>
<img src="example-diagram.png" style="height: 250px; display: inline; opacity: 0.8"/>
</center>
<br/>
<div id="progress-bar" class="w-full bg-red-200 rounded overflow-hidden" style="opacity: 0.7">
<div class="h-2 bg-red-600"></div>
</div>
<div id="input-area" class="rounded bg-gray-200 p-6">
<i class="fas fa-globe py-2 text-3xl align-center"></i>
<img src="data:," class="favicon"/>
<textarea id="url-input" class="w-2/3 p-2 border rounded align-top text-xl" placeholder="https://example.com/paste-a-URL-here.html" rows="1" style="display: inline-block; min-height: 50px; margin-top: -1px; color: #1a1a1a"></textarea>
<button id="digest-btn" class="w-1/4 bg-red-600 text-xl text-white py-2 rounded align-top shadow-md hover:bg-red-700 hover:border-white border-solid border-2" style="border-color: #9e0000">
Digest <i class="fas fa-cutlery"></i>
</button>
</div>
</div>
<div class="w-full bg-red-200 rounded mb-4 overflow-hidden" style="opacity: 0.8">
<div class="h-2 bg-red-600"></div>
</div>
<div id="output-pane" class="grid grid-cols-1 md:grid-cols-4 gap-4">
<!-- Title Module -->
<div class="module p-4 bg-white rounded shadow-md relative opacity-50" id="title-pane">
<i class="fas fa-heading mb-2"></i>
<h3 class="font-bold">Title</h3>
<div class="hidden-area">
<p>The title of the page will be displayed here.</p>
<div class="text-right">
<button class="text-black px-4 py-1 rounded mt-2"><i class="fas fa-download"></i></button>
</div>
</div>
</div>
<!-- Favicon Module -->
<div class="module p-4 bg-white rounded shadow-md relative opacity-50" id="favicon-pane">
<i class="fas fa-image mb-2"></i>
<h3 class="font-bold">Favicon</h3>
<div class="hidden-area">
<p>Favicon will be displayed here.</p>
<div class="text-right">
<button class="text-black px-4 py-1 rounded mt-2"><i class="fas fa-download"></i></button>
</div>
</div>
</div>
<div class="module p-4 bg-white rounded shadow-md relative opacity-50" id="screenshot-pane">
<i class="fas fa-camera mb-2"></i>
<h3 class="font-bold">Screenshot</h3>
<div class="hidden-area">
<p>A screenshot of the page will be displayed here.</p>
<div class="text-right">
<button class="text-black px-4 py-1 rounded mt-2"><i class="fas fa-download"></i></button>
</div>
</div>
</div>
<!-- PDF Module -->
<div class="module p-4 bg-white rounded shadow-md relative opacity-50" id="pdf-pane">
<i class="fas fa-file-pdf mb-2"></i>
<h3 class="font-bold">PDF</h3>
<div class="hidden-area">
<p>A PDF of the page will be displayed here.</p>
<div class="text-right">
<button class="text-black px-4 py-1 rounded mt-2"><i class="fas fa-download"></i></button>
</div>
</div>
</div>
<!-- Metadata Module -->
<div class="module p-4 bg-white rounded shadow-md relative opacity-50" id="metadata-pane">
<i class="fas fa-info-circle mb-2"></i>
<h3 class="font-bold">Metadata</h3>
<p>Metadata like response headers, content-type, GeoIP, etc. will be shown here as JSON.</p>
<div class="text-right">
<button class="text-black px-4 py-1 rounded mt-2"><i class="fas fa-download"></i></button>
</div>
</div>
<!-- Screenshot Module -->
<!-- Article Text Module -->
<div class="module p-4 bg-white rounded shadow-md relative opacity-50" id="article-text-pane">
<i class="fas fa-newspaper mb-2"></i>
<h3 class="font-bold">Article Text</h3>
<p>Article text found by Readability will be displayed here in markdown format.</p>
<div class="text-right">
<button class="text-black px-4 py-1 rounded mt-2"><i class="fas fa-download"></i></button>
</div>
</div>
<!-- Featured Images Module -->
<div class="module p-4 bg-white rounded shadow-md relative opacity-50" id="featured-images-pane">
<i class="fas fa-images mb-2"></i>
<h3 class="font-bold">Featured Images</h3>
<p>Prominent images or photo collections found with gallery-dl will be displayed here.</p>
<div class="text-right">
<button class="text-black px-4 py-1 rounded mt-2"><i class="fas fa-download"></i></button>
</div>
</div>
<!-- Comments Module -->
<div class="module p-4 bg-white rounded shadow-md relative opacity-50" id="comments-pane">
<i class="fas fa-comments mb-2"></i>
<h3 class="font-bold">Comments</h3>
<p>Comments, forum threads, and discussions will be shown here. (Twitter, Reddit, Disqus, etc.)</p>
<div class="text-right">
<button class="text-black px-4 py-1 rounded mt-2"><i class="fas fa-download"></i></button>
</div>
</div>
<!-- Featured Audio/Video Module -->
<div class="module p-4 bg-white rounded shadow-md relative opacity-50" id="featured-audio-video-pane">
<i class="fas fa-film mb-2"></i>
<h3 class="font-bold">Video or Audio Content</h3>
<p>Hi-res audio, video, and subtitles found with yt-dlp will be displayed here.</p>
<div class="text-right">
<button class="text-black px-4 py-1 rounded mt-2"><i class="fas fa-download"></i></button>
</div>
</div>
<!-- Featured Downloads Module -->
<div class="module p-4 bg-white rounded shadow-md relative opacity-50" id="featured-downloads-pane">
<i class="fas fa-download mb-2"></i>
<h3 class="font-bold">Downloads</h3>
<p>Files linked for downloading will be displayed here.</p>
<div class="text-right">
<button class="text-black px-4 py-1 rounded mt-2"><i class="fas fa-download"></i></button>
</div>
</div>
<!-- Git Repositories Module -->
<div class="module p-4 bg-white rounded shadow-md relative opacity-50" id="git-repo-pane">
<i class="fas fa-code-branch mb-2"></i>
<h3 class="font-bold">Git Repositories</h3>
<p>Extracted Git repositories and source code will be shown here.</p>
<div class="text-right">
<button class="text-black px-4 py-1 rounded mt-2"><i class="fas fa-download"></i></button>
</div>
</div>
<!-- Research Papers Module -->
<div class="module p-4 bg-white rounded shadow-md relative opacity-50" id="research-papers-pane">
<i class="fas fa-book mb-2"></i>
<h3 class="font-bold">Research Papers</h3>
<p>PDFs of research papers and DOI numbers will be displayed here.</p>
<div class="text-right">
<button class="text-black px-4 py-1 rounded mt-2"><i class="fas fa-download"></i></button>
</div>
</div>
<!-- OCR Content Module -->
<div class="module p-4 bg-white rounded shadow-md relative opacity-50" id="ocr-content-pane">
<i class="fas fa-barcode mb-2"></i>
<h3 class="font-bold">Text found in images (BETA)</h3>
<p>Text found in images using OCR/AI will be displayed here.</p>
<div class="text-right">
<button class="text-black px-4 py-1 rounded mt-2"><i class="fas fa-download"></i></button>
</div>
</div>
<!-- AI Summary Module -->
<div class="module p-4 bg-white rounded shadow-md relative opacity-50" id="ocr-content-pane">
<i class="fas fa-brain mb-2"></i>
<h3 class="font-bold">AI summary (BETA)</h3>
<p>An AI-generated summary of the page will be shown here.</p>
<div class="text-right">
<button class="text-black px-4 py-1 rounded mt-2"><i class="fas fa-download"></i></button>
</div>
</div>
<!-- WARC Archive Module -->
<div class="module p-4 bg-white rounded shadow-md relative opacity-50" id="ocr-content-pane">
<i class="fas fa-file-archive mb-2"></i>
<h3 class="font-bold">HTML + CSS + JS Snapshot</h3>
<p>A self-contained, offline replica of the page will be generated as HTML & WARCZ files here.</p>
<div class="text-right">
<button class="text-black px-4 py-1 rounded mt-2"><i class="fas fa-download"></i></button>
</div>
</div>
<!-- External Archives -->
<div class="module p-4 bg-white rounded shadow-md relative opacity-50" id="ocr-content-pane">
<i class="fas fa-external-link mb-2"></i>
<h3 class="font-bold">3rd-Party Archives</h3>
<p>Links to this page saved on Archive.org, Archive.today, and IPFS will be shown here.</p>
<div class="text-right">
<button class="text-black px-4 py-1 rounded mt-2"><i class="fas fa-download"></i></button>
</div>
</div>
<!-- ... add similar blocks for each module you have ... -->
</div>
<br/>
<br/>
<div id="download-section" class="text-center">
<button id="digest-btn" class="bg-blue-900 text-white py-2 rounded mb-4 px-4 mx-5">View results as spreadsheet <img src="sheets-icon.png" alt="" style="height: 20px; display: inline-block; margin-left: 4px; vertical-align: -4px"/></button>
<button id="digest-btn" class="bg-red-600 text-white py-2 rounded mb-4 px-4 mx-5">Download all (.ZIP) <i class="fas fa-download mx-2"></i></button>
<button id="digest-btn" class="py-2 rounded mb-4 px-4 mx-5 bg-purple-500 text-white hover:bg-purple-600 active:bg-purple-700 focus:outline-none focus:ring focus:ring-violet-300">Get public share link <i class="fas fa-external-link mx-2"></i></button>
</div>
</div>
<br/><br/>
<hr/>
<br/><br/><br/>
<div class="max-w-6xl mx-auto border-3 rounded p-10" style="font-size: 1.1em; border: 3px solid gold; background-color: #ffeaea">
<i>Want more? Pay just 1¢ per URL to use DigestBox PRO:</i>
<br/>
<a href="https://github.com/ArchiveBox/DigestBox/issues/1" class="button text-3xl bg-gray-900 text-white rounded p-4" style="display: block; float: right; margin: 20px">
Use PRO for 1¢/URL<i class="fas fa-arrow-right" style="color: gold"></i>
</a>
<br/>
<ul style="list-style: circle">
<li>Crawl entire sites/domains, continuously ingest your browser history/bookmarks</li>
<li>Set up repeating snapshots of sites on a schedule & auto-import from RSS/social media</li>
<li>Transcribe / describe visual scenes and speech from video/images/audio using AI</li>
<li>End-to-End encryption, REST API, and enterprise-ready permissions & audit logs</li>
<li><i>And more...</i></li>
</ul>
</div>
<br/><br/><br/>
<center>
<img src="logo.png" style="width: 90px; display: inline-block; margin-bottom: 10px; opacity: 0.7;"/><br/><br/>
</center>
</main>
<footer class="py-4 bg-gray-800 text-white text-center">
<a href="https://github.com/ArchiveBox/DigestBox" target="_blank" class="mx-2">GitHub</a>
<a href="https://github.com/ArchiveBox/DigestBox/issues/1 target="_blank" class="mx-2">Privacy Policy</a>
<a href="https://github.com/ArchiveBox" target="_blank" class="mx-2">ArchiveBox</a>
</footer>
<script>
function debounce(func, delay) {
let timeout;
return async function (...args) {
const context = this;
clearTimeout(timeout);
timeout = setTimeout(async () => await func.apply(context, args), delay);
};
}
let lastdomain;
async function loadPreviewContent() {
const urls = document.getElementById('url-input').value.split('\n');
const progressBar = document.getElementById('progress-bar').children[0];
progressBar.style.width = '100%';
urls.forEach(url => {
if (url.trim()) {
// simulateFetching('title-pane', url);
// Similarly, call simulateFetching for other panes
try {
const domain = new URL(url).hostname
if (domain.indexOf('.') == -1) throw 'Not a valid domain'
if (domain.split('.')[1].length < 2) throw 'TLD is not long enough'
if (domain != lastdomain) {
console.log("Getting favicon for:", domain)
document.querySelector('#input-area i.fa-globe').style.display = 'none'
document.querySelector('#input-area img.favicon').src = `https://www.google.com/s2/favicons?domain=${domain}`
lastdomain = domain;
}
} catch {}
}
});
}
const debouncedPreviewContent = debounce(loadPreviewContent, 250);
document.getElementById('digest-btn').addEventListener('click', () => {window.location = 'https://github.com/ArchiveBox/DigestBox/issues/1'});
document.getElementById('url-input').addEventListener('change', debouncedPreviewContent);
document.getElementById('url-input').addEventListener('keyup', debouncedPreviewContent);
function simulateFetching(paneId, url) {
const pane = document.getElementById(paneId);
const span = pane.getElementsByTagName('span')[0];
const button = pane.getElementsByTagName('button')[0];
pane.classList.add('in-progress');
span.textContent = `Fetching for ${url}...`;
setTimeout(() => {
pane.classList.remove('in-progress');
if (Math.random() > 0.2) {
span.textContent = `Data for ${url} fetched successfully.`;
} else {
span.textContent = `Fetching for ${url} failed.`;
button.disabled = true;
}
progressBar.style.width = '0%';
}, Math.random() * 2000 + 1000);
}
async function getFavicon(url) {
try {
// Extract the domain from the URL
const domain = new URL(url).hostname;
// Make a request to Google's favicon service
const response = await fetch(`https://www.google.com/s2/favicons?domain=${domain}`, {method: 'GET', mode: 'no-cors'});
console.log(domain, response)
// Convert the binary data to a blob URL
const blob = await response.blob();
const imageUrl = URL.createObjectURL(blob);
// Returning the image URL
return imageUrl;
} catch (error) {
console.error('Failed to fetch favicon:', error);
return null;
}
}
</script>
</body>
</html>