Closed nicaicaii closed 8 months ago
u :="https://www.yangshipin.cn/#/video/home?vid=b000015axds&cid=518iuubyz1txkbw" ud, err := url.Parse(u) if err != nil { log.Error(err) return } cid := ud.Params.Get("cid")
是不是应该先按?切分
url.go func Parse(rawURL string) (*URL, error) { url, err := parse(rawURL, false) if err != nil { return nil, &Error{"parse", rawURL, err} } return url, nil } func parse(rawURL string, viaRequest bool) (*URL, error) { ...................................................................................................... url.Scheme = strings.ToLower(url.Scheme) rest, tempQuery, _ := strings.Cut(rest, "?") url.RawQuery, frag, _ = strings.Cut(tempQuery, "#") if tempQuery=="" { url.ForceQuery = true rest = rest[:len(rest)] } if frag != "" { err := url.setFragment(frag) if err != nil { return nil, &Error{"parse", rawURL, err} } } if !strings.HasPrefix(rest, "/") { ....................................................................
是不是应该先按?切分