go-rod / rod

A Chrome DevTools Protocol driver for web automation and scraping.
https://go-rod.github.io
MIT License
5.42k stars 356 forks source link

Can't open YouTube streams #417

Closed objectObjectObjectObject closed 3 years ago

objectObjectObjectObject commented 3 years ago

Rod Version: v0.99.1

I tried to open YouTube streams and I get an error "Your browser is not supported". Although normal videos run fine.

btw I tried to change the user-agent, but it didn't help. I also ask you to note that before opening YouTube, it gives me "Before you continue to YouTube" where I have to click on a button and, judging by the HTML code of this page, YouTube noticed that I am a bot (but this is my guess)

rod-robot commented 3 years ago

Please add a valid **Rod Version:** v0.0.0 to your issue. Current version is v0.99.1 generated by check-issue

ysmood commented 3 years ago

The problem is not the User-Agent, it's the Chromium doesn't support it, I think it's some license issue, if you use Chrome everything works fine.

For example, make sure you have Chrome installed, then run:

package main

import (
    "github.com/go-rod/rod"
    "github.com/go-rod/rod/lib/launcher"
    "github.com/go-rod/rod/lib/utils"
)

func main() {
    path, _ := launcher.LookPath()
    u := launcher.New().Bin(path).MustLaunch()
    rod.New().ControlURL(u).MustConnect().MustPage("https://youtu.be/DDU-rZs-Ic4")
    utils.Pause()
}