From f06e1d9bacf83619c5272fee6ffaa9644f103f5c Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Fri, 6 Apr 2018 00:43:44 +0200 Subject: [PATCH] Improved trailers list --- pages/editor/filteranime/trailers.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pages/editor/filteranime/trailers.go b/pages/editor/filteranime/trailers.go index bd55063c..6ba28812 100644 --- a/pages/editor/filteranime/trailers.go +++ b/pages/editor/filteranime/trailers.go @@ -1,6 +1,8 @@ package filteranime import ( + "strings" + "github.com/aerogo/aero" "github.com/animenotifier/arn" ) @@ -13,6 +15,14 @@ func Trailers(ctx *aero.Context) string { func(anime *arn.Anime) bool { return len(anime.Trailers) == 0 }, - nil, + func(anime *arn.Anime) string { + title := anime.Title.Canonical + + if anime.Title.Japanese != "" { + title = anime.Title.Japanese + } + + return "https://www.youtube.com/results?search_query=" + strings.Replace(title+" PV", " ", "+", -1) + }, ) }