feat: expand media URLs in tweet
This commit is contained in:
parent
9f31f3890f
commit
cc1eb793d6
3 changed files with 29 additions and 18 deletions
8
util.go
8
util.go
|
|
@ -388,6 +388,14 @@ func expandURLs(text string, urls []Url) string {
|
|||
return expandedText
|
||||
}
|
||||
|
||||
func expandMediaURLs(text string, extendedMediaEntities []ExtendedMedia) string {
|
||||
expandedText := text
|
||||
for _, entity := range extendedMediaEntities {
|
||||
expandedText = strings.ReplaceAll(expandedText, entity.URL, entity.MediaURLHttps)
|
||||
}
|
||||
return expandedText
|
||||
}
|
||||
|
||||
func parseProfileV2(user userResult) Profile {
|
||||
u := user.Legacy
|
||||
description := expandURLs(u.Description, u.Entities.Description.Urls)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue