mirror of
https://github.com/muesli/telephant
synced 2024-11-23 03:43:10 +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"
|
||||
"fmt"
|
||||
"log"
|
||||
"time"
|
||||
"regexp"
|
||||
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/mattn/go-mastodon"
|
||||
|
@ -147,8 +147,12 @@ func handleReplyStatus(status string) string {
|
|||
return status
|
||||
}
|
||||
|
||||
func parsePost(ev *accounts.MessageEvent) {
|
||||
return
|
||||
func parseBody(body string) string {
|
||||
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 {
|
||||
|
|
Loading…
Reference in a new issue