|
|
@@ -16,6 +16,7 @@ import (
|
|
|
|
|
|
var (
|
|
|
youtubeRegex = regexp.MustCompile(`youtube\.com/watch\?v=(.*)`)
|
|
|
+ invidioRegex = regexp.MustCompile(`invidio\.us\/watch\?v=(.*)`)
|
|
|
imgRegex = regexp.MustCompile(`<img [^>]+>`)
|
|
|
textLinkRegex = regexp.MustCompile(`(?mi)(\bhttps?:\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])`)
|
|
|
)
|
|
|
@@ -148,6 +149,26 @@ func addYoutubeVideo(entryURL, entryContent string) string {
|
|
|
return entryContent
|
|
|
}
|
|
|
|
|
|
+func addYoutubeVideoUsingInvidiousPlayer(entryURL, entryContent string) string {
|
|
|
+ matches := youtubeRegex.FindStringSubmatch(entryURL)
|
|
|
+
|
|
|
+ if len(matches) == 2 {
|
|
|
+ video := `<iframe width="650" height="350" frameborder="0" src="https://invidio.us/embed/` + matches[1] + `" allowfullscreen></iframe>`
|
|
|
+ return video + `<br>` + entryContent
|
|
|
+ }
|
|
|
+ return entryContent
|
|
|
+}
|
|
|
+
|
|
|
+func addInvidiousVideo(entryURL, entryContent string) string {
|
|
|
+ matches := invidioRegex.FindStringSubmatch(entryURL)
|
|
|
+ fmt.Println(matches)
|
|
|
+ if len(matches) == 2 {
|
|
|
+ video := `<iframe width="650" height="350" frameborder="0" src="https://invidio.us/embed/` + matches[1] + `" allowfullscreen></iframe>`
|
|
|
+ return video + `<br>` + entryContent
|
|
|
+ }
|
|
|
+ return entryContent
|
|
|
+}
|
|
|
+
|
|
|
func addPDFLink(entryURL, entryContent string) string {
|
|
|
if strings.HasSuffix(entryURL, ".pdf") {
|
|
|
return fmt.Sprintf(`<a href="%s">PDF</a><br>%s`, entryURL, entryContent)
|