Fixing offset for youtube videos
This commit is contained in:
parent
a610147236
commit
d2d75f093d
|
@ -108,7 +108,7 @@ func (yt YouTube) parseTime(duration string) time.Duration {
|
||||||
var days, hours, minutes, seconds, totalSeconds int64
|
var days, hours, minutes, seconds, totalSeconds int64
|
||||||
if duration != "" {
|
if duration != "" {
|
||||||
timestampExp := regexp.MustCompile(`P(?P<days>\d+D)?T(?P<hours>\d+H)?(?P<minutes>\d+M)?(?P<seconds>\d+S)?`)
|
timestampExp := regexp.MustCompile(`P(?P<days>\d+D)?T(?P<hours>\d+H)?(?P<minutes>\d+M)?(?P<seconds>\d+S)?`)
|
||||||
timestampMatch := timestampExp.FindStringSubmatch(duration)
|
timestampMatch := timestampExp.FindStringSubmatch(strings.ToUpper(duration))
|
||||||
timestampResult := make(map[string]string)
|
timestampResult := make(map[string]string)
|
||||||
for i, name := range timestampExp.SubexpNames() {
|
for i, name := range timestampExp.SubexpNames() {
|
||||||
if i < len(timestampMatch) {
|
if i < len(timestampMatch) {
|
||||||
|
|
Reference in a new issue