2020-02-25 00:56:19 +02:00
|
|
|
package utils
|
|
|
|
|
|
|
|
import (
|
2020-02-25 01:01:10 +02:00
|
|
|
"fmt"
|
|
|
|
"strings"
|
2020-04-12 03:22:00 +03:00
|
|
|
|
|
|
|
res "github.com/pikami/tiktok-dl/resources"
|
2020-02-25 00:56:19 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// 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 00:56:19 +02:00
|
|
|
|
2020-02-25 01:01:10 +02:00
|
|
|
panic(fmt.Sprintf(res.ErrorCouldNotRecogniseURL, str))
|
2020-02-25 00:56:19 +02:00
|
|
|
}
|