# ograph-rs

A simple command-line utility to extract and print OpenGraph metadata from a given URL.

## Usage

```sh
ograph 'https://www.rust-lang.org'
```

The above command prints the following:

```
twitter:card "summary"
twitter:site "@rustlang"
twitter:creator "@rustlang"
twitter:title ""
twitter:description "A language empowering everyone to build reliable and efficient software."
twitter:image "https://www.rust-lang.org/static/images/rust-social.jpg"
og:title ""
og:description "A language empowering everyone to build reliable and efficient software."
og:image "https://www.rust-lang.org/static/images/rust-social-wide.jpg"
og:type "website"
og:locale "en_US"
```

By default, `ograph` follows HTTP redirects. To avoid following redirects, use either `--no-follow-redirects` or `-d`:

```sh
ograph -d 'https://avg.name'
```

Use `--help` or `-h` for more information.

## Installation

### Build from source

To build from source, you first need [`cargo`](https://www.rust-lang.org/tools/install) installed. Then run:

```sh
git clone https://git.average.name/AverageHelper/ograph-rs.git
cd ograph-rs
cargo build --release
```

You can then run the binary directly at `./target/release/ograph`, or use `cargo`:

```sh
cargo run --release -- https://example.com
```

### All platforms via Cargo package registries (`cargo`)

This package is published on our own package registry. With [`cargo`](https://www.rust-lang.org/tools/install) installed, run the following:

```sh
cargo install --index sparse+https://git.average.name/api/packages/AverageHelper/cargo/ ograph-rs
```

Also available from [crates.io](https://crates.io/crates/ograph-rs):

```sh
cargo install ograph-rs
```

### macOS via Homebrew (`brew`) (EXPERIMENTAL)

This package is available as a formula on [our own formula repository](https://git.average.name/AverageHelper/homebrew/src/branch/main/Formula/ograph-rs.rb). To tap this registry:

```sh
brew tap --force-auto-update averagehelper/homebrew 'https://git.average.name/AverageHelper/homebrew'
```

Then, to install the formula:

```sh
brew install averagehelper/homebrew/ograph-rs
```

### Android via Termux (`pkg`)

This package is available on the [Termux User Repository](https://github.com/termux-user-repository/tur/tree/master/tur/ograph-rs). To set up the external repository:

```sh
pkg install tur-repo
```

Then, to install:

```sh
pkg install ograph-rs
```
