tiktok-dl/utils/getHashtag.go

17 lines
318 B
Go
Raw Normal View History

package utils
import (
2020-02-25 01:01:10 +02:00
res "../resources"
"fmt"
"strings"
)
// GetHashtagFromURL - Get's tag name from passed url
func GetHashtagFromURL(str string) string {
2020-02-25 01:01:10 +02:00
if match := strings.Contains(str, "/tag/"); match {
return strings.Split(str, "/tag/")[1]
}
2020-02-25 01:01:10 +02:00
panic(fmt.Sprintf(res.ErrorCouldNotRecogniseURL, str))
}