0

当我运行此代码时,我收到错误错误:未找到视频格式;请在https://yt-dl.org/bug上报告此问题。确保您使用的是最新版本; 有关如何更新,请参阅 https://yt-dl.org/update 。请务必使用 --verbose 标志调用 youtube-dl 并包含其完整输出。令人惊讶的是,该程序非常适合旧的 youtube 视频。我不知道该错误意味着什么以及如何解决它。有人可以帮忙吗?

from googlesearch import search
import speech_recognition as sr
import pyttsx3
import time
engine = pyttsx3.init()
engine.setProperty('rate', 125) 
voices = engine.getProperty('voices') 
engine.setProperty('voice', voices[2].id)
r = sr.Recognizer()
while True:
   query = input("Wipisz: ")
   if query=="exit":
       engine.say("Quiting program")
       engine.runAndWait()
       quit()
   elif query=="pause":
       engine.say("Paused")
       engine.runAndWait()
       player.set_pause(1)
   elif query=="continue":
       engine.say("Continueing")
       engine.runAndWait()
       player.set_pause(0)
 else:
       query+=" youtube"
       for j in search(query, tld="co.in", num=1, stop=1, pause=2):
              url=j
              print(url)

       import pafy
       import vlc
       import pyttsx3
    
      try:
          video = pafy.new(url)                                                                                                                       
          best = video.getbestaudio()                                                                                                                 
          playurl = best.url                                                                                                                          
          player = vlc.MediaPlayer(playurl)                                                                                                           
          player.play()
      except:
          engine.say("Pleas input another video name")
          engine.runAndWait()
4

0 回答 0