libs

package
v0.0.0-...-dd0df5d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OnlyAudio    PostType = 1
	OnlyPost              = 2
	AudioAndPost          = 3
)
View Source
const (
	MaxAudioMessage = 1024
	MaxMessage      = 4096
)

Variables

View Source
var MarkdownLinkRegexp = regexp.MustCompile("\\[(?P<name>.+)]\\((?P<link>.+)\\)")
View Source
var TimeCodeRegexp = regexp.MustCompile("(\\d+:)+\\d+")
View Source
var UrlRegexp = regexp.MustCompile("(http|ftp|https)://([\\w_-]+(?:(?:\\.[\\w_-]+)+))([\\w.,@?^=%&:/~+#-]*[\\w@?^=%&/~+#-])?\\.?")

Functions

func HtmlToMarkdown

func HtmlToMarkdown(s string) (string, error)

func MagicTextReplace

func MagicTextReplace(s string, mapReplace map[string]string, revert bool) string

MagicTextReplace

func SearchTimeCondeText

func SearchTimeCondeText(ss []string) (string, int, int)

func ShortMessage

func ShortMessage(s string, isLinkName bool, isBitly bool) string

ShortMessage метод для уменьшения размера сообщения - уменьшает названия сылок

func ValidateHTML

func ValidateHTML(s string) string

ValidateHTML

данный код попытка сделыть HTML от simplecast.com красивым для отображения в telegram - удаляем часть html тегов - переводим html -> Markdown - заменяем часть экранирвоанных символов (из-за того что telegram полностью не подерживает Markdown)

p.s. если вы знаете как сделать лучше то просьба переписать.

Types

type PostMessage

type PostMessage struct {
	FileName  string // Название файла
	Audio     string // Текст аудио
	Title     string
	Performer string

	Post string // Текст сообщения для telegram

	Type PostType

	V rss.Item
	// contains filtered or unexported fields
}

func (*PostMessage) Formats

func (m *PostMessage) Formats(v rss.Item) error

func (*PostMessage) SetAudioText

func (m *PostMessage) SetAudioText()

func (*PostMessage) SetPostText

func (m *PostMessage) SetPostText()

type PostType

type PostType int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL