warcraft

package module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2022 License: MIT Imports: 11 Imported by: 1

README

warcraft

warcraft is a toolkit to help download webpage as warc file using wget.

Installation

The simplest, cross-platform way is to download from GitHub Releases and place the executable file in your PATH.

Via Golang package get command

go get -u github.com/wabarc/warcraft/cmd/warcraft

From gobinaries.com:

$ curl -sf https://gobinaries.com/wabarc/warcraft | sh

Usage

Command-line:

$ warcraft
A CLI tool help download webpage as warc file using wget.

Usage:

  warcraft [options] [url1] ... [urlN]

Go package:

import (
        "fmt"

        "github.com/wabarc/warcraft"
)

func main() {
        if b, err := warcraft.NewWarcraft(nil).Download(url); err != nil {
            fmt.Fprintf(os.Stderr, "warcraft: %v\n", err)
        } else {
            fmt.Fprintf(os.Stdout, "%s  %s\n", url, string(b))
        }
}

License

This software is released under the terms of the MIT. See the LICENSE file for details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Warcraft

type Warcraft struct {
	BasePath  string // base path of warc file, defaults to current directory
	UserAgent string
	Verbose   bool
}

Warcraft represents warcraft config.

func New

func New() *Warcraft

New a Warcraft struct

func (*Warcraft) Download

func (warc *Warcraft) Download(ctx context.Context, u *url.URL) (string, error)

Download webpage as warc via wget

Directories

Path Synopsis
cmd
warcraft command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL