iawia002/lux · error

暂不支持斗鱼直播

Error message

暂不支持斗鱼直播

What it means

The douyu extractor in this codebase supports recorded videos only. Any URL matching https?://www.douyu.com/(\S+) is classified as a live-room link and rejected up front with this Chinese message, which translates to 'Douyu live streaming is not supported yet'. No network request is made.

Solutions

  1. Use the recorded video URL form (https://v.douyu.com/<id>) copied from the replay page, not the live room.
  2. For live rooms, use a tool that supports live-stream capture; this library intentionally rejects them.

Example fix

// before
$ lux "https://www.douyu.com/12345"
// after
$ lux "https://v.douyu.com/show/abcdefgh"
Defensive patterns

Strategy: validation

Validate before calling

if utils.MatchOneOf(url, `https?://www\.douyu\.com/(\S+)`) != nil {
	return errors.New("douyu live rooms are not supported; use a v.douyu.com recorded-video URL")
}

Type guard

func isDouyuLiveRoom(url string) bool {
	return utils.MatchOneOf(url, `https?://www\.douyu\.com/(\S+)`) != nil
}

Prevention

When it happens

Trigger: Passing a live-room URL such as www.douyu.com/<roomId>, or any topic/subject page on the main domain, instead of a recorded-video link.

Common situations: Pasting a streamer's room link from a share button; assuming live VODs on the main domain are downloadable.

Related errors


AI-assisted analysis of iawia002/lux@dd00f6d258 (2026-08-15). Data as JSON: /api/errors/87bea4c300275943. Report an issue: GitHub.

Appendix: source

Thrown at extractors/douyu/douyu.go:67

		}
		data = append(data, temp)
	}
	return data, totalSize, nil
}

type extractor struct{}

// New returns a douyu 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) {
	var err error
	liveVid := utils.MatchOneOf(url, `https?://www.douyu.com/(\S+)`)
	if liveVid != nil {
		return nil, errors.New("暂不支持斗鱼直播")
	}

	html, err := request.Get(url, url, nil)
	if err != nil {
		return nil, errors.WithStack(err)
	}
	titles := utils.MatchOneOf(html, `<title>(.*?)</title>`)
	if titles == nil || len(titles) < 2 {
		return nil, errors.WithStack(extractors.ErrURLParseFailed)
	}
	title := titles[1]

	vids := utils.MatchOneOf(url, `https?://v.douyu.com/show/(\S+)`)
	if vids == nil || len(vids) < 2 {
		return nil, errors.WithStack(extractors.ErrURLParseFailed)
	}
	vid := vids[1]

View on GitHub (pinned to dd00f6d258)