https://github.com/talentlessguy/og-service
🐹 Golang service for getting OpenGraph data from a URL
https://github.com/talentlessguy/og-service
go golang golang-service opengraph opengraph-data service web web-service
Last synced: about 1 year ago
JSON representation
🐹 Golang service for getting OpenGraph data from a URL
- Host: GitHub
- URL: https://github.com/talentlessguy/og-service
- Owner: talentlessguy
- License: mit
- Created: 2020-05-28T15:56:27.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-03-22T19:43:53.000Z (about 5 years ago)
- Last Synced: 2025-03-28T11:37:30.245Z (about 1 year ago)
- Topics: go, golang, golang-service, opengraph, opengraph-data, service, web, web-service
- Language: Go
- Homepage: https://og-service.herokuapp.com/
- Size: 17.6 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# og-service
 [](https://pkg.go.dev/github.com/talentlessguy/og-service)
Golang service for getting OpenGraph data from a URL. Useful for link previews.
## Instances
- [og-service.herokuapp.com](https://og-service.herokuapp.com)
- [vercel-og-service.vercel.app](https://vercel-og-service.vercel.app)
## Usage
The URL scheme looks like this:
```
https://og-service.herokuapp.com/?link=
```
## Example
```sh
curl 'https://og-service.herokuapp.com/?link=https://v1rtl.site'
```
The endpoint will return data of the following structure:
```json
{
"title": "v 1 r t l ✨",
"type": "",
"url": "v1rtl.site",
"website": "",
"description": "16 yo nullstack (TS/Go) developer, open sourcerer. Creator of go-web-app, react-postprocessing and tinyhttp. Author of t.me/we_use_js Telegram channel",
"images": []
}
```
## Installation
The service itself is a go package that you can install and deploy on your own.
```shell
go get -u -v https://github.com/talentlessguy/og-service
```
## Using with Go
And then use it in your Go HTTP server:
```go
package main
import (
"log"
"net/http"
preview "github.com/talentlessguy/og-service"
)
func main() {
// List of origins that can request this endpoint
origins := []string{"*"}
s := preview.NewReactLinkPreviewService(origins)
log.Println("Started a service on http://localhost:8080")
// Launch the service on a port
log.Fatal(http.ListenAndServe(":8080", s))
}
```