0
try 'play' in query.lower():
    linklist=[]
    url='https://www.youtube.com/results?search_query='
    path = 'C:/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe  --new-window -- %s'
    webbrowser.get(path).open_new(url+query)
    response=urllib.request.urlopen(url+query)
    html=response.read()
    soup=BeautifulSoup(html,'html.parser')
    for vid in soup.findAll(attrs={'class':'yt-uix-tile-link'}):
        linklist.append("https://www.youtube.com"+vid['href'])

我得到的错误是:

raise InvalidURL(f"URL 不能包含控制字符。{url!r}" http.client.InvalidURL: URL 不能包含控制字符。'/results?search_query=play任何东西'(至少找到'')

4

0 回答 0