mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-21 15:05:01 +00:00
add youtube embed endpoint
This commit is contained in:
@@ -1,5 +1,22 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
"embed": [{
|
||||||
|
"title": "Embed a youtube video",
|
||||||
|
"run_check": false,
|
||||||
|
"description": "Embed a youtube video",
|
||||||
|
"request": {
|
||||||
|
"url": "https://www.youtube.com/watch?v=GWRWZu7XsJ0"
|
||||||
|
},
|
||||||
|
"response": {
|
||||||
|
{
|
||||||
|
"embed_url": "https://www.youtube.com/embed/GWRWZu7XsJ0",
|
||||||
|
"html_script": "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/GWRWZu7XsJ0\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>",
|
||||||
|
"long_url": "https://www.youtube.com/watch?v=GWRWZu7XsJ0",
|
||||||
|
"short_url": "https://youtu.be/GWRWZu7XsJ0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}],
|
||||||
"search": [{
|
"search": [{
|
||||||
"title": "Search for videos",
|
"title": "Search for videos",
|
||||||
"run_check": false,
|
"run_check": false,
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package handler
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -17,10 +16,6 @@ type Youtube struct {
|
|||||||
Client *youtube.Service
|
Client *youtube.Service
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
|
||||||
iframe = `<iframe width="560" height="315" src="%s" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>`
|
|
||||||
)
|
|
||||||
|
|
||||||
func New(apiKey string) *Youtube {
|
func New(apiKey string) *Youtube {
|
||||||
ctx := context.TODO()
|
ctx := context.TODO()
|
||||||
yt, _ := youtube.NewService(ctx, option.WithAPIKey(apiKey))
|
yt, _ := youtube.NewService(ctx, option.WithAPIKey(apiKey))
|
||||||
@@ -35,35 +30,30 @@ func (y *Youtube) Embed(ctx context.Context, req *pb.EmbedRequest, rsp *pb.Embed
|
|||||||
return errors.BadRequest("youtube.embed", "missing url")
|
return errors.BadRequest("youtube.embed", "missing url")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var id string
|
||||||
|
|
||||||
if strings.HasPrefix(req.Url, "https://youtu.be/") {
|
if strings.HasPrefix(req.Url, "https://youtu.be/") {
|
||||||
id := strings.TrimPrefix(req.Url, "https://youtu.be/")
|
id = strings.TrimPrefix(req.Url, "https://youtu.be/")
|
||||||
|
} else if !strings.HasPrefix(req.Url, "https://www.youtube.com/watch") {
|
||||||
rsp.Link = "https://www.youtube.com/embed/" + id
|
|
||||||
rsp.Script = fmt.Sprintf(iframe, rsp.Link)
|
|
||||||
rsp.ShortUrl = req.Url
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if !strings.HasPrefix(req.Url, "https://www.youtube.com/watch") {
|
|
||||||
return errors.BadRequest("youtube.embed", "invalid url")
|
return errors.BadRequest("youtube.embed", "invalid url")
|
||||||
|
} else {
|
||||||
|
uri, err := url.Parse(req.Url)
|
||||||
|
if err != nil {
|
||||||
|
return errors.BadRequest("youtube.embed", "invalid url")
|
||||||
|
}
|
||||||
|
|
||||||
|
vals := uri.Query()
|
||||||
|
id = vals.Get("v")
|
||||||
|
|
||||||
|
if len(id) == 0 {
|
||||||
|
return errors.BadRequest("youtube.embed", "invalid url")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uri, err := url.Parse(req.Url)
|
rsp.LongUrl = "https://www.youtube.com/watch?v="+id
|
||||||
if err != nil {
|
|
||||||
return errors.BadRequest("youtube.embed", "invalid url")
|
|
||||||
}
|
|
||||||
|
|
||||||
vals := uri.Query()
|
|
||||||
id := vals.Get("v")
|
|
||||||
|
|
||||||
if len(id) == 0 {
|
|
||||||
return errors.BadRequest("youtube.embed", "invalid url")
|
|
||||||
}
|
|
||||||
|
|
||||||
rsp.Link = "https://www.youtube.com/embed/" + id
|
|
||||||
rsp.Script = fmt.Sprintf(iframe, rsp.Link)
|
|
||||||
rsp.ShortUrl = "https://youtu.be/" + id
|
rsp.ShortUrl = "https://youtu.be/" + id
|
||||||
|
rsp.EmbedUrl = "https://www.youtube.com/embed/" + id
|
||||||
|
rsp.HtmlScript = `<iframe width="560" height="315" src="` + rsp.EmbedUrl + `" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>`
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,12 +74,14 @@ type EmbedResponse struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
// the full url
|
||||||
|
LongUrl string `protobuf:"bytes,1,opt,name=long_url,json=longUrl,proto3" json:"long_url,omitempty"`
|
||||||
|
// the short url
|
||||||
|
ShortUrl string `protobuf:"bytes,2,opt,name=short_url,json=shortUrl,proto3" json:"short_url,omitempty"`
|
||||||
// the embeddable link e.g https://www.youtube.com/watch?v=GWRWZu7XsJ0
|
// the embeddable link e.g https://www.youtube.com/watch?v=GWRWZu7XsJ0
|
||||||
Link string `protobuf:"bytes,1,opt,name=link,proto3" json:"link,omitempty"`
|
EmbedUrl string `protobuf:"bytes,3,opt,name=embed_url,json=embedUrl,proto3" json:"embed_url,omitempty"`
|
||||||
// the script code
|
// the script code
|
||||||
Script string `protobuf:"bytes,2,opt,name=script,proto3" json:"script,omitempty"`
|
HtmlScript string `protobuf:"bytes,4,opt,name=html_script,json=htmlScript,proto3" json:"html_script,omitempty"`
|
||||||
// the short link
|
|
||||||
ShortUrl string `protobuf:"bytes,3,opt,name=short_url,json=shortUrl,proto3" json:"short_url,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *EmbedResponse) Reset() {
|
func (x *EmbedResponse) Reset() {
|
||||||
@@ -114,16 +116,9 @@ func (*EmbedResponse) Descriptor() ([]byte, []int) {
|
|||||||
return file_proto_youtube_proto_rawDescGZIP(), []int{1}
|
return file_proto_youtube_proto_rawDescGZIP(), []int{1}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *EmbedResponse) GetLink() string {
|
func (x *EmbedResponse) GetLongUrl() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Link
|
return x.LongUrl
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *EmbedResponse) GetScript() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Script
|
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@@ -135,6 +130,20 @@ func (x *EmbedResponse) GetShortUrl() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *EmbedResponse) GetEmbedUrl() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.EmbedUrl
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *EmbedResponse) GetHtmlScript() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.HtmlScript
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
type SearchResult struct {
|
type SearchResult struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
@@ -360,45 +369,48 @@ var file_proto_youtube_proto_rawDesc = []byte{
|
|||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x79, 0x6f, 0x75, 0x74, 0x75, 0x62, 0x65, 0x22, 0x20,
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x79, 0x6f, 0x75, 0x74, 0x75, 0x62, 0x65, 0x22, 0x20,
|
||||||
0x0a, 0x0c, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10,
|
0x0a, 0x0c, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10,
|
||||||
0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c,
|
0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c,
|
||||||
0x22, 0x58, 0x0a, 0x0d, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
0x22, 0x85, 0x01, 0x0a, 0x0d, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||||
0x65, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x73, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6c, 0x6f, 0x6e, 0x67, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01,
|
||||||
0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x18,
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6c, 0x6f, 0x6e, 0x67, 0x55, 0x72, 0x6c, 0x12, 0x1b, 0x0a,
|
||||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x12, 0x1b, 0x0a,
|
0x09, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||||
0x09, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
|
0x52, 0x08, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x55, 0x72, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x6d,
|
||||||
0x52, 0x08, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x55, 0x72, 0x6c, 0x22, 0x87, 0x02, 0x0a, 0x0c, 0x53,
|
0x62, 0x65, 0x64, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65,
|
||||||
0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69,
|
0x6d, 0x62, 0x65, 0x64, 0x55, 0x72, 0x6c, 0x12, 0x1f, 0x0a, 0x0b, 0x68, 0x74, 0x6d, 0x6c, 0x5f,
|
||||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6b,
|
0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x68, 0x74,
|
||||||
0x69, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12,
|
0x6d, 0x6c, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x22, 0x87, 0x02, 0x0a, 0x0c, 0x53, 0x65, 0x61,
|
||||||
0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
|
0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
|
||||||
0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
|
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x69, 0x6e,
|
||||||
0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63,
|
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x14, 0x0a,
|
||||||
0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e,
|
0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69,
|
||||||
0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x68, 0x61,
|
0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
|
||||||
0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65,
|
0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
|
||||||
0x6c, 0x5f, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63,
|
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c,
|
||||||
0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x70,
|
0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e,
|
||||||
0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28,
|
0x65, 0x6c, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f,
|
||||||
0x09, 0x52, 0x0b, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x41, 0x74, 0x12, 0x22,
|
0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x68, 0x61,
|
||||||
0x0a, 0x0c, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x08,
|
0x6e, 0x6e, 0x65, 0x6c, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x75, 0x62,
|
||||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x69,
|
0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
0x6e, 0x67, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x0b, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x41, 0x74, 0x12, 0x22, 0x0a, 0x0c,
|
||||||
0x03, 0x75, 0x72, 0x6c, 0x22, 0x25, 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65,
|
0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x08, 0x20, 0x01,
|
||||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01,
|
0x28, 0x09, 0x52, 0x0c, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x69, 0x6e, 0x67,
|
||||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x22, 0x41, 0x0a, 0x0e, 0x53,
|
0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75,
|
||||||
0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a,
|
0x72, 0x6c, 0x22, 0x25, 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75,
|
||||||
0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15,
|
0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01,
|
||||||
0x2e, 0x79, 0x6f, 0x75, 0x74, 0x75, 0x62, 0x65, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52,
|
0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x22, 0x41, 0x0a, 0x0e, 0x53, 0x65, 0x61,
|
||||||
0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x32, 0x80,
|
0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x07, 0x72,
|
||||||
0x01, 0x0a, 0x07, 0x59, 0x6f, 0x75, 0x74, 0x75, 0x62, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x53, 0x65,
|
0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x79,
|
||||||
0x61, 0x72, 0x63, 0x68, 0x12, 0x16, 0x2e, 0x79, 0x6f, 0x75, 0x74, 0x75, 0x62, 0x65, 0x2e, 0x53,
|
|
||||||
0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x79,
|
|
||||||
0x6f, 0x75, 0x74, 0x75, 0x62, 0x65, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73,
|
0x6f, 0x75, 0x74, 0x75, 0x62, 0x65, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73,
|
||||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x38, 0x0a, 0x05, 0x45, 0x6d, 0x62, 0x65, 0x64,
|
0x75, 0x6c, 0x74, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x32, 0x80, 0x01, 0x0a,
|
||||||
0x12, 0x15, 0x2e, 0x79, 0x6f, 0x75, 0x74, 0x75, 0x62, 0x65, 0x2e, 0x45, 0x6d, 0x62, 0x65, 0x64,
|
0x07, 0x59, 0x6f, 0x75, 0x74, 0x75, 0x62, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x53, 0x65, 0x61, 0x72,
|
||||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x79, 0x6f, 0x75, 0x74, 0x75, 0x62,
|
0x63, 0x68, 0x12, 0x16, 0x2e, 0x79, 0x6f, 0x75, 0x74, 0x75, 0x62, 0x65, 0x2e, 0x53, 0x65, 0x61,
|
||||||
0x65, 0x2e, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
|
0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x79, 0x6f, 0x75,
|
||||||
0x00, 0x42, 0x11, 0x5a, 0x0f, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x79, 0x6f, 0x75,
|
0x74, 0x75, 0x62, 0x65, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||||
0x74, 0x75, 0x62, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x38, 0x0a, 0x05, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x12, 0x15,
|
||||||
|
0x2e, 0x79, 0x6f, 0x75, 0x74, 0x75, 0x62, 0x65, 0x2e, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x52, 0x65,
|
||||||
|
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x79, 0x6f, 0x75, 0x74, 0x75, 0x62, 0x65, 0x2e,
|
||||||
|
0x45, 0x6d, 0x62, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42,
|
||||||
|
0x11, 0x5a, 0x0f, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x79, 0x6f, 0x75, 0x74, 0x75,
|
||||||
|
0x62, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -16,12 +16,14 @@ message EmbedRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message EmbedResponse {
|
message EmbedResponse {
|
||||||
|
// the full url
|
||||||
|
string long_url = 1;
|
||||||
|
// the short url
|
||||||
|
string short_url = 2;
|
||||||
// the embeddable link e.g https://www.youtube.com/watch?v=GWRWZu7XsJ0
|
// the embeddable link e.g https://www.youtube.com/watch?v=GWRWZu7XsJ0
|
||||||
string link = 1;
|
string embed_url = 3;
|
||||||
// the script code
|
// the script code
|
||||||
string script = 2;
|
string html_script = 4;
|
||||||
// the short link
|
|
||||||
string short_url = 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message SearchResult {
|
message SearchResult {
|
||||||
|
|||||||
Reference in New Issue
Block a user