2 @unnumbered WARCs management
4 To view WARC files, you have to load them in daemon. Responses will be
5 transparently replaced from those WARCs for corresponding URIs.
7 There is no strict validation or checking of WARCs correctness at all!
8 But built-in WARC support seems to be good enough for various sources.
9 Following formats are supported:
14 Ordinary uncompressed WARC. Useful to be stored on transparently
15 compressed ZFS dataset.
17 @item @command{.warc.gz}
18 GZIP compressed WARC. Multi-stream (multi-segment) formats are also
19 supported and properly indexed.
21 @item @command{.warc.zst}
22 Zstandard compressed WARC, as in
23 @url{https://iipc.github.io/warc-specifications/specifications/warc-zstd/, specification}.
24 Multi-frame format is properly indexed. Dictionary at the beginning
27 It is processed with @command{unzstd} (@file{cmd/zstd/unzstd})
28 utility. It eats compressed stream from @code{stdin}, outputs
29 decompressed data to @code{stdout}, and prints each frame size with
30 corresponding decompressed data size to 3rd file descriptor (if it is
41 $ tee fifos/add-warcs < warcs.txt
42 smth.warc-00000.warc.gz
43 smth.warc-00001.warc.gz
44 smth.warc-00002.warc.gz
49 Visit the URI you know, that exists in those WARCs, or go to
50 @url{http://warc/}, to view full list of known loaded URIs from
54 Pay attention that order of WARCs loading is important! WARC can be
55 segmented and single response can be split on multiple WARC files.
56 Each following WARC files will overwrite possibly already existing URIs.
59 To list and delete loaded known WARCs:
62 $ cat fifos/list-warcs
63 smth.warc-00000.warc.gz 154
64 smth.warc-00001.warc.gz 13
65 smth.warc-00002.warc.gz 0
67 $ echo another.warc > fifos/del-warcs
70 One possibility that @file{smth.warc-00002.warc.gz} has no URIs is that
71 it contains continuation segmented records.
75 Loading of WARC involves its whole reading and remembering where is each
76 URI response is located. You can @code{echo SAVE > fifos/add-warcs} to
77 save in-memory index to the disk as @file{....idx.gob} files. During
78 the next load, if those files exists, they are used as index immediately,
79 without expensive WARC parsing.
81 @code{cmd/warc-extract/warc-extract} utility uses exactly the same code
82 for parsing WARCs. It can be used to check if WARCs can be successfully
83 loaded, to list all URIs after, to extract some specified URI and to
84 pre-generate @file{.idx.gob} indices.
87 $ cmd/warc-extract/warc-extract -idx \
88 smth.warc-00000.warc.gz \
89 smth.warc-00001.warc.gz \
90 smth.warc-00002.warc.gz
91 $ cmd/warc-extract/warc-extract -uri http://some/uri \
92 smth.warc-00000.warc.gz \
93 smth.warc-00001.warc.gz \
94 smth.warc-00002.warc.gz
97 Following example can be used to create multi-frame @file{.warc.zst}
98 from any kind of already existing WARCs. It has better compression ratio
99 and much higher decompression speed, than @file{.warc.gz}.
102 $ cmd/warc-extract/warc-extract -for-enzstd /path/to.warc.gz |
103 cmd/zstd/enzstd > /path/to.warc.zst
106 @url{https://www.gnu.org/software/wget/, GNU Wget} can be easily used to
110 $ wget ... [--page-requisites] [--recursive] \
111 --no-warc-keep-log --no-warc-digests [--warc-max-size=XXX] \
112 --warc-file smth.warc ...
115 Or even more simpler @url{https://git.jordan.im/crawl/tree/README.md, crawl}
116 utility written on Go too.