-/*
-warc-extract -- WARC files data extractor
-Copyright (C) 2021 Sergey Matveev <stargrave@stargrave.org>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 3 of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+// warc-extract -- WARC files data extractor
+// Copyright (C) 2021-2024 Sergey Matveev <stargrave@stargrave.org>
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 3 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
package main
func main() {
uri := flag.String("uri", "", "URI to extract, if specified")
hdr := flag.Bool("hdr", false, "Also extract WARC's header")
- idx := flag.Bool("idx", false, "Save WARC indexes")
+ idx := flag.Bool("idx", false, "Save WARC indices")
recompress := flag.Bool("for-enzstd", false, "Output for enzstd utility")
+ unzstdPath := flag.String("unzstd", "cmd/zstd/unzstd", "Path to unzstd utility")
flag.Parse()
log.SetFlags(log.Lshortfile)
+ warc.UnZSTDPath = *unzstdPath
if *recompress {
var hdr bytes.Buffer
}
log.Println("added", p, len(warc.WARCs[p]), "URIs")
if *idx {
- if err := warc.SaveIndexes(); err != nil {
+ if err := warc.SaveIndices(); err != nil {
log.Fatalln(err)
}
}
io.Copy(os.Stdout, r)
}
}
- return
}