iawia002/lux · error
invalid url for netease music
Error message
invalid url for netease music
What it means
The netease extractor handles only music.163.com video/mv pages. It first rewrites the hash-route form /#/ to /, then requires /(mv|video)?id=<\w+>. Any URL without an mv or video id — songs, playlists, albums, artist pages — is rejected before any request is made.
Source
Thrown at extractors/netease/netease.go:30
)
func init() {
extractors.Register("163", New())
}
type extractor struct{}
// New returns a netease extractor.
func New() extractors.Extractor {
return &extractor{}
}
// Extract is the main function to extract the data.
func (e *extractor) Extract(url string, option extractors.Options) ([]*extractors.Data, error) {
url = strings.Replace(url, "/#/", "/", 1)
vid := utils.MatchOneOf(url, `/(mv|video)\?id=(\w+)`)
if vid == nil {
return nil, errors.New("invalid url for netease music")
}
html, err := request.Get(url, url, nil)
if err != nil {
return nil, errors.WithStack(err)
}
if strings.Contains(html, "u-errlg-404") {
return nil, errors.New("404 music not found")
}
titles := utils.MatchOneOf(html, `<meta property="og:title" content="(.+?)" />`)
if titles == nil || len(titles) < 2 {
return nil, errors.WithStack(extractors.ErrURLParseFailed)
}
title := titles[1]
realURLs := utils.MatchOneOf(html, `<meta property="og:video" content="(.+?)" />`)
if realURLs == nil || len(realURLs) < 2 {View on GitHub (pinned to dd00f6d258)
Solutions
- Use the MV/video page URL: https://music.163.com/#/mv?id=<id> or https://music.163.com/#/video?id=<id>.
- For plain songs, use a tool that supports netease audio; this extractor is video/mv only.
Example fix
// before $ lux "https://music.163.com/#/song?id=186016" // after $ lux "https://music.163.com/#/mv?id=5436392"
Defensive patterns
Strategy: validation
Validate before calling
u := strings.Replace(url, "/#/", "/", 1)
if utils.MatchOneOf(u, `/(mv|video)\?id=(\w+)`) == nil {
return fmt.Errorf("not a netease mv/video URL (song/playlist/album links unsupported): %s", url)
} Type guard
func isNeteaseVideoURL(url string) bool {
u := strings.Replace(url, "/#/", "/", 1)
return utils.MatchOneOf(u, `/(mv|video)\?id=(\w+)`) != nil
} Prevention
- Filter netease inputs to mv/video page URLs only
- Route song links to an audio-capable tool instead
- Remember the extractor normalizes /#/ hash routes — compare against the normalized form
When it happens
Trigger: Passing a song page (?id= under /song), playlist, album or artist URL; any link whose id segment does not match \w+.
Common situations: Assuming audio/song downloads are supported; copying links from the netease web player's song pages.
Related errors
- Invalid video URL: Missing video ID parameter
- unable to get video ID
- 暂不支持斗鱼直播
- couldn't extract the media short code from the link
- 404 music not found
AI-assisted analysis of iawia002/lux@dd00f6d258 (2026-08-15).
Data as JSON: /api/errors/c9a67454ded749ad.
Report an issue: GitHub.