iawia002/lux · error

Could not extract media URL from page

Error message

Could not extract media URL from page

What it means

After loading the beta9 embed page (with gzip handling), the extractor greps the HTML for media_url = 'https://<host>.bitchute.com/....mp4'. The page was fetched successfully but contained no such assignment, so the mp4 location is unknown. This is a page-shape failure, not a network failure.

Source

Thrown at extractors/bitchute/bitchute.go:66

	case "deflate":
		reader = flate.NewReader(res.Body)
	default:
		reader = res.Body
	}
	defer reader.Close() // nolint

	b, err := io.ReadAll(reader)
	if err != nil {
		return nil, errors.WithStack(err)
	}

	// There is also an API that provides meta data
	// POST https://api.bitchute.com/api/beta9/video {"video_id": <video_id>}
	html := string(b)
	regMediaURL := regexp.MustCompile(`media_url\s*=\s*['|"](https:\/\/[^.]+\.bitchute\.com\/.*\.mp4)`)
	matchMediaURL := regMediaURL.FindStringSubmatch(html)
	if len(matchMediaURL) < 2 {
		return nil, errors.New("Could not extract media URL from page")
	}
	mediaURL := matchMediaURL[1]

	regVideoName := regexp.MustCompile(`(?m)video_name\s*=\s*["|']\\?"?(.*)["|'];?$`)
	matchVideoName := regVideoName.FindStringSubmatch(html)
	if len(matchVideoName) < 2 {
		return nil, errors.New("Could not extract media name from page")
	}
	videoName := strings.ReplaceAll(matchVideoName[1], `\"`, "")

	streams := make(map[string]*extractors.Stream, 1)
	size, err := request.Size(mediaURL, u)
	if err != nil {
		return nil, errors.WithStack(err)
	}
	streams["Default"] = &extractors.Stream{
		Parts: []*extractors.Part{
			{

View on GitHub (pinned to dd00f6d258)

Solutions

  1. Open https://www.bitchute.com/api/beta9/embed/?videoID=<id> in a browser and confirm the media_url assignment still exists.
  2. Use the alternative the code comment mentions: POST https://api.bitchute.com/api/beta9/video with a {"video_id": id} body returns metadata including the media URL.
  3. Retry from a residential IP or a session that passes the anti-bot check.
  4. Update the media_url regex if the host/path pattern changed.

Example fix

// before: scrape the embed HTML for media_url
// after: fall back to the beta9 metadata API noted in the source comment
type beta9Video struct {
	MediaURL string `json:"media_url"`
}
reqBody := strings.NewReader(fmt.Sprintf(`{"video_id":%q}`, matchVideoID[1]))
res, err := request.Request(http.MethodPost, "https://api.bitchute.com/api/beta9/video", reqBody, nil)
Defensive patterns

Strategy: try-catch

Type guard

func isMediaURLMissing(err error) bool {
	return err != nil && strings.Contains(err.Error(), "Could not extract media URL")
}

Try / catch

Catch per-URL in batch drivers; on this message, optionally retry once via the beta9 metadata API (POST https://api.bitchute.com/api/beta9/video) as an alternate source, then skip and queue the item instead of aborting the batch.

Prevention

When it happens

Trigger: Video removed or geo-restricted; BitChute serving a Cloudflare/anti-bot challenge page on the embed endpoint; a player template change that renames the variable or moves the media off a host matching [^.]+.bitchute.com.

Common situations: Server or datacenter IPs getting challenged; stale links to deleted videos; BitChute player rollouts changing the embed HTML.

Related errors


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