mirror of
https://github.com/muesli/telephant
synced 2024-11-23 11:53:12 +00:00
Parse Mastodon's post body
This commit is contained in:
parent
fe0ac8c5eb
commit
2abf333c19
1 changed files with 7 additions and 3 deletions
|
@ -5,7 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"time"
|
"regexp"
|
||||||
|
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
"github.com/mattn/go-mastodon"
|
"github.com/mattn/go-mastodon"
|
||||||
|
@ -147,8 +147,12 @@ func handleReplyStatus(status string) string {
|
||||||
return status
|
return status
|
||||||
}
|
}
|
||||||
|
|
||||||
func parsePost(ev *accounts.MessageEvent) {
|
func parseBody(body string) string {
|
||||||
return
|
r := regexp.MustCompile("<span class=\"invisible\">(.[^<]*)</span>")
|
||||||
|
body = r.ReplaceAllString(body, "")
|
||||||
|
|
||||||
|
r = regexp.MustCompile("<span class=\"ellipsis\">(.[^<]*)</span>")
|
||||||
|
return r.ReplaceAllString(body, "$1...")
|
||||||
|
|
||||||
/*
|
/*
|
||||||
for _, u := range ents.Urls {
|
for _, u := range ents.Urls {
|
||||||
|
|
Loading…
Reference in a new issue