38 lines
1.1 KiB
Go
Raw Normal View History

2018-04-16 14:11:32 +00:00
package amv
import (
"strings"
2019-06-03 09:32:43 +00:00
"github.com/animenotifier/notify.moe/arn"
2019-06-01 04:55:49 +00:00
"github.com/animenotifier/notify.moe/assets"
2018-04-16 14:11:32 +00:00
)
func getOpenGraph(amv *arn.AMV) *arn.OpenGraph {
2018-04-16 14:11:32 +00:00
openGraph := &arn.OpenGraph{
Tags: map[string]string{
"og:title": amv.Title.ByUser(nil) + " (AMV)",
2019-06-01 04:55:49 +00:00
"og:url": "https://" + assets.Domain + amv.Link(),
"og:site_name": assets.Domain,
2018-04-16 14:11:32 +00:00
"og:type": "video.other",
},
2018-04-16 22:22:04 +00:00
Meta: map[string]string{},
2018-04-16 14:11:32 +00:00
}
2018-04-16 14:21:18 +00:00
openGraph.Tags["og:description"] = strings.Join(amv.Tags, ", ")
2018-04-16 14:11:32 +00:00
if amv.File != "" {
2019-08-28 02:31:19 +00:00
openGraph.Tags["og:video"] = amv.VideoLink()
2018-04-16 14:11:32 +00:00
openGraph.Tags["og:video:type"] = "video/webm"
2018-04-16 14:33:23 +00:00
openGraph.Tags["og:video:width"] = "640"
openGraph.Tags["og:video:height"] = "360"
2018-04-16 14:11:32 +00:00
2018-04-16 22:22:04 +00:00
openGraph.Meta["twitter:player"] = openGraph.Tags["og:video"]
openGraph.Meta["twitter:player:width"] = openGraph.Tags["og:video:width"]
openGraph.Meta["twitter:player:height"] = openGraph.Tags["og:video:height"]
openGraph.Meta["twitter:player:stream"] = openGraph.Tags["og:video"]
openGraph.Meta["twitter:player:stream:content_type"] = openGraph.Tags["og:video:type"]
2018-04-16 14:11:32 +00:00
}
return openGraph
}