ph

package module
v0.0.0-...-a0922e1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2023 License: GPL-3.0 Imports: 27 Imported by: 1

README

A Golang and Command-Line Interface to Telegra.ph

This package is a command-line tool named telegra.ph convert webpage to telegra.ph, it also supports imports as a Golang package for a programmatic. Please report all bugs and issues on Github.

Installation

From source:

$ go get github.com/wabarc/telegra.ph

From gobinaries.com:

$ curl -sf https://gobinaries.com/wabarc/telegra.ph/cmd/telegra.ph | sh

From releases

Usage

Command-line
$ telegra.ph https://www.eff.org/ https://www.fsf.org/

https://www.eff.org/ => https://telegra.ph/Electronic-Frontier-Foundation--Defending-your-rights-in-the-digital-world-01-27-5
https://www.fsf.org/ => https://telegra.ph/Front-Page--Free-Software-Foundation--working-together-for-free-software-01-27-2
Go package interfaces
package main

import (
        "fmt"

        "github.com/wabarc/telegra.ph"
)

func main() {
        links := []string{"https://www.eff.org/", "https://www.fsf.org/"}
	wbrc := &ph.Archiver{}
	published, _ := wbrc.Wayback(links)
	for orig, dest := range published {
		fmt.Println(orig, "=>", dest)
	}
}

// Output:
// https://www.eff.org/ => https://telegra.ph/Electronic-Frontier-Foundation--Defending-your-rights-in-the-digital-world-01-27-5
// https://www.fsf.org/ => https://telegra.ph/Front-Page--Free-Software-Foundation--working-together-for-free-software-01-27-2

License

This software is released under the terms of the GNU General Public License v3.0. See the LICENSE file for details.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "dev"

Functions

This section is empty.

Types

type Archiver

type Archiver struct {
	sync.RWMutex

	Author string

	Client *http.Client
	// contains filtered or unexported fields
}

func New

func New(client *http.Client) *Archiver

New returns a Archiver struct.

func (*Archiver) ByRemote

func (arc *Archiver) ByRemote(addr string) *Archiver

ByRemote returns Archiver with headless browser remote address.

func (*Archiver) SetAuthor

func (arc *Archiver) SetAuthor(author string) *Archiver

SetAuthor return an Archiver struct with Author

func (*Archiver) Wayback

func (arc *Archiver) Wayback(ctx context.Context, input *url.URL) (dst string, err error)

Wayback is the handle of saving webpages to telegra.ph

func (*Archiver) WithArticle

func (arc *Archiver) WithArticle(ctx context.Context, art readability.Article) context.Context

WithArticle puts a readability.Article into context.

func (*Archiver) WithShot

WithShot puts a screenshot.Screenshots into context.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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