]> Cypherpunks.ru repositories - nncp.git/blob - doc/integration/warc.texi
Note about tofuproxy WARC browser
[nncp.git] / doc / integration / warc.texi
1 @node WARCs
2 @section Integration with Web pages
3
4 Simple HTML web page can be downloaded very easily for sending and
5 viewing it offline after:
6
7 @example
8 $ wget http://www.example.com/page.html
9 @end example
10
11 But most web pages contain links to images, CSS and JavaScript files,
12 required for complete rendering.
13 @url{https://www.gnu.org/software/wget/, GNU Wget} supports that
14 documents parsing and understanding page dependencies. You can download
15 the whole page with dependencies the following way:
16
17 @example
18 $ wget \
19     --page-requisites \
20     --convert-links \
21     --adjust-extension \
22     --restrict-file-names=ascii \
23     --span-hosts \
24     --random-wait \
25     --execute robots=off \
26     http://www.example.com/page.html
27 @end example
28
29 that will create @file{www.example.com} directory with all files
30 necessary to view @file{page.html} web page. You can create single file
31 compressed tarball with that directory and send it to remote node:
32
33 @example
34 $ tar cf - www.example.com | zstd |
35     nncp-file - remote.node:www.example.com-page.tar.zst
36 @end example
37
38 But there are multi-paged articles, there are the whole interesting
39 sites you want to get in a single package. You can mirror the whole web
40 site by utilizing @command{wget}'s recursive feature:
41
42 @example
43 $ wget \
44     --recursive \
45     --timestamping \
46     -l inf \
47     --no-remove-listing \
48     --no-parent [@dots{}] \
49     http://www.example.com/
50 @end example
51
52 There is a standard for creating
53 @url{https://en.wikipedia.org/wiki/Web_ARChive, Web ARChives}:
54 @strong{WARC}. Fortunately again, @command{wget} supports it as an
55 output format.
56
57 @example
58 $ wget [--page-requisites] [--recursive] \
59     --warc-file www.example.com-$(date '+%Y%M%d%H%m%S') \
60     --no-warc-keep-log --no-warc-digests \
61     [--no-warc-compression] [--warc-max-size=XXX] \
62     [@dots{}] http://www.example.com/
63 @end example
64
65 That command will create @file{www.example.com-XXX.warc} web archive.
66 It could produce specialized segmented
67 @url{https://en.wikipedia.org/wiki/Gzip, gzip} and
68 @url{https://en.wikipedia.org/wiki/Zstandard, Zstandard}
69 indexing/searching-friendly compressed archives. I can advise my own
70 @url{http://www.tofuproxy.stargrave.org/WARCs.html, tofuproxy} software
71 (also written on Go) to index, browse and extract those archives
72 conveniently.